diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74b78166e..941fa4a3e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -113,11 +113,14 @@ jobs: cargo make check --tests - name: Test run: | - cargo make test -E 'not (package(miden-integration-tests) or package(miden-integration-node-tests) or package(cargo-miden))' + cargo make test -E 'not (package(miden-integration-tests) or package(midenc-integration-network-tests) or package(cargo-miden))' - check_release: - name: release checks + lit_tests: + name: midenc lit/filecheck tests runs-on: ubuntu-latest + # We only want to run our lit tests if the unit tests pass, and that has the added + # benefit that we can re-use the cache from the unit test job + needs: [unit_tests] steps: - uses: actions/checkout@v5 - uses: ./.github/actions/cleanup-runner @@ -128,25 +131,18 @@ jobs: - name: Cache Cargo uses: Swatinem/rust-cache@v2 with: - # NOTE: We use a different cache for the these release checks - shared-key: ${{ github.workflow }}-shared-release-checks + # NOTE: We use a different cache for the tests, so they can be run in parallel, but we + # also share the cache for the tests for efficiency + shared-key: ${{ github.workflow }}-shared-tests prefix-key: ${{ env.RUST_CACHE_KEY }} - save-if: ${{ github.ref == 'refs/heads/next' }} - name: Install cargo-make run: | if ! cargo make --version 2>/dev/null; then cargo install cargo-make --force fi - - name: Check(release) - # We run `check` with `--release` to check the release build (without - # `debug_assertions`, etc.) - run: | - cargo make check --release --tests - - name: Check each member (release) - # To uncover any compilation errors hidden by the workspace feature - # unification and avoid surprises on publishing the crates. + - name: Test run: | - cargo make check-each --release --all-features + cargo make test-lit midenc_integration_tests: name: midenc integration tests @@ -294,7 +290,7 @@ jobs: fi - name: Test run: | - cargo make test -E 'test(test_all_templates_and_examples)' + cargo make test -E 'test(test_all_templates)' miden_integration_node_tests: name: miden integration node tests @@ -323,7 +319,40 @@ jobs: fi - name: Test run: | - cargo make test -E 'package(miden-integration-node-tests)' + cargo make test -E 'package(midenc-integration-network-tests)' + + check_release: + name: release checks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - uses: ./.github/actions/cleanup-runner + - name: Install Rust + run: | + rustup update --no-self-update + rustc --version + - name: Cache Cargo + uses: Swatinem/rust-cache@v2 + with: + # NOTE: We use a different cache for the these release checks + shared-key: ${{ github.workflow }}-shared-release-checks + prefix-key: ${{ env.RUST_CACHE_KEY }} + save-if: ${{ github.ref == 'refs/heads/next' }} + - name: Install cargo-make + run: | + if ! cargo make --version 2>/dev/null; then + cargo install cargo-make --force + fi + - name: Check(release) + # We run `check` with `--release` to check the release build (without + # `debug_assertions`, etc.) + run: | + cargo make check --release --tests + - name: Check each member (release) + # To uncover any compilation errors hidden by the workspace feature + # unification and avoid surprises on publishing the crates. + run: | + cargo make check-each --release --all-features cargo_publish_dry_run: name: cargo publish dry run diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 819545242..4deeb91b3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -46,14 +46,22 @@ jobs: upload-artifacts: name: upload pre-built midenc executable artifacts - runs-on: ubuntu-latest needs: publish if: ${{ github.repository_owner == '0xMiden' && needs.publish.outputs.releases_created == 'true' }} permissions: contents: write + id-token: write + attestations: write strategy: matrix: + os: [macos-latest, ubuntu-latest] target: [aarch64-apple-darwin, x86_64-unknown-linux-gnu] + exclude: + - os: macos-latest + target: x86_64-unknown-linux-gnu + - os: ubuntu-latest + target: aarch64-apple-darwin + runs-on: ${{ matrix.os }} steps: - *checkout - *install-rust @@ -91,6 +99,22 @@ jobs: ARGS="--release --target ${{ matrix.target }}" cargo make --profile production midenc ${ARGS} cargo make --profile production cargo-miden ${ARGS} + - name: prepare artifacts + if: ${{ steps.midenc-release.outputs.release_tag != '' }} + run: | + set -e + mv bin/midenc midenc-${{ matrix.target }} + mv bin/cargo-miden cargo-miden-${{ matrix.target }} + - name: attest midenc + if: ${{ steps.midenc-release.outputs.release_tag != '' }} + uses: actions/attest-build-provenance@v3 + with: + subject-path: midenc-${{ matrix.target }} + - name: attest cargo-miden + if: ${{ steps.midenc-release.outputs.release_tag != '' }} + uses: actions/attest-build-provenance@v3 + with: + subject-path: cargo-miden-${{ matrix.target }} - name: upload if: ${{ steps.midenc-release.outputs.release_tag != '' }} env: @@ -98,9 +122,7 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | set -e - mv bin/midenc midenc-${{ matrix.target }} gh release upload ${RELEASE_TAG} midenc-${{ matrix.target }} - mv bin/cargo-miden cargo-miden-${{ matrix.target }} gh release upload ${RELEASE_TAG} cargo-miden-${{ matrix.target }} release: diff --git a/.gitignore b/.gitignore index 80e438e95..16e94cb97 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ target/ -bin/midenc -bin/litcheck +bin/* +!bin/filecheck +!bin/lit .crates.toml .crates2.json diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dfea75e1a..18c6c3c71 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,18 +4,44 @@ TBD ## Release Process -### Release of the Miden Compiler - -1. Merging to `main` will create a new release PR containing any unreleased changes. -2. Optional. Change the proposed crate version, CHANGELOG edits. -3. The release PR gets merged to `main` when we are ready to publish the release. -4. The crates are published to crates.io, a new git tag is created, as well as a GitHub release -5. A job is run to pre-build the executable for our supported targets and upload them to the created Github release. -6. Merge the `main` branch back to the `next` branch. - -### Release of the Miden SDK crates +### 1. Release of the Miden SDK crates 1. Create a release PR against the `next` branch naming the branch with the `release-plz-` prefix (its important to use this prefix to trigger the crate publishing on CI in the later step). 2. Manually bump ALL the SDK crate versions and update the `sdk/sdk/CHANGELOG.md` 3. Review the changes in the release PR, and merge it into the `next` branch. 4. The CI will automatically run `release-plz release` after the release PR is merged to publish the new versions to crates.io. + +### 2. Release of the Miden Compiler + +1. Update the contract templates at https://github.com/0xMiden/project-template (see 2.1 below). +2. Update the new project template at https://github.com/0xMiden/project-template (see 2.2 below). +3. Merging to `main` will create a new release PR containing any unreleased changes. +4. Optional. Change the proposed crate version, CHANGELOG edits. +5. The release PR gets merged to `main` when we are ready to publish the release. +6. The crates are published to crates.io, a new git tag is created, as well as a GitHub release +7. A job is run to pre-build the executable for our supported targets and upload them to the created Github release. +8. Merge the `main` branch back to the `next` branch. + +### 2.1. Updating the new contract templates + +1. Bump the Miden SDK version in the Cargo.toml. +2. Migrate the code in lib.rs. +3. Create a git tag. +4. Make a PR in the compiler repo and set the new git tag (bump the current in `PROJECT_TEMPLATES_REPO_TAG` at tools/cargo-miden/src/commands/new_project.rs). +5. Run the compiler tests, if red then goto 2. + +### 2.2. Updating the new project template + +1. Bump the Miden SDK, `miden-client` versions in the Cargo.toml files, set the `cargo-miden` version to the `next` branch for now(after the compiler release it'd be the new version). +2. Migrate the code in the contracts, tests and the app. +3. Create a git tag. +4. Make a PR in the compiler repo and set the new git tag (bump the current in `MIDEN_PROJECT_TEMPLATE_REPO_TAG` at tools/cargo-miden/src/commands/new_project.rs). +5. Run the local repo tests, if red then goto 2. +6. Run the compiler tests, if red then goto 2. + +### 3. After the Miden Compiler crates are published + +1. Change the `cargo-miden` version to the newly published crate in the PR (created in 2.2.4) at https://github.com/0xMiden/project-template. +2. Re-set the same git tag (created in 2.2.3) to the new commit. +3. Merge the PR (created in 2.2.4). + diff --git a/Cargo.lock b/Cargo.lock index 4264d021e..4434ca9d5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -153,6 +153,9 @@ name = "anyhow" version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" +dependencies = [ + "backtrace", +] [[package]] name = "anymap2" @@ -189,7 +192,7 @@ checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -242,9 +245,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" -version = "1.8.1" +version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e050f626429857a27ddccb31e0aca21356bfa709c04041aefddac081a8f068a" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" [[package]] name = "bech32" @@ -288,6 +291,15 @@ version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" +[[package]] +name = "bitmaps" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" +dependencies = [ + "typenum", +] + [[package]] name = "bitvec" version = "1.0.1" @@ -302,15 +314,16 @@ dependencies = [ [[package]] name = "blake3" -version = "1.8.2" +version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3888aaa89e4b2a40fca9848e400f6a658a5a3978de7be858e209cafa8be9a4a0" +checksum = "2468ef7d57b3fb7e16b576e8377cdbde2320c60e1491e961d11da40fc4f02a2d" dependencies = [ "arrayref", "arrayvec", "cc", "cfg-if", "constant_time_eq", + "cpufeatures", ] [[package]] @@ -331,15 +344,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "block2" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" -dependencies = [ - "objc2", -] - [[package]] name = "bstr" version = "1.12.1" @@ -352,9 +356,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.19.0" +version = "3.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" +checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" [[package]] name = "byteorder" @@ -370,9 +374,9 @@ checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" [[package]] name = "camino" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "276a59bf2b2c967788139340c9f0c5b12d7fd6630315c15c217e559de85d2609" +checksum = "e629a66d692cb9ff1a1c664e41771b3dcaf961985a9774c0eb0bd1b51cf60a48" dependencies = [ "serde_core", ] @@ -384,18 +388,18 @@ dependencies = [ "anyhow", "cargo_metadata", "clap", - "env_logger", "liquid", "log", "miden-mast-package", "midenc-compile", + "midenc-log", "midenc-session", "path-absolutize", "semver 1.0.27", "serde", "serde_json", "tempfile", - "toml_edit 0.23.9", + "toml_edit 0.23.10+spec-1.0.0", "walkdir", ] @@ -410,9 +414,9 @@ dependencies = [ [[package]] name = "cargo-util" -version = "0.2.25" +version = "0.2.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03ae3fc62640c9e0235c95b07e68a59a31919d7331bd95961cc811bc0607c87b" +checksum = "f70b0c7772872ac3234e46a6591091d4da57f0c3aa24c381776ed1550624a14b" dependencies = [ "anyhow", "core-foundation", @@ -442,7 +446,7 @@ dependencies = [ "semver 1.0.27", "serde", "serde_json", - "thiserror 2.0.17", + "thiserror", ] [[package]] @@ -468,9 +472,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.49" +version = "1.2.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90583009037521a116abf44494efecd645ba48b6622457080f080b85544e2215" +checksum = "47b26a0954ae34af09b50f0de26458fa95369a0d478d8236d3f93082b219bd29" dependencies = [ "find-msvc-tools", "jobserver", @@ -484,12 +488,6 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - [[package]] name = "chacha20" version = "0.9.1" @@ -516,9 +514,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.42" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" +checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118" dependencies = [ "iana-time-zone", "js-sys", @@ -567,9 +565,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.53" +version = "4.5.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e340e012a1bf4935f5282ed1436d1489548e8f72308207ea5df0e23d2d03f8" +checksum = "a75ca66430e33a14957acc24c5077b503e7d374151b2b4b3a10c83b4ceb4be0e" dependencies = [ "clap_builder", "clap_derive", @@ -577,33 +575,34 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.53" +version = "4.5.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76b5d13eaa18c901fd2f7fca939fefe3a0727a953561fefdf3b2922b8569d00" +checksum = "793207c7fa6300a0608d1080b858e5fdbe713cdc1c8db9fb17777d8a13e63df0" dependencies = [ "anstream", "anstyle", "clap_lex", "strsim", + "terminal_size 0.4.3", ] [[package]] name = "clap_derive" -version = "4.5.49" +version = "4.5.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" +checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5" dependencies = [ "heck", "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] name = "clap_lex" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" +checksum = "c3e64b0cc0439b12df2fa678eae89a1c56a529fd067a9115f7827f1fffd22b32" [[package]] name = "colorchoice" @@ -646,7 +645,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f76990911f2267d837d9d0ad060aa63aaad170af40904b29461734c339030d4d" dependencies = [ "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -657,9 +656,9 @@ checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "constant_time_eq" -version = "0.3.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" +checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b" [[package]] name = "core-foundation" @@ -858,7 +857,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -867,8 +866,18 @@ version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.20.11", + "darling_macro 0.20.11", +] + +[[package]] +name = "darling" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d" +dependencies = [ + "darling_core 0.23.0", + "darling_macro 0.23.0", ] [[package]] @@ -882,48 +891,42 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn", + "syn 2.0.114", ] [[package]] -name = "darling_macro" -version = "0.20.11" +name = "darling_core" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0" dependencies = [ - "darling_core", + "ident_case", + "proc-macro2", "quote", - "syn", -] - -[[package]] -name = "deadpool" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0be2b1d1d6ec8d846f05e137292d0b89133caf95ef33695424c09568bdd39b1b" -dependencies = [ - "deadpool-runtime", - "lazy_static", - "num_cpus", - "tokio", + "strsim", + "syn 2.0.114", ] [[package]] -name = "deadpool-runtime" -version = "0.1.4" +name = "darling_macro" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "092966b41edc516079bdf31ec78a2e0588d1d0c08f78b91d8307215928642b2b" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ - "tokio", + "darling_core 0.20.11", + "quote", + "syn 2.0.114", ] [[package]] -name = "deadpool-sync" -version = "0.1.4" +name = "darling_macro" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524bc3df0d57e98ecd022e21ba31166c2625e7d3e5bcc4510efaeeab4abcab04" +checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" dependencies = [ - "deadpool-runtime", + "darling_core 0.23.0", + "quote", + "syn 2.0.114", ] [[package]] @@ -947,23 +950,23 @@ dependencies = [ [[package]] name = "derive_more" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10b768e943bed7bf2cab53df09f4bc34bfd217cdb57d971e769874c9a6710618" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" dependencies = [ "derive_more-impl", ] [[package]] name = "derive_more-impl" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d286bfdaf75e988b4a78e013ecd79c581e06399ab53fbacd2d916c2f904f30b" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" dependencies = [ "proc-macro2", "quote", "rustc_version 0.4.1", - "syn", + "syn 2.0.114", ] [[package]] @@ -984,16 +987,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "dispatch2" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89a09f22a6c6069a18470eb92d2298acf25463f14256d24778e1230d789a2aec" -dependencies = [ - "bitflags", - "objc2", -] - [[package]] name = "dissimilar" version = "1.0.10" @@ -1073,18 +1066,6 @@ dependencies = [ "log", ] -[[package]] -name = "enum_dispatch" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" -dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "env_filter" version = "0.1.4" @@ -1125,16 +1106,16 @@ dependencies = [ ] [[package]] -name = "fallible-iterator" -version = "0.3.0" +name = "escape8259" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" +checksum = "5692dd7b5a1978a5aeb0ce83b7655c58ca8efdcb79d21036ea249da95afec2c6" [[package]] -name = "fallible-streaming-iterator" -version = "0.1.9" +name = "fallible-iterator" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" [[package]] name = "fastrand" @@ -1160,21 +1141,20 @@ checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" [[package]] name = "filetime" -version = "0.2.26" +version = "0.2.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc0505cd1b6fa6580283f6bdf70a73fcf4aba1184038c90902b92b3dd0df63ed" +checksum = "f98844151eee8917efc50bd9e8318cb963ae8b297431495d3f758616ea5c57db" dependencies = [ "cfg-if", "libc", "libredox", - "windows-sys 0.60.2", ] [[package]] name = "find-msvc-tools" -version = "0.1.5" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" [[package]] name = "fixedbitset" @@ -1184,9 +1164,9 @@ checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" [[package]] name = "flate2" -version = "1.1.5" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb" +checksum = "b375d6465b98090a5f25b1c7703f3859783755aa9a80433b36e0379a3ec2f369" dependencies = [ "crc32fast", "miniz_oxide", @@ -1224,23 +1204,13 @@ checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" [[package]] name = "fs-err" -version = "3.2.0" +version = "3.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62d91fd049c123429b018c47887d3f75a265540dd3c30ba9cb7bae9197edb03a" +checksum = "baf68cef89750956493a66a10f512b9e58d9db21f2a573c079c0bdf1207a54a7" dependencies = [ "autocfg", ] -[[package]] -name = "fs2" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "funty" version = "2.0.0" @@ -1303,7 +1273,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -1338,16 +1308,17 @@ dependencies = [ [[package]] name = "generator" -version = "0.8.7" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "605183a538e3e2a9c1038635cc5c2d194e2ee8fd0d1b66b8349fad7dbacce5a2" +checksum = "52f04ae4152da20c76fe800fa48659201d5cf627c5149ca0b707b69d7eef6cf9" dependencies = [ "cc", "cfg-if", "libc", "log", "rustversion", - "windows", + "windows-link 0.2.1", + "windows-result 0.4.1", ] [[package]] @@ -1363,9 +1334,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" dependencies = [ "cfg-if", "js-sys", @@ -1436,9 +1407,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3c0b69cfcb4e1b9f1bf2f53f95f766e4661169728ec61cd3fe5a0166f2d1386" +checksum = "2f44da3a8150a6703ed5d34e164b875fd14c2cdab9af1252a9a1020bde2bdc54" dependencies = [ "atomic-waker", "bytes", @@ -1489,27 +1460,12 @@ dependencies = [ "serde_core", ] -[[package]] -name = "hashlink" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" -dependencies = [ - "hashbrown 0.15.5", -] - [[package]] name = "heck" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "hermit-abi" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" - [[package]] name = "hex" version = "0.4.3" @@ -1581,17 +1537,17 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "human-panic" -version = "2.0.4" +version = "2.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8a07a0957cd4a3cad4a1e4ca7cd5ea07fcacef6ebe2e5d0c7935bfc95120d8" +checksum = "075e8747af11abcff07d55d98297c9c6c70eb5d6365b25e7b12f02e484935191" dependencies = [ "anstream", "anstyle", "backtrace", - "os_info", "serde", "serde_derive", - "toml 0.9.8", + "sysinfo", + "toml 0.9.11+spec-1.1.0", "uuid", ] @@ -1654,9 +1610,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.64" +version = "0.1.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1678,9 +1634,9 @@ dependencies = [ [[package]] name = "id-arena" -version = "2.2.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" [[package]] name = "ident_case" @@ -1704,6 +1660,20 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "im-rc" +version = "15.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af1955a75fa080c677d3972822ec4bad316169ab1cfc6c257a942c2265dbe5fe" +dependencies = [ + "bitmaps", + "rand_core 0.6.4", + "rand_xoshiro 0.6.0", + "sized-chunks", + "typenum", + "version_check", +] + [[package]] name = "indenter" version = "0.3.4" @@ -1712,9 +1682,9 @@ checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5" [[package]] name = "indexmap" -version = "2.12.1" +version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" dependencies = [ "equivalent", "hashbrown 0.16.1", @@ -1742,15 +1712,15 @@ dependencies = [ [[package]] name = "instability" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6778b0196eefee7df739db78758e5cf9b37412268bfa5650bfeed028aed20d9c" +checksum = "357b7205c6cd18dd2c86ed312d1e70add149aea98e7ef72b9fdf0270e555c11d" dependencies = [ - "darling", + "darling 0.23.0", "indoc", "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -1803,15 +1773,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.15" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" [[package]] name = "jiff" -version = "0.2.16" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49cce2b81f2098e7e3efc35bc2e0a6b7abec9d34128283d7a26fa8f32a6dbb35" +checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" dependencies = [ "jiff-static", "log", @@ -1822,13 +1792,13 @@ dependencies = [ [[package]] name = "jiff-static" -version = "0.2.16" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "980af8b43c3ad5d8d349ace167ec8170839f753a42d233ba19e08afe1850fa69" +checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -1843,9 +1813,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.83" +version = "0.3.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8" +checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3" dependencies = [ "once_cell", "wasm-bindgen", @@ -1911,6 +1881,7 @@ version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5baa5e9ff84f1aefd264e6869907646538a52147a755d494517a8007fb48733" dependencies = [ + "regex-automata", "rustversion", ] @@ -1928,36 +1899,37 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" [[package]] name = "libc" -version = "0.2.178" +version = "0.2.180" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" +checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" [[package]] name = "libm" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" [[package]] name = "libredox" -version = "0.1.10" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb" +checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" dependencies = [ "bitflags", "libc", - "redox_syscall", + "redox_syscall 0.7.0", ] [[package]] -name = "libsqlite3-sys" -version = "0.34.0" +name = "libtest-mimic" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91632f3b4fb6bd1d72aa3d78f41ffecfcf2b1a6648d8c241dbe7dbfaf4875e15" +checksum = "5297962ef19edda4ce33aaa484386e0a5b3d7f2f4e037cbeee00503ef6b29d33" dependencies = [ - "cc", - "pkg-config", - "vcpkg", + "anstream", + "anstyle", + "clap", + "escape8259", ] [[package]] @@ -2015,7 +1987,7 @@ checksum = "de66c928222984aea59fcaed8ba627f388aaac3c1f57dcb05cc25495ef8faefe" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -2032,6 +2004,62 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "litcheck-core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e96692d50994f26d57417be79b6719ee179fd8e6b93b3fd2014c1aa60342cc9d" +dependencies = [ + "Inflector", + "anyhow", + "clap", + "compact_str 0.9.0", + "either", + "glob", + "hashbrown 0.15.5", + "lock_api", + "log", + "memchr", + "miette", + "parking_lot", + "paste", + "rustc-hash", + "serde", + "serde_spanned 1.0.4", + "smallvec", + "thiserror", + "toml 0.9.11+spec-1.1.0", + "walkdir", +] + +[[package]] +name = "litcheck-filecheck" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51f8835f8046b2cfe2da332500562112991828f00716328a993e728beab8e0ad" +dependencies = [ + "aho-corasick", + "anyhow", + "bitflags", + "bstr", + "clap", + "either", + "im-rc", + "lalrpop", + "lalrpop-util", + "litcheck-core", + "log", + "logos 0.16.1", + "memchr", + "miette", + "regex", + "regex-automata", + "regex-syntax", + "rustc-hash", + "smallvec", + "thiserror", +] + [[package]] name = "lock_api" version = "0.4.14" @@ -2049,27 +2077,27 @@ checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "logos" -version = "0.14.4" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7251356ef8cb7aec833ddf598c6cb24d17b689d20b993f9d11a3d764e34e6458" +checksum = "ff472f899b4ec2d99161c51f60ff7075eeb3097069a36050d8037a6325eb8154" dependencies = [ - "logos-derive 0.14.4", + "logos-derive 0.15.1", ] [[package]] name = "logos" -version = "0.15.1" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff472f899b4ec2d99161c51f60ff7075eeb3097069a36050d8037a6325eb8154" +checksum = "eb2c55a318a87600ea870ff8c2012148b44bf18b74fad48d0f835c38c7d07c5f" dependencies = [ - "logos-derive 0.15.1", + "logos-derive 0.16.1", ] [[package]] name = "logos-codegen" -version = "0.14.4" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59f80069600c0d66734f5ff52cc42f2dabd6b29d205f333d61fd7832e9e9963f" +checksum = "192a3a2b90b0c05b27a0b2c43eecdb7c415e29243acc3f89cc8247a5b693045c" dependencies = [ "beef", "fnv", @@ -2077,41 +2105,40 @@ dependencies = [ "proc-macro2", "quote", "regex-syntax", - "syn", + "rustc_version 0.4.1", + "syn 2.0.114", ] [[package]] name = "logos-codegen" -version = "0.15.1" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "192a3a2b90b0c05b27a0b2c43eecdb7c415e29243acc3f89cc8247a5b693045c" +checksum = "58b3ffaa284e1350d017a57d04ada118c4583cf260c8fb01e0fe28a2e9cf8970" dependencies = [ - "beef", "fnv", - "lazy_static", "proc-macro2", "quote", + "regex-automata", "regex-syntax", - "rustc_version 0.4.1", - "syn", + "syn 2.0.114", ] [[package]] name = "logos-derive" -version = "0.14.4" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24fb722b06a9dc12adb0963ed585f19fc61dc5413e6a9be9422ef92c091e731d" +checksum = "605d9697bcd5ef3a42d38efc51541aa3d6a4a25f7ab6d1ed0da5ac632a26b470" dependencies = [ - "logos-codegen 0.14.4", + "logos-codegen 0.15.1", ] [[package]] name = "logos-derive" -version = "0.15.1" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "605d9697bcd5ef3a42d38efc51541aa3d6a4a25f7ab6d1ed0da5ac632a26b470" +checksum = "52d3a9855747c17eaf4383823f135220716ab49bea5fbea7dd42cc9a92f8aa31" dependencies = [ - "logos-codegen 0.15.1", + "logos-codegen 0.16.1", ] [[package]] @@ -2171,49 +2198,71 @@ dependencies = [ [[package]] name = "miden" -version = "0.8.0" +version = "0.10.0" dependencies = [ "miden-base", + "miden-base-macros", "miden-base-sys", + "miden-field", + "miden-field-repr", "miden-sdk-alloc", "miden-stdlib-sys", - "wit-bindgen", + "wit-bindgen 0.46.0", +] + +[[package]] +name = "miden-agglayer" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21a867217bab689c0539f6b4797cb452f0932de6904479a38f1322e045b9383b" +dependencies = [ + "fs-err", + "miden-assembly", + "miden-core", + "miden-core-lib", + "miden-protocol", + "miden-standards", + "miden-utils-sync", + "regex", + "walkdir", ] [[package]] name = "miden-air" -version = "0.19.1" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" +checksum = "33eacdeeaf50a704b221efe81abf1f1e9870154c5bd4acc11f5ad3f872e73509" dependencies = [ "miden-core", "miden-utils-indexing", - "thiserror 2.0.17", + "thiserror", "winter-air", "winter-prover", ] [[package]] name = "miden-assembly" -version = "0.19.1" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" +checksum = "cdebc6a73964aaf92179d9a9925ca48d662894f24774ab6380e784214de00fdb" dependencies = [ + "env_logger", "log", "miden-assembly-syntax", "miden-core", "miden-mast-package", "smallvec", - "thiserror 2.0.17", + "thiserror", ] [[package]] name = "miden-assembly-syntax" -version = "0.19.1" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" +checksum = "0c7b96df3facd26ae58fe0c3c30bd1d8e83c2b7f0b0c9c046800901dc1eff14e" dependencies = [ "aho-corasick", + "env_logger", "lalrpop", "lalrpop-util", "log", @@ -2222,32 +2271,32 @@ dependencies = [ "miden-utils-diagnostics", "midenc-hir-type", "proptest", + "proptest-derive", "regex", "rustc_version 0.4.1", "semver 1.0.27", "smallvec", - "thiserror 2.0.17", + "thiserror", ] [[package]] name = "miden-base" -version = "0.8.0" +version = "0.10.0" dependencies = [ - "miden-base-macros", "miden-base-sys", "miden-stdlib-sys", ] [[package]] name = "miden-base-macros" -version = "0.8.0" +version = "0.10.0" dependencies = [ "heck", - "miden-objects", + "miden-protocol", "proc-macro2", "quote", "semver 1.0.27", - "syn", + "syn 2.0.114", "toml 0.8.23", "wit-bindgen-core", "wit-bindgen-rust", @@ -2255,16 +2304,27 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.1" +version = "0.10.0" dependencies = [ + "miden-field-repr", "miden-stdlib-sys", ] +[[package]] +name = "miden-block-prover" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e92a0ddae8d0983e37bc636edba741947b1e3dc63baed2ad85921342080154a" +dependencies = [ + "miden-protocol", + "thiserror", +] + [[package]] name = "miden-client" -version = "0.12.5" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f0574b4ce13a16f07513bfc8775a6e8d55e64684a82bffd59174cab3a2c1991" +checksum = "68b256399e6f0d7ae53a592b771a1286c46ca6b45397d1c5fda6d83dbd222357" dependencies = [ "anyhow", "async-trait", @@ -2272,75 +2332,78 @@ dependencies = [ "futures", "getrandom 0.3.4", "hex", - "miden-lib", + "miden-mast-package", "miden-node-proto-build", "miden-note-transport-proto-build", - "miden-objects", + "miden-protocol", "miden-remote-prover-client", + "miden-standards", + "miden-testing", "miden-tx", "miette", - "prost 0.14.1", - "prost-build", - "prost-types 0.14.1", - "protox 0.7.2", + "prost", + "prost-types", "rand", - "thiserror 2.0.17", + "thiserror", "tonic", - "tonic-build", "tonic-health", "tonic-prost", "tonic-prost-build", "tonic-web-wasm-client", "tracing", + "uuid", "web-sys", ] -[[package]] -name = "miden-client-sqlite-store" -version = "0.12.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "594b08393cd63ff092acabae229ae8cc92953471831efdf63650496f4c22dbd6" -dependencies = [ - "anyhow", - "async-trait", - "chrono", - "deadpool", - "deadpool-sync", - "miden-client", - "miden-objects", - "rusqlite", - "rusqlite_migration", - "thiserror 2.0.17", - "tokio", -] - [[package]] name = "miden-core" -version = "0.19.1" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" +checksum = "10cb3c6b071a7a5fc6a10dfbaed76f3d0170f3739a231233a3c5e27596a5612f" dependencies = [ - "enum_dispatch", + "derive_more", + "itertools 0.14.0", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-core-derive", "miden-utils-indexing", "num-derive", "num-traits", - "thiserror 2.0.17", + "proptest", + "proptest-derive", + "thiserror", "winter-math", "winter-utils", ] +[[package]] +name = "miden-core-lib" +version = "0.20.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703c0e94089a3135ba75e3586fcb4e5d61e3bee10a7ee1dad0b2ac0a497c14e9" +dependencies = [ + "env_logger", + "fs-err", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", + "sha2", + "thiserror", +] + [[package]] name = "miden-crypto" -version = "0.18.5" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395e5cc76b64e24533ee55c8d1ff90305b8cad372bdbea4f4f324239e36a895f" +checksum = "6e28b6e110f339c2edc2760a8cb94863f0a055ee658a49bc90c8560eff2feef4" dependencies = [ "blake3", "cc", "chacha20poly1305", + "curve25519-dalek", "ed25519-dalek", "flume", "glob", @@ -2352,12 +2415,13 @@ dependencies = [ "num-complex", "rand", "rand_chacha", - "rand_core 0.9.3", + "rand_core 0.9.5", "rand_hc", "rayon", + "sha2", "sha3", "subtle", - "thiserror 2.0.17", + "thiserror", "winter-crypto", "winter-math", "winter-utils", @@ -2366,18 +2430,19 @@ dependencies = [ [[package]] name = "miden-crypto-derive" -version = "0.18.5" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89641b257eb395cf03105ac1c6cbdf3fd9a5450749696af9835c3c47fc6806e" +checksum = "f40e95b9c7c99ed6bbf073d9e02721d812dedd2c195019c0a0e0a3dbb9cbf034" dependencies = [ "quote", - "syn", + "syn 2.0.114", ] [[package]] name = "miden-debug" -version = "0.4.1" -source = "git+https://github.com/0xMiden/miden-debug?rev=0cfdc623f51c721ff7812a0f70836ffaea182898#0cfdc623f51c721ff7812a0f70836ffaea182898" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39b757124b749cb4226c7d78758514b8eb0b2fdd948c8937ef0fd60dab107bf3" dependencies = [ "clap", "crossterm", @@ -2407,9 +2472,9 @@ dependencies = [ [[package]] name = "miden-debug-types" -version = "0.19.1" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" +checksum = "3cb127273a9ee9ac1f9ad71899c1c2a0dea8cf768a90024d2d8b91800980c756" dependencies = [ "memchr", "miden-crypto", @@ -2419,36 +2484,58 @@ dependencies = [ "miden-utils-sync", "paste", "serde", - "serde_spanned 1.0.3", - "thiserror 2.0.17", + "serde_spanned 1.0.4", + "thiserror", ] [[package]] -name = "miden-formatting" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e392e0a8c34b32671012b439de35fa8987bf14f0f8aac279b97f8b8cc6e263b" +name = "miden-field" +version = "0.10.0" dependencies = [ - "unicode-width 0.1.14", + "miden-core", ] [[package]] -name = "miden-integration-node-tests" -version = "0.6.0" +name = "miden-field-repr" +version = "0.10.0" dependencies = [ - "anyhow", - "fs2", - "miden-client", - "miden-client-sqlite-store", "miden-core", + "miden-field", + "miden-field-repr-derive", +] + +[[package]] +name = "miden-field-repr-derive" +version = "0.10.0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "miden-field-repr-tests" +version = "0.10.0" +dependencies = [ + "miden-core", + "miden-debug", + "miden-field", + "miden-field-repr", "miden-integration-tests", - "miden-mast-package", - "miden-objects", + "miden-processor", + "miden-protocol", + "midenc-expect-test", "midenc-frontend-wasm", - "rand", - "temp-dir", - "tokio", - "uuid", + "midenc-session", +] + +[[package]] +name = "miden-formatting" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e392e0a8c34b32671012b439de35fa8987bf14f0f8aac279b97f8b8cc6e263b" +dependencies = [ + "unicode-width 0.1.14", ] [[package]] @@ -2460,17 +2547,16 @@ dependencies = [ "cargo-miden", "cargo-util", "concat-idents", - "env_logger", "filetime", "glob", "log", "miden-assembly", "miden-core", "miden-debug", - "miden-lib", "miden-mast-package", - "miden-objects", "miden-processor", + "miden-protocol", + "miden-standards", "midenc-codegen-masm", "midenc-compile", "midenc-dialect-arith", @@ -2480,6 +2566,7 @@ dependencies = [ "midenc-frontend-wasm", "midenc-hir", "midenc-hir-eval", + "midenc-log", "midenc-session", "proptest", "sha2", @@ -2487,34 +2574,16 @@ dependencies = [ "wasmprinter", ] -[[package]] -name = "miden-lib" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "598582071e5b0ec835d06288857d4ddc0090a98bd4c17e408fa56b2c43f45d73" -dependencies = [ - "Inflector", - "fs-err", - "miden-assembly", - "miden-core", - "miden-objects", - "miden-processor", - "miden-stdlib", - "regex", - "thiserror 2.0.17", - "walkdir", -] - [[package]] name = "miden-mast-package" -version = "0.19.1" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" +checksum = "4f7b21cd2593ed5930d5af10b197917dd6668ab34e203e47fb9c1ba712dc9a2c" dependencies = [ "derive_more", "miden-assembly-syntax", "miden-core", - "thiserror 2.0.17", + "thiserror", ] [[package]] @@ -2540,10 +2609,10 @@ dependencies = [ "supports-color", "supports-hyperlinks", "supports-unicode", - "syn", + "syn 2.0.114", "terminal_size 0.3.0", "textwrap", - "thiserror 2.0.17", + "thiserror", "trybuild", "unicode-width 0.1.14", ] @@ -2556,82 +2625,100 @@ checksum = "86a905f3ea65634dd4d1041a4f0fd0a3e77aa4118341d265af1a94339182222f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] name = "miden-node-proto-build" -version = "0.12.5" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8059a6beaabf87cc58c24a9c51d01fbd6d9b46edc2522125442962ce279ec2" +checksum = "5ba5dcc0fa93d0d647cd4f39327f01d55adc843c0b1be3b122794cb5ffdb85c2" dependencies = [ "fs-err", "miette", - "protox 0.9.1", + "protox", "tonic-prost-build", ] [[package]] name = "miden-note-transport-proto-build" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86d7a7b3a64c71d33f771d32cde58559207819a64ada9add0acb31857e111b9d" +checksum = "ec23738a2eee393524a849a8dce982ad824050cc54abde145d4fb62b92c84198" dependencies = [ "fs-err", "miette", - "protox 0.9.1", + "protox", "tonic-prost-build", ] [[package]] -name = "miden-objects" -version = "0.12.4" +name = "miden-processor" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace4018bb2d6cdbcff4d86d8af5ade8efca9f0479f7e5775c7f09cfab5f91ebe" +checksum = "72712c2c71774f7a49d66a0265b57be7a283919ffbdc4b034ab355b0283de021" +dependencies = [ + "itertools 0.14.0", + "miden-air", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", + "thiserror", + "tokio", + "tracing", + "winter-prover", +] + +[[package]] +name = "miden-protocol" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "785be319a826c9cb43d2e1a41a1fb1eee3f2baafe360e0d743690641f7c93ad5" dependencies = [ "bech32", + "fs-err", "getrandom 0.3.4", "miden-assembly", "miden-assembly-syntax", "miden-core", + "miden-core-lib", "miden-crypto", "miden-mast-package", "miden-processor", - "miden-stdlib", + "miden-protocol-macros", "miden-utils-sync", "miden-verifier", "rand", + "rand_chacha", + "rand_xoshiro 0.7.0", + "regex", "semver 1.0.27", "serde", - "thiserror 2.0.17", - "toml 0.9.8", + "thiserror", + "toml 0.9.11+spec-1.1.0", + "walkdir", + "winter-rand-utils", ] [[package]] -name = "miden-processor" -version = "0.19.1" +name = "miden-protocol-macros" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" +checksum = "f2dc854c1b9e49e82d3f39c5710345226e0b2a62ec0ea220c616f1f3a099cfb3" dependencies = [ - "itertools 0.14.0", - "miden-air", - "miden-core", - "miden-debug-types", - "miden-utils-diagnostics", - "miden-utils-indexing", - "paste", - "rayon", - "thiserror 2.0.17", - "tokio", - "tracing", - "winter-prover", + "proc-macro2", + "quote", + "syn 2.0.114", ] [[package]] name = "miden-prover" -version = "0.19.1" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c30a5d10baeec17b9336de8544cb7f9b96b32de757c4cfb8d95ee0521bb5cd" +checksum = "1d6a65651c8bf931743580c4a8c00a35f3453da39679bd23fa95f29ae7849ffd" dependencies = [ "miden-air", "miden-debug-types", @@ -2643,17 +2730,18 @@ dependencies = [ [[package]] name = "miden-remote-prover-client" -version = "0.12.5" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b319ea63a16a95c04ed16b1626fb9eae581acc79c46050ba231e4d8cb9b06aae" +checksum = "c1badab21e9a4680c3cf2b04857d0141fd499fc1da615eaa785ae7d191aa43f6" dependencies = [ + "fs-err", "getrandom 0.3.4", "miden-node-proto-build", - "miden-objects", + "miden-protocol", "miden-tx", "miette", - "prost 0.14.1", - "thiserror 2.0.17", + "prost", + "thiserror", "tokio", "tonic", "tonic-prost", @@ -2663,27 +2751,78 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.8.0" +version = "0.10.0" [[package]] -name = "miden-stdlib" -version = "0.19.1" +name = "miden-standards" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e90a5de45a1e6213ff17b66fff8accde0bbc64264e2c22bbcb9a895f8f3b767" +checksum = "98e33771fc35e1e640582bcd26c88b2ab449dd3a70888b315546d0d3447f4bb3" dependencies = [ - "env_logger", "fs-err", "miden-assembly", "miden-core", - "miden-crypto", + "miden-core-lib", "miden-processor", - "miden-utils-sync", - "thiserror 2.0.17", + "miden-protocol", + "rand", + "regex", + "thiserror", + "walkdir", ] [[package]] name = "miden-stdlib-sys" -version = "0.8.0" +version = "0.10.0" +dependencies = [ + "miden-field", +] + +[[package]] +name = "miden-test-harness" +version = "0.6.0" +dependencies = [ + "cargo-miden", + "cfg-if", + "clap", + "inventory", + "libtest-mimic", + "miden-protocol", + "miden-test-harness-macros", + "miden-testing", +] + +[[package]] +name = "miden-test-harness-macros" +version = "0.6.0" +dependencies = [ + "miden-mast-package", + "miden-testing", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "miden-testing" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae5d41a888d1a5e520a9312a170975d0fbadefb1b9200543cebdf54dd0960310" +dependencies = [ + "anyhow", + "itertools 0.14.0", + "miden-agglayer", + "miden-assembly", + "miden-block-prover", + "miden-core-lib", + "miden-processor", + "miden-protocol", + "miden-standards", + "miden-tx", + "miden-tx-batch-prover", + "rand", + "rand_chacha", + "winterfell", +] [[package]] name = "miden-thiserror" @@ -2702,30 +2841,49 @@ checksum = "0ee4176a0f2e7d29d2a8ee7e60b6deb14ce67a20e94c3e2c7275cdb8804e1862" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] name = "miden-tx" -version = "0.12.4" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d959064f99ce09fc38e9b6b4dc24c3fa80a63072bf5840a1074ca4ed5e9c911" +checksum = "430e4ee02b5efb71b104926e229441e0071a93a259a70740bf8c436495caa64f" dependencies = [ - "miden-lib", - "miden-objects", "miden-processor", + "miden-protocol", "miden-prover", + "miden-standards", "miden-verifier", - "rand", - "thiserror 2.0.17", - "tokio", + "thiserror", +] + +[[package]] +name = "miden-tx-batch-prover" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03bc209b6487ebac0de230461e229a99d17ed73596c7d99fc59eea47a28a89cc" +dependencies = [ + "miden-protocol", + "miden-tx", +] + +[[package]] +name = "miden-utils-core-derive" +version = "0.20.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3753ff5c16cb83244d234b7f76fb8abec3377200b215859fe599c41465e7d36b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] name = "miden-utils-diagnostics" -version = "0.19.1" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" +checksum = "de6c667538374e6a3579397a29f82d94e62d2f9cf1eca8a95da1a7acbfed381d" dependencies = [ "miden-crypto", "miden-debug-types", @@ -2736,18 +2894,18 @@ dependencies = [ [[package]] name = "miden-utils-indexing" -version = "0.19.1" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +checksum = "07e135423d4d3d626ea15fdfe7070abe5f7908ac71a2d174c832c870668fb2a3" dependencies = [ - "thiserror 2.0.17", + "thiserror", ] [[package]] name = "miden-utils-sync" -version = "0.19.1" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" +checksum = "8a9e678634bd9ce5d6f89809cda926a268bcbfe72aa0a5d2031a0c8182074992" dependencies = [ "lock_api", "loom", @@ -2756,13 +2914,13 @@ dependencies = [ [[package]] name = "miden-verifier" -version = "0.19.1" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" +checksum = "b9513494a2a8cd876150bbbb5a2985b078368de280cc8a52e9aff41320c344b7" dependencies = [ "miden-air", "miden-core", - "thiserror 2.0.17", + "thiserror", "tracing", "winter-verifier", ] @@ -2771,9 +2929,9 @@ dependencies = [ name = "midenc" version = "0.6.0" dependencies = [ - "env_logger", "human-panic", "midenc-driver", + "midenc-log", ] [[package]] @@ -2789,16 +2947,16 @@ dependencies = [ name = "midenc-codegen-masm" version = "0.6.0" dependencies = [ - "env_logger", + "anyhow", "inventory", "itertools 0.14.0", "log", "miden-assembly", "miden-assembly-syntax", "miden-core", - "miden-lib", "miden-mast-package", "miden-processor", + "miden-protocol", "miden-thiserror", "midenc-dialect-arith", "midenc-dialect-cf", @@ -2808,6 +2966,7 @@ dependencies = [ "midenc-expect-test", "midenc-hir", "midenc-hir-analysis", + "midenc-log", "midenc-session", "petgraph 0.8.3", "proptest", @@ -2819,6 +2978,7 @@ dependencies = [ name = "midenc-compile" version = "0.6.0" dependencies = [ + "anyhow", "clap", "inventory", "log", @@ -2856,14 +3016,17 @@ dependencies = [ name = "midenc-dialect-hir" version = "0.6.0" dependencies = [ - "env_logger", + "litcheck-core", + "litcheck-filecheck", "log", "midenc-dialect-arith", "midenc-dialect-cf", + "midenc-dialect-scf", "midenc-expect-test", "midenc-hir", "midenc-hir-analysis", "midenc-hir-transform", + "midenc-log", ] [[package]] @@ -2871,7 +3034,6 @@ name = "midenc-dialect-scf" version = "0.6.0" dependencies = [ "bitvec", - "env_logger", "log", "midenc-dialect-arith", "midenc-dialect-cf", @@ -2879,6 +3041,7 @@ dependencies = [ "midenc-expect-test", "midenc-hir", "midenc-hir-transform", + "midenc-log", ] [[package]] @@ -2929,6 +3092,7 @@ dependencies = [ "midenc-hir-symbol", "midenc-session", "wasmparser 0.227.1", + "wasmprinter", "wat", ] @@ -2941,7 +3105,6 @@ dependencies = [ "bitvec", "blink-alloc", "compact_str 0.9.0", - "env_logger", "hashbrown 0.15.5", "intrusive-collections", "inventory", @@ -2951,6 +3114,7 @@ dependencies = [ "midenc-hir-macros", "midenc-hir-symbol", "midenc-hir-type", + "midenc-log", "midenc-session", "pretty_assertions", "rustc-demangle", @@ -2965,13 +3129,14 @@ version = "0.6.0" dependencies = [ "bitvec", "blink-alloc", - "env_logger", "log", "midenc-dialect-arith", "midenc-dialect-cf", "midenc-dialect-hir", + "midenc-dialect-scf", "midenc-expect-test", "midenc-hir", + "midenc-log", ] [[package]] @@ -2994,10 +3159,10 @@ name = "midenc-hir-macros" version = "0.6.0" dependencies = [ "Inflector", - "darling", + "darling 0.20.11", "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -3019,9 +3184,15 @@ dependencies = [ name = "midenc-hir-transform" version = "0.6.0" dependencies = [ + "litcheck-core", + "litcheck-filecheck", "log", + "midenc-dialect-arith", + "midenc-dialect-hir", + "midenc-dialect-scf", "midenc-hir", "midenc-hir-analysis", + "midenc-log", "midenc-session", ] @@ -3035,7 +3206,35 @@ dependencies = [ "serde", "serde_repr", "smallvec", - "thiserror 2.0.17", + "thiserror", +] + +[[package]] +name = "midenc-integration-network-tests" +version = "0.6.0" +dependencies = [ + "miden-client", + "miden-core", + "miden-field-repr", + "miden-integration-tests", + "miden-mast-package", + "miden-protocol", + "miden-standards", + "midenc-frontend-wasm", + "rand", + "tokio", +] + +[[package]] +name = "midenc-log" +version = "0.6.0" +dependencies = [ + "anstream", + "anstyle", + "jiff", + "log", + "regex", + "snapbox", ] [[package]] @@ -3049,14 +3248,15 @@ dependencies = [ "miden-assembly", "miden-assembly-syntax", "miden-core", + "miden-core-lib", "miden-debug-types", - "miden-lib", "miden-mast-package", - "miden-stdlib", + "miden-protocol", "miden-thiserror", "midenc-hir-macros", "midenc-hir-symbol", "parking_lot", + "smallvec", "termcolor", ] @@ -3087,7 +3287,7 @@ checksum = "db5b29714e950dbb20d5e6f74f9dcec4edbcc1067bb7f8ed198c097b8c1a818b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -3133,7 +3333,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" dependencies = [ - "getrandom 0.2.16", + "getrandom 0.2.17", ] [[package]] @@ -3143,15 +3343,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" [[package]] -name = "nix" -version = "0.30.1" +name = "normalize-line-endings" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" + +[[package]] +name = "ntapi" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" +checksum = "c70f219e21142367c70c0b30c6a9e3a14d55b4d12a204d897fbec83a0363f081" dependencies = [ - "bitflags", - "cfg-if", - "cfg_aliases", - "libc", + "winapi", ] [[package]] @@ -3198,9 +3401,9 @@ dependencies = [ [[package]] name = "num-conv" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" [[package]] name = "num-derive" @@ -3208,219 +3411,69 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" -dependencies = [ - "num-bigint", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", - "libm", -] - -[[package]] -name = "num_cpus" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "objc2" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7c2599ce0ec54857b29ce62166b0ed9b4f6f1a70ccc9a71165b6154caca8c05" -dependencies = [ - "objc2-encode", -] - -[[package]] -name = "objc2-cloud-kit" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73ad74d880bb43877038da939b7427bba67e9dd42004a18b809ba7d87cee241c" -dependencies = [ - "bitflags", - "objc2", - "objc2-foundation", -] - -[[package]] -name = "objc2-core-data" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b402a653efbb5e82ce4df10683b6b28027616a2715e90009947d50b8dd298fa" -dependencies = [ - "objc2", - "objc2-foundation", -] - -[[package]] -name = "objc2-core-foundation" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" -dependencies = [ - "bitflags", - "dispatch2", - "objc2", -] - -[[package]] -name = "objc2-core-graphics" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" -dependencies = [ - "bitflags", - "dispatch2", - "objc2", - "objc2-core-foundation", - "objc2-io-surface", -] - -[[package]] -name = "objc2-core-image" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d563b38d2b97209f8e861173de434bd0214cf020e3423a52624cd1d989f006" -dependencies = [ - "objc2", - "objc2-foundation", -] - -[[package]] -name = "objc2-core-location" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca347214e24bc973fc025fd0d36ebb179ff30536ed1f80252706db19ee452009" -dependencies = [ - "objc2", - "objc2-foundation", -] - -[[package]] -name = "objc2-core-text" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d" -dependencies = [ - "bitflags", - "objc2", - "objc2-core-foundation", - "objc2-core-graphics", + "proc-macro2", + "quote", + "syn 2.0.114", ] [[package]] -name = "objc2-encode" -version = "4.1.0" +name = "num-integer" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] [[package]] -name = "objc2-foundation" -version = "0.3.2" +name = "num-iter" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ - "bitflags", - "block2", - "libc", - "objc2", - "objc2-core-foundation", + "autocfg", + "num-integer", + "num-traits", ] [[package]] -name = "objc2-io-surface" -version = "0.3.2" +name = "num-rational" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "bitflags", - "objc2", - "objc2-core-foundation", + "num-bigint", + "num-integer", + "num-traits", ] [[package]] -name = "objc2-quartz-core" -version = "0.3.2" +name = "num-traits" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ - "bitflags", - "objc2", - "objc2-core-foundation", - "objc2-foundation", + "autocfg", + "libm", ] [[package]] -name = "objc2-ui-kit" +name = "objc2-core-foundation" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" dependencies = [ "bitflags", - "block2", - "objc2", - "objc2-cloud-kit", - "objc2-core-data", - "objc2-core-foundation", - "objc2-core-graphics", - "objc2-core-image", - "objc2-core-location", - "objc2-core-text", - "objc2-foundation", - "objc2-quartz-core", - "objc2-user-notifications", ] [[package]] -name = "objc2-user-notifications" +name = "objc2-io-kit" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9df9128cbbfef73cda168416ccf7f837b62737d748333bfe9ab71c245d76613e" +checksum = "33fafba39597d6dc1fb709123dfa8289d39406734be322956a69f0931c73bb15" dependencies = [ - "objc2", - "objc2-foundation", + "libc", + "objc2-core-foundation", ] [[package]] @@ -3491,25 +3544,9 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "openssl-probe" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" - -[[package]] -name = "os_info" -version = "3.13.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c39b5918402d564846d5aba164c09a66cc88d232179dfd3e3c619a25a268392" -dependencies = [ - "android_system_properties", - "log", - "nix", - "objc2", - "objc2-foundation", - "objc2-ui-kit", - "serde", - "windows-sys 0.61.2", -] +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" [[package]] name = "owo-colors" @@ -3545,7 +3582,7 @@ checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.5.18", "smallvec", "windows-link 0.2.1", ] @@ -3582,9 +3619,9 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "pest" -version = "2.8.4" +version = "2.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbcfd20a6d4eeba40179f05735784ad32bdaef05ce8e8af05f180d45bb3e7e22" +checksum = "2c9eb05c21a464ea704b53158d358a31e6425db2f63a1a7312268b05fe2b75f7" dependencies = [ "memchr", "ucd-trie", @@ -3592,9 +3629,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.8.4" +version = "2.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51f72981ade67b1ca6adc26ec221be9f463f2b5839c7508998daa17c23d94d7f" +checksum = "68f9dbced329c441fa79d80472764b1a2c7e57123553b8519b36663a2fb234ed" dependencies = [ "pest", "pest_generator", @@ -3602,22 +3639,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.8.4" +version = "2.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee9efd8cdb50d719a80088b76f81aec7c41ed6d522ee750178f83883d271625" +checksum = "3bb96d5051a78f44f43c8f712d8e810adb0ebf923fc9ed2655a7f66f63ba8ee5" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] name = "pest_meta" -version = "2.8.4" +version = "2.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf1d70880e76bdc13ba52eafa6239ce793d85c8e43896507e43dd8984ff05b82" +checksum = "602113b5b5e8621770cfd490cfd90b9f84ab29bd2b0e49ad83eb6d186cef2365" dependencies = [ "pest", "sha2", @@ -3670,7 +3707,7 @@ checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -3742,15 +3779,15 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.11.1" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" +checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" [[package]] name = "portable-atomic-util" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +checksum = "7a9db96d7fa8782dd8c15ce32ffe8680bbd1e978a43bf51a34d39483540495f5" dependencies = [ "portable-atomic", ] @@ -3793,14 +3830,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.114", ] [[package]] name = "proc-macro2" -version = "1.0.103" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ "unicode-ident", ] @@ -3825,13 +3862,14 @@ dependencies = [ ] [[package]] -name = "prost" -version = "0.13.5" +name = "proptest-derive" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2796faa41db3ec313a31f7624d9286acf277b52de526150b7e69f3debf891ee5" +checksum = "fb6dc647500e84a25a85b100e76c85b8ace114c209432dc174f20aac11d4ed6c" dependencies = [ - "bytes", - "prost-derive 0.13.5", + "proc-macro2", + "quote", + "syn 2.0.114", ] [[package]] @@ -3841,7 +3879,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7231bd9b3d3d33c86b58adbac74b5ec0ad9f496b19d22801d773636feaa95f3d" dependencies = [ "bytes", - "prost-derive 0.14.1", + "prost-derive", ] [[package]] @@ -3857,52 +3895,26 @@ dependencies = [ "once_cell", "petgraph 0.7.1", "prettyplease", - "prost 0.14.1", - "prost-types 0.14.1", + "prost", + "prost-types", "pulldown-cmark", "pulldown-cmark-to-cmark", "regex", - "syn", + "syn 2.0.114", "tempfile", ] [[package]] name = "prost-derive" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" -dependencies = [ - "anyhow", - "itertools 0.14.0", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "prost-derive" -version = "0.14.1" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9120690fafc389a67ba3803df527d0ec9cbbc9cc45e4cc20b332996dfb672425" +checksum = "27c6023962132f4b30eb4c172c91ce92d933da334c59c23cddee82358ddafb0b" dependencies = [ "anyhow", "itertools 0.14.0", "proc-macro2", "quote", - "syn", -] - -[[package]] -name = "prost-reflect" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5edd582b62f5cde844716e66d92565d7faf7ab1445c8cebce6e00fba83ddb2" -dependencies = [ - "logos 0.14.4", - "miette", - "once_cell", - "prost 0.13.5", - "prost-types 0.13.5", + "syn 2.0.114", ] [[package]] @@ -3913,17 +3925,8 @@ checksum = "b89455ef41ed200cafc47c76c552ee7792370ac420497e551f16123a9135f76e" dependencies = [ "logos 0.15.1", "miette", - "prost 0.14.1", - "prost-types 0.14.1", -] - -[[package]] -name = "prost-types" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52c2c1bf36ddb1a1c396b3601a3cec27c2462e45f07c386894ec3ccf5332bd16" -dependencies = [ - "prost 0.13.5", + "prost", + "prost-types", ] [[package]] @@ -3932,49 +3935,22 @@ version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9b4db3d6da204ed77bb26ba83b6122a73aeb2e87e25fbf7ad2e84c4ccbf8f72" dependencies = [ - "prost 0.14.1", -] - -[[package]] -name = "protox" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f352af331bf637b8ecc720f7c87bf903d2571fa2e14a66e9b2558846864b54a" -dependencies = [ - "bytes", - "miette", - "prost 0.13.5", - "prost-reflect 0.14.7", - "prost-types 0.13.5", - "protox-parse 0.7.0", - "thiserror 1.0.69", + "prost", ] [[package]] name = "protox" -version = "0.9.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f25a07a73c6717f0b9bbbd685918f5df9815f7efba450b83d9c9dea41f0e3a1" +checksum = "8555716f64c546306ddf3383065dc40d4232609e79e0a4c50e94e87d54f30fb4" dependencies = [ "bytes", "miette", - "prost 0.14.1", - "prost-reflect 0.16.3", - "prost-types 0.14.1", - "protox-parse 0.9.0", - "thiserror 2.0.17", -] - -[[package]] -name = "protox-parse" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3a462d115462c080ae000c29a47f0b3985737e5d3a995fcdbcaa5c782068dde" -dependencies = [ - "logos 0.14.4", - "miette", - "prost-types 0.13.5", - "thiserror 1.0.69", + "prost", + "prost-reflect", + "prost-types", + "protox-parse", + "thiserror", ] [[package]] @@ -3985,8 +3961,8 @@ checksum = "072eee358134396a4643dff81cfff1c255c9fbd3fb296be14bdb6a26f9156366" dependencies = [ "logos 0.15.1", "miette", - "prost-types 0.14.1", - "thiserror 2.0.17", + "prost-types", + "thiserror", ] [[package]] @@ -4017,9 +3993,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.42" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" +checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" dependencies = [ "proc-macro2", ] @@ -4043,7 +4019,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ "rand_chacha", - "rand_core 0.9.3", + "rand_core 0.9.5", ] [[package]] @@ -4053,7 +4029,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", - "rand_core 0.9.3", + "rand_core 0.9.5", ] [[package]] @@ -4062,14 +4038,14 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.16", + "getrandom 0.2.17", ] [[package]] name = "rand_core" -version = "0.9.3" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" dependencies = [ "getrandom 0.3.4", ] @@ -4089,7 +4065,25 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" dependencies = [ - "rand_core 0.9.3", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_xoshiro" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rand_xoshiro" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f703f4665700daf5512dcca5f43afa6af89f09db47fb56be587f80636bda2d41" +dependencies = [ + "rand_core 0.9.5", ] [[package]] @@ -4142,6 +4136,15 @@ dependencies = [ "bitflags", ] +[[package]] +name = "redox_syscall" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f3fe0889e69e2ae9e41f4d6c4c0181701d00e4697b356fb1f74173a5e0ee27" +dependencies = [ + "bitflags", +] + [[package]] name = "regex" version = "1.12.2" @@ -4189,41 +4192,17 @@ checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if", - "getrandom 0.2.16", + "getrandom 0.2.17", "libc", "untrusted", "windows-sys 0.52.0", ] -[[package]] -name = "rusqlite" -version = "0.36.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3de23c3319433716cf134eed225fe9986bc24f63bed9be9f20c329029e672dc7" -dependencies = [ - "bitflags", - "fallible-iterator", - "fallible-streaming-iterator", - "hashlink", - "libsqlite3-sys", - "smallvec", -] - -[[package]] -name = "rusqlite_migration" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a324f81362b5cd8f2eeef82d032172fdf2ca70aeec64962ff55a56874fe5ec41" -dependencies = [ - "log", - "rusqlite", -] - [[package]] name = "rustc-demangle" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" [[package]] name = "rustc-hash" @@ -4264,9 +4243,9 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" dependencies = [ "bitflags", "errno", @@ -4277,9 +4256,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.35" +version = "0.23.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f" +checksum = "c665f33d38cea657d9614f766881e4d510e0eda4239891eea56b4cadcf01801b" dependencies = [ "log", "once_cell", @@ -4292,9 +4271,9 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9980d917ebb0c0536119ba501e90834767bffc3d60641457fd84a1f3fd337923" +checksum = "612460d5f7bea540c490b2b6395d8e34a953e52b491accd6c86c8164c5932a63" dependencies = [ "openssl-probe", "rustls-pki-types", @@ -4304,18 +4283,18 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "708c0f9d5f54ba0272468c1d306a52c495b31fa155e91bc25371e6df7996908c" +checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" dependencies = [ "zeroize", ] [[package]] name = "rustls-webpki" -version = "0.103.8" +version = "0.103.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffdfa2f5286e2247234e03f680868ac2815974dc39e00ea15adc445d0aafe52" +checksum = "d7df23109aa6c1567d1c575b9952556388da57401e4ace1d15f79eedad0d8f53" dependencies = [ "ring", "rustls-pki-types", @@ -4351,9 +4330,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.20" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +checksum = "a50f4cf475b65d88e057964e0e9bb1f0aa9bbb2036dc65c64596b42932536984" [[package]] name = "same-file" @@ -4474,20 +4453,20 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] name = "serde_json" -version = "1.0.145" +version = "1.0.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" dependencies = [ "itoa", "memchr", - "ryu", "serde", "serde_core", + "zmij", ] [[package]] @@ -4498,7 +4477,7 @@ checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -4512,9 +4491,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e24345aa0fe688594e73770a5f6d1b216508b4f93484c0026d521acd30134392" +checksum = "f8bbf91e5a4d6315eee45e704372590b30e260ee83af6639d64557f51b067776" dependencies = [ "serde_core", ] @@ -4584,10 +4563,11 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.4.7" +version = "1.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7664a098b8e616bdfcc2dc0e9ac44eb231eedf41db4e9fe95d8d32ec728dedad" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" dependencies = [ + "errno", "libc", ] @@ -4615,15 +4595,25 @@ checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa" [[package]] name = "siphasher" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" +checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e" + +[[package]] +name = "sized-chunks" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" +dependencies = [ + "bitmaps", + "typenum", +] [[package]] name = "slab" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "smallvec" @@ -4640,11 +4630,33 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" +[[package]] +name = "snapbox" +version = "0.6.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c1abc378119f77310836665f8523018532cf7e3faeb3b10b01da5a7321bf8e1" +dependencies = [ + "anstream", + "anstyle", + "normalize-line-endings", + "similar", + "snapbox-macros", +] + +[[package]] +name = "snapbox-macros" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b750c344002d7cc69afb9da00ebd9b5c0f8ac2eb7d115d9d45d5b5f47718d74" +dependencies = [ + "anstream", +] + [[package]] name = "socket2" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" +checksum = "86f4aa3ad99f2088c990dfa82d367e19cb29268ed67c574d10d0a4bfe71f07e0" dependencies = [ "libc", "windows-sys 0.60.2", @@ -4727,7 +4739,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn", + "syn 2.0.114", ] [[package]] @@ -4747,9 +4759,9 @@ dependencies = [ [[package]] name = "supports-hyperlinks" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "804f44ed3c63152de6a9f90acbea1a110441de43006ea51bcce8f436196a288b" +checksum = "e396b6523b11ccb83120b115a0b7366de372751aa6edf19844dfb13a6af97e91" [[package]] name = "supports-unicode" @@ -4759,9 +4771,20 @@ checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" [[package]] name = "syn" -version = "2.0.111" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" +checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" dependencies = [ "proc-macro2", "quote", @@ -4788,11 +4811,25 @@ dependencies = [ "regex-syntax", "serde", "serde_derive", - "thiserror 2.0.17", + "thiserror", "walkdir", "yaml-rust", ] +[[package]] +name = "sysinfo" +version = "0.37.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16607d5caffd1c07ce073528f9ed972d88db15dd44023fa57142963be3feb11f" +dependencies = [ + "libc", + "memchr", + "ntapi", + "objc2-core-foundation", + "objc2-io-kit", + "windows", +] + [[package]] name = "tap" version = "1.0.1" @@ -4805,22 +4842,16 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "591ef38edfb78ca4771ee32cf494cb8771944bee237a9b91fc9c1424ac4b777b" -[[package]] -name = "temp-dir" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83176759e9416cf81ee66cb6508dbfe9c96f20b8b56265a39917551c23c70964" - [[package]] name = "tempfile" -version = "3.23.0" +version = "3.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" +checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" dependencies = [ "fastrand", "getrandom 0.3.4", "once_cell", - "rustix 1.1.2", + "rustix 1.1.3", "windows-sys 0.61.2", ] @@ -4858,7 +4889,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b8cb979cb11c32ce1603f8137b22262a9d131aaa5c37b5678025f22b8becd0" dependencies = [ - "rustix 1.1.2", + "rustix 1.1.3", "windows-sys 0.60.2", ] @@ -4875,42 +4906,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl 1.0.69", -] - -[[package]] -name = "thiserror" -version = "2.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" -dependencies = [ - "thiserror-impl 2.0.17", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.69" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ - "proc-macro2", - "quote", - "syn", + "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "2.0.17" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -4924,30 +4935,30 @@ dependencies = [ [[package]] name = "time" -version = "0.3.44" +version = "0.3.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" +checksum = "9da98b7d9b7dad93488a84b8248efc35352b0b2657397d4167e7ad67e5d535e5" dependencies = [ "deranged", "itoa", "num-conv", "powerfmt", - "serde", + "serde_core", "time-core", "time-macros", ] [[package]] name = "time-core" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" [[package]] name = "time-macros" -version = "0.2.24" +version = "0.2.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" +checksum = "78cc610bac2dcee56805c99642447d4c5dbde4d01f752ffea0199aee1f601dc4" dependencies = [ "num-conv", "time-core", @@ -4965,9 +4976,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.48.0" +version = "1.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" dependencies = [ "bytes", "libc", @@ -4986,7 +4997,7 @@ checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -5001,9 +5012,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" +checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" dependencies = [ "futures-core", "pin-project-lite", @@ -5013,9 +5024,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.17" +version = "0.7.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2efa149fe76073d6e8fd97ef4f4eca7b67f599660115591483572e406e165594" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" dependencies = [ "bytes", "futures-core", @@ -5039,14 +5050,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.9.8" +version = "0.9.11+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0dc8b1fb61449e27716ec0e1bdf0f6b8f3e8f6b05391e8497b8b6d7804ea6d8" +checksum = "f3afc9a848309fe1aaffaed6e1546a7a14de1f935dc9d89d32afd9a44bab7c46" dependencies = [ "indexmap", "serde_core", - "serde_spanned 1.0.3", - "toml_datetime 0.7.3", + "serde_spanned 1.0.4", + "toml_datetime 0.7.5+spec-1.1.0", "toml_parser", "toml_writer", "winnow", @@ -5063,9 +5074,9 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.7.3" +version = "0.7.5+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" dependencies = [ "serde_core", ] @@ -5086,14 +5097,14 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.23.9" +version = "0.23.10+spec-1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d7cbc3b4b49633d57a0509303158ca50de80ae32c265093b24c414705807832" +checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269" dependencies = [ "indexmap", "serde_core", - "serde_spanned 1.0.3", - "toml_datetime 0.7.3", + "serde_spanned 1.0.4", + "toml_datetime 0.7.5+spec-1.1.0", "toml_parser", "toml_writer", "winnow", @@ -5101,9 +5112,9 @@ dependencies = [ [[package]] name = "toml_parser" -version = "1.0.4" +version = "1.0.6+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e" +checksum = "a3198b4b0a8e11f09dd03e133c0280504d0801269e9afa46362ffde1cbeebf44" dependencies = [ "winnow", ] @@ -5116,15 +5127,15 @@ checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" [[package]] name = "toml_writer" -version = "1.0.4" +version = "1.0.6+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df8b2b54733674ad286d16267dcfc7a71ed5c776e4ac7aa3c3e2561f7c637bf2" +checksum = "ab16f14aed21ee8bfd8ec22513f7287cd4a91aa92e44edfe2c17ddd004e92607" [[package]] name = "tonic" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb7613188ce9f7df5bfe185db26c5814347d110db17920415cf2fbcad85e7203" +checksum = "a286e33f82f8a1ee2df63f4fa35c0becf4a85a0cb03091a15fd7bf0b402dc94a" dependencies = [ "async-trait", "base64", @@ -5152,23 +5163,23 @@ dependencies = [ [[package]] name = "tonic-build" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c40aaccc9f9eccf2cd82ebc111adc13030d23e887244bc9cfa5d1d636049de3" +checksum = "27aac809edf60b741e2d7db6367214d078856b8a5bff0087e94ff330fb97b6fc" dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] name = "tonic-health" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a82868bf299e0a1d2e8dce0dc33a46c02d6f045b2c1f1d6cc8dc3d0bf1812ef" +checksum = "8dbde2c702c4be12b9b2f6f7e6c824a84a7b7be177070cada8ee575a581af359" dependencies = [ - "prost 0.14.1", + "prost", "tokio", "tokio-stream", "tonic", @@ -5177,27 +5188,27 @@ dependencies = [ [[package]] name = "tonic-prost" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66bd50ad6ce1252d87ef024b3d64fe4c3cf54a86fb9ef4c631fdd0ded7aeaa67" +checksum = "d6c55a2d6a14174563de34409c9f92ff981d006f56da9c6ecd40d9d4a31500b0" dependencies = [ "bytes", - "prost 0.14.1", + "prost", "tonic", ] [[package]] name = "tonic-prost-build" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4a16cba4043dc3ff43fcb3f96b4c5c154c64cbd18ca8dce2ab2c6a451d058a2" +checksum = "a4556786613791cfef4ed134aa670b61a85cfcacf71543ef33e8d801abae988f" dependencies = [ "prettyplease", "proc-macro2", "prost-build", - "prost-types 0.14.1", + "prost-types", "quote", - "syn", + "syn 2.0.114", "tempfile", "tonic-build", ] @@ -5218,7 +5229,7 @@ dependencies = [ "httparse", "js-sys", "pin-project", - "thiserror 2.0.17", + "thiserror", "tonic", "tower-service", "wasm-bindgen", @@ -5229,9 +5240,9 @@ dependencies = [ [[package]] name = "tower" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" dependencies = [ "futures-core", "futures-util", @@ -5260,9 +5271,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d15d90a0b5c19378952d479dc858407149d7bb45a14de0142f6c534b16fc647" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -5277,14 +5288,14 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] name = "tracing-core" -version = "0.1.35" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" dependencies = [ "once_cell", "valuable", @@ -5327,9 +5338,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "trybuild" -version = "1.0.114" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e17e807bff86d2a06b52bca4276746584a78375055b6e45843925ce2802b335" +checksum = "5f614c21bd3a61bad9501d75cbb7686f00386c806d7f456778432c25cf86948a" dependencies = [ "dissimilar", "glob", @@ -5338,7 +5349,7 @@ dependencies = [ "serde_json", "target-triple", "termcolor", - "toml 0.9.8", + "toml 0.9.11+spec-1.1.0", ] [[package]] @@ -5387,9 +5398,9 @@ checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" [[package]] name = "unicase" -version = "2.8.1" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" +checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" [[package]] name = "unicode-ident" @@ -5462,12 +5473,13 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.19.0" +version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e054861b4bd027cd373e18e8d8d8e6548085000e41290d95ce0c373a654b4a" +checksum = "ee48d38b119b0cd71fe4141b30f5ba9c7c5d9f4e7a3a8b4a674e4b6ef789976f" dependencies = [ "getrandom 0.3.4", "js-sys", + "serde_core", "wasm-bindgen", ] @@ -5477,12 +5489,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version_check" version = "0.9.5" @@ -5534,18 +5540,18 @@ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasip2" -version = "1.0.1+wasi-0.2.4" +version = "1.0.2+wasi-0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" dependencies = [ - "wit-bindgen", + "wit-bindgen 0.51.0", ] [[package]] name = "wasm-bindgen" -version = "0.2.106" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd" +checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566" dependencies = [ "cfg-if", "once_cell", @@ -5556,11 +5562,12 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.56" +version = "0.4.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836d9622d604feee9e5de25ac10e3ea5f2d65b41eac0d9ce72eb5deae707ce7c" +checksum = "70a6e77fd0ae8029c9ea0063f87c46fde723e7d887703d74ad2616d792e51e6f" dependencies = [ "cfg-if", + "futures-util", "js-sys", "once_cell", "wasm-bindgen", @@ -5569,9 +5576,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.106" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3" +checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5579,22 +5586,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.106" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40" +checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55" dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn", + "syn 2.0.114", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.106" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4" +checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12" dependencies = [ "unicode-ident", ] @@ -5611,12 +5618,12 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.243.0" +version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c55db9c896d70bd9fa535ce83cd4e1f2ec3726b0edd2142079f594fc3be1cb35" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" dependencies = [ "leb128fmt", - "wasmparser 0.243.0", + "wasmparser 0.244.0", ] [[package]] @@ -5669,9 +5676,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.243.0" +version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6d8db401b0528ec316dfbe579e6ab4152d61739cfe076706d2009127970159d" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" dependencies = [ "bitflags", "indexmap", @@ -5691,31 +5698,31 @@ dependencies = [ [[package]] name = "wast" -version = "243.0.0" +version = "244.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df21d01c2d91e46cb7a221d79e58a2d210ea02020d57c092e79255cc2999ca7f" +checksum = "b2e7b9f9e23311275920e3d6b56d64137c160cf8af4f84a7283b36cfecbf4acb" dependencies = [ "bumpalo", "leb128fmt", "memchr", "unicode-width 0.2.0", - "wasm-encoder 0.243.0", + "wasm-encoder 0.244.0", ] [[package]] name = "wat" -version = "1.243.0" +version = "1.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "226a9a91cd80a50449312fef0c75c23478fcecfcc4092bdebe1dc8e760ef521b" +checksum = "bbf35b87ed352f9ab6cd0732abde5a67dd6153dfd02c493e61459218b19456fa" dependencies = [ "wast", ] [[package]] name = "web-sys" -version = "0.3.83" +version = "0.3.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b32828d774c412041098d182a8b38b16ea816958e07cf40eec2bc080ae137ac" +checksum = "312e32e551d92129218ea9a2452120f4aabc03529ef03e4d0d82fb2780608598" dependencies = [ "js-sys", "wasm-bindgen", @@ -5819,7 +5826,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -5830,7 +5837,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -6192,7 +6199,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d31a19dae58475d019850e25b0170e94b16d382fbf6afee9c0e80fdc935e73e" dependencies = [ "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -6210,6 +6217,16 @@ dependencies = [ "winter-utils", ] +[[package]] +name = "winter-rand-utils" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4ff3b651754a7bd216f959764d0a5ab6f4b551c9a3a08fb9ccecbed594b614a" +dependencies = [ + "rand", + "winter-utils", +] + [[package]] name = "winter-utils" version = "0.13.1" @@ -6232,6 +6249,17 @@ dependencies = [ "winter-utils", ] +[[package]] +name = "winterfell" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43f824ddd5aec8ca6a54307f20c115485a8a919ea94dd26d496d856ca6185f4f" +dependencies = [ + "winter-air", + "winter-prover", + "winter-verifier", +] + [[package]] name = "wit-bindgen" version = "0.46.0" @@ -6241,6 +6269,12 @@ dependencies = [ "wit-bindgen-rust-macro", ] +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" + [[package]] name = "wit-bindgen-core" version = "0.46.0" @@ -6262,7 +6296,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn", + "syn 2.0.114", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -6278,7 +6312,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn", + "syn 2.0.114", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -6356,22 +6390,22 @@ checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" [[package]] name = "zerocopy" -version = "0.8.31" +version = "0.8.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3" +checksum = "7456cf00f0685ad319c5b1693f291a650eaf345e941d082fc4e03df8a03996ac" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.31" +version = "0.8.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a" +checksum = "1328722bbf2115db7e19d69ebcc15e795719e2d66b60827c6a69a117365e37a0" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -6379,3 +6413,9 @@ name = "zeroize" version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" + +[[package]] +name = "zmij" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff05f8caa9038894637571ae6b9e29466c1f4f829d26c9b28f869a29cbe3445" diff --git a/Cargo.toml b/Cargo.toml index f0e5817bc..b1f3eaea7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,11 +14,20 @@ members = [ "midenc", "midenc-compile", "midenc-driver", + "midenc-log", "midenc-session", - "sdk/*", + "sdk/field-repr/*", + "sdk/field", + "sdk/alloc", + "sdk/base", + "sdk/base-macros", + "sdk/base-sys", + "sdk/sdk", + "sdk/stdlib-sys", "tools/*", "tests/integration", - "tests/integration-node", + "test-harness/*", + "tests/integration-network", ] exclude = [ "sdk/.cargo", @@ -59,29 +68,26 @@ clap = { version = "4.5", default-features = false, features = [ ] } cranelift-entity = "0.120" compact_str = { version = "0.9", default-features = false } -env_logger = "0.11" hashbrown = { version = "0.15", features = ["nightly"] } Inflector = "0.11" intrusive-collections = "0.9" inventory = "0.3" -log = "0.4" +litcheck = { package = "litcheck-core", version = "0.4" } +litcheck-filecheck = "0.4" +log = { version = "0.4", features = ["kv"] } # Miden Dependencies -miden-assembly = { version = "0.19", default-features = false } -miden-core = { version = "0.19", default-features = false } -miden-debug = { version = "0.4.1" } -miden-debug-types = { version = "0.19", default-features = false } -miden-assembly-syntax = { version = "0.19", default-features = false } +miden-assembly = { version = "0.20", default-features = false } +miden-core = { version = "0.20", default-features = false } +miden-debug = { version = "0.4" } +miden-debug-types = { version = "0.20", default-features = false } +miden-assembly-syntax = { version = "0.20", default-features = false } miden-formatting = { version = "0.1", default-features = false } -miden-lib = { version = "0.12", default-features = false, features = [ - "with-debug-info", -] } -miden-objects = { version = "0.12", default-features = false } -miden-processor = { version = "0.19", default-features = false } -miden-stdlib = { version = "0.19", default-features = false, features = [ - "with-debug-info", -] } -miden-mast-package = { version = "0.19", default-features = false } +miden-protocol = { version = "0.13", default-features = false } +miden-standards = { version = "0.13", default-features = false } +miden-processor = { version = "0.20", default-features = false } +miden-core-lib = { version = "0.20", default-features = false } +miden-mast-package = { version = "0.20", default-features = false } miette = { package = "miden-miette", version = "7.1.1" } paste = "1.0" parking_lot = "0.12" @@ -119,6 +125,7 @@ thiserror = { package = "miden-thiserror", version = "1.0" } toml = { version = "0.8", features = ["preserve_order"] } tokio = { version = "1.39.2", features = ["rt", "time", "macros", "rt-multi-thread"] } wat = "1.0.69" +wasmprinter = "0.227" wasmparser = { version = "0.227", default-features = false, features = [ "features", "component-model", @@ -142,10 +149,13 @@ midenc-hir-transform = { version = "0.6.0", path = "hir-transform" } midenc-frontend-wasm = { version = "0.6.0", path = "frontend/wasm" } midenc-compile = { version = "0.6.0", path = "midenc-compile" } midenc-driver = { version = "0.6.0", path = "midenc-driver" } +midenc-log = { version = "0.6.0", path = "midenc-log", features = ["kv"] } midenc-session = { version = "0.6.0", path = "midenc-session" } cargo-miden = { version = "0.6.0", path = "tools/cargo-miden" } miden-integration-tests = { path = "tests/integration" } midenc-expect-test = { path = "tools/expect-test" } +miden-test-harness = { path = "test-harness/test-harness-lib" } +miden-test-harness-macros = { path = "test-harness/test-harness-macros" } [patch.crates-io] #miden-assembly = { git = "https://github.com/0xMiden/miden-vm", rev = "614cd7f9b52f45238b0ab59c71ebb49325051e5d" } @@ -153,15 +163,11 @@ midenc-expect-test = { path = "tools/expect-test" } #miden-assembly-syntax = { path = "../miden-vm/assembly-syntax" } #miden-core = { git = "https://github.com/0xMiden/miden-vm", rev = "614cd7f9b52f45238b0ab59c71ebb49325051e5d" } #miden-core = { path = "../miden-vm/core" } -#miden-client = { git = "https://github.com/0xMiden/miden-client", rev = "4099516c08c9a56c6d1271fddfc798f40da0d702" } -miden-debug = { git = "https://github.com/0xMiden/miden-debug", rev = "0cfdc623f51c721ff7812a0f70836ffaea182898" } +# miden-client = { git = "https://github.com/0xMiden/miden-client", rev = "0a5add565d1388f77cd182f3639c16aa8f7ec674" } +# miden-debug = { git = "https://github.com/0xMiden/miden-debug", branch = "greenhat-migrate-vm-v0.20" } #miden-debug-types = { path = "../miden-vm/crates/debug/types" } #miden-processor = { git = "https://github.com/0xMiden/miden-vm", rev = "614cd7f9b52f45238b0ab59c71ebb49325051e5d" } #miden-processor = { path = "../miden-vm/processor" } -#miden-lib = { git = "https://github.com/0xMiden/miden-base", rev = "8a50c8f98529f9a78655385e3e78a6de44db9316" } -#miden-objects = { git = "https://github.com/0xMiden/miden-base", rev = "8a50c8f98529f9a78655385e3e78a6de44db9316" } -#miden-stdlib = { git = "https://github.com/0xMiden/miden-vm", rev = "614cd7f9b52f45238b0ab59c71ebb49325051e5d" } -#miden-stdlib = { path = "../miden-vm/stdlib" } #miden-mast-package = { git = "https://github.com/0xMiden/miden-vm", rev = "614cd7f9b52f45238b0ab59c71ebb49325051e5d" } #miden-mast-package = { path = "../miden-vm/package" } @@ -187,7 +193,7 @@ opt-level = 3 # Speed up the test profile (proving times) # ============================================================ # The test package itself needs optimization -[profile.test.package.miden-integration-node-tests] +[profile.test.package.midenc-integration-network-tests] opt-level = 3 # Core Miden packages @@ -203,7 +209,7 @@ opt-level = 3 [profile.test.package.miden-client] opt-level = 3 -[profile.test.package.miden-lib] +[profile.test.package.miden-protocol] opt-level = 3 [profile.test.package.miden-tx] @@ -222,7 +228,7 @@ opt-level = 3 [profile.test.package.winter-math] opt-level = 3 -[profile.test.package.miden-objects] +[profile.test.package.miden-standards] opt-level = 3 [profile.test.package.miden-core] @@ -231,7 +237,7 @@ opt-level = 3 [profile.test.package.miden-assembly] opt-level = 3 -[profile.test.package.miden-stdlib] +[profile.test.package.miden-core-lib] opt-level = 3 # Compiler packages that might be used in tests @@ -271,7 +277,7 @@ opt-level = 3 [profile.dev.package.miden-client] opt-level = 3 -[profile.dev.package.miden-lib] +[profile.dev.package.miden-protocol] opt-level = 3 [profile.dev.package.miden-tx] diff --git a/Makefile.toml b/Makefile.toml index 5a1411acd..ffe94f768 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -31,7 +31,29 @@ MIDENC_BUILD_PROFILE = "debug" MIDENC_BUILD_PROFILE = "release" [tasks.init] -run_task = "print-env" +script = [''' +#!@duckscript + +# Set an environment variable containing the current rustup toolchain +# +if is_path_exists "rust-toolchain.toml" + toolchain_file = readfile "rust-toolchain.toml" + channel_start = indexof ${toolchain_file} "channel = " + if not is_empty ${channel_start} + channel_quoted_start = calc ${channel_start} + 11 + rest_of_file = substring ${toolchain_file} ${channel_quoted_start} + + channel_end = indexof ${rest_of_file} "\"" + if not is_empty ${channel_end} + channel = substring ${rest_of_file} 0 ${channel_end} + channel = trim ${channel} + set_env CARGO_MAKE_RUSTUP_TOOLCHAIN_NAME ${channel} + end + end +end + +cm_run_task "print-env" +'''] [tasks.default] category = "Build" @@ -100,6 +122,7 @@ release ${rustc_version_parts} echo "*************************************" echo "Rust:" echo " Version: ${CARGO_MAKE_RUST_VERSION}" +echo " Toolchain: ${CARGO_MAKE_RUSTUP_TOOLCHAIN_NAME}" echo " Channel: ${CARGO_MAKE_RUST_CHANNEL}" echo " Build Hash: ${hash}" echo " Build Date: ${date}" @@ -182,7 +205,6 @@ args = [ "midenc", "--artifact-dir", "${MIDENC_BIN_DIR}", - "@@split(CARGO_MAKE_TASK_ARGS, ;)", ] [tasks.cargo-miden] @@ -197,7 +219,6 @@ args = [ "cargo-miden", "--artifact-dir", "${MIDENC_BIN_DIR}", - "@@split(CARGO_MAKE_TASK_ARGS, ;)", ] [tasks.build] @@ -275,9 +296,14 @@ description = "Check dependencies for known vulnerabilities, deprecations" command = "cargo" args = ["audit"] +[tasks.test-all] +category = "Test" +description = "Runs the complete set of compiler tests" +dependencies = ["test-rust", "test-lit"] + [tasks.test] category = "Test" -description = "Runs all tests including integration node tests" +description = "Runs all Rust-based tests including network integration tests" dependencies = ["test-rust"] [tasks.install-cargo-miden] @@ -310,11 +336,11 @@ args = [ "midenc", ] - [tasks.test-rust] category = "Test" -description = "Runs tests written in Rust" +description = "Run tests written in Rust, with optional extra arguments" command = "cargo" +install_crate_args = ["--locked"] args = [ "nextest", "run", @@ -333,11 +359,21 @@ args = [ "--verbose", "--path", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/bin", - "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/tests/lit/parse", - "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/tests/lit/wasm-translation", - "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/tests/lit/source-location", + "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/tests/lit", ] -dependencies = ["litcheck"] +dependencies = ["litcheck", "midenc", "cargo-miden"] + +[tasks.lit] +category = "Test" +description = "Execute the lit utility" +command = "litcheck" +env = { MIDENC_BIN_DIR = "${MIDENC_BIN_DIR}" } +args = [ + "lit", + "${@}", +] +dependencies = ["litcheck", "midenc", "cargo-miden"] + [tasks.litcheck] category = "Test" diff --git a/README.md b/README.md index e3455c972..367e1ea98 100644 --- a/README.md +++ b/README.md @@ -50,11 +50,20 @@ To run the compiler test suite: This will run all of the unit tests in the workspace, as well as all of our `lit` tests. +## Debugging + +### Emitting internal sources/artifacts + +- `MIDENC_EMIT`: Environment-variable equivalent of `--emit`. Accepts the same `KIND[=PATH]` syntax + (comma-delimited), where `PATH` is treated either as folder e.g. `MIDENC_EMIT=ir=target/emit` or file `MIDENC_EMIT=hir=my_name.hir`. +- `MIDENC_EMIT_MACRO_EXPAND[=]`: When set, integration tests dump `cargo expand` + output for Rust fixtures to `.expanded.rs` files in `` (or the CWD if empty/`1`). + ## Docs The documentation in the `docs/external` folder is built using Docusaurus and is automatically absorbed into the main [miden-docs](https://github.com/0xMiden/miden-docs) repository for the main documentation website. Changes to the `next` branch trigger an automated deployment workflow. The docs folder requires npm packages to be installed before building. -The `docs/internal` folder corresponds to internal docs, which are hosted using mdbook and Github Pages here: [0xmiden.github.io/compiler/](0xmiden.github.io/compiler/). These md files are not exported to the main docs. +The `docs/internal` folder corresponds to internal docs, which are hosted using mdbook and Github Pages here: [The Miden compiler](https://0xmiden.github.io/compiler/). These md files are not exported to the main docs. ## Packaging diff --git a/bin/filecheck b/bin/filecheck deleted file mode 120000 index 7e67e25eb..000000000 --- a/bin/filecheck +++ /dev/null @@ -1 +0,0 @@ -litcheck \ No newline at end of file diff --git a/bin/lit b/bin/lit deleted file mode 120000 index 7e67e25eb..000000000 --- a/bin/lit +++ /dev/null @@ -1 +0,0 @@ -litcheck \ No newline at end of file diff --git a/codegen/masm/Cargo.toml b/codegen/masm/Cargo.toml index 7222103d3..507432f96 100644 --- a/codegen/masm/Cargo.toml +++ b/codegen/masm/Cargo.toml @@ -16,6 +16,7 @@ default = ["std"] std = ["midenc-hir/std", "midenc-dialect-hir/std", "petgraph/std"] [dependencies] +anyhow.workspace = true inventory.workspace = true log.workspace = true miden-assembly.workspace = true @@ -23,7 +24,7 @@ miden-assembly-syntax.workspace = true miden-core.workspace = true miden-mast-package.workspace = true miden-processor.workspace = true -miden-lib.workspace = true +miden-protocol.workspace = true midenc-hir.workspace = true midenc-hir-analysis.workspace = true midenc-dialect-arith.workspace = true @@ -41,5 +42,5 @@ thiserror.workspace = true # Use local paths for dev-only dependency to avoid relying on crates.io during packaging midenc-expect-test = { path = "../../tools/expect-test" } proptest.workspace = true -env_logger.workspace = true +midenc-log = { path = "../../midenc-log" } itertools = "0.14.0" diff --git a/codegen/masm/intrinsics/advice.masm b/codegen/masm/intrinsics/advice.masm index c943b6af5..4f093001b 100644 --- a/codegen/masm/intrinsics/advice.masm +++ b/codegen/masm/intrinsics/advice.masm @@ -5,7 +5,7 @@ #! Stack Output: [num_elements, ...] (returns the number of elements pushed) #! #! The key is a Word (4 field elements) used to lookup values in the advice map -export.adv_push_mapvaln +pub proc adv_push_mapvaln # Stack: [key3, key2, key1, key0, ...] # Call the VM instruction to push values from advice map @@ -30,8 +30,8 @@ end #! #! Inputs: [msg3, msg2, msg1, msg0, pk3, pk2, pk1, pk0, ...] #! Outputs: [...] -const.AUTH_REQUEST_EVENT=event("miden::auth::request") -export.emit_falcon_sig_to_stack +const AUTH_REQUEST_EVENT=event("miden::auth::request") +pub proc emit_falcon_sig_to_stack emit.AUTH_REQUEST_EVENT dropw dropw end @@ -41,7 +41,7 @@ end #! Inputs: [key3, key2, key1, key0, start_addr, end_addr, ...] #! Outputs: [...] #! Side effects: advice_map[key] <- mem[start_addr..end_addr] -export.adv_insert_mem +pub proc adv_insert_mem # VM op expects [KEY, a, b, ...] and leaves them on the stack adv.insert_mem # Drop a,b and the key word from the stack so the proc has no outputs diff --git a/codegen/masm/intrinsics/crypto.masm b/codegen/masm/intrinsics/crypto.masm index c9cb81455..8bcc3e4a9 100644 --- a/codegen/masm/intrinsics/crypto.masm +++ b/codegen/masm/intrinsics/crypto.masm @@ -6,7 +6,7 @@ #! #! The digests_ptr points to an array of 2 digests [A, B] (8 field elements total) #! Memory layout: [a0, a1, a2, a3, b0, b1, b2, b3] -export.hmerge +pub proc hmerge # Stack: [digests_ptr, result_ptr, ...] # Load first digest (A) from digests_ptr diff --git a/codegen/masm/intrinsics/i128.masm b/codegen/masm/intrinsics/i128.masm index 0956a60cb..5460c7354 100644 --- a/codegen/masm/intrinsics/i128.masm +++ b/codegen/masm/intrinsics/i128.masm @@ -1,5 +1,5 @@ # Adds `a` to `b`, wrapping to 128 bits. -export.add # [bhh bmh bml bll ahh amh aml all ...] +pub proc add # [bhh bmh bml bll ahh amh aml all ...] movup.7 # [all bhh bmh bml bll ahh amh aml ...] movup.4 # [bll all bhh bmh bml ahh amh aml ...] u32overflowing_add # [oll rll bhh bmh bml ahh amh aml ...] @@ -15,7 +15,7 @@ export.add # [bhh bmh bml bll ahh amh aml all ...] end # Subtracts `b` from `a`, wrapping to 128 bits. -export.sub # [bhh bmh bml bll ahh amh aml all ...] +pub proc sub # [bhh bmh bml bll ahh amh aml all ...] movup.7 # [all bhh bmh bml bll ahh amh aml ...] movup.4 # [bll all bhh bmh bml ahh amh aml ...] u32overflowing_sub # [ull rll bhh bmh bml ahh amh aml ...] @@ -59,7 +59,7 @@ end # ------------------------------------------- # rhh rmh rml rll -export.mul # [bhh bmh bml bll ahh amh aml all ... ] +pub proc mul # [bhh bmh bml bll ahh amh aml all ... ] dup.7 # [all bhh bmh bml bll ahh amh aml all ... ] dup.4 # [bll all bhh bmh bml bll ahh amh aml all ... ] u32overflowing_mul # [o rll bhh bmh bml bll ahh amh aml all ... ] diff --git a/codegen/masm/intrinsics/i32.masm b/codegen/masm/intrinsics/i32.masm index ae259c104..85dcdf8f6 100644 --- a/codegen/masm/intrinsics/i32.masm +++ b/codegen/masm/intrinsics/i32.masm @@ -1,19 +1,19 @@ -const.SIGN_BIT=2147483648 # 1 << 31 -const.MIN=SIGN_BIT -const.MAX=2147483647 # (1 << 31) - 1 -const.NEG1=4294967295 # u32::MAX +const SIGN_BIT=2147483648 # 1 << 31 +const MIN=SIGN_BIT +const MAX=2147483647 # (1 << 31) - 1 +const NEG1=4294967295 # u32::MAX # Returns `1` if `a` has its sign bit set, else `0` # # This function consumes `a`. -export.is_signed # [a] +pub proc is_signed # [a] push.SIGN_BIT u32and push.SIGN_BIT eq end # Get the negation of `a` # # This operation is unchecked, so if the input is not a valid i32 the behavior is undefined -export.unchecked_neg # [a] +pub proc unchecked_neg # [a] u32not u32wrapping_add.1 end @@ -21,7 +21,7 @@ end # # This operation is checked, so if the input is not a valid i32, # or if the negation is not a valid i32, execution traps -export.checked_neg # [a] +pub proc checked_neg # [a] # assert that the negation is representable dup.0 push.MIN eq assertz exec.unchecked_neg @@ -30,7 +30,7 @@ end # Adds `b` to `a`, asserting that both inputs are valid i32. # # Returns the result modulo 2^32, plus a boolean indicating whether or not the subtraction underflowed. -export.overflowing_add # [b, a] +pub proc overflowing_add # [b, a] u32assert2 # is `b` signed? @@ -60,13 +60,13 @@ export.overflowing_add # [b, a] end # Adds `b` to `a`, wrapping around on overflow. -export.wrapping_add # [b, a] +pub proc wrapping_add # [b, a] exec.overflowing_add # [overflowed, result] drop end # Adds `b` to `a`, asserting on overflow. -export.checked_add # [b, a] +pub proc checked_add # [b, a] exec.overflowing_add # [overflowed, result] assertz # [result] end @@ -74,7 +74,7 @@ end # Subtracts `b` from `a`, asserting that both inputs are valid i32. # # Returns the result modulo 2^32, plus a boolean indicating whether or not the subtraction underflowed. -export.overflowing_sub # [b, a] +pub proc overflowing_sub # [b, a] u32assert2 # Subtraction is equivalent to addition if we negate the right-hand operand @@ -112,13 +112,13 @@ end # Subtracts `b` from `a` # # This operation will fail if `b` is not a valid i32, or if `result` is not a valid i32 -export.wrapping_sub # [b, a] +pub proc wrapping_sub # [b, a] exec.overflowing_sub # [overflowed, result] drop end # Subtracts `b` from `a`, asserting on underflow/overflow -export.checked_sub # [b, a] +pub proc checked_sub # [b, a] exec.overflowing_sub # [overflowed, result] assertz # [result] end @@ -126,7 +126,7 @@ end # Multiplies `a` by `b`, asserting that both inputs are valid i32. # # Returns the result modulo 2^32, plus a boolean indicating whether or not the multiplication overflowed. -export.overflowing_mul # [b, a] +pub proc overflowing_mul # [b, a] u32assert2 # is `b` i32::MIN? @@ -186,19 +186,19 @@ export.overflowing_mul # [b, a] end # Multiplies `a` by `b`, wrapping on overflow. -export.wrapping_mul # [b, a] +pub proc wrapping_mul # [b, a] exec.overflowing_mul # [overflowed, result] drop end # Multiplies `a` by `b`, asserting on overflow -export.checked_mul # [b, a] +pub proc checked_mul # [b, a] exec.overflowing_mul # [overflowed, result] assertz # [result] end # Divides `a` by `b`, asserting that both inputs are valid i32 -export.checked_div # [b, a] +pub proc checked_div # [b, a] u32assert2 # get positive dividend @@ -224,7 +224,7 @@ end # Given two i32 values in two's complement representation, compare them, # returning -1 if `a` < `b`, 0 if equal, and 1 if `a` > `b`. -export.icmp # [b, a] +pub proc icmp # [b, a] dup.1 # [a, b, a] dup.1 # [b, a, b, a] @@ -263,27 +263,27 @@ export.icmp # [b, a] end # Given two i32 values in two's complement representation, return 1 if `a < b`, else 0 -export.is_lt # [b, a] +pub proc is_lt # [b, a] exec.icmp push.NEG1 eq end # Given two i32 values in two's complement representation, return 1 if `a <= b`, else 0 -export.is_lte # [b, a] +pub proc is_lte # [b, a] exec.icmp neq.1 end # Given two i32 values in two's complement representation, return 1 if `a > b`, else 0 -export.is_gt # [b, a] +pub proc is_gt # [b, a] exec.icmp eq.1 end # Given two i32 values in two's complement representation, return 1 if `a >= b`, else 0 -export.is_gte # [b, a] +pub proc is_gte # [b, a] exec.icmp push.NEG1 neq end # Compute 2^n, where `n` must be less than 31, or the result will overflow i32::MAX -export.pow2 # [n] +pub proc pow2 # [n] dup.0 push.31 u32lt # [n < 31, pow] @@ -293,7 +293,7 @@ export.pow2 # [n] end # Compute a^b, where `b` must be a positive i32 value < 31 -export.ipow # [b, a] +pub proc ipow # [b, a] dup.0 push.31 u32lt assert # assert that `b` is < 31 dup.0 eq.0 # [b == 0, b, a] dup.2 eq.0 # [a == 0, b == 0, b, a] @@ -338,7 +338,7 @@ end # This function will assert if `b` is > 31. # # This implementation is checked, so it will assert if the inputs are invalid -export.checked_shr # [b, a] +pub proc checked_shr # [b, a] # validate the shift is valid dup.0 push.32 u32lt # [b < 32, b, a] diff --git a/codegen/masm/intrinsics/i64.masm b/codegen/masm/intrinsics/i64.masm index d2f7e4095..28166dcd0 100644 --- a/codegen/masm/intrinsics/i64.masm +++ b/codegen/masm/intrinsics/i64.masm @@ -1,15 +1,15 @@ -const.SIGN_BIT=2147483648 # 1 << 31 -const.MIN_HI=SIGN_BIT -const.MIN_LO=0 -const.MAX_HI=2147483647 # (1 << 31) - 1 -const.MAX_LO=4294967295 # u32::MAX -const.NEG1_HI=MAX_LO -const.NEG1_LO=MAX_LO +const SIGN_BIT=2147483648 # 1 << 31 +const MIN_HI=SIGN_BIT +const MIN_LO=0 +const MAX_HI=2147483647 # (1 << 31) - 1 +const MAX_LO=4294967295 # u32::MAX +const NEG1_HI=MAX_LO +const NEG1_LO=MAX_LO # Returns `1` if `a` has its sign bit set, else `0` # # This function consumes `a`. -export.is_signed # [a_hi, a_lo] +pub proc is_signed # [a_hi, a_lo] swap.1 drop push.SIGN_BIT u32and push.SIGN_BIT eq end @@ -17,30 +17,30 @@ end # Get the negation of `a` # # This operation is unchecked, so if the input is not a valid i64 the behavior is undefined -export.unchecked_neg # [a_hi, a_lo] +pub proc unchecked_neg # [a_hi, a_lo] # !a - 1 swap.1 u32not swap.1 u32not push.1.0 - exec.::std::math::u64::wrapping_add + exec.::miden::core::math::u64::wrapping_add end # Get the negation of `a` # # This operation is checked, so if the input is not a valid i64, # or if the negation is not a valid i64, execution traps -export.checked_neg # [a_hi, a_lo] +pub proc checked_neg # [a_hi, a_lo] # assert input is valid i64 u32assert2 # assert that the negation is representable dup.1 dup.1 push.MIN_LO.MIN_HI - exec.::std::math::u64::eq assertz + exec.::miden::core::math::u64::eq assertz exec.unchecked_neg end # Adds `b` to `a`, asserting that both inputs are valid i32. # # Returns the result modulo 2^32, plus a boolean indicating whether or not the subtraction underflowed. -export.overflowing_add # [b_hi, b_lo, a_hi, a_lo] +pub proc overflowing_add # [b_hi, b_lo, a_hi, a_lo] u32assertw # is `b` signed? @@ -60,7 +60,7 @@ export.overflowing_add # [b_hi, b_lo, a_hi, a_lo] dup.1 eq # [is_same_sign, is_signed, b_hi, b_lo, a_hi, a_lo] # compute result - movdn.5 movdn.5 exec.::std::math::u64::wrapping_add + movdn.5 movdn.5 exec.::miden::core::math::u64::wrapping_add # is `result` signed? dup.1 dup.1 exec.is_signed # [is_result_signed, result_hi, result_lo, is_same_sign, is_signed] @@ -70,11 +70,8 @@ export.overflowing_add # [b_hi, b_lo, a_hi, a_lo] movup.3 and # [overflowed, result_hi, result_lo] end -# Adds `b` to `a`, wrapping around on overflow. -export.::std::math::u64::wrapping_add - # Adds `b` to `a`, asserting on overflow. -export.checked_add # [b_hi, b_lo, a_hi, a_lo] +pub proc checked_add # [b_hi, b_lo, a_hi, a_lo] exec.overflowing_add # [overflowed, result_hi, result_lo] assertz end @@ -82,7 +79,7 @@ end # Subtracts `b` from `a`, asserting that both inputs are valid i64. # # Returns the result modulo 2^64, plus a boolean indicating whether or not the subtraction underflowed. -export.overflowing_sub # [b_hi, b_lo, a_hi, a_lo] +pub proc overflowing_sub # [b_hi, b_lo, a_hi, a_lo] u32assertw # Subtraction is equivalent to addition if we negate the right-hand operand @@ -90,7 +87,7 @@ export.overflowing_sub # [b_hi, b_lo, a_hi, a_lo] # However, we must account for the edge case where `i64::MIN` is given, as that # cannot be negated. In our case, the negation doesn't need to be realized immediately, # so as long as the result is in range, we don't need to assert. - dup.1 dup.1 push.MIN_LO.MIN_HI exec.::std::math::u64::eq # [is_b_min, b_hi, b_lo, a_hi, a_lo] + dup.1 dup.1 push.MIN_LO.MIN_HI exec.::miden::core::math::u64::eq # [is_b_min, b_hi, b_lo, a_hi, a_lo] if.true # The following is effectively identical to the implementation for `overflowing_add`, # but inlined here as we know the value of `b` statically in this branch, and we need @@ -102,8 +99,8 @@ export.overflowing_sub # [b_hi, b_lo, a_hi, a_lo] dup.0 eq.0 # [is_same_sign, is_a_signed, i64::MAX_HI, i64::MAX_LO, a_hi, a_lo] # compute result - movdn.5 movdn.5 exec.::std::math::u64::wrapping_add # [a + i64::MAX, .., is_same_sign, is_a_signed] - push.1.0 exec.::std::math::u64::wrapping_add # [a + i64::MAX + 1, .., is_same_sign, is_a_signed] + movdn.5 movdn.5 exec.::miden::core::math::u64::wrapping_add # [a + i64::MAX, .., is_same_sign, is_a_signed] + push.1.0 exec.::miden::core::math::u64::wrapping_add # [a + i64::MAX + 1, .., is_same_sign, is_a_signed] # is `result` signed? dup.0 push.SIGN_BIT u32and push.SIGN_BIT eq # [is_result_signed, result_hi, result_lo, is_same_sign, is_a_signed] @@ -120,13 +117,13 @@ end # Subtracts `b` from `a` # # This operation will fail if `b` is not a valid i64, or if `result` is not a valid i64 -export.wrapping_sub # [b_hi, b_lo, a_hi, a_lo] +pub proc wrapping_sub # [b_hi, b_lo, a_hi, a_lo] exec.overflowing_sub # [overflowed, result] drop end # Subtracts `b` from `a`, asserting on underflow/overflow -export.checked_sub # [b_hi, b_lo, a_hi, a_lo] +pub proc checked_sub # [b_hi, b_lo, a_hi, a_lo] exec.overflowing_sub # [overflowed, result] assertz # [result] end @@ -134,14 +131,14 @@ end # Multiplies `a` by `b`, asserting that both inputs are valid i64. # # Returns the result modulo 2^64, plus a boolean indicating whether or not the multiplication overflowed. -export.overflowing_mul # [b, a] +pub proc overflowing_mul # [b, a] u32assertw # is `b` i64::MIN? - dup.1 dup.1 push.MIN_LO.MIN_HI exec.::std::math::u64::eq # [is_b_MIN, b_hi, b_lo, a_hi, a_lo] + dup.1 dup.1 push.MIN_LO.MIN_HI exec.::miden::core::math::u64::eq # [is_b_MIN, b_hi, b_lo, a_hi, a_lo] # is `a` i64::MIN? - dup.4 dup.4 push.MIN_LO.MIN_HI exec.::std::math::u64::eq # [is_a_MIN, is_b_MIN, b_hi, b_lo, a_hi, a_lo] + dup.4 dup.4 push.MIN_LO.MIN_HI exec.::miden::core::math::u64::eq # [is_a_MIN, is_b_MIN, b_hi, b_lo, a_hi, a_lo] # are either `a` or `b` i64::MIN? or # [is_either_MIN, b_hi, b_lo, a_hi, a_lo] @@ -153,12 +150,12 @@ export.overflowing_mul # [b, a] # 3. For any other value, there is overflow, and the result is zero if.true # if either are 1, rule 1 applies - dup.1 dup.1 push.1.0 exec.::std::math::u64::eq # [is_b_1, b_hi, b_lo, a_hi, a_lo] - dup.4 dup.4 push.1.0 exec.::std::math::u64::eq # [is_a_1, is_b_1, b_hi, b_lo, a_hi, a_lo] + dup.1 dup.1 push.1.0 exec.::miden::core::math::u64::eq # [is_b_1, b_hi, b_lo, a_hi, a_lo] + dup.4 dup.4 push.1.0 exec.::miden::core::math::u64::eq # [is_a_1, is_b_1, b_hi, b_lo, a_hi, a_lo] or # [is_either_1, b_hi, b_lo, a_hi, a_lo] # either are -1, rule 2 applies - movup.4 movup.4 push.NEG1_LO.NEG1_HI exec.::std::math::u64::eq # [is_a_neg1, is_either_1, b_hi, b_lo] - movup.3 movup.3 push.NEG1_LO.NEG1_HI exec.::std::math::u64::eq # [is_b_neg1, is_a_neg1, is_either_1] + movup.4 movup.4 push.NEG1_LO.NEG1_HI exec.::miden::core::math::u64::eq # [is_a_neg1, is_either_1, b_hi, b_lo] + movup.3 movup.3 push.NEG1_LO.NEG1_HI exec.::miden::core::math::u64::eq # [is_b_neg1, is_a_neg1, is_either_1] or # [is_either_neg1, is_either_1] # choose between rule 1/2 or rule 3 result dup.1 or # [result_is_MIN, is_either_1] @@ -190,8 +187,8 @@ export.overflowing_mul # [b, a] dup.1 dup.1 exec.unchecked_neg # [-b_hi, -b_lo, b_hi, b_lo, -a or a hi, -a or a lo, is_b_signed, negate_result] movup.2 swap.1 dup.6 cdrop # [-b or b hi, -b_lo, b_lo, -a or a hi, -a or a lo, is_b_signed, negate_result] movdn.2 movup.5 cdrop swap.1 # [-b or b hi, -b or b lo, -a or a hi, -a or a lo, negate_result] - exec.::std::math::u64::overflowing_mul - exec.::std::math::u64::eqz # [overflowed, result_hi, result_lo, negate_result] + exec.::miden::core::math::u64::overflowing_mul + exec.::miden::core::math::u64::eqz # [overflowed, result_hi, result_lo, negate_result] # if the unsigned op overflowed, we definitely overflowed, but overflow # also occurred if the supposedly unsigned result has its sign bit set, @@ -205,19 +202,19 @@ export.overflowing_mul # [b, a] end # Multiplies `a` by `b`, wrapping on overflow. -export.wrapping_mul # [b_hi, b_lo, a_hi, a_lo] +pub proc wrapping_mul # [b_hi, b_lo, a_hi, a_lo] exec.overflowing_mul # [overflowed, result_hi, result_lo] drop end # Multiplies `a` by `b`, asserting on overflow -export.checked_mul # [b_hi, b_lo, a_hi, a_lo] +pub proc checked_mul # [b_hi, b_lo, a_hi, a_lo] exec.overflowing_mul # [overflowed, result_hi, result_lo] assertz # [result] end # Divides `a` by `b`, asserting that both inputs are valid i64 -export.checked_div # [b_hi, b_lo, a_hi, a_lo] +pub proc checked_div # [b_hi, b_lo, a_hi, a_lo] u32assertw # get positive dividend @@ -236,7 +233,7 @@ export.checked_div # [b_hi, b_lo, a_hi, a_lo] swap.2 cdrop swap.1 # [|b hi|, |b lo|, |a hi|, |a lo|, is_a_signed, is_b_signed] # divide - exec.::std::math::u64::div # [|a / b|, |a / b|, is_a_signed, is_b_signed] + exec.::miden::core::math::u64::div # [|a / b|, |a / b|, is_a_signed, is_b_signed] # if the signs differ, negate the result movdn.3 movdn.3 neq # [signs_differ, |a / b|, |a / b|] @@ -251,7 +248,7 @@ end # Given two i64 values in two's complement representation, compare them, # returning -1 if `a` < `b`, 0 if equal, and 1 if `a` > `b`. -export.icmp # [b_hi, b_lo, a_hi, a_lo] +pub proc icmp # [b_hi, b_lo, a_hi, a_lo] dup.2 # [a_hi, b_hi, b_lo, a_hi, a_lo] dup.1 # [b_hi, a_hi, b_hi, b_lo, a_hi, a_lo] @@ -276,9 +273,9 @@ export.icmp # [b_hi, b_lo, a_hi, a_lo] # which we get for free via the lt/gt ops drop # [b_hi, b_lo, a_hi, a_lo] dupw # [b_hi, b_lo, a_hi, a_lo, b_hi, b_lo, a_hi, a_lo] - exec.::std::math::u64::gt + exec.::miden::core::math::u64::gt movdn.4 # [b_hi, b_lo, a_hi, a_lo, a > b] - exec.::std::math::u64::lt # [a < b, a > b] + exec.::miden::core::math::u64::lt # [a < b, a > b] push.0 push.NEG1_LO push.1 swap.3 # [a < b, -1, 0, 1, a > b] cdrop # [-1 or 0, 1, a > b] @@ -288,33 +285,33 @@ export.icmp # [b_hi, b_lo, a_hi, a_lo] end # Given two i64 values in two's complement representation, return 1 if `a < b`, else 0 -export.lt # [b, a] +pub proc lt # [b, a] exec.icmp push.NEG1_LO eq end # Given two i64 values in two's complement representation, return 1 if `a <= b`, else 0 -export.lte # [b, a] +pub proc lte # [b, a] exec.icmp neq.1 end # Given two i64 values in two's complement representation, return 1 if `a > b`, else 0 -export.gt # [b, a] +pub proc gt # [b, a] exec.icmp eq.1 end # Given two i64 values in two's complement representation, return 1 if `a >= b`, else 0 -export.gte # [b, a] +pub proc gte # [b, a] exec.icmp push.NEG1_LO neq end # Compute 2^n, where `n` must be less than 63, or the result will overflow i64::MAX -export.pow2 # [n_hi, n_lo] +pub proc pow2 # [n_hi, n_lo] dup.0 push.63 u32lt # [n < 63, n] assert # [n] push.1.0 movup.2 push.0 # [0, n, 0, 1] - exec.::std::math::u64::shl # [1 << n hi, 1 << n lo] + exec.::miden::core::math::u64::shl # [1 << n hi, 1 << n lo] end # Arithmetic shift-right, i.e. `a >> b` preserves the signedness of the value @@ -322,7 +319,7 @@ end # This function will assert if `b` is > 63. # # This implementation is checked, so it will assert if the inputs are invalid -export.checked_shr # [b, a_hi, a_lo] +pub proc checked_shr # [b, a_hi, a_lo] # validate the shift is valid dup.0 push.64 u32lt # [b < 64, b, a_hi, a_lo] @@ -333,7 +330,7 @@ export.checked_shr # [b, a_hi, a_lo] dup.0 eq.0 # [b == 0, b, a_hi, a_lo] dup.3 dup.3 # [a_hi, a_lo, b == 0, b] u32assert2 - exec.::std::math::u64::eqz # [a == 0, b == 0, b, a_hi, a_lo] + exec.::miden::core::math::u64::eqz # [a == 0, b == 0, b, a_hi, a_lo] or # [a == 0 || b == 0, b, a_hi, a_lo] if.true # return `a` if `b == 0`, otherwise `a == 0` so return 0 @@ -355,22 +352,22 @@ export.checked_shr # [b, a_hi, a_lo] if.true # [b, a_hi, a_lo] movdn.2 # [a_hi, a_lo, b] dup.2 # [b, a_hi, a_lo, b] - exec.::std::math::u64::shr # [shifted_hi, shifted_lo, b] + exec.::miden::core::math::u64::shr # [shifted_hi, shifted_lo, b] # compute the extension mask push.1.0 dup.4 # [b, 1u64, 1u64, shifted_hi, shifted_lo, b] - exec.::std::math::u64::shl + exec.::miden::core::math::u64::shl push.1.0 - exec.::std::math::u64::wrapping_sub # [(1 << b) - 1, .., shifted_hi, shifted_lo, b] + exec.::miden::core::math::u64::wrapping_sub # [(1 << b) - 1, .., shifted_hi, shifted_lo, b] # shift the mask into place push.64 movup.5 # [b, 64, mask_hi, mask_lo, shifted_hi, shifted_lo] sub # [64 - b, mask_hi, mask_lo, shifted_hi, shifted_lo] - exec.::std::math::u64::shl # [mask << (64 - b), .., shifted_hi, shifted_lo] - exec.::std::math::u64::or # [shifted | mask, ..] + exec.::miden::core::math::u64::shl # [mask << (64 - b), .., shifted_hi, shifted_lo] + exec.::miden::core::math::u64::or # [shifted | mask, ..] u32assert2 else - exec.::std::math::u64::shr # [shifted_hi, shifted_lo] + exec.::miden::core::math::u64::shr # [shifted_hi, shifted_lo] u32assert2 end end diff --git a/codegen/masm/intrinsics/mem.masm b/codegen/masm/intrinsics/mem.masm index a50c8bb33..01328db3a 100644 --- a/codegen/masm/intrinsics/mem.masm +++ b/codegen/masm/intrinsics/mem.masm @@ -1,37 +1,42 @@ # The location where we store information about the dynamic heap -const.HEAP_INFO_ADDR=0x80000000 # 2^31 (address in elements) +# +# NOTE: This must not overlap with the reserved address space for procedure locals, which begins +# at 2^31 (see `miden_core::FMP_INIT_VALUE`). Additionally, we place this above the maximum +# addressable Wasm linear memory range (in element-addressable space) so that Wasm code cannot +# reach it via byte pointers. +const HEAP_INFO_ADDR=0x40000000 # 2^30 (address in elements) # The location of the heap_top value -const.HEAP_INFO_TOP=HEAP_INFO_ADDR +const HEAP_INFO_TOP=HEAP_INFO_ADDR # The location of the heap_size value -const.HEAP_INFO_SIZE=HEAP_INFO_ADDR + 1 +const HEAP_INFO_SIZE=HEAP_INFO_ADDR + 1 # The location of the heap_base value -const.HEAP_INFO_BASE=HEAP_INFO_ADDR + 2 +const HEAP_INFO_BASE=HEAP_INFO_ADDR + 2 # The location of the MAGIC value -const.HEAP_INFO_MAGIC=HEAP_INFO_ADDR + 3 +const HEAP_INFO_MAGIC=HEAP_INFO_ADDR + 3 # The address beyond which the dynamic heap cannot be allowed to grow -const.HEAP_END=0x10000000 # 2^30 * 4 (i.e. byte address, not element address) +const HEAP_END=((HEAP_INFO_ADDR - 1) * 4) # (2^30 - 1) * 4 (i.e. byte address, not element address) # The assertion error code used when intrinsics are used without calling heap_init -const.HEAP_ERR="rust heap has not been initialized" +const HEAP_ERR="rust heap has not been initialized" # u32::MAX | -1i32 -const.NEG1=4294967295 +const NEG1=4294967295 # The magic bytes used to verify that the heap was properly initialized -const.MAGIC=0xDEADBEEF +const MAGIC=0xDEADBEEF # The size in bytes of each page of memory -const.PAGE_SIZE=65536 +const PAGE_SIZE=65536 # Checks the HEAP_INFO magic to ensure heap initialization has taken place # # This consumes the input element. -proc.verify_heap_magic +proc verify_heap_magic mem_load.HEAP_INFO_MAGIC push.MAGIC assert_eq.err=HEAP_ERR @@ -40,7 +45,7 @@ end # Intrinsic used to initialize the heap globals manipulated by memory intrinsics # # This must be called before any other heap intrinsics are called. This is checked by each intrinsic -export.heap_init # [heap_base] +pub proc heap_init # [heap_base] dup.0 # [heap_base, heap_base] push.0 # [0, heap_base, heap_base] swap.1 # [heap_base, 0, heap_base] @@ -50,30 +55,30 @@ export.heap_init # [heap_base] end # Get the (byte) address where the base of the heap starts -export.heap_base +pub proc heap_base exec.verify_heap_magic mem_load.HEAP_INFO_BASE end # Get the (byte) address of the top of the heap -export.heap_top_unchecked +pub proc heap_top_unchecked mem_load.HEAP_INFO_TOP end # Get the (byte) address of the top of the heap -export.heap_top +pub proc heap_top exec.verify_heap_magic mem_load.HEAP_INFO_TOP end # Intrinsic corresponding to the `memory_size` instruction -export.memory_size +pub proc memory_size exec.verify_heap_magic mem_load.HEAP_INFO_SIZE end # Intrinsic corresponding to the `memory_grow` instruction -export.memory_grow # [num_pages] +pub proc memory_grow # [num_pages] exec.verify_heap_magic mem_load.HEAP_INFO_SIZE # [heap_size, num_pages] dup.0 # [heap_size, heap_size, num_pages] @@ -113,7 +118,7 @@ end # word other than the at the specified index. # # The element index must be in the range 0..=3. -export.extract_element # [element_index, w3, w2, w1, w0] +pub proc extract_element # [element_index, w3, w2, w1, w0] # assert the index given is valid dup.0 push.3 lte assert # compute a set of three booleans which used in conjunction with cdrop will @@ -135,13 +140,13 @@ export.extract_element # [element_index, w3, w2, w1, w0] movup.2 cdrop end -# Load a field element from the given native pointer triplet. +# Load a field element from the given native pointer tuple. # # A native pointer tuple consists of an element address where the data begins, and a byte offset, # which is the offset of the first byte, in the 32-bit representation of that element. # # A field element must be naturally aligned, i.e. it's byte offset must be zero. -export.load_felt # [addr, offset] +pub proc load_felt # [addr, offset] # assert the pointer is felt-aligned, then load swap.1 assertz mem_load end @@ -150,7 +155,7 @@ end # # A native pointer tuple consists of an element address where the data begins, and a byte offset, # which is the offset of the first byte, in the 32-bit representation of that element. -export.load_sw # [addr, offset] +pub proc load_sw # [addr, offset] # check for alignment and offset validity dup.1 eq.0 # [offset == 0, addr, offset] # offset must be < 4 @@ -231,7 +236,7 @@ end # representing any unaligned double-word value # # Stack transition is [chunk_hi, chunk_mid, chunk_lo, offset] -> [shifted_lo, shifted_hi] -export.realign_dw +pub proc realign_dw # We will refer to the parts of our desired double-word value # as two parts, `x_hi` and `x_lo`. # Re-align the high bits by shifting out the offset @@ -290,7 +295,7 @@ end # Shift two 32-bit words by the given offset. # # Returns three 32-bit chunks [chunk_lo, chunk_mid, chunk_hi] -export.offset_dw # [value_hi, value_lo, offset] +pub proc offset_dw # [value_hi, value_lo, offset] dup.0 dup.3 u32shl # [chunk_hi, value_hi, value_lo, offset] @@ -308,7 +313,7 @@ export.offset_dw # [value_hi, value_lo, offset] end # Load two 32-bit words to the operand stack -export.load_dw # [addr, offset] +pub proc load_dw # [addr, offset] # check for alignment and offset validity dup.1 eq.0 # [offset == 0, addr, offset] # offset must be < 4 @@ -325,7 +330,7 @@ export.load_dw # [addr, offset] else # unaligned; an unaligned double-word spans three elements # - # convert offset from bytes to bitcount from RHS of triplet (32 - offset * 8) + # convert offset from bytes to bitcount from RHS of tuple (32 - offset * 8) swap.1 push.8 mul push.32 swap.1 sub swap.1 # [addr, bit_offset] # load the three elements containing the double-word on the stack and re-align @@ -340,7 +345,7 @@ end # specified index, leaving the modified word on top of the stack # # The element index must be in the range 0..=3. -export.replace_element # [element_index, value, w3, w2, w1, w0] +pub proc replace_element # [element_index, value, w3, w2, w1, w0] # assert the index given is valid dup.0 push.3 lte assert # compute a set of three booleans which used in conjunction with cdrop will @@ -365,7 +370,7 @@ end # which is the offset of the first byte, in the 32-bit representation of that element. # # A field element must be naturally aligned, i.e. it's byte offset must be zero. -export.store_felt # [addr, offset, value] +pub proc store_felt # [addr, offset, value] # assert the pointer is felt-aligned, then load swap.1 assertz mem_store end @@ -374,7 +379,7 @@ end # # A native pointer tuple consists of an element address where the data begins, and a byte offset, # which is the offset of the first byte, in the 32-bit representation of that element. -export.store_sw # [addr, offset, value] +pub proc store_sw # [addr, offset, value] # check for alignment and offset validity dup.1 eq.0 # [offset == 0, addr, offset, value] # offset must be < 4 @@ -435,7 +440,7 @@ end # # A native pointer tuple consists of an element address where the data begins, and a byte offset, # which is the offset of the first byte, in the 32-bit representation of that element. -export.store_dw # [addr, offset, value_hi, value_lo] +pub proc store_dw # [addr, offset, value_hi, value_lo] # check for alignment and offset validity dup.1 eq.0 # [offset == 0, addr, offset] # offset must be < 4 @@ -494,7 +499,7 @@ end # # * `dst` is expected to be an address in byte-addressable space, _not_ an element address. # * `value` must be a 32-bit value or smaller -export.memset_sw # [size, dst, count, value] +pub proc memset_sw # [size, dst, count, value] # prepare to loop until `count` iterations have been performed push.0 # [i, dst, size, count, value] dup.3 # [count, i, dst, size, count, value] @@ -534,7 +539,7 @@ end # # * `dst` is expected to be an address in byte-addressable space, _not_ an element address. # * `value` must be a two 32-bit words. -export.memset_dw # [size, dst, count, value_hi, value_lo] +pub proc memset_dw # [size, dst, count, value_hi, value_lo] # prepare to loop until `count` iterations have been performed push.0 # [i, dst, size, count, value_hi, value_lo] dup.3 # [count, i, dst, size, count, value_hi, value_lo] diff --git a/codegen/masm/src/artifact.rs b/codegen/masm/src/artifact.rs index 1ba70a649..bc703dc99 100644 --- a/codegen/masm/src/artifact.rs +++ b/codegen/masm/src/artifact.rs @@ -4,13 +4,17 @@ use alloc::{ }; use core::fmt; -use miden_assembly::{Library, ast::InvocationTarget, library::LibraryExport}; +use miden_assembly::{ + Library, Path, PathBuf, + ast::InvocationTarget, + library::{LibraryExport, ProcedureExport}, +}; use miden_core::{Program, Word}; -use miden_mast_package::{MastArtifact, Package, ProcedureName}; +use miden_mast_package::{MastArtifact, Package}; use midenc_hir::{constants::ConstantData, dialects::builtin, interner::Symbol}; use midenc_session::{ - Session, - diagnostics::{Report, SourceSpan, Span}, + Emit, OutputMode, OutputType, Session, Writer, + diagnostics::{IntoDiagnostic, Report, SourceSpan, Span, WrapErr}, }; use crate::{TraceEvent, lower::NativePtr, masm}; @@ -38,6 +42,29 @@ pub struct MasmComponent { pub modules: Vec>, } +impl Emit for MasmComponent { + fn name(&self) -> Option { + None + } + + fn output_type(&self, _mode: OutputMode) -> OutputType { + OutputType::Masm + } + + fn write_to( + &self, + mut writer: W, + mode: OutputMode, + _session: &Session, + ) -> anyhow::Result<()> { + if mode != OutputMode::Text { + anyhow::bail!("masm emission does not support binary mode"); + } + writer.write_fmt(core::format_args!("{self}"))?; + Ok(()) + } +} + /// Represents a read-only data segment, combined with its content digest #[derive(Clone, PartialEq, Eq)] pub struct Rodata { @@ -126,15 +153,19 @@ impl fmt::Display for MasmComponent { use crate::intrinsics::INTRINSICS_MODULE_NAMES; for module in self.modules.iter() { - // Skip printing the standard library modules and intrinsics - // modules to focus on the user-defined modules and avoid the + // Skip printing the standard library modules and intrinsics modules to focus on the + // user-defined modules and avoid the // stack overflow error when printing large programs // https://github.com/0xMiden/miden-formatting/issues/4 - let module_name = module.path().path(); - if INTRINSICS_MODULE_NAMES.contains(&module_name.as_ref()) { + let module_name = module.path().as_str(); + let module_name_trimmed = module_name.trim_start_matches("::"); + if INTRINSICS_MODULE_NAMES.contains(&module_name) { continue; } - if ["std"].contains(&module.namespace().as_str()) { + if module.is_in_namespace(Path::new("std")) + || module_name_trimmed.starts_with("miden::core") + || module_name_trimmed.starts_with("miden::protocol") + { continue; } else { writeln!(f, "# mod {}\n", &module_name)?; @@ -170,21 +201,18 @@ impl MasmComponent { ) -> Result, Report> { use miden_assembly::Assembler; - let debug_mode = session.options.emit_debug_decorators(); - log::debug!( target: "assembly", - "assembling executable with entrypoint '{entrypoint}' (debug_mode={debug_mode})" + "assembling executable with entrypoint '{entrypoint}'" ); - let mut assembler = - Assembler::new(session.source_manager.clone()).with_debug_mode(debug_mode); + let mut assembler = Assembler::new(session.source_manager.clone()); - let mut lib_modules = BTreeSet::default(); + let mut lib_modules = BTreeSet::::default(); // Link extra libraries for library in link_libraries.iter().cloned() { for module in library.module_infos() { log::debug!(target: "assembly", "registering '{}' with assembler", module.path()); - lib_modules.insert(module.path().clone()); + lib_modules.insert(module.path().to_path_buf()); } assembler.link_dynamic_library(library)?; } @@ -205,7 +233,7 @@ impl MasmComponent { continue; } - if module.path().to_string().starts_with("intrinsics") { + if module.path().as_str().trim_start_matches("::").starts_with("intrinsics") { log::debug!(target: "assembly", "adding intrinsics '{}' to assembler", module.path()); assembler.compile_and_statically_link(module)?; } else { @@ -221,7 +249,8 @@ impl MasmComponent { } let emit_test_harness = session.get_flag("test_harness"); - let main = self.generate_main(entrypoint, emit_test_harness)?; + let main = + self.generate_main(entrypoint, emit_test_harness, session.source_manager.clone())?; log::debug!(target: "assembly", "generated executable module:\n{main}"); let program = assembler.assemble_program(main)?; let advice_map: miden_core::AdviceMap = @@ -237,23 +266,20 @@ impl MasmComponent { ) -> Result, Report> { use miden_assembly::Assembler; - let debug_mode = session.options.emit_debug_decorators(); log::debug!( target: "assembly", - "assembling library of {} modules (debug_mode={})", - self.modules.len(), - debug_mode + "assembling library of {} modules", + self.modules.len() ); - let mut assembler = - Assembler::new(session.source_manager.clone()).with_debug_mode(debug_mode); + let mut assembler = Assembler::new(session.source_manager.clone()); - let mut lib_modules = Vec::new(); + let mut lib_modules = BTreeSet::::default(); // Link extra libraries for library in link_libraries.iter().cloned() { for module in library.module_infos() { log::debug!(target: "assembly", "registering '{}' with assembler", module.path()); - lib_modules.push(module.path().clone()); + lib_modules.insert(module.path().to_path_buf()); } assembler.link_dynamic_library(library)?; } @@ -272,7 +298,7 @@ impl MasmComponent { ); continue; } - if module.path().to_string().starts_with("intrinsics") { + if module.path().as_str().trim_start_matches("::").starts_with("intrinsics") { log::debug!(target: "assembly", "adding intrinsics '{}' to assembler", module.path()); assembler.compile_and_statically_link(module)?; } else { @@ -307,6 +333,7 @@ impl MasmComponent { &self, entrypoint: &InvocationTarget, emit_test_harness: bool, + source_manager: Arc, ) -> Result, Report> { use masm::{Instruction as Inst, Op}; @@ -334,12 +361,11 @@ impl MasmComponent { .push(Op::Inst(Span::new(span, Inst::Trace(TraceEvent::FrameEnd.as_u32().into())))); // Truncate the stack to 16 elements on exit - let truncate_stack = InvocationTarget::AbsoluteProcedurePath { - name: ProcedureName::new("truncate_stack").unwrap(), - path: masm::LibraryPath::new_from_components( - masm::LibraryNamespace::new("std").unwrap(), - [masm::Ident::new("sys").unwrap()], - ), + let truncate_stack = { + let name = masm::ProcedureName::new("truncate_stack").unwrap(); + let module = masm::LibraryPath::new("::miden::core::sys").unwrap(); + let qualified = masm::QualifiedProcedureName::new(module.as_path(), name); + InvocationTarget::Path(Span::new(span, qualified.into_inner())) }; block.push(Op::Inst(Span::new(span, Inst::Exec(truncate_stack)))); block @@ -351,7 +377,9 @@ impl MasmComponent { 0, body, ); - exe.define_procedure(masm::Export::Procedure(start))?; + exe.define_procedure(start, source_manager) + .into_diagnostic() + .wrap_err("failed to define executable `main` procedure")?; Ok(Arc::from(exe)) } @@ -361,8 +389,12 @@ impl MasmComponent { let span = SourceSpan::default(); - let pipe_words_to_memory = masm::ProcedureName::new("pipe_words_to_memory").unwrap(); - let std_mem = masm::LibraryPath::new("std::mem").unwrap(); + let pipe_words_to_memory = { + let name = masm::ProcedureName::new("pipe_words_to_memory").unwrap(); + let module = masm::LibraryPath::new("::miden::core::mem").unwrap(); + let qualified = masm::QualifiedProcedureName::new(module.as_path(), name); + InvocationTarget::Path(Span::new(span, qualified.into_inner())) + }; // Step 1: Get the number of initializers to run // => [inits] on operand stack @@ -391,13 +423,7 @@ impl MasmComponent { // => [C, B, A, dest_ptr, inits'] on operand stack loop_body .push(Op::Inst(Span::new(span, Inst::Trace(TraceEvent::FrameStart.as_u32().into())))); - loop_body.push(Op::Inst(Span::new( - span, - Inst::Exec(InvocationTarget::AbsoluteProcedurePath { - name: pipe_words_to_memory, - path: std_mem, - }), - ))); + loop_body.push(Op::Inst(Span::new(span, Inst::Exec(pipe_words_to_memory)))); loop_body .push(Op::Inst(Span::new(span, Inst::Trace(TraceEvent::FrameEnd.as_u32().into())))); // Drop C, B, A @@ -436,48 +462,61 @@ impl MasmComponent { /// /// 2. Assembler using the current module name to generate exports. /// -fn recover_wasm_cm_interfaces( - lib: &Library, -) -> BTreeMap { +fn recover_wasm_cm_interfaces(lib: &Library) -> BTreeMap, LibraryExport> { use crate::intrinsics::INTRINSICS_MODULE_NAMES; let mut exports = BTreeMap::new(); for export in lib.exports() { - if INTRINSICS_MODULE_NAMES.contains(&export.name.module.to_string().as_str()) - || export.name.name.as_str().starts_with("cabi") - { + let path = export.path(); + let Some(proc_export) = export.as_procedure() else { + exports.insert(path, export.clone()); + continue; + }; + + let Some(module) = proc_export.path.parent() else { + exports.insert(path, export.clone()); + continue; + }; + let Some(proc_name) = proc_export.path.last() else { + exports.insert(path, export.clone()); + continue; + }; + + if INTRINSICS_MODULE_NAMES.contains(&module.as_str()) || proc_name.starts_with("cabi") { // Preserve intrinsics modules and internal Wasm CM `cabi_*` functions - exports.insert(export.name.clone(), export.clone()); + exports.insert(path, export.clone()); continue; } - if let Some((component, interface)) = export.name.name.as_str().rsplit_once('/') { - let export_node_id = lib.get_export_node_id(&export.name); - + if let Some((component, interface)) = proc_name.rsplit_once('/') { // Wasm CM interface let (interface, function) = interface.rsplit_once('#').expect("invalid wasm component model identifier"); - let mut component_parts = component.split(':').map(Arc::from); - let ns = masm::LibraryNamespace::User( - component_parts.next().expect("invalid wasm component model identifier"), - ); - let component_parts = component_parts - .map(Span::unknown) - .map(masm::Ident::from_raw_parts) - .chain([masm::Ident::from_raw_parts(Span::unknown(Arc::from(interface)))]); - let path = masm::LibraryPath::new_from_components(ns, component_parts); + // Derive a new module path in which the Wasm CM interface name is encoded as part of + // the module path, rather than being encoded in the procedure name. + let mut module_path = component.to_string(); + module_path.push_str("::"); + module_path.push_str(interface); + let module_path = masm::LibraryPath::new(&module_path) + .expect("invalid wasm component model identifier"); + let name = masm::ProcedureName::from_raw_parts(masm::Ident::from_raw_parts( Span::unknown(Arc::from(function)), )); - let new_export = masm::QualifiedProcedureName::new(path, name); + let qualified = masm::QualifiedProcedureName::new(module_path.as_path(), name); + let qualified = qualified.into_inner(); - let new_lib_export = LibraryExport::new(export_node_id, new_export.clone()); + let mut new_export = ProcedureExport::new(proc_export.node, qualified.clone()) + .with_attributes(proc_export.attributes.clone()); + if let Some(signature) = proc_export.signature.clone() { + new_export = new_export.with_signature(signature); + } - exports.insert(new_export, new_lib_export.clone()); + exports.insert(qualified, LibraryExport::Procedure(new_export)); } else { // Non-Wasm CM interface, preserve as is - exports.insert(export.name.clone(), export.clone()); + exports.insert(path, export.clone()); } } exports diff --git a/codegen/masm/src/emit/binary.rs b/codegen/masm/src/emit/binary.rs index e8f8e6702..3f305d642 100644 --- a/codegen/masm/src/emit/binary.rs +++ b/codegen/masm/src/emit/binary.rs @@ -136,7 +136,7 @@ impl OpEmitter<'_> { Type::U32 | Type::U16 | Type::U8 | Type::I1 => { self.emit(masm::Instruction::U32Gt, span); } - Type::I32 => self.raw_exec("intrinsics::i32::is_gt", span), + Type::I32 => self.raw_exec("::intrinsics::i32::is_gt", span), ty => unimplemented!("gt is not yet implemented for {ty}"), } self.push(Type::I1); @@ -166,7 +166,7 @@ impl OpEmitter<'_> { } Type::I32 => { self.push_immediate(imm, span); - self.raw_exec("intrinsics::i32::is_gt", span); + self.raw_exec("::intrinsics::i32::is_gt", span); } ty => unimplemented!("gt is not yet implemented for {ty}"), } @@ -191,7 +191,7 @@ impl OpEmitter<'_> { Type::U32 | Type::U16 | Type::U8 | Type::I1 => { self.emit(masm::Instruction::U32Gte, span); } - Type::I32 => self.raw_exec("intrinsics::i32::is_gte", span), + Type::I32 => self.raw_exec("::intrinsics::i32::is_gte", span), ty => unimplemented!("gte is not yet implemented for {ty}"), } self.push(Type::I1); @@ -221,7 +221,7 @@ impl OpEmitter<'_> { } Type::I32 => { self.push_immediate(imm, span); - self.raw_exec("intrinsics::i32::is_gte", span); + self.raw_exec("::intrinsics::i32::is_gte", span); } ty => unimplemented!("gte is not yet implemented for {ty}"), } @@ -246,7 +246,7 @@ impl OpEmitter<'_> { Type::U32 | Type::U16 | Type::U8 | Type::I1 => { self.emit(masm::Instruction::U32Lt, span); } - Type::I32 => self.raw_exec("intrinsics::i32::is_lt", span), + Type::I32 => self.raw_exec("::intrinsics::i32::is_lt", span), ty => unimplemented!("lt is not yet implemented for {ty}"), } self.push(Type::I1); @@ -276,7 +276,7 @@ impl OpEmitter<'_> { } Type::I32 => { self.push_immediate(imm, span); - self.raw_exec("intrinsics::i32::is_lt", span); + self.raw_exec("::intrinsics::i32::is_lt", span); } ty => unimplemented!("lt is not yet implemented for {ty}"), } @@ -301,7 +301,7 @@ impl OpEmitter<'_> { Type::U32 | Type::U16 | Type::U8 | Type::I1 => { self.emit(masm::Instruction::U32Lte, span); } - Type::I32 => self.raw_exec("intrinsics::i32::is_lte", span), + Type::I32 => self.raw_exec("::intrinsics::i32::is_lte", span), ty => unimplemented!("lte is not yet implemented for {ty}"), } self.push(Type::I1); @@ -331,7 +331,7 @@ impl OpEmitter<'_> { } Type::I32 => { self.push_immediate(imm, span); - self.raw_exec("intrinsics::i32::is_lte", span); + self.raw_exec("::intrinsics::i32::is_lte", span); } ty => unimplemented!("lte is not yet implemented for {ty}"), } @@ -837,7 +837,7 @@ impl OpEmitter<'_> { self.emit_all([masm::Instruction::Exp, masm::Instruction::U32Assert], span); } Type::I32 => { - self.raw_exec("intrinsics::i32::ipow", span); + self.raw_exec("::intrinsics::i32::ipow", span); } ty @ (Type::U16 | Type::U8) => { self.emit_all([masm::Instruction::Exp, masm::Instruction::U32Assert], span); @@ -874,7 +874,7 @@ impl OpEmitter<'_> { } Type::I32 => { self.emit_push(exp, span); - self.raw_exec("intrinsics::i32::ipow", span); + self.raw_exec("::intrinsics::i32::ipow", span); } ty @ (Type::U16 | Type::U8) => { self.emit_all( diff --git a/codegen/masm/src/emit/int128.rs b/codegen/masm/src/emit/int128.rs index e9fb267fd..b631d3685 100644 --- a/codegen/masm/src/emit/int128.rs +++ b/codegen/masm/src/emit/int128.rs @@ -235,7 +235,7 @@ impl OpEmitter<'_> { "Only 128bit *wrapping* adds implemented as yet." ); - self.raw_exec("intrinsics::i128::add", span); + self.raw_exec("::intrinsics::i128::add", span); } /// Pops two i128 values off the stack, `b` and `a`, and performs `a - b`. @@ -245,12 +245,12 @@ impl OpEmitter<'_> { "Only 128bit *wrapping* subs implemented as yet." ); - self.raw_exec("intrinsics::i128::sub", span); + self.raw_exec("::intrinsics::i128::sub", span); } /// Pops two i128 values off the stack, `b` and `a`, and performs `a * b`. #[inline] pub fn mul_i128(&mut self, span: SourceSpan) { - self.raw_exec("intrinsics::i128::mul", span); + self.raw_exec("::intrinsics::i128::mul", span); } } diff --git a/codegen/masm/src/emit/int32.rs b/codegen/masm/src/emit/int32.rs index 84de430ca..adb6db65b 100644 --- a/codegen/masm/src/emit/int32.rs +++ b/codegen/masm/src/emit/int32.rs @@ -447,8 +447,8 @@ impl OpEmitter<'_> { Overflow::Unchecked | Overflow::Wrapping => { self.emit(masm::Instruction::U32WrappingAdd, span) } - Overflow::Checked => self.raw_exec("intrinsics::i32::checked_add", span), - Overflow::Overflowing => self.raw_exec("intrinsics::i32::overflowing_add", span), + Overflow::Checked => self.raw_exec("::intrinsics::i32::checked_add", span), + Overflow::Overflowing => self.raw_exec("::intrinsics::i32::overflowing_add", span), } } @@ -498,11 +498,11 @@ impl OpEmitter<'_> { } Overflow::Checked => { self.emit_push(imm as u32, span); - self.raw_exec("intrinsics::i32::checked_add", span); + self.raw_exec("::intrinsics::i32::checked_add", span); } Overflow::Overflowing => { self.emit_push(imm as u32, span); - self.raw_exec("intrinsics::i32::overflowing_add", span); + self.raw_exec("::intrinsics::i32::overflowing_add", span); } } } @@ -531,8 +531,8 @@ impl OpEmitter<'_> { pub fn sub_i32(&mut self, overflow: Overflow, span: SourceSpan) { match overflow { Overflow::Unchecked | Overflow::Wrapping => self.sub_u32(overflow, span), - Overflow::Checked => self.raw_exec("intrinsics::i32::checked_sub", span), - Overflow::Overflowing => self.raw_exec("intrinsics::i32::overflowing_sub", span), + Overflow::Checked => self.raw_exec("::intrinsics::i32::checked_sub", span), + Overflow::Overflowing => self.raw_exec("::intrinsics::i32::overflowing_sub", span), } } @@ -581,11 +581,11 @@ impl OpEmitter<'_> { } Overflow::Checked => { self.emit_push(imm as u32, span); - self.raw_exec("intrinsics::i32::checked_sub", span); + self.raw_exec("::intrinsics::i32::checked_sub", span); } Overflow::Overflowing => { self.emit_push(imm as u32, span); - self.raw_exec("intrinsics::i32::overflowing_sub", span); + self.raw_exec("::intrinsics::i32::overflowing_sub", span); } } } @@ -614,10 +614,10 @@ impl OpEmitter<'_> { pub fn mul_i32(&mut self, overflow: Overflow, span: SourceSpan) { match overflow { Overflow::Unchecked | Overflow::Wrapping => { - self.raw_exec("intrinsics::i32::wrapping_mul", span) + self.raw_exec("::intrinsics::i32::wrapping_mul", span) } - Overflow::Checked => self.raw_exec("intrinsics::i32::checked_mul", span), - Overflow::Overflowing => self.raw_exec("intrinsics::i32::overflowing_mul", span), + Overflow::Checked => self.raw_exec("::intrinsics::i32::checked_mul", span), + Overflow::Overflowing => self.raw_exec("::intrinsics::i32::overflowing_mul", span), } } @@ -682,15 +682,15 @@ impl OpEmitter<'_> { imm => match overflow { Overflow::Unchecked | Overflow::Wrapping => { self.emit_push(imm as u32, span); - self.raw_exec("intrinsics::i32::wrapping_mul", span); + self.raw_exec("::intrinsics::i32::wrapping_mul", span); } Overflow::Checked => { self.emit_push(imm as u32, span); - self.raw_exec("intrinsics::i32::checked_mul", span) + self.raw_exec("::intrinsics::i32::checked_mul", span) } Overflow::Overflowing => { self.emit_push(imm as u32, span); - self.raw_exec("intrinsics::i32::overflowing_mul", span); + self.raw_exec("::intrinsics::i32::overflowing_mul", span); } }, } @@ -707,7 +707,7 @@ impl OpEmitter<'_> { /// /// This operation is checked, so if the operands or result are not valid i32, execution traps. pub fn checked_div_i32(&mut self, span: SourceSpan) { - self.raw_exec("intrinsics::i32::checked_div", span); + self.raw_exec("::intrinsics::i32::checked_div", span); } /// Pops a u32 value off the stack, `a`, and performs `a / `. @@ -731,7 +731,7 @@ impl OpEmitter<'_> { pub fn checked_div_imm_i32(&mut self, imm: i32, span: SourceSpan) { assert_ne!(imm, 0, "division by zero is not allowed"); self.emit_push(imm as u32, span); - self.raw_exec("intrinsics::i32::checked_div", span); + self.raw_exec("::intrinsics::i32::checked_div", span); } /// Pops two u32 values off the stack, `b` and `a`, and performs `a / b`. @@ -903,7 +903,7 @@ impl OpEmitter<'_> { /// /// This operation is checked, if the operands or result are not valid i32, execution traps. pub fn shr_i32(&mut self, span: SourceSpan) { - self.raw_exec("intrinsics::i32::checked_shr", span); + self.raw_exec("::intrinsics::i32::checked_shr", span); } /// Pops a u32 value off the stack, `a`, and performs `a >> ` @@ -920,7 +920,7 @@ impl OpEmitter<'_> { pub fn shr_imm_i32(&mut self, imm: u32, span: SourceSpan) { assert!(imm < 32, "invalid shift value: must be < 32, got {imm}"); self.emit_push(imm, span); - self.raw_exec("intrinsics::i32::checked_shr", span); + self.raw_exec("::intrinsics::i32::checked_shr", span); } /// Pops two u32 values off the stack, `b` and `a`, and rotates the bits of `a` left by `b` bits @@ -971,7 +971,7 @@ impl OpEmitter<'_> { /// /// This operation is checked, if the operands or result are not valid i32, execution traps. pub fn min_i32(&mut self, span: SourceSpan) { - self.raw_exec("intrinsics::i32::min", span); + self.raw_exec("::intrinsics::i32::min", span); } /// Pops a u32 value off the stack, `a`, and puts the result of `min(a, imm)` on the stack @@ -987,7 +987,7 @@ impl OpEmitter<'_> { /// This operation is checked, if the operand or result are not valid i32, execution traps. pub fn min_imm_i32(&mut self, imm: i32, span: SourceSpan) { self.emit_push(imm as u32, span); - self.raw_exec("intrinsics::i32::min", span); + self.raw_exec("::intrinsics::i32::min", span); } /// Pops two u32 values off the stack, `b` and `a`, and puts the result of `max(a, b)` on the @@ -1003,7 +1003,7 @@ impl OpEmitter<'_> { /// /// This operation is checked, if the operands or result are not valid i32, execution traps. pub fn max_i32(&mut self, span: SourceSpan) { - self.raw_exec("intrinsics::i32::max", span); + self.raw_exec("::intrinsics::i32::max", span); } /// Pops a u32 value off the stack, `a`, and puts the result of `max(a, imm)` on the stack @@ -1019,6 +1019,6 @@ impl OpEmitter<'_> { /// This operation is checked, if the operand or result are not valid i32, execution traps. pub fn max_imm_i32(&mut self, imm: i32, span: SourceSpan) { self.emit_push(imm as u32, span); - self.raw_exec("intrinsics::i32::max", span); + self.raw_exec("::intrinsics::i32::max", span); } } diff --git a/codegen/masm/src/emit/int64.rs b/codegen/masm/src/emit/int64.rs index 47972558b..a926ec504 100644 --- a/codegen/masm/src/emit/int64.rs +++ b/codegen/masm/src/emit/int64.rs @@ -256,7 +256,7 @@ impl OpEmitter<'_> { /// This operation is checked, so if the values are not valid u64, execution will trap. #[inline] pub fn lt_u64(&mut self, span: SourceSpan) { - self.raw_exec("std::math::u64::lt", span); + self.raw_exec("::miden::core::math::u64::lt", span); } /// Pops two i64 values off the stack, `b` and `a`, and pushes `a < b` on the stack. @@ -264,7 +264,7 @@ impl OpEmitter<'_> { /// This operation is checked, so if the values are not valid u64, execution will trap. #[inline] pub fn lt_i64(&mut self, span: SourceSpan) { - self.raw_exec("intrinsics::i64::lt", span); + self.raw_exec("::intrinsics::i64::lt", span); } /// Pops two u64 values off the stack, `b` and `a`, and pushes `a <= b` on the stack. @@ -272,7 +272,7 @@ impl OpEmitter<'_> { /// This operation is checked, so if the values are not valid u64, execution will trap. #[inline] pub fn lte_u64(&mut self, span: SourceSpan) { - self.raw_exec("std::math::u64::lte", span); + self.raw_exec("::miden::core::math::u64::lte", span); } /// Pops two i64 values off the stack, `b` and `a`, and pushes `a <= b` on the stack. @@ -280,7 +280,7 @@ impl OpEmitter<'_> { /// This operation is checked, so if the values are not valid u64, execution will trap. #[inline] pub fn lte_i64(&mut self, span: SourceSpan) { - self.raw_exec("intrinsics::i64::lte", span); + self.raw_exec("::intrinsics::i64::lte", span); } /// Pops two u64 values off the stack, `b` and `a`, and pushes `a > b` on the stack. @@ -288,7 +288,7 @@ impl OpEmitter<'_> { /// This operation is checked, so if the values are not valid u64, execution will trap. #[inline] pub fn gt_u64(&mut self, span: SourceSpan) { - self.raw_exec("std::math::u64::gt", span); + self.raw_exec("::miden::core::math::u64::gt", span); } /// Pops two i64 values off the stack, `b` and `a`, and pushes `a > b` on the stack. @@ -296,7 +296,7 @@ impl OpEmitter<'_> { /// This operation is checked, so if the values are not valid u64, execution will trap. #[inline] pub fn gt_i64(&mut self, span: SourceSpan) { - self.raw_exec("intrinsics::i64::gt", span); + self.raw_exec("::intrinsics::i64::gt", span); } /// Pops two u64 values off the stack, `b` and `a`, and pushes `a >= b` on the stack. @@ -304,7 +304,7 @@ impl OpEmitter<'_> { /// This operation is checked, so if the values are not valid u64, execution will trap. #[inline] pub fn gte_u64(&mut self, span: SourceSpan) { - self.raw_exec("std::math::u64::gte", span); + self.raw_exec("::miden::core::math::u64::gte", span); } /// Pops two i64 values off the stack, `b` and `a`, and pushes `a >= b` on the stack. @@ -312,7 +312,7 @@ impl OpEmitter<'_> { /// This operation is checked, so if the values are not valid u64, execution will trap. #[inline] pub fn gte_i64(&mut self, span: SourceSpan) { - self.raw_exec("intrinsics::i64::gte", span); + self.raw_exec("::intrinsics::i64::gte", span); } /// Pops two u64 values off the stack, `b` and `a`, and pushes `a == b` on the stack. @@ -320,7 +320,7 @@ impl OpEmitter<'_> { /// This operation is checked, so if the values are not valid u64, execution will trap. #[inline] pub fn eq_int64(&mut self, span: SourceSpan) { - self.raw_exec("std::math::u64::eq", span); + self.raw_exec("::miden::core::math::u64::eq", span); } /// Pops a u64 value off the stack, `a`, and pushes `a == 0` on the stack. @@ -328,7 +328,7 @@ impl OpEmitter<'_> { /// This operation is checked, so if the value is not a valid u64, execution will trap. #[inline] pub fn is_zero_int64(&mut self, span: SourceSpan) { - self.raw_exec("std::math::u64::eqz", span); + self.raw_exec("::miden::core::math::u64::eqz", span); } /// Pops two u64 values off the stack, `b` and `a`, and pushes `min(a, b)` on the stack. @@ -336,19 +336,19 @@ impl OpEmitter<'_> { /// This operation is checked, so if the values are not valid u64, execution will trap. #[inline] pub fn min_u64(&mut self, span: SourceSpan) { - self.raw_exec("std::math::u64::min", span); + self.raw_exec("::miden::core::math::u64::min", span); } /// Pops two i64 values off the stack, `b` and `a`, and pushes `min(a, b)` on the stack. /// /// This operation is checked, so if the values are not valid i64, execution will trap. pub fn min_i64(&mut self, span: SourceSpan) { - self.raw_exec("intrinsics::i64::min", span); + self.raw_exec("::intrinsics::i64::min", span); } pub fn min_imm_i64(&mut self, imm: i64, span: SourceSpan) { self.push_i64(imm, span); - self.raw_exec("intrinsics::i64::min", span); + self.raw_exec("::intrinsics::i64::min", span); } /// Pops two u64 values off the stack, `b` and `a`, and pushes `max(a, b)` on the stack. @@ -356,19 +356,19 @@ impl OpEmitter<'_> { /// This operation is checked, so if the values are not valid u64, execution will trap. #[inline] pub fn max_u64(&mut self, span: SourceSpan) { - self.raw_exec("std::math::u64::max", span); + self.raw_exec("::miden::core::math::u64::max", span); } /// Pops two i64 values off the stack, `b` and `a`, and pushes `max(a, b)` on the stack. /// /// This operation is checked, so if the values are not valid i64, execution will trap. pub fn max_i64(&mut self, span: SourceSpan) { - self.raw_exec("intrinsics::i64::max", span); + self.raw_exec("::intrinsics::i64::max", span); } pub fn max_imm_i64(&mut self, imm: i64, span: SourceSpan) { self.push_i64(imm, span); - self.raw_exec("intrinsics::i64::max", span); + self.raw_exec("::intrinsics::i64::max", span); } /// Pops two u64 values off the stack, `b` and `a`, and pushes `a != b` on the stack. @@ -376,7 +376,7 @@ impl OpEmitter<'_> { /// This operation is checked, so if the values are not valid u64, execution will trap. #[inline] pub fn neq_int64(&mut self, span: SourceSpan) { - self.raw_exec("std::math::u64::neq", span); + self.raw_exec("::miden::core::math::u64::neq", span); } /// Pops two u64 values off the stack, `b` and `a`, and performs `a + b`. @@ -395,14 +395,14 @@ impl OpEmitter<'_> { pub fn add_u64(&mut self, overflow: Overflow, span: SourceSpan) { match overflow { Overflow::Checked => { - self.raw_exec("std::math::u64::overflowing_add", span); + self.raw_exec("::miden::core::math::u64::overflowing_add", span); self.emit(masm::Instruction::Assertz, span); } Overflow::Unchecked | Overflow::Wrapping => { - self.raw_exec("std::math::u64::wrapping_add", span); + self.raw_exec("::miden::core::math::u64::wrapping_add", span); } Overflow::Overflowing => { - self.raw_exec("std::math::u64::overflowing_add", span); + self.raw_exec("::miden::core::math::u64::overflowing_add", span); } } } @@ -414,9 +414,11 @@ impl OpEmitter<'_> { pub fn add_i64(&mut self, overflow: Overflow, span: SourceSpan) { self.raw_exec( match overflow { - Overflow::Unchecked | Overflow::Wrapping => "std::math::u64::wrapping_add", - Overflow::Checked => "intrinsics::i64::checked_add", - Overflow::Overflowing => "intrinsics::i64::overflowing_add", + Overflow::Unchecked | Overflow::Wrapping => { + "::miden::core::math::u64::wrapping_add" + } + Overflow::Checked => "::intrinsics::i64::checked_add", + Overflow::Overflowing => "::intrinsics::i64::overflowing_add", }, span, ) @@ -436,9 +438,9 @@ impl OpEmitter<'_> { match overflow { Overflow::Unchecked | Overflow::Wrapping => self.add_u64(overflow, span), Overflow::Checked => { - self.raw_exec("intrinsics::i64::checked_add", span); + self.raw_exec("::intrinsics::i64::checked_add", span); } - Overflow::Overflowing => self.raw_exec("intrinsics::i64::overflowing_add", span), + Overflow::Overflowing => self.raw_exec("::intrinsics::i64::overflowing_add", span), } } @@ -458,14 +460,14 @@ impl OpEmitter<'_> { pub fn sub_u64(&mut self, overflow: Overflow, span: SourceSpan) { match overflow { Overflow::Checked => { - self.raw_exec("std::math::u64::overflowing_sub", span); + self.raw_exec("::miden::core::math::u64::overflowing_sub", span); self.emit(masm::Instruction::Assertz, span); } Overflow::Unchecked | Overflow::Wrapping => { - self.raw_exec("std::math::u64::wrapping_sub", span); + self.raw_exec("::miden::core::math::u64::wrapping_sub", span); } Overflow::Overflowing => { - self.raw_exec("std::math::u64::overflowing_sub", span); + self.raw_exec("::miden::core::math::u64::overflowing_sub", span); } } } @@ -476,8 +478,8 @@ impl OpEmitter<'_> { pub fn sub_i64(&mut self, overflow: Overflow, span: SourceSpan) { match overflow { Overflow::Unchecked | Overflow::Wrapping => self.sub_u64(overflow, span), - Overflow::Checked => self.raw_exec("intrinsics::i64::checked_sub", span), - Overflow::Overflowing => self.raw_exec("intrinsics::i64::overflowing_sub", span), + Overflow::Checked => self.raw_exec("::intrinsics::i64::checked_sub", span), + Overflow::Overflowing => self.raw_exec("::intrinsics::i64::overflowing_sub", span), } } @@ -494,8 +496,8 @@ impl OpEmitter<'_> { self.push_i64(imm, span); match overflow { Overflow::Unchecked | Overflow::Wrapping => self.sub_u64(overflow, span), - Overflow::Checked => self.raw_exec("intrinsics::i64::checked_sub", span), - Overflow::Overflowing => self.raw_exec("intrinsics::i64::overflowing_sub", span), + Overflow::Checked => self.raw_exec("::intrinsics::i64::checked_sub", span), + Overflow::Overflowing => self.raw_exec("::intrinsics::i64::overflowing_sub", span), } } @@ -515,16 +517,16 @@ impl OpEmitter<'_> { pub fn mul_u64(&mut self, overflow: Overflow, span: SourceSpan) { match overflow { Overflow::Checked => { - self.raw_exec("std::math::u64::overflowing_mul", span); - self.raw_exec("std::math::u64::eqz", span); + self.raw_exec("::miden::core::math::u64::overflowing_mul", span); + self.raw_exec("::miden::core::math::u64::eqz", span); self.emit(masm::Instruction::Assertz, span); } Overflow::Unchecked | Overflow::Wrapping => { - self.raw_exec("std::math::u64::wrapping_mul", span); + self.raw_exec("::miden::core::math::u64::wrapping_mul", span); } Overflow::Overflowing => { - self.raw_exec("std::math::u64::overflowing_mul", span); - self.raw_exec("std::math::u64::eqz", span); + self.raw_exec("::miden::core::math::u64::overflowing_mul", span); + self.raw_exec("::miden::core::math::u64::eqz", span); } } } @@ -535,10 +537,10 @@ impl OpEmitter<'_> { pub fn mul_i64(&mut self, overflow: Overflow, span: SourceSpan) { match overflow { Overflow::Unchecked | Overflow::Wrapping => { - self.raw_exec("intrinsics::i64::wrapping_mul", span) + self.raw_exec("::intrinsics::i64::wrapping_mul", span) } - Overflow::Checked => self.raw_exec("intrinsics::i64::checked_mul", span), - Overflow::Overflowing => self.raw_exec("intrinsics::i64::overflowing_mul", span), + Overflow::Checked => self.raw_exec("::intrinsics::i64::checked_mul", span), + Overflow::Overflowing => self.raw_exec("::intrinsics::i64::overflowing_mul", span), } } @@ -562,15 +564,15 @@ impl OpEmitter<'_> { imm => match overflow { Overflow::Unchecked | Overflow::Wrapping => { self.push_i64(imm, span); - self.raw_exec("intrinsics::i64::wrapping_mul", span); + self.raw_exec("::intrinsics::i64::wrapping_mul", span); } Overflow::Checked => { self.push_i64(imm, span); - self.raw_exec("intrinsics::i64::checked_mul", span); + self.raw_exec("::intrinsics::i64::checked_mul", span); } Overflow::Overflowing => { self.push_i64(imm, span); - self.raw_exec("intrinsics::i64::overflowing_mul", span); + self.raw_exec("::intrinsics::i64::overflowing_mul", span); } }, } @@ -583,7 +585,7 @@ impl OpEmitter<'_> { #[inline] pub fn checked_div_u64(&mut self, span: SourceSpan) { self.emit(masm::Instruction::U32AssertW, span); - self.raw_exec("std::math::u64::div", span); + self.raw_exec("::miden::core::math::u64::div", span); } /// Pops two i64 values off the stack, `b` and `a`, and pushes the result of `a / b` on the @@ -592,7 +594,7 @@ impl OpEmitter<'_> { /// Both the operands and result are validated to ensure they are valid u64 values. #[inline] pub fn checked_div_i64(&mut self, span: SourceSpan) { - self.raw_exec("intrinsics::i64::checked_div", span); + self.raw_exec("::intrinsics::i64::checked_div", span); } /// Pops a i64 value off the stack, `a`, and performs `a / `. @@ -603,7 +605,7 @@ impl OpEmitter<'_> { pub fn checked_div_imm_i64(&mut self, imm: i64, span: SourceSpan) { assert_ne!(imm, 0, "division by zero is not allowed"); self.push_i64(imm, span); - self.raw_exec("intrinsics::i64::checked_div", span); + self.raw_exec("::intrinsics::i64::checked_div", span); } /// Pops two u64 values off the stack, `b` and `a`, and pushes the result of `a / b` on the @@ -612,7 +614,7 @@ impl OpEmitter<'_> { /// This operation is unchecked, it is up to the caller to ensure validity of the operands. #[inline] pub fn unchecked_div_u64(&mut self, span: SourceSpan) { - self.raw_exec("std::math::u64::div", span); + self.raw_exec("::miden::core::math::u64::div", span); } /// Pops two u64 values off the stack, `b` and `a`, and pushes the result of `a % b` on the @@ -622,7 +624,7 @@ impl OpEmitter<'_> { #[inline] pub fn checked_mod_u64(&mut self, span: SourceSpan) { self.emit(masm::Instruction::U32AssertW, span); - self.raw_exec("std::math::u64::mod", span); + self.raw_exec("::miden::core::math::u64::mod", span); } /// Pops two u64 values off the stack, `b` and `a`, and pushes the result of `a % b` on the @@ -631,7 +633,7 @@ impl OpEmitter<'_> { /// This operation is unchecked, it is up to the caller to ensure validity of the operands. #[inline] pub fn unchecked_mod_u64(&mut self, span: SourceSpan) { - self.raw_exec("std::math::u64::mod", span); + self.raw_exec("::miden::core::math::u64::mod", span); } /// Pops two u64 values off the stack, `b` and `a`, and pushes `a / b`, then `a % b` on the @@ -641,7 +643,7 @@ impl OpEmitter<'_> { #[inline] pub fn checked_divmod_u64(&mut self, span: SourceSpan) { self.emit(masm::Instruction::U32AssertW, span); - self.raw_exec("std::math::u64::divmod", span); + self.raw_exec("::miden::core::math::u64::divmod", span); } /// Pops two u64 values off the stack, `b` and `a`, and pushes `a / b`, then `a % b` on the @@ -650,7 +652,7 @@ impl OpEmitter<'_> { /// This operation is unchecked, it is up to the caller to ensure validity of the operands. #[inline] pub fn unchecked_divmod_u64(&mut self, span: SourceSpan) { - self.raw_exec("std::math::u64::divmod", span); + self.raw_exec("::miden::core::math::u64::divmod", span); } /// Pops two 64-bit values off the stack, `b` and `a`, and pushes `a & b` on the stack. @@ -658,7 +660,7 @@ impl OpEmitter<'_> { /// Both the operands and result are validated to ensure they are valid int64 values. #[inline] pub fn band_int64(&mut self, span: SourceSpan) { - self.raw_exec("std::math::u64::and", span); + self.raw_exec("::miden::core::math::u64::and", span); } /// Pops two 64-bit values off the stack, `b` and `a`, and pushes `a | b` on the stack. @@ -666,7 +668,7 @@ impl OpEmitter<'_> { /// Both the operands and result are validated to ensure they are valid int64 values. #[inline] pub fn bor_int64(&mut self, span: SourceSpan) { - self.raw_exec("std::math::u64::or", span); + self.raw_exec("::miden::core::math::u64::or", span); } /// Pops two 64-bit values off the stack, `b` and `a`, and pushes `a ^ b` on the stack. @@ -674,7 +676,7 @@ impl OpEmitter<'_> { /// Both the operands and result are validated to ensure they are valid int64 values. #[inline] pub fn bxor_int64(&mut self, span: SourceSpan) { - self.raw_exec("std::math::u64::xor", span); + self.raw_exec("::miden::core::math::u64::xor", span); } /// Pops a u32 value, `b`, and a u64 value, `a`, off the stack and pushes `a << b` on the stack. @@ -684,7 +686,7 @@ impl OpEmitter<'_> { /// The operation will trap if the shift value is > 63. #[inline] pub fn shl_u64(&mut self, span: SourceSpan) { - self.raw_exec("std::math::u64::shl", span); + self.raw_exec("::miden::core::math::u64::shl", span); } /// Pops a u32 value, `b`, and a u64 value, `a`, off the stack and pushes `a >> b` on the stack. @@ -694,7 +696,7 @@ impl OpEmitter<'_> { /// The operation will trap if the shift value is > 63. #[inline] pub fn shr_u64(&mut self, span: SourceSpan) { - self.raw_exec("std::math::u64::shr", span); + self.raw_exec("::miden::core::math::u64::shr", span); } /// Arithmetic shift right (i.e. signedness is preserved) @@ -706,7 +708,7 @@ impl OpEmitter<'_> { /// The operation will trap if the shift value is > 63. #[inline] pub fn shr_i64(&mut self, span: SourceSpan) { - self.raw_exec("intrinsics::i64::checked_shr", span); + self.raw_exec("::intrinsics::i64::checked_shr", span); } /// Pops a i64 value off the stack, `a`, and performs `a >> ` @@ -715,7 +717,7 @@ impl OpEmitter<'_> { pub fn shr_imm_i64(&mut self, imm: u32, span: SourceSpan) { assert!(imm < 63, "invalid shift value: must be < 63, got {imm}"); self.emit_push(imm, span); - self.raw_exec("intrinsics::i64::checked_shr", span); + self.raw_exec("::intrinsics::i64::checked_shr", span); } /// Pops a u32 value, `b`, and a u64 value, `a`, off the stack and rotates the bitwise @@ -725,7 +727,7 @@ impl OpEmitter<'_> { /// The operation will trap if the rotation value is > 63. #[inline] pub fn rotl_u64(&mut self, span: SourceSpan) { - self.raw_exec("std::math::u64::rotl", span); + self.raw_exec("::miden::core::math::u64::rotl", span); } /// Pops a u32 value, `b`, and a u64 value, `a`, off the stack and rotates the bitwise @@ -735,7 +737,7 @@ impl OpEmitter<'_> { /// The operation will trap if the rotation value is > 63. #[inline] pub fn rotr_u64(&mut self, span: SourceSpan) { - self.raw_exec("std::math::u64::rotr", span); + self.raw_exec("::miden::core::math::u64::rotr", span); } } diff --git a/codegen/masm/src/emit/mem.rs b/codegen/masm/src/emit/mem.rs index 8a9a29162..83fcfed1b 100644 --- a/codegen/masm/src/emit/mem.rs +++ b/codegen/masm/src/emit/mem.rs @@ -5,7 +5,7 @@ use midenc_hir::{ }; use super::{OpEmitter, masm}; -use crate::lower::NativePtr; +use crate::{OperandStack, lower::NativePtr}; /// Allocation impl OpEmitter<'_> { @@ -13,13 +13,13 @@ impl OpEmitter<'_> { /// size of the heap (in pages) if successful, or -1 if the heap could not be grown. pub fn mem_grow(&mut self, span: SourceSpan) { let _num_pages = self.stack.pop().expect("operand stack is empty"); - self.raw_exec("intrinsics::mem::memory_grow", span); + self.raw_exec("::intrinsics::mem::memory_grow", span); self.push(Type::I32); } /// Returns the size (in pages) of the heap (from the perspective of Wasm programs) pub fn mem_size(&mut self, span: SourceSpan) { - self.raw_exec("intrinsics::mem::memory_size", span); + self.raw_exec("::intrinsics::mem::memory_size", span); self.push(Type::U32); } } @@ -64,7 +64,7 @@ impl OpEmitter<'_> { Type::I128 => self.load_quad_word(None, span), Type::I64 | Type::U64 => self.load_double_word_int(None, span), Type::Felt => self.load_felt(None, span), - Type::I32 | Type::U32 => self.load_word(None, span), + Type::I32 | Type::U32 | Type::Ptr(_) => self.load_word(None, span), ty @ (Type::I16 | Type::U16 | Type::U8 | Type::I8 | Type::I1) => { self.load_small(ty, None, span); } @@ -89,7 +89,7 @@ impl OpEmitter<'_> { Type::I128 => self.load_quad_word(Some(ptr), span), Type::I64 | Type::U64 => self.load_double_word_int(Some(ptr), span), Type::Felt => self.load_felt(Some(ptr), span), - Type::I32 | Type::U32 => self.load_word(Some(ptr), span), + Type::I32 | Type::U32 | Type::Ptr(_) => self.load_word(Some(ptr), span), Type::I16 | Type::U16 | Type::U8 | Type::I8 | Type::I1 => { self.load_small(&ty, Some(ptr), span); } @@ -130,13 +130,14 @@ impl OpEmitter<'_> { /// Load a field element from a naturally aligned address, either immediate or dynamic /// - /// A native pointer triplet is expected on the stack if an immediate is not given. + /// A native pointer pair `(element_addr, byte_offset)` is expected on the stack if an + /// immediate is not given. fn load_felt(&mut self, ptr: Option, span: SourceSpan) { if let Some(imm) = ptr { return self.load_felt_imm(imm, span); } - self.raw_exec("intrinsics::mem::load_felt", span); + self.raw_exec("::intrinsics::mem::load_felt", span); } fn load_felt_imm(&mut self, ptr: NativePtr, span: SourceSpan) { @@ -147,13 +148,14 @@ impl OpEmitter<'_> { /// Loads a single 32-bit machine word, i.e. a single field element, not the Miden notion of a /// word /// - /// Expects a native pointer triplet on the stack if an immediate address is not given. + /// Expects a native pointer pair `(element_addr, byte_offset)` on the stack if an immediate + /// address is not given. fn load_word(&mut self, ptr: Option, span: SourceSpan) { if let Some(imm) = ptr { return self.load_word_imm(imm, span); } - self.raw_exec("intrinsics::mem::load_sw", span); + self.raw_exec("::intrinsics::mem::load_sw", span); } /// Loads a single 32-bit machine word from the given immediate address. @@ -166,7 +168,7 @@ impl OpEmitter<'_> { } else { // Delegate to load_sw intrinsic to handle the details of unaligned loads self.push_native_ptr(ptr, span); - self.raw_exec("intrinsics::mem::load_sw", span); + self.raw_exec("::intrinsics::mem::load_sw", span); } } @@ -175,7 +177,7 @@ impl OpEmitter<'_> { if let Some(imm) = ptr { self.load_double_word_imm(imm, span); } else { - self.raw_exec("intrinsics::mem::load_dw", span); + self.raw_exec("::intrinsics::mem::load_dw", span); } // The mem::intrinsic loads two 32-bit words with the first at the top of the stack. Swap @@ -270,7 +272,7 @@ impl OpEmitter<'_> { } else { // Delegate to load_dw to handle the details of unaligned loads self.push_native_ptr(ptr, span); - self.raw_exec("intrinsics::mem::load_dw", span); + self.raw_exec("::intrinsics::mem::load_dw", span); } } @@ -279,7 +281,7 @@ impl OpEmitter<'_> { if let Some(imm) = ptr { return self.load_quad_word_imm(imm, span); } - self.raw_exec("intrinsics::mem::load_qw", span); + self.raw_exec("::intrinsics::mem::load_qw", span); } fn load_quad_word_imm(&mut self, ptr: NativePtr, span: SourceSpan) { @@ -308,7 +310,7 @@ impl OpEmitter<'_> { } else { // Delegate to load_qw to handle the details of unaligned loads self.push_native_ptr(ptr, span); - self.raw_exec("intrinsics::mem::load_qw", span); + self.raw_exec("::intrinsics::mem::load_qw", span); } } @@ -352,7 +354,7 @@ impl OpEmitter<'_> { /// the operand stack representing any unaligned double-word value #[allow(unused)] fn realign_double_word(&mut self, _ptr: NativePtr, span: SourceSpan) { - self.raw_exec("intrinsics::mem::realign_dw", span); + self.raw_exec("::intrinsics::mem::realign_dw", span); } /// This handles emitting code that handles aligning an unaligned quad machine-word value @@ -544,7 +546,7 @@ impl OpEmitter<'_> { Type::I128 => self.store_quad_word(None, span), Type::I64 | Type::U64 => self.store_double_word_int(None, span), Type::Felt => self.store_felt(None, span), - Type::I32 | Type::U32 => self.store_word(None, span), + Type::I32 | Type::U32 | Type::Ptr(_) => self.store_word(None, span), ref ty if ty.size_in_bytes() <= 4 => self.store_small(ty, None, span), Type::Array(ref array_ty) => self.store_array(array_ty, None, span), Type::Struct(ref struct_ty) => self.store_struct(struct_ty, None, span), @@ -572,7 +574,7 @@ impl OpEmitter<'_> { Type::I128 => self.store_quad_word(Some(ptr), span), Type::I64 | Type::U64 => self.store_double_word_int(Some(ptr), span), Type::Felt => self.store_felt(Some(ptr), span), - Type::I32 | Type::U32 => self.store_word(Some(ptr), span), + Type::I32 | Type::U32 | Type::Ptr(_) => self.store_word(Some(ptr), span), ref ty if ty.size_in_bytes() <= 4 => self.store_small(ty, Some(ptr), span), Type::Array(ref array_ty) => self.store_array(array_ty, Some(ptr), span), Type::Struct(ref struct_ty) => self.store_struct(struct_ty, Some(ptr), span), @@ -679,11 +681,86 @@ impl OpEmitter<'_> { let ty = src.ty(); assert!(ty.is_pointer()); assert_eq!(ty, dst.ty(), "expected src and dst operands to have the same type"); - let value_ty = ty.pointee().unwrap(); + let value_ty = ty.pointee().unwrap().clone(); let value_size = u32::try_from(value_ty.size_in_bytes()).expect("invalid value size"); // Use optimized intrinsics when available match value_size { + // Byte copies (Wasm `memory.copy`) can often be performed more efficiently by copying + // whole felt elements when the source, destination, and length are all + // element-aligned. + 1 => { + // Compute: use_elements = (src % 4 == 0) && (dst % 4 == 0) && (count % 4 == 0) + // + // Stack: [src, dst, count] + self.emit_all( + [ + // src % 4 == 0 + masm::Instruction::Dup0, + masm::Instruction::U32DivModImm(4.into()), + masm::Instruction::Swap1, + masm::Instruction::Drop, + masm::Instruction::EqImm(Felt::ZERO.into()), + // dst % 4 == 0 + masm::Instruction::Dup2, + masm::Instruction::U32DivModImm(4.into()), + masm::Instruction::Swap1, + masm::Instruction::Drop, + masm::Instruction::EqImm(Felt::ZERO.into()), + masm::Instruction::And, + // count % 4 == 0 + masm::Instruction::Dup3, + masm::Instruction::U32DivModImm(4.into()), + masm::Instruction::Swap1, + masm::Instruction::Drop, + masm::Instruction::EqImm(Felt::ZERO.into()), + masm::Instruction::And, + ], + span, + ); + + // then: convert byte addresses/count to element units and delegate to core + let mut then_ops = Vec::default(); + let mut then_stack = OperandStack::default(); + let mut then_emitter = OpEmitter::new(self.invoked, &mut then_ops, &mut then_stack); + then_emitter.emit_all( + [ + // Convert `src` to element address + masm::Instruction::U32DivModImm(4.into()), + masm::Instruction::Assertz, + // Convert `dst` to an element address + masm::Instruction::Swap1, + masm::Instruction::U32DivModImm(4.into()), + masm::Instruction::Assertz, + // Bring `count` to top to convert to element count + masm::Instruction::Swap2, + masm::Instruction::U32DivModImm(4.into()), + masm::Instruction::Assertz, + ], + span, + ); + then_emitter.raw_exec("::miden::core::mem::memcopy_elements", span); + + // else: fall back to the generic implementation + let mut else_ops = Vec::default(); + let mut else_stack = OperandStack::default(); + let mut else_emitter = OpEmitter::new(self.invoked, &mut else_ops, &mut else_stack); + else_emitter.emit_memcpy_fallback_loop( + src.clone(), + dst.clone(), + count.clone(), + value_ty.clone(), + value_size, + span, + ); + + self.current_block.push(masm::Op::If { + span, + then_blk: masm::Block::new(span, then_ops), + else_blk: masm::Block::new(span, else_ops), + }); + return; + } // Word-sized values have an optimized intrinsic we can lean on 16 => { // We have to convert byte addresses to element addresses @@ -705,7 +782,7 @@ impl OpEmitter<'_> { ], span, ); - self.raw_exec("std::mem::memcopy_words", span); + self.raw_exec("::miden::core::mem::memcopy_words", span); return; } // Values which can be broken up into word-sized chunks can piggy-back on the @@ -734,13 +811,26 @@ impl OpEmitter<'_> { ], span, ); - self.raw_exec("std::mem::memcopy_words", span); + self.raw_exec("::miden::core::mem::memcopy_words", span); return; } // For now, all other values fallback to the default implementation _ => (), } + self.emit_memcpy_fallback_loop(src, dst, count, value_ty, value_size, span); + } + + /// Emit the default memcpy loop for types which do not have a specialized intrinsic. + fn emit_memcpy_fallback_loop( + &mut self, + src: crate::Operand, + dst: crate::Operand, + count: crate::Operand, + value_ty: Type, + value_size: u32, + span: SourceSpan, + ) { // Create new block for loop body and switch to it temporarily let mut body = Vec::default(); let mut body_emitter = OpEmitter::new(self.invoked, &mut body, self.stack); @@ -824,7 +914,7 @@ impl OpEmitter<'_> { if let Some(imm) = ptr { return self.store_quad_word_imm(imm, span); } - self.raw_exec("intrinsics::mem::store_qw", span); + self.raw_exec("::intrinsics::mem::store_qw", span); } fn store_quad_word_imm(&mut self, ptr: NativePtr, span: SourceSpan) { @@ -853,51 +943,62 @@ impl OpEmitter<'_> { } else { // Delegate to `store_qw` to handle unaligned stores self.push_native_ptr(ptr, span); - self.raw_exec("intrinsics::mem::store_qw", span); + self.raw_exec("::intrinsics::mem::store_qw", span); } } - /// Store a 64-bit word to the operand stack + /// Store a 64-bit integer in linear memory. + /// + /// Values are represented as two 32-bit limbs on the operand stack in big-endian order + /// (`[hi, lo]`). fn store_double_word_int(&mut self, ptr: Option, span: SourceSpan) { - // The mem::intrinsic stores two 32-bit words in stack order. Swap them (the 3rd and 4th - // params) first to make a little-endian-limbed memory value. - self.emit(masm::Instruction::MovUp2, span); - self.emit(masm::Instruction::MovDn3, span); - - if let Some(imm) = ptr { - self.store_double_word_imm(imm, span); - } else { - self.raw_exec("intrinsics::mem::store_dw", span); - } - } - - fn store_double_word_imm(&mut self, ptr: NativePtr, span: SourceSpan) { - if ptr.is_element_aligned() { - self.emit_all( - [ - masm::Instruction::U32Assert2, - masm::Instruction::MemStoreImm(ptr.addr.into()), - masm::Instruction::MemStoreImm((ptr.addr + 1).into()), - ], - span, - ); - } else { - // Delegate to `store_dw` to handle unaligned stores - self.push_native_ptr(ptr, span); - self.raw_exec("intrinsics::mem::store_dw", span); + match ptr { + // When storing to an immediate address, the operand stack only contains the value + // limbs. We must swap them so that the low limb is stored at the lower address. + Some(ptr) if ptr.is_element_aligned() => { + // Stack: [value_hi, value_lo] + self.emit_all( + [ + masm::Instruction::Swap1, + masm::Instruction::U32Assert2, + masm::Instruction::MemStoreImm(ptr.addr.into()), + masm::Instruction::MemStoreImm((ptr.addr + 1).into()), + ], + span, + ); + } + // When storing to a dynamic address, or an unaligned immediate address, the operand + // stack contains (or must contain) the native pointer pair `(element_addr, byte_offset)` + // above the value limbs. This is derived from the 32-bit byte pointer via `divmod 4`. + // Swap the limbs underneath the pointer pair before delegating to the mem intrinsic. + Some(ptr) => { + // Stack: [value_hi, value_lo] + self.push_native_ptr(ptr, span); + // Stack: [addr, offset, value_hi, value_lo] + self.emit(masm::Instruction::MovUp2, span); + self.emit(masm::Instruction::MovDn3, span); + self.raw_exec("::intrinsics::mem::store_dw", span); + } + None => { + // Stack: [addr, offset, value_hi, value_lo] + self.emit(masm::Instruction::MovUp2, span); + self.emit(masm::Instruction::MovDn3, span); + self.raw_exec("::intrinsics::mem::store_dw", span); + } } } /// Stores a single 32-bit machine word, i.e. a single field element, not the Miden notion of a /// word /// - /// Expects a native pointer triplet on the stack if an immediate address is not given. + /// Expects a native pointer pair `(element_addr, byte_offset)` on the stack if an immediate + /// address is not given. fn store_word(&mut self, ptr: Option, span: SourceSpan) { if let Some(imm) = ptr { return self.store_word_imm(imm, span); } - self.raw_exec("intrinsics::mem::store_sw", span); + self.raw_exec("::intrinsics::mem::store_sw", span); } /// Stores a single 32-bit machine word to the given immediate address. @@ -910,19 +1011,20 @@ impl OpEmitter<'_> { } else { // Delegate to `store_sw` to handle unaligned stores self.push_native_ptr(ptr, span); - self.raw_exec("intrinsics::mem::store_sw", span); + self.raw_exec("::intrinsics::mem::store_sw", span); } } /// Store a field element to a naturally aligned address, either immediate or dynamic /// - /// A native pointer triplet is expected on the stack if an immediate is not given. + /// A native pointer pair `(element_addr, byte_offset)` is expected on the stack if an + /// immediate is not given. fn store_felt(&mut self, ptr: Option, span: SourceSpan) { if let Some(imm) = ptr { return self.store_felt_imm(imm, span); } - self.raw_exec("intrinsics::mem::store_felt", span); + self.raw_exec("::intrinsics::mem::store_felt", span); } fn store_felt_imm(&mut self, ptr: NativePtr, span: SourceSpan) { diff --git a/codegen/masm/src/emit/mod.rs b/codegen/masm/src/emit/mod.rs index c5d6fafa5..2aa9af8b5 100644 --- a/codegen/masm/src/emit/mod.rs +++ b/codegen/masm/src/emit/mod.rs @@ -203,8 +203,10 @@ impl<'a> OpEmitter<'a> { span, callee.function.as_str().into(), ))); - let path = masm::LibraryPath::new(callee.module.as_str()).unwrap(); - let target = masm::InvocationTarget::AbsoluteProcedurePath { name, path }; + let module_name = callee.module.as_str(); + let module = masm::LibraryPath::new(module_name).unwrap(); + let qualified = masm::QualifiedProcedureName::new(module.as_path(), name); + let target = masm::InvocationTarget::Path(Span::new(span, qualified.into_inner())); self.emit(masm::Instruction::Trace(TraceEvent::FrameStart.as_u32().into()), span); self.emit(masm::Instruction::Nop, span); self.emit(masm::Instruction::Exec(target), span); @@ -476,7 +478,7 @@ impl<'a> OpEmitter<'a> { let raw_size = self.stack.raw_len(); self.stack.dropn(num_to_drop); self.emit_n(raw_size / 4, masm::Instruction::DropW, span); - self.emit_n(raw_size % 4, masm::Instruction::DropW, span); + self.emit_n(raw_size % 4, masm::Instruction::Drop, span); return; } @@ -2035,12 +2037,11 @@ mod tests { let mut emitter = OpEmitter::new(&mut invoked, &mut block, &mut stack); let return_ty = Type::from(ArrayType::new(Type::U32, 1)); - let callee = masm::InvocationTarget::AbsoluteProcedurePath { - path: masm::LibraryPath::new_from_components( - masm::LibraryNamespace::new("test").unwrap(), - [], - ), - name: masm::ProcedureName::new("add").unwrap(), + let callee = { + let name = masm::ProcedureName::new("add").unwrap(); + let module = masm::LibraryPath::new("test").unwrap(); + let qualified = masm::QualifiedProcedureName::new(module.as_path(), name); + masm::InvocationTarget::Path(Span::new(SourceSpan::default(), qualified.into_inner())) }; let signature = Signature::new( [AbiParam::new(Type::U32), AbiParam::new(Type::I1)], @@ -2080,4 +2081,34 @@ mod tests { assert_eq!(emitter.stack()[0], Type::I32); assert_eq!(emitter.stack()[1], Type::U32); } + + #[test] + fn op_emitter_truncate_stack_drops_all_with_remainder() { + let mut block = Vec::default(); + let mut stack = OperandStack::default(); + let mut invoked = BTreeSet::default(); + let mut emitter = OpEmitter::new(&mut invoked, &mut block, &mut stack); + + let span = SourceSpan::default(); + + // Push 5 elements (raw_size = 5, so 5 / 4 = 1 DropW, 5 % 4 = 1 Drop) + emitter.push(Type::U32); + emitter.push(Type::U32); + emitter.push(Type::U32); + emitter.push(Type::U32); + emitter.push(Type::U32); + assert_eq!(emitter.stack_len(), 5); + + // truncate_stack(0) should drop all 5 elements + emitter.truncate_stack(0, span); + assert_eq!(emitter.stack_len(), 0); + + { + let ops = emitter.current_block(); + // Should emit 1 DropW (for 4 elements) + 1 Drop (for remainder 1 element) + assert_eq!(ops.len(), 2); + assert_eq!(&ops[0], &Op::Inst(Span::new(span, masm::Instruction::DropW))); + assert_eq!(&ops[1], &Op::Inst(Span::new(span, masm::Instruction::Drop))); + } + } } diff --git a/codegen/masm/src/emit/unary.rs b/codegen/masm/src/emit/unary.rs index 051f26534..41d4b12e3 100644 --- a/codegen/masm/src/emit/unary.rs +++ b/codegen/masm/src/emit/unary.rs @@ -526,7 +526,7 @@ impl OpEmitter<'_> { // otherwise we take just the high bit count. // // Count leading zeros in the high bits - self.raw_exec("std::math::u64::clz", span); + self.raw_exec("::miden::core::math::u64::clz", span); self.emit_all( [ // [hi_clz, lo_hi, lo_lo] @@ -536,7 +536,7 @@ impl OpEmitter<'_> { ], span, ); - self.raw_exec("std::math::u64::clz", span); // [lo_clz, hi_clz] + self.raw_exec("::miden::core::math::u64::clz", span); // [lo_clz, hi_clz] // Add the low bit leading zeros to those of the high bits, if the high // bits are all zeros; otherwise return only the // high bit count @@ -553,7 +553,7 @@ impl OpEmitter<'_> { ); } Type::I64 | Type::U64 => { - self.raw_exec("std::math::u64::clz", span); + self.raw_exec("::miden::core::math::u64::clz", span); } Type::I32 | Type::U32 => { self.emit(masm::Instruction::U32Clz, span); @@ -611,7 +611,7 @@ impl OpEmitter<'_> { // otherwise we take just the high bit count. // // Count leading ones in the high bits - self.raw_exec("std::math::u64::clo", span); // [hi_clo, lo_hi, lo_lo] + self.raw_exec("::miden::core::math::u64::clo", span); // [hi_clo, lo_hi, lo_lo] self.emit_all( [ // Count leading ones in the low bits @@ -620,7 +620,7 @@ impl OpEmitter<'_> { ], span, ); - self.raw_exec("std::math::u64::clo", span); // [lo_clo, hi_clo] + self.raw_exec("::miden::core::math::u64::clo", span); // [lo_clo, hi_clo] // Add the low bit leading ones to those of the high bits, if the high bits // are all one; otherwise return only the high bit count self.emit_push(0u32, span); // [0, lo_clo, hi_clo] @@ -635,7 +635,7 @@ impl OpEmitter<'_> { span, ); } - Type::I64 | Type::U64 => self.raw_exec("std::math::u64::clo", span), + Type::I64 | Type::U64 => self.raw_exec("::miden::core::math::u64::clo", span), Type::I32 | Type::U32 => { self.emit(masm::Instruction::U32Clo, span); } @@ -703,7 +703,7 @@ impl OpEmitter<'_> { // otherwise we take just the high bit count. // // Count trailing zeros in the high bits - self.raw_exec("std::math::u64::ctz", span); // [hi_ctz, lo_hi, lo_lo] + self.raw_exec("::miden::core::math::u64::ctz", span); // [hi_ctz, lo_hi, lo_lo] self.emit_all( [ // Count trailing zeros in the low bits @@ -712,7 +712,7 @@ impl OpEmitter<'_> { ], span, ); - self.raw_exec("std::math::u64::ctz", span); // [lo_ctz, hi_ctz] + self.raw_exec("::miden::core::math::u64::ctz", span); // [lo_ctz, hi_ctz] // Add the high bit trailing zeros to those of the low bits, if the low // bits are all zero; otherwise return only the low // bit count @@ -729,7 +729,7 @@ impl OpEmitter<'_> { span, ); } - Type::I64 | Type::U64 => self.raw_exec("std::math::u64::ctz", span), + Type::I64 | Type::U64 => self.raw_exec("::miden::core::math::u64::ctz", span), Type::I32 | Type::U32 => self.emit(masm::Instruction::U32Ctz, span), Type::I16 | Type::U16 => { // Clamp the total number of trailing zeros to 16 @@ -799,7 +799,7 @@ impl OpEmitter<'_> { // otherwise we take just the high bit count. // // Count trailing ones in the high bits - self.raw_exec("std::math::u64::cto", span); // [hi_cto, lo_hi, lo_lo] + self.raw_exec("::miden::core::math::u64::cto", span); // [hi_cto, lo_hi, lo_lo] self.emit_all( [ // Count trailing ones in the low bits @@ -808,7 +808,7 @@ impl OpEmitter<'_> { ], span, ); - self.raw_exec("std::math::u64::cto", span); // [lo_cto, hi_cto] + self.raw_exec("::miden::core::math::u64::cto", span); // [lo_cto, hi_cto] // Add the high bit trailing ones to those of the low bits, if the low bits // are all one; otherwise return only the low bit count self.emit(masm::Instruction::Swap1, span); @@ -824,7 +824,7 @@ impl OpEmitter<'_> { span, ); } - Type::I64 | Type::U64 => self.raw_exec("std::math::u64::cto", span), + Type::I64 | Type::U64 => self.raw_exec("::miden::core::math::u64::cto", span), Type::I32 | Type::U32 | Type::I16 | Type::U16 | Type::I8 | Type::U8 => { // The number of trailing ones is de-facto clamped by the bitwidth of // the value, since all of the padding bits are leading zeros. @@ -928,7 +928,7 @@ impl OpEmitter<'_> { ); } Type::I64 => { - self.raw_exec("intrinsics::i64::pow2", span); + self.raw_exec("::intrinsics::i64::pow2", span); } Type::Felt => { self.emit(masm::Instruction::Pow2, span); @@ -937,7 +937,7 @@ impl OpEmitter<'_> { self.emit_all([masm::Instruction::Pow2, masm::Instruction::U32Assert], span); } Type::I32 => { - self.raw_exec("intrinsics::i32::pow2", span); + self.raw_exec("::intrinsics::i32::pow2", span); } Type::U8 | Type::U16 => { self.emit_all([masm::Instruction::Pow2, masm::Instruction::U32Assert], span); diff --git a/codegen/masm/src/emitter.rs b/codegen/masm/src/emitter.rs index 385c0ade7..12db31481 100644 --- a/codegen/masm/src/emitter.rs +++ b/codegen/masm/src/emitter.rs @@ -1,7 +1,7 @@ use alloc::collections::BTreeSet; use miden_assembly::diagnostics::WrapErr; -use midenc_hir::{Block, Operation, ProgramPoint, ValueRange, ValueRef}; +use midenc_hir::{Block, Operation, ProgramPoint, TraceTarget, ValueRange, ValueRef}; use midenc_hir_analysis::analyses::LivenessAnalysis; use midenc_session::diagnostics::{SourceSpan, Spanned}; use smallvec::SmallVec; @@ -20,6 +20,7 @@ pub(crate) struct BlockEmitter<'b> { pub invoked: &'b mut BTreeSet, pub target: Vec, pub stack: OperandStack, + pub trace_target: TraceTarget, } impl BlockEmitter<'_> { @@ -30,6 +31,7 @@ impl BlockEmitter<'_> { invoked: self.invoked, target: Default::default(), stack: self.stack.clone(), + trace_target: self.trace_target.clone(), } } @@ -65,6 +67,7 @@ impl BlockEmitter<'_> { } // Continue normally, by emitting the contents of the block based on the given schedule + let scheduling_target = self.trace_target.clone().with_topic("operand-scheduling"); for op in block.body() { self.emit_inst(&op); @@ -79,7 +82,11 @@ impl BlockEmitter<'_> { continue; } - log::trace!(target: "codegen", "dropping dead instruction result {next_result} at index {index}"); + log::trace!( + target: &scheduling_target, + symbol = self.trace_target.relevant_symbol(); + "dropping dead instruction result {next_result} at index {index}" + ); self.emitter().drop_operand_at_position(index, span); } @@ -133,7 +140,12 @@ impl BlockEmitter<'_> { where F: Fn(ValueRef) -> bool, { - log::trace!(target: "codegen", "dropping unused operands at: {op}"); + let trace_target = self.trace_target.clone().with_topic("operand-scheduling"); + log::trace!( + target: &trace_target, + symbol = self.trace_target.relevant_symbol(); + "dropping unused operands at: {op}" + ); // We start by computing the set of unused operands on the stack at this point // in the program. We will use the resulting vectors to schedule instructions // that will move those operands to the top of the stack to be discarded @@ -142,13 +154,22 @@ impl BlockEmitter<'_> { for operand in self.stack.iter().rev() { let value = operand.as_value().expect("unexpected non-ssa value on stack"); if !is_live(value) { - log::trace!(target: "codegen", "should drop {value} at {}", ProgramPoint::before(op)); + log::trace!( + target: &trace_target, + symbol = self.trace_target.relevant_symbol(); + "should drop {value} at {}", + ProgramPoint::before(op) + ); unused.push(value); constraints.push(Constraint::Move); } } - log::trace!(target: "codegen", "found unused operands {unused:?} with constraints {constraints:?}"); + log::trace!( + target: &trace_target, + symbol = self.trace_target.relevant_symbol(); + "found unused operands {unused:?} with constraints {constraints:?}" + ); // Next, emit the optimal set of moves to get the unused operands to the top if !unused.is_empty() { @@ -156,7 +177,11 @@ impl BlockEmitter<'_> { // of used operands, then we will schedule manually, since this // is a pathological use case for the operand scheduler. let num_used = self.stack.len() - unused.len(); - log::trace!(target: "codegen", "there are {num_used} used operands out of {}", self.stack.len()); + log::trace!( + target: &trace_target, + symbol = self.trace_target.relevant_symbol(); + "there are {num_used} used operands out of {}", self.stack.len() + ); if unused.len() > num_used { // In this case, we emit code starting from the top // of the stack, i.e. if we encounter an unused value @@ -261,7 +286,12 @@ impl BlockEmitter<'_> { // We may have accumulated a batch comprising the rest of the stack, handle that // here. if unused_batch && batch_size > 0 { - log::trace!(target: "codegen", "dropping {batch_size} operands from {:?}", &self.stack); + log::trace!( + target: &trace_target, + symbol = self.trace_target.relevant_symbol(); + "dropping {batch_size} operands from {:?}", + &self.stack + ); // It should only be possible to hit this point if the entire stack is unused assert_eq!(batch_size, self.stack.len()); match batch_size { diff --git a/codegen/masm/src/intrinsics.rs b/codegen/masm/src/intrinsics.rs index 6f75315fe..af74e4d56 100644 --- a/codegen/masm/src/intrinsics.rs +++ b/codegen/masm/src/intrinsics.rs @@ -1,15 +1,17 @@ +use alloc::sync::Arc; + use miden_assembly::{ - LibraryPath, + PathBuf as LibraryPath, ast::{Module, ModuleKind}, }; use midenc_session::diagnostics::{PrintDiagnostic, SourceLanguage, SourceManager, Uri}; -pub const I32_INTRINSICS_MODULE_NAME: &str = "intrinsics::i32"; -pub const I64_INTRINSICS_MODULE_NAME: &str = "intrinsics::i64"; -pub const I128_INTRINSICS_MODULE_NAME: &str = "intrinsics::i128"; -pub const MEM_INTRINSICS_MODULE_NAME: &str = "intrinsics::mem"; -pub const CRYPTO_INTRINSICS_MODULE_NAME: &str = "intrinsics::crypto"; -pub const ADVICE_INTRINSICS_MODULE_NAME: &str = "intrinsics::advice"; +pub const I32_INTRINSICS_MODULE_NAME: &str = "::intrinsics::i32"; +pub const I64_INTRINSICS_MODULE_NAME: &str = "::intrinsics::i64"; +pub const I128_INTRINSICS_MODULE_NAME: &str = "::intrinsics::i128"; +pub const MEM_INTRINSICS_MODULE_NAME: &str = "::intrinsics::mem"; +pub const CRYPTO_INTRINSICS_MODULE_NAME: &str = "::intrinsics::crypto"; +pub const ADVICE_INTRINSICS_MODULE_NAME: &str = "::intrinsics::advice"; pub const INTRINSICS_MODULE_NAMES: [&str; 6] = [ I32_INTRINSICS_MODULE_NAME, @@ -69,14 +71,14 @@ const INTRINSICS: [(&str, &str, &str); 6] = [ /// This helper loads the named module from the set of intrinsics modules defined in this crate. /// -/// Expects the fully-qualified name to be given, e.g. `intrinsics::mem` -pub fn load>(name: N, source_manager: &dyn SourceManager) -> Option> { +/// Expects the fully-qualified name to be given, e.g. `::intrinsics::mem` +pub fn load>(name: N, source_manager: Arc) -> Option> { let name = name.as_ref(); let (name, source, filename) = INTRINSICS.iter().copied().find(|(n, ..)| *n == name)?; let filename = Uri::new(filename); let source_file = source_manager.load(SourceLanguage::Masm, filename, source.to_string()); let path = LibraryPath::new(name).expect("invalid module name"); - match Module::parse(path, ModuleKind::Library, source_file.clone()) { + match Module::parse(path, ModuleKind::Library, source_file.clone(), source_manager) { Ok(module) => Some(module), Err(err) => { let err = PrintDiagnostic::new(err); diff --git a/codegen/masm/src/lib.rs b/codegen/masm/src/lib.rs index 4cba3d36e..d308ad6c0 100644 --- a/codegen/masm/src/lib.rs +++ b/codegen/masm/src/lib.rs @@ -19,7 +19,8 @@ mod stack; pub mod masm { pub use miden_assembly_syntax::{ - KernelLibrary, Library, LibraryNamespace, LibraryPath, + KernelLibrary, Library, Path as LibraryPathRef, PathBuf as LibraryPath, + PathComponent as LibraryPathComponent, ast::*, debuginfo::{SourceSpan, Span, Spanned}, parser::{IntValue, PushValue}, diff --git a/codegen/masm/src/lower/component.rs b/codegen/masm/src/lower/component.rs index a9c3a1039..d2f3e117c 100644 --- a/codegen/masm/src/lower/component.rs +++ b/codegen/masm/src/lower/component.rs @@ -1,16 +1,15 @@ use alloc::{collections::BTreeSet, sync::Arc}; -use miden_assembly::{LibraryPath, ast::InvocationTarget}; +use miden_assembly::{PathBuf as LibraryPath, ast::InvocationTarget}; use miden_assembly_syntax::parser::WordValue; -use miden_mast_package::ProcedureName; use midenc_hir::{ - CallConv, FunctionIdent, Op, SourceSpan, Span, Symbol, ValueRef, diagnostics::IntoDiagnostic, - dialects::builtin, pass::AnalysisManager, + CallConv, FunctionIdent, Op, SourceSpan, Span, Symbol, TraceTarget, ValueRef, + diagnostics::IntoDiagnostic, dialects::builtin, pass::AnalysisManager, }; use midenc_hir_analysis::analyses::LivenessAnalysis; use midenc_session::{ TargetEnv, - diagnostics::{Report, Spanned}, + diagnostics::{Report, Spanned, WrapErr}, }; use smallvec::SmallVec; @@ -61,15 +60,21 @@ impl ToMasmComponent for builtin::Component { // TODO(pauls): Narrow this to only be true if the target env is not 'rollup', we // cannot currently do so because we do not have sufficient Cargo metadata yet in // 'cargo miden build' to detect the target env, and we default it to 'rollup' - let is_wrapper = component_path.path() == "root_ns:root@1.0.0"; + let is_wrapper = link_info.component().is_synthetic_wrapper(); let path = if is_wrapper { - component_path.clone().append_unchecked(entry_id.module) + let mut path = component_path.clone(); + path.push(entry_id.module.as_str()); + path } else { // We're compiling a Wasm component and the component id is included // in the entrypoint. - LibraryPath::new(entry_id.module).into_diagnostic()? + LibraryPath::new(entry_id.module.as_str()).into_diagnostic()? }; - Some(masm::InvocationTarget::AbsoluteProcedurePath { name, path }) + let qualified = masm::QualifiedProcedureName::new(path.as_path(), name); + Some(masm::InvocationTarget::Path(Span::new( + entry_id.function.span, + qualified.into_inner(), + ))) } None => None, }; @@ -78,10 +83,12 @@ impl ToMasmComponent for builtin::Component { // function, as well as a module to hold component-level functions such as init let requires_init = link_info.has_globals() || link_info.has_data_segments(); let init = if requires_init { - Some(masm::InvocationTarget::AbsoluteProcedurePath { - name: masm::ProcedureName::new("init").unwrap(), - path: component_path, - }) + let name = masm::ProcedureName::new("init").unwrap(); + let qualified = masm::QualifiedProcedureName::new(component_path.as_path(), name); + Some(masm::InvocationTarget::Path(Span::new( + SourceSpan::default(), + qualified.into_inner(), + ))) } else { None }; @@ -98,7 +105,7 @@ impl ToMasmComponent for builtin::Component { let rodata = data_segments_to_rodata(&link_info)?; let kernel = if matches!(context.session().options.target, TargetEnv::Rollup { .. }) { - Some(miden_lib::transaction::TransactionKernel::kernel()) + Some(miden_protocol::transaction::TransactionKernel::kernel()) } else { None }; @@ -126,6 +133,7 @@ impl ToMasmComponent for builtin::Component { analysis_manager, component: &mut masm_component, link_info: &link_info, + source_manager: context.session().source_manager.clone(), init_body: Default::default(), invoked_from_init: Default::default(), }; @@ -169,6 +177,7 @@ struct MasmComponentBuilder<'a> { component: &'a mut MasmComponent, analysis_manager: AnalysisManager, link_info: &'a LinkInfo, + source_manager: Arc, init_body: Vec, invoked_from_init: BTreeSet, } @@ -189,19 +198,17 @@ impl MasmComponentBuilder<'_> { span, Inst::Push(masm::Immediate::Value(Span::unknown(heap_base.into()))), ))); - let heap_init = masm::ProcedureName::new("heap_init").unwrap(); - let memory_intrinsics = masm::LibraryPath::new("intrinsics::mem").unwrap(); + let heap_init = { + let name = masm::ProcedureName::new("heap_init").unwrap(); + let module = masm::LibraryPath::new("::intrinsics::mem").unwrap(); + let qualified = masm::QualifiedProcedureName::new(module.as_path(), name); + InvocationTarget::Path(Span::new(span, qualified.into_inner())) + }; self.init_body.push(Op::Inst(Span::new( span, Inst::Trace(TraceEvent::FrameStart.as_u32().into()), ))); - self.init_body.push(Op::Inst(Span::new( - span, - Inst::Exec(InvocationTarget::AbsoluteProcedurePath { - name: heap_init, - path: memory_intrinsics, - }), - ))); + self.init_body.push(Op::Inst(Span::new(span, Inst::Exec(heap_init)))); self.init_body .push(Op::Inst(Span::new(span, Inst::Trace(TraceEvent::FrameEnd.as_u32().into())))); @@ -242,7 +249,10 @@ impl MasmComponentBuilder<'_> { masm::Block::new(component.span(), init_body), ); - module.define_procedure(masm::Export::Procedure(init))?; + module + .define_procedure(init, self.source_manager.clone()) + .into_diagnostic() + .wrap_err("failed to define component `init` procedure")?; } else { assert!( self.init_body.is_empty(), @@ -255,7 +265,8 @@ impl MasmComponentBuilder<'_> { fn define_interface(&mut self, interface: &builtin::Interface) -> Result<(), Report> { let component_path = self.component.id.to_library_path(); - let interface_path = component_path.append_unchecked(interface.name()); + let mut interface_path = component_path; + interface_path.push(interface.name().as_str()); let mut masm_module = Box::new(masm::Module::new(masm::ModuleKind::Library, interface_path)); let builder = MasmModuleBuilder { @@ -264,6 +275,7 @@ impl MasmComponentBuilder<'_> { .analysis_manager .nest(interface.as_operation().as_operation_ref()), link_info: self.link_info, + source_manager: self.source_manager.clone(), init_body: &mut self.init_body, invoked_from_init: &mut self.invoked_from_init, }; @@ -276,12 +288,14 @@ impl MasmComponentBuilder<'_> { fn define_module(&mut self, module: &builtin::Module) -> Result<(), Report> { let component_path = self.component.id.to_library_path(); - let module_path = component_path.append_unchecked(module.name()); + let mut module_path = component_path; + module_path.push(module.name().as_str()); let mut masm_module = Box::new(masm::Module::new(masm::ModuleKind::Library, module_path)); let builder = MasmModuleBuilder { module: &mut masm_module, analysis_manager: self.analysis_manager.nest(module.as_operation_ref()), link_info: self.link_info, + source_manager: self.source_manager.clone(), init_body: &mut self.init_body, invoked_from_init: &mut self.invoked_from_init, }; @@ -302,14 +316,18 @@ impl MasmComponentBuilder<'_> { let module = Arc::get_mut(&mut self.component.modules[0]).expect("expected unique reference"); + let expected_path_len = if module.path().is_absolute() { 2 } else { 1 }; assert_eq!( - module.path().num_components(), - 1, + module.path().len(), + expected_path_len, "expected top-level namespace module, but one has not been defined (in '{}' of '{}')", module.path(), function.path() ); - module.define_procedure(masm::Export::Procedure(procedure))?; + module + .define_procedure(procedure, self.source_manager.clone()) + .into_diagnostic() + .wrap_err("failed to define MASM procedure")?; Ok(()) } @@ -325,10 +343,13 @@ impl MasmComponentBuilder<'_> { // NOTE: This depends on the program being executed with the data for all data segments // having been placed in the advice map with the same commitment and encoding used here. // The program will fail to execute if this is not set up correctly. - let pipe_preimage_to_memory = masm::ProcedureName::new("pipe_preimage_to_memory").unwrap(); - let std_mem = masm::LibraryPath::new("std::mem").unwrap(); - let span = SourceSpan::default(); + let pipe_preimage_to_memory = { + let name = masm::ProcedureName::new("pipe_preimage_to_memory").unwrap(); + let module = masm::LibraryPath::new("::miden::core::mem").unwrap(); + let qualified = masm::QualifiedProcedureName::new(module.as_path(), name); + InvocationTarget::Path(Span::new(span, qualified.into_inner())) + }; for rodata in self.component.rodata.iter() { // Push the commitment hash (`COM`) for this data onto the operand stack @@ -361,13 +382,8 @@ impl MasmComponentBuilder<'_> { span, Inst::Trace(TraceEvent::FrameStart.as_u32().into()), ))); - self.init_body.push(Op::Inst(Span::new( - span, - Inst::Exec(InvocationTarget::AbsoluteProcedurePath { - name: pipe_preimage_to_memory.clone(), - path: std_mem.clone(), - }), - ))); + self.init_body + .push(Op::Inst(Span::new(span, Inst::Exec(pipe_preimage_to_memory.clone())))); self.init_body .push(Op::Inst(Span::new(span, Inst::Trace(TraceEvent::FrameEnd.as_u32().into())))); // drop write_ptr' @@ -380,6 +396,7 @@ struct MasmModuleBuilder<'a> { module: &'a mut masm::Module, analysis_manager: AnalysisManager, link_info: &'a LinkInfo, + source_manager: Arc, init_body: &'a mut Vec, invoked_from_init: &'a mut BTreeSet, } @@ -432,7 +449,9 @@ impl MasmModuleBuilder<'_> { self.link_info, )?; - self.module.define_procedure(masm::Export::Procedure(procedure))?; + self.module + .define_procedure(procedure, self.source_manager.clone()) + .map_err(|e| Report::msg(e.to_string()))?; Ok(()) } @@ -453,12 +472,15 @@ impl MasmModuleBuilder<'_> { // Emit the initializer block let initializer_region = gv.region(0); let initializer_block = initializer_region.entry(); + let mut block_emitter = BlockEmitter { liveness: &liveness, link_info: self.link_info, invoked: self.invoked_from_init, target: Default::default(), stack: Default::default(), + trace_target: TraceTarget::category("codegen") + .with_relevant_symbol(gv.name().as_symbol()), }; block_emitter.emit_inline(&initializer_block); @@ -502,7 +524,7 @@ impl MasmFunctionBuilder { let name = function.name(); let name = masm::ProcedureName::from_raw_parts(masm::Ident::from_raw_parts(Span::new( name.span, - name.as_str().into(), + name.as_ref().into(), ))); let visibility = match function.visibility() { Visibility::Public => masm::Visibility::Public, @@ -553,7 +575,11 @@ impl MasmFunctionBuilder { use midenc_hir_analysis::analyses::LivenessAnalysis; - log::trace!(target: "codegen", "lowering {}", function.as_operation()); + let demangled_symbol_name = midenc_hir::demangle::demangle(function.name()); + let trace_target = TraceTarget::category("codegen") + .with_relevant_symbol(midenc_hir::SymbolName::intern(demangled_symbol_name)); + + log::trace!(target: &trace_target, "lowering {}", function.as_operation()); let liveness = analysis_manager.get_analysis::()?; @@ -572,6 +598,7 @@ impl MasmFunctionBuilder { invoked: &mut invoked, target: Default::default(), stack, + trace_target, }; // For component export functions, invoke the `init` procedure first if needed. @@ -580,9 +607,10 @@ impl MasmFunctionBuilder { && (link_info.has_globals() || link_info.has_data_segments()) { let component_path = link_info.component().to_library_path(); - let init = InvocationTarget::AbsoluteProcedurePath { - name: ProcedureName::new("init").unwrap(), - path: component_path, + let init = { + let name = masm::ProcedureName::new("init").unwrap(); + let qualified = masm::QualifiedProcedureName::new(component_path.as_path(), name); + InvocationTarget::Path(Span::new(SourceSpan::default(), qualified.into_inner())) }; let span = SourceSpan::default(); // Add init call to the emitter's target before emitting the function body @@ -601,12 +629,11 @@ impl MasmFunctionBuilder { // Since the VM's `drop` instruction not letting stack size go beyond the 16 elements // we most likely end up with stack size > 16 elements at the end. // See https://github.com/0xPolygonMiden/miden-vm/blob/c4acf49510fda9ba80f20cee1a9fb1727f410f47/processor/src/stack/mod.rs?plain=1#L226-L253 - let truncate_stack = InvocationTarget::AbsoluteProcedurePath { - name: ProcedureName::new("truncate_stack").unwrap(), - path: masm::LibraryPath::new_from_components( - masm::LibraryNamespace::new("std").unwrap(), - [masm::Ident::new("sys").unwrap()], - ), + let truncate_stack = { + let name = masm::ProcedureName::new("truncate_stack").unwrap(); + let module = masm::LibraryPath::new("::miden::core::sys").unwrap(); + let qualified = masm::QualifiedProcedureName::new(module.as_path(), name); + InvocationTarget::Path(Span::new(SourceSpan::default(), qualified.into_inner())) }; let span = SourceSpan::default(); body.push(masm::Op::Inst(Span::new(span, masm::Instruction::Exec(truncate_stack)))); diff --git a/codegen/masm/src/lower/lowering.rs b/codegen/masm/src/lower/lowering.rs index c1e31d76a..bfd3f100e 100644 --- a/codegen/masm/src/lower/lowering.rs +++ b/codegen/masm/src/lower/lowering.rs @@ -4,7 +4,7 @@ use midenc_dialect_hir as hir; use midenc_dialect_scf as scf; use midenc_dialect_ub as ub; use midenc_hir::{ - Op, OpExt, Span, SymbolTable, Value, ValueRange, ValueRef, + Op, OpExt, Span, SymbolTable, Type, Value, ValueRange, ValueRef, dialects::builtin, traits::{BinaryOp, Commutative}, }; @@ -14,6 +14,20 @@ use smallvec::{SmallVec, smallvec}; use super::*; use crate::{Constraint, emitter::BlockEmitter, masm, opt::operands::SolverOptions}; +/// Convert a resolved callee [`midenc_hir::SymbolPath`] into a MASM [`masm::InvocationTarget`]. +fn invocation_target_from_symbol_path( + callee_path: &midenc_hir::SymbolPath, + span: midenc_hir::SourceSpan, +) -> masm::InvocationTarget { + let proc_name = callee_path.name(); + let proc_name = masm::ProcedureName::from_raw_parts(masm::Ident::from_raw_parts( + masm::Span::new(span, proc_name.as_ref().into()), + )); + let module = callee_path.without_leaf().to_library_path(); + let qualified = masm::QualifiedProcedureName::new(module.as_path(), proc_name); + masm::InvocationTarget::Path(masm::Span::new(span, qualified.into_inner())) +} + /// This trait is registered with all ops, of all dialects, which are legal for lowering to MASM. /// /// The [BlockEmitter] is responsible for then invoking the methods of this trait to facilitate @@ -46,6 +60,7 @@ pub trait HirLowering: Op { /// and provide a custom schedule. fn schedule_operands(&self, emitter: &mut BlockEmitter<'_>) -> Result<(), Report> { let op = self.as_operation(); + let trace_target = emitter.trace_target.clone().with_topic("operand-scheduling"); // Move instruction operands into place, minimizing unnecessary stack manipulation ops // @@ -70,11 +85,11 @@ pub trait HirLowering: Op { constraints.swap(0, 1); } - log::trace!(target: "codegen", "scheduling operands for {op}"); + log::trace!(target: &trace_target, "scheduling operands for {op}"); for arg in args.iter() { - log::trace!(target: "codegen", "{arg} is live at/after entry: {}", emitter.liveness.is_live_after_entry(*arg, op)); + log::trace!(target: &trace_target, "{arg} is live at/after entry: {}", emitter.liveness.is_live_after_entry(*arg, op)); } - log::trace!(target: "codegen", "starting with stack: {:#?}", &emitter.stack); + log::trace!(target: &trace_target, "starting with stack: {:#?}", &emitter.stack); emitter .schedule_operands( &args, @@ -93,7 +108,7 @@ pub trait HirLowering: Op { &emitter.stack, ) }); - log::trace!(target: "codegen", "stack after scheduling: {:#?}", &emitter.stack); + log::trace!(target: &trace_target, "stack after scheduling: {:#?}", &emitter.stack); Ok(()) } @@ -402,7 +417,6 @@ impl HirLowering for scf::Yield { fn emit(&self, _emitter: &mut BlockEmitter<'_>) -> Result<(), Report> { // Lowering 'hir.yield' is a no-op, as it is simply forwarding operands to another region, // and the semantics of that are handled by the lowering of the containing op - log::trace!(target: "codegen", "yielding {:#?}", &_emitter.stack); Ok(()) } } @@ -411,7 +425,6 @@ impl HirLowering for scf::Condition { fn emit(&self, _emitter: &mut BlockEmitter<'_>) -> Result<(), Report> { // Lowering 'hir.condition' is a no-op, as it is simply forwarding operands to another // region, and the semantics of that are handled by the lowering of the containing op - log::trace!(target: "codegen", "conditionally yielding {:#?}", &_emitter.stack); Ok(()) } } @@ -855,12 +868,8 @@ impl HirLowering for hir::Exec { } }; - // Convert the path components to an absolute procedure path - let mut path = callee_path.to_library_path(); - let name = masm::ProcedureName::from_raw_parts( - path.pop().expect("expected at least two path components"), - ); - let callee = masm::InvocationTarget::AbsoluteProcedurePath { name, path }; + // Convert the symbol path to a fully-qualified procedure path + let callee = invocation_target_from_symbol_path(&callee_path, self.span()); emitter.inst_emitter(self.as_operation()).exec(callee, signature, self.span()); @@ -909,12 +918,8 @@ impl HirLowering for hir::Call { } }; - // Convert the path components to an absolute procedure path - let mut path = callee_path.to_library_path(); - let name = masm::ProcedureName::from_raw_parts( - path.pop().expect("expected at least two path components"), - ); - let callee = masm::InvocationTarget::AbsoluteProcedurePath { name, path }; + // Convert the symbol path to a fully-qualified procedure path + let callee = invocation_target_from_symbol_path(&callee_path, self.span()); emitter.inst_emitter(self.as_operation()).call(callee, signature, self.span()); @@ -1210,10 +1215,53 @@ impl HirLowering for arith::Cto { } impl HirLowering for arith::Join { + fn schedule_operands(&self, emitter: &mut BlockEmitter<'_>) -> Result<(), Report> { + let op = self.as_operation(); + + let args = self.required_operands(); + if args.is_empty() { + return Ok(()); + } + + let mut constraints = emitter.constraints_for(op, &args); + let mut args = args.into_smallvec(); + + // For `i128`/`u128` we use a different stack order for 64-bit limbs. + // + // The IR specifies limbs most-significant to least-significant, but the runtime stack + // representation for two 64-bit limbs is (lo, hi). + if args.len() == 2 && matches!(self.ty(), Type::I128 | Type::U128) { + args.swap(0, 1); + constraints.swap(0, 1); + } + + emitter + .schedule_operands( + &args, + &constraints, + op.span(), + SolverOptions { + strict: true, + ..Default::default() + }, + ) + .unwrap_or_else(|err| { + panic!( + "failed to schedule operands: {args:?}\nfor inst '{}'\nwith error: \ + {err:?}\nconstraints: {constraints:?}\nstack: {:#?}", + op.name(), + &emitter.stack, + ) + }); + + Ok(()) + } + fn emit(&self, emitter: &mut BlockEmitter<'_>) -> Result<(), Report> { let mut inst_emitter = emitter.inst_emitter(self.as_operation()); - inst_emitter.pop().expect("operand stack is empty"); - inst_emitter.pop().expect("operand stack is empty"); + for _ in 0..self.num_operands() { + inst_emitter.pop().expect("operand stack is empty"); + } inst_emitter.push(self.result().as_value_ref()); Ok(()) } @@ -1223,8 +1271,9 @@ impl HirLowering for arith::Split { fn emit(&self, emitter: &mut BlockEmitter<'_>) -> Result<(), Report> { let mut inst_emitter = emitter.inst_emitter(self.as_operation()); inst_emitter.pop().expect("operand stack is empty"); - inst_emitter.push(self.result_low().as_value_ref()); - inst_emitter.push(self.result_high().as_value_ref()); + for limb in self.limbs().iter().rev() { + inst_emitter.push(limb.borrow().as_value_ref()); + } Ok(()) } } diff --git a/codegen/masm/src/lower/utils.rs b/codegen/masm/src/lower/utils.rs index b22a37af3..f5707348d 100644 --- a/codegen/masm/src/lower/utils.rs +++ b/codegen/masm/src/lower/utils.rs @@ -2,7 +2,7 @@ use midenc_dialect_scf as scf; use midenc_hir::{Op, Operation, Region, Report, Spanned, ValueRef}; use smallvec::SmallVec; -use crate::{Constraint, emitter::BlockEmitter, masm}; +use crate::{Constraint, emitter::BlockEmitter, masm, opt::operands::SolverOptions}; /// Emit a conditonal branch-like region, e.g. `scf.if`. /// @@ -181,7 +181,7 @@ pub fn emit_binary_search( (then_emitter.into_emitted_block(span), then_stack) }; - let (else_blk, else_stack) = { + let else_blk = { let default_region = op.default_region(); let is_live_after = emitter .liveness @@ -197,19 +197,31 @@ pub fn emit_binary_search( for (index, result) in op.results().all().into_iter().enumerate() { else_stack.rename(index, *result as ValueRef); } - (else_emitter.into_emitted_block(span), else_stack) - }; - if then_stack != else_stack { - panic!( - "unexpected observable stack effect leaked from regions of {} + // Schedule realignment of the stack if needed + if then_stack != else_stack { + schedule_stack_realignment(&then_stack, &else_stack, &mut else_emitter); + } + + if cfg!(debug_assertions) { + let mut else_stack = else_emitter.stack.clone(); + for (index, result) in op.results().all().into_iter().enumerate() { + else_stack.rename(index, *result as ValueRef); + } + if then_stack != else_stack { + panic!( + "unexpected observable stack effect leaked from regions of {} stack on exit from 'then': {then_stack:#?} stack on exit from 'else': {else_stack:#?} - ", - op.as_operation() - ); - } +", + op.as_operation() + ); + } + } + + else_emitter.into_emitted_block(span) + }; emitter.emit_op(masm::Op::If { span, @@ -455,9 +467,11 @@ pub fn schedule_stack_realignment( assert_eq!(lhs.len(), rhs.len()); - log::trace!(target: "codegen", "stack realignment required, scheduling moves.."); - log::trace!(target: "codegen", " desired stack state: {lhs:#?}"); - log::trace!(target: "codegen", " misaligned stack state: {rhs:#?}"); + let trace_target = emitter.trace_target.clone().with_topic("operand-scheduling"); + + log::trace!(target: &trace_target, "stack realignment required, scheduling moves.."); + log::trace!(target: &trace_target, " desired stack state: {lhs:#?}"); + log::trace!(target: &trace_target, " misaligned stack state: {rhs:#?}"); let mut constraints = SmallVec::<[Constraint; 8]>::with_capacity(lhs.len()); constraints.resize(lhs.len(), Constraint::Move); @@ -467,7 +481,11 @@ pub fn schedule_stack_realignment( .rev() .map(|o| o.as_value().expect("unexpected operand type")) .collect::>(); - match OperandMovementConstraintSolver::new(&expected, &constraints, rhs) { + let options = SolverOptions { + trace_target: emitter.trace_target.clone().with_topic("solver"), + ..SolverOptions::default() + }; + match OperandMovementConstraintSolver::new_with_options(&expected, &constraints, rhs, options) { Ok(solver) => { solver .solve_and_apply(&mut emitter.emitter(), Default::default()) @@ -493,7 +511,7 @@ mod tests { use midenc_dialect_scf::StructuredControlFlowOpBuilder; use midenc_expect_test::expect_file; use midenc_hir::{ - AbiParam, Context, Ident, OpBuilder, Signature, Type, + AbiParam, Context, Ident, OpBuilder, Signature, TraceTarget, Type, dialects::builtin::{self, BuiltinOpBuilder, FunctionBuilder, FunctionRef}, formatter::PrettyPrint, pass::AnalysisManager, @@ -511,8 +529,9 @@ mod tests { let mut builder = OpBuilder::new(context.clone()); + let function_name = Ident::with_empty_span("test".into()); let function_ref = builder.create_function( - Ident::with_empty_span("test".into()), + function_name, Signature::new( [AbiParam::new(Type::U32), AbiParam::new(Type::U32)], [AbiParam::new(Type::U32)], @@ -573,6 +592,8 @@ mod tests { invoked: &mut invoked, target: Default::default(), stack, + trace_target: TraceTarget::category("codegen") + .with_relevant_symbol(function_name.as_symbol()), }; // Lower input @@ -597,8 +618,9 @@ mod tests { let mut builder = OpBuilder::new(context.clone()); + let function_name = Ident::with_empty_span("test".into()); let function_ref = builder.create_function( - Ident::with_empty_span("test".into()), + function_name, Signature::new( [AbiParam::new(Type::U32), AbiParam::new(Type::U32)], [AbiParam::new(Type::U32)], @@ -671,6 +693,8 @@ mod tests { invoked: &mut invoked, target: Default::default(), stack, + trace_target: TraceTarget::category("codegen") + .with_relevant_symbol(function_name.as_symbol()), }; // Lower input @@ -690,7 +714,7 @@ mod tests { #[test] fn util_emit_binary_search_single_case_test() -> Result<(), Report> { - let _ = env_logger::Builder::from_env("MIDENC_TRACE") + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") .format_timestamp(None) .is_test(true) .try_init(); @@ -712,7 +736,7 @@ mod tests { #[test] fn util_emit_binary_search_two_cases_test() -> Result<(), Report> { - let _ = env_logger::Builder::from_env("MIDENC_TRACE") + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") .format_timestamp(None) .is_test(true) .try_init(); @@ -734,7 +758,7 @@ mod tests { #[test] fn util_emit_binary_search_three_cases_test() -> Result<(), Report> { - let _ = env_logger::Builder::from_env("MIDENC_TRACE") + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") .format_timestamp(None) .is_test(true) .try_init(); @@ -756,7 +780,7 @@ mod tests { #[test] fn util_emit_binary_search_four_cases_test() -> Result<(), Report> { - let _ = env_logger::Builder::from_env("MIDENC_TRACE") + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") .format_timestamp(None) .is_test(true) .try_init(); @@ -778,7 +802,7 @@ mod tests { #[test] fn util_emit_binary_search_five_cases_test() -> Result<(), Report> { - let _ = env_logger::Builder::from_env("MIDENC_TRACE") + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") .format_timestamp(None) .is_test(true) .try_init(); @@ -800,7 +824,7 @@ mod tests { #[test] fn util_emit_binary_search_seven_cases_test() -> Result<(), Report> { - let _ = env_logger::Builder::from_env("MIDENC_TRACE") + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") .format_timestamp(None) .is_test(true) .try_init(); @@ -826,8 +850,9 @@ mod tests { ) -> Result<(FunctionRef, masm::Block), Report> { let mut builder = OpBuilder::new(context.clone()); + let function_name = Ident::with_empty_span("test".into()); let function_ref = builder.create_function( - Ident::with_empty_span("test".into()), + function_name, Signature::new( [AbiParam::new(Type::U32), AbiParam::new(Type::U32)], [AbiParam::new(Type::U32)], @@ -888,6 +913,8 @@ mod tests { invoked: &mut invoked, target: Default::default(), stack, + trace_target: TraceTarget::category("codegen") + .with_relevant_symbol(function_name.as_symbol()), }; // Lower input diff --git a/codegen/masm/src/opt/operands/mod.rs b/codegen/masm/src/opt/operands/mod.rs index eb4f6eb76..129efb5ad 100644 --- a/codegen/masm/src/opt/operands/mod.rs +++ b/codegen/masm/src/opt/operands/mod.rs @@ -10,6 +10,9 @@ pub use midenc_hir::{StackOperand as Operand, ValueOrAlias}; pub use self::solver::{OperandMovementConstraintSolver, SolverError, SolverOptions}; use self::{context::SolverContext, stack::Stack}; +/// The number of field elements addressable by MASM stack manipulation instructions. +pub(crate) const MASM_STACK_WINDOW_FELTS: usize = 16; + /// This represents a specific action that should be taken by /// the code generator with regard to an operand on the stack. /// @@ -17,7 +20,7 @@ use self::{context::SolverContext, stack::Stack}; /// the effect of which is to place all of the current instruction's /// operands exactly where they need to be, just when they are /// needed. -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum Action { /// Copy the operand at the given index to the top of the stack Copy(u8), diff --git a/codegen/masm/src/opt/operands/solver.rs b/codegen/masm/src/opt/operands/solver.rs index 92a1986f3..1b13cec94 100644 --- a/codegen/masm/src/opt/operands/solver.rs +++ b/codegen/masm/src/opt/operands/solver.rs @@ -1,4 +1,4 @@ -use midenc_hir::{self as hir, SourceSpan}; +use midenc_hir::{self as hir, SourceSpan, TraceTarget}; use smallvec::SmallVec; use super::{tactics::Tactic, *}; @@ -14,8 +14,14 @@ pub enum SolverError { } /// Configures the behavior of the [OperandMovementConstraintSolver]. -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Clone)] pub struct SolverOptions { + /// Used for tracing to enable filtering trace messages by symbol + pub trace_target: TraceTarget, + /// An integer representing the amount of optimization fuel we have available + /// + /// The more fuel, the more effort will be spent attempting to find an optimal solution. + pub fuel: usize, /// This flag conveys to the solver that the solution(s) it computes must adhere strictly to /// the order of the expected operands provided to the solver. /// @@ -30,17 +36,14 @@ pub struct SolverOptions { /// the instruction semantics are equivalent in any permutation. Using non-strict operation in /// any other use case is likely to lead to miscompilation. pub strict: bool, - /// An integer representing the amount of optimization fuel we have available - /// - /// The more fuel, the more effort will be spent attempting to find an optimal solution. - pub fuel: usize, } impl Default for SolverOptions { fn default() -> Self { Self { + trace_target: TraceTarget::category("codegen").with_topic("solver"), strict: true, - fuel: 25, + fuel: 40, } } } @@ -124,8 +127,53 @@ pub struct OperandMovementConstraintSolver { fuel: usize, } impl OperandMovementConstraintSolver { + /// Returns true if `solution` would require accessing stack slots beyond what MASM supports. + /// + /// MASM stack manipulation instructions can only directly access the first 16 *field elements* + /// on the operand stack (indices `0..=15`). Since a single operand may consist of multiple + /// field elements, an operand index `< 16` can still map to an invalid MASM stack offset. + pub(crate) fn solution_requires_unsupported_stack_access( + solution: &[Action], + stack: &Stack, + ) -> bool { + let mut pending = stack.clone(); + for action in solution.iter().copied() { + let index = match action { + Action::Copy(index) + | Action::Swap(index) + | Action::MoveUp(index) + | Action::MoveDown(index) => index as usize, + }; + + let required_stack_depth: usize = + pending.iter().rev().take(index + 1).map(|v| v.stack_size()).sum(); + if required_stack_depth > MASM_STACK_WINDOW_FELTS { + return true; + } + + match action { + Action::Copy(index) => { + let value = pending[index as usize]; + pending.push(value); + } + Action::Swap(index) => { + pending.swap(index as usize); + } + Action::MoveUp(index) => { + pending.movup(index as usize); + } + Action::MoveDown(index) => { + pending.movdn(index as usize); + } + } + } + + false + } + /// Construct a new solver for the given expected operands, constraints, and operand stack /// state. + #[cfg(test)] pub fn new( expected: &[hir::ValueRef], constraints: &[Constraint], @@ -153,6 +201,11 @@ impl OperandMovementConstraintSolver { }) } + #[inline] + fn trace_target(&self) -> &TraceTarget { + &self.context.options().trace_target + } + /// Compute a solution that can be used to get the stack into the correct state pub fn solve(mut self) -> Result, SolverError> { use super::tactics::*; @@ -178,11 +231,13 @@ impl OperandMovementConstraintSolver { if is_binary { self.tactics.push(Box::new(TwoArgs)); } else if self.context.copies().is_empty() { + self.tactics.push(Box::new(LinearStackWindow)); self.tactics.push(Box::new(Linear)); self.tactics.push(Box::new(SwapAndMoveUp)); self.tactics.push(Box::new(MoveUpAndSwap)); self.tactics.push(Box::new(MoveDownAndSwap)); } else { + self.tactics.push(Box::new(LinearStackWindow)); self.tactics.push(Box::new(Linear)); self.tactics.push(Box::new(CopyAll)); } @@ -214,36 +269,57 @@ impl OperandMovementConstraintSolver { Ok(_) => { if builder.is_valid() { let solution = builder.take(); - let solution_size = solution.len(); - let best_size = best_solution.as_ref().map(|best| best.len()); - match best_size { - Some(best_size) if best_size > solution_size => { - best_solution = Some(solution); - log::trace!( - "a better solution ({solution_size} vs {best_size}) was found \ - using tactic {}", - tactic.name() - ); - } - Some(best_size) => { - log::trace!( - "a solution of size {solution_size} was found using tactic \ - {}, but it is no better than the best found so far \ - ({best_size})", - tactic.name() - ); - } - None => { - best_solution = Some(solution); - log::trace!( - "an initial solution of size {solution_size} was found using \ - tactic {}", - tactic.name() - ); + if Self::solution_requires_unsupported_stack_access( + &solution, + self.context.stack(), + ) { + log::trace!( + target: self.trace_target(), + symbol = self.trace_target().relevant_symbol(); + "a solution was found using tactic {}, but it requires stack \ + access deeper than supported by MASM; rejecting it", + tactic.name() + ); + } else { + let solution_size = solution.len(); + let best_size = best_solution.as_ref().map(|best| best.len()); + match best_size { + Some(best_size) if best_size > solution_size => { + best_solution = Some(solution); + log::trace!( + target: self.trace_target(), + symbol = self.trace_target().relevant_symbol(); + "a better solution ({solution_size} vs {best_size}) was \ + found using tactic {}", + tactic.name() + ); + } + Some(best_size) => { + log::trace!( + target: self.trace_target(), + symbol = self.trace_target().relevant_symbol(); + "a solution of size {solution_size} was found using \ + tactic {}, but it is no better than the best found so \ + far ({best_size})", + tactic.name() + ); + } + None => { + best_solution = Some(solution); + log::trace!( + target: self.trace_target(), + symbol = self.trace_target().relevant_symbol(); + "an initial solution of size {solution_size} was found \ + using tactic {}", + tactic.name() + ); + } } } } else { log::trace!( + target: self.trace_target(), + symbol = self.trace_target().relevant_symbol(); "a partial solution was found using tactic {}, but is not sufficient \ on its own", tactic.name() @@ -252,16 +328,24 @@ impl OperandMovementConstraintSolver { } } Err(_) => { - log::trace!("tactic {} could not be applied", tactic.name()); + log::trace!(target: self.trace_target(), symbol = self.trace_target().relevant_symbol(); "tactic {} could not be applied", tactic.name()); builder.discard(); } } let remaining_fuel = self.fuel.saturating_sub(tactic.cost(&self.context)); - if remaining_fuel == 0 { - log::trace!("no more optimization fuel, using the best solution found so far"); + self.fuel = remaining_fuel; + + // If we have no optimization fuel, we should still exhaust tactics until we find a + // supported solution. However, once we have a candidate solution, we stop searching + // for better ones. + if remaining_fuel == 0 && best_solution.is_some() { + log::trace!( + target: self.trace_target(), + symbol = self.trace_target().relevant_symbol(); + "no more optimization fuel, using the best solution found so far" + ); break; } - self.fuel = remaining_fuel; } best_solution.take().ok_or(SolverError::NoSolution) @@ -279,9 +363,19 @@ impl OperandMovementConstraintSolver { // The tactic was applied successfully Ok(_) => { if builder.is_valid() { - Ok(Some(builder.take())) + let solution = builder.take(); + if Self::solution_requires_unsupported_stack_access( + &solution, + self.context.stack(), + ) { + Ok(None) + } else { + Ok(Some(solution)) + } } else { log::trace!( + target: self.trace_target(), + symbol = self.trace_target().relevant_symbol(); "a partial solution was found using tactic {}, but is not sufficient on \ its own", tactic.name() @@ -290,7 +384,7 @@ impl OperandMovementConstraintSolver { } } Err(_) => { - log::trace!("tactic {} could not be applied", tactic.name()); + log::trace!(target: self.trace_target(), symbol = self.trace_target().relevant_symbol(); "tactic {} could not be applied", tactic.name()); Err(SolverError::NoSolution) } } @@ -361,6 +455,180 @@ mod tests { use super::{super::testing, *}; + /// Apply `actions` to `stack` and return the resulting stack. + fn apply_actions(mut stack: crate::OperandStack, actions: &[Action]) -> crate::OperandStack { + for action in actions.iter().copied() { + match action { + Action::Copy(index) => stack.dup(index as usize), + Action::Swap(index) => stack.swap(index as usize), + Action::MoveUp(index) => stack.movup(index as usize), + Action::MoveDown(index) => stack.movdn(index as usize), + } + } + stack + } + + /// Regression test: copy materialization can increase stack depth in field elements, and the + /// solver must fall back to a tactic that avoids producing unsupported stack accesses. + #[test] + fn operand_movement_constraint_solver_stack_window_fallback_full_window_top_copy() { + let problem = testing::make_problem_inputs((0..16).collect(), 16, 0b0000_0000_0000_0001); + let context = SolverContext::new( + &problem.expected, + &problem.constraints, + &problem.stack, + SolverOptions { + fuel: 10, + ..Default::default() + }, + ) + .expect("expected solver context to be valid"); + + let actions = OperandMovementConstraintSolver::new_with_options( + &problem.expected, + &problem.constraints, + &problem.stack, + SolverOptions { + fuel: 10, + ..Default::default() + }, + ) + .expect("expected solver context to be valid") + .solve() + .expect("expected solver to find a supported solution via fallback"); + + let pending = apply_actions(problem.stack.clone(), &actions); + for (index, expected) in problem.expected.iter().copied().enumerate() { + assert_eq!(&pending[index], &expected); + } + assert!( + !OperandMovementConstraintSolver::solution_requires_unsupported_stack_access( + &actions, + context.stack(), + ), + "solver produced a solution requiring unsupported stack access: {problem:#?}" + ); + } + + /// Regression test: ensure solver fallback avoids 16-felt addressing violations during copy + /// materialization when a copy source would otherwise be pushed out of the addressable window. + #[test] + fn operand_movement_constraint_solver_stack_window_fallback_regression_case() { + let problem = testing::make_problem_inputs( + vec![0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 2], + 4, + 0b0111, + ); + let solver_context = SolverContext::new( + &problem.expected, + &problem.constraints, + &problem.stack, + SolverOptions { + fuel: 10, + ..Default::default() + }, + ) + .expect("expected solver context to be valid"); + + let actions = OperandMovementConstraintSolver::new_with_options( + &problem.expected, + &problem.constraints, + &problem.stack, + SolverOptions { + fuel: 10, + ..Default::default() + }, + ) + .expect("expected solver context to be valid") + .solve() + .expect("expected solver to find a supported solution via fallback"); + + let pending = apply_actions(problem.stack.clone(), &actions); + for (index, expected) in problem.expected.iter().copied().enumerate() { + assert_eq!(&pending[index], &expected); + } + assert!( + !OperandMovementConstraintSolver::solution_requires_unsupported_stack_access( + &actions, + solver_context.stack(), + ), + "solver produced a solution requiring unsupported stack access: {problem:#?}" + ); + } + + /// Regression test: ensure fallback works even when the full-window stack is not already in the + /// expected order. + #[test] + fn operand_movement_constraint_solver_stack_window_fallback_full_window_nontrivial_permutation() + { + let problem = testing::make_problem_inputs( + vec![0, 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], + 16, + 0b0000_0000_0000_0001, + ); + let solver_context = SolverContext::new( + &problem.expected, + &problem.constraints, + &problem.stack, + SolverOptions { + fuel: 10, + ..Default::default() + }, + ) + .expect("expected solver context to be valid"); + + let actions = OperandMovementConstraintSolver::new_with_options( + &problem.expected, + &problem.constraints, + &problem.stack, + SolverOptions { + fuel: 10, + ..Default::default() + }, + ) + .expect("expected solver context to be valid") + .solve() + .expect("expected solver to find a supported solution via fallback"); + + let pending = apply_actions(problem.stack.clone(), &actions); + for (index, expected) in problem.expected.iter().copied().enumerate() { + assert_eq!(&pending[index], &expected); + } + assert!( + !OperandMovementConstraintSolver::solution_requires_unsupported_stack_access( + &actions, + solver_context.stack(), + ), + "solver produced a solution requiring unsupported stack access: {problem:#?}" + ); + } + + /// Regression test: ensure we still try all tactics even when we have no optimization fuel. + #[test] + fn operand_movement_constraint_solver_exhausts_tactics_when_out_of_fuel() { + // A mixed copy/move problem: the `CopyAll` tactic will fail its precondition, but `Linear` + // can still find a solution. + let problem = testing::make_problem_inputs(vec![0, 1, 2], 3, 0b0000_0000_0000_0001); + + let actions = OperandMovementConstraintSolver::new_with_options( + &problem.expected, + &problem.constraints, + &problem.stack, + SolverOptions { + fuel: 0, + ..Default::default() + }, + ) + .expect("expected solver context to be valid") + .solve() + .expect("expected solver to find a solution even with no optimization fuel"); + + let pending = apply_actions(problem.stack.clone(), &actions); + for (index, expected) in problem.expected.iter().copied().enumerate() { + assert_eq!(&pending[index], &expected); + } + } + #[test] fn operand_movement_constraint_solver_example() { use hir::Context; @@ -555,5 +823,10 @@ mod tests { fn operand_movement_constraint_solver_copy_some(problem in testing::generate_copy_some_problem()) { testing::solve_problem(problem)? } + + #[test] + fn operand_tactics_linear_proptest(problem in testing::generate_linear_problem()) { + testing::solve_problem(problem)? + } } } diff --git a/codegen/masm/src/opt/operands/tactics/copy_all.rs b/codegen/masm/src/opt/operands/tactics/copy_all.rs index d79793da7..92eb1aa9b 100644 --- a/codegen/masm/src/opt/operands/tactics/copy_all.rs +++ b/codegen/masm/src/opt/operands/tactics/copy_all.rs @@ -5,16 +5,20 @@ use super::*; /// As a precondition, this tactic requires that all expected operands are copies. #[derive(Default)] pub struct CopyAll; + impl Tactic for CopyAll { fn cost(&self, context: &SolverContext) -> usize { core::cmp::max(context.copies().len(), 1) } fn apply(&mut self, builder: &mut SolutionBuilder) -> TacticResult { + let trace_target = builder.trace_target().clone().with_topic("solver:copy-all"); + // We can't apply this tactic if any values should be moved let arity = builder.arity(); if builder.num_copies() != arity { log::trace!( + target: &trace_target, "expected all operands to require copying; but only {} out of {} operands are \ copied", builder.num_copies(), @@ -35,6 +39,7 @@ impl Tactic for CopyAll { }); // A copy already exists, so use it log::trace!( + target: &trace_target, "copying {expected_value:?} at index {index} to top of stack, shifting {:?} down \ one", builder.unwrap_current(0) diff --git a/codegen/masm/src/opt/operands/tactics/linear.rs b/codegen/masm/src/opt/operands/tactics/linear.rs index 42cd62973..689a4729e 100644 --- a/codegen/masm/src/opt/operands/tactics/linear.rs +++ b/codegen/masm/src/opt/operands/tactics/linear.rs @@ -20,6 +20,8 @@ impl Tactic for Linear { } fn apply(&mut self, builder: &mut SolutionBuilder) -> TacticResult { + let trace_target = builder.trace_target().clone().with_topic("solver:linear"); + let mut changed = true; while changed { changed = false; @@ -32,6 +34,7 @@ impl Tactic for Linear { // Where is B if let Some(_b_at) = builder.get_current_position(b_value) { log::trace!( + target: &trace_target, "no copy needed for {b_value:?} from index {b_pos} to top of stack", ); materialized.insert(*b_value); @@ -40,6 +43,7 @@ impl Tactic for Linear { assert!(b_value.is_alias()); let b_at = builder.unwrap_current_position(&b_value.unaliased()); log::trace!( + target: &trace_target, "materializing copy of {b_value:?} from index {b_pos} to top of stack", ); builder.dup(b_at, b_value.unwrap_alias()); @@ -62,6 +66,7 @@ impl Tactic for Linear { if let Some(expected_at) = builder.get_expected_position(&value) { if currently_at == expected_at { log::trace!( + target: &trace_target, "{value:?} at index {currently_at} is expected there, no movement \ needed" ); @@ -70,6 +75,7 @@ impl Tactic for Linear { } let occupied_by = builder.unwrap_current(expected_at); log::trace!( + target: &trace_target, "{value:?} at index {currently_at}, is expected at index {expected_at}, \ which is currently occupied by {occupied_by:?}" ); @@ -104,6 +110,7 @@ impl Tactic for Linear { // are materialized initially. let mut root = parent.unwrap(); log::trace!( + target: &trace_target, "{value:?} at index {currently_at}, is not an expected operand; but must \ be moved to make space for {:?}", root.value @@ -116,6 +123,7 @@ impl Tactic for Linear { graph.neighbors_directed(parent_operand, Direction::Incoming).next(); } log::trace!( + target: &trace_target, "forming component with {value:?} by adding edge to {:?}, the start of \ the path which led to it", root.value @@ -132,6 +140,7 @@ impl Tactic for Linear { break; } log::trace!( + target: &trace_target, "found the following connected components when analyzing required operand moves: \ {components:?}" ); @@ -181,6 +190,7 @@ impl Tactic for Linear { // Find the operand at the shallowest depth on the stack to move. let start = component.iter().min_by(|a, b| a.pos.cmp(&b.pos)).copied().unwrap(); log::trace!( + target: &trace_target, "resolving component {component:?} by starting from {:?} at index {}", start.value, start.pos @@ -199,6 +209,7 @@ impl Tactic for Linear { // Swap each child with its parent until we reach the edge that forms a cycle while child != start { log::trace!( + target: &trace_target, "swapping {:?} with {:?} at index {}", builder.unwrap_current(0), child.value, @@ -240,27 +251,110 @@ impl Tactic for Linear { #[cfg(test)] mod tests { - use proptest::prelude::*; - use crate::opt::operands::{ - tactics::Linear, - testing::{self, ProblemInputs}, + use crate::opt::{ + OperandMovementConstraintSolver, + operands::{ + Action, SolverOptions, + tactics::Linear, + testing::{self, ProblemInputs}, + }, }; - prop_compose! { - fn generate_linear_problem() - (stack_size in 0usize..16) - (problem in testing::generate_stack_subset_copy_any_problem(stack_size)) -> ProblemInputs { - problem - } + /// Solve `problem` using only the [Linear] tactic. + fn solve_with_linear_tactic(problem: &ProblemInputs) -> Vec { + OperandMovementConstraintSolver::new_with_options( + &problem.expected, + &problem.constraints, + &problem.stack, + SolverOptions { + fuel: 10, + ..Default::default() + }, + ) + .expect("expected solver context to be valid") + .solve_with_tactic::() + .expect("expected tactic to be applicable") + .expect("expected tactic to produce a full solution") } - proptest! { - #![proptest_config(ProptestConfig::with_cases(2000))] + /// Apply `actions` to the operand stack and assert that the expected prefix matches. + fn assert_actions_place_expected_on_top(problem: &ProblemInputs, actions: &[Action]) { + let mut stack = problem.stack.clone(); + for action in actions.iter().copied() { + match action { + Action::Copy(index) => stack.dup(index as usize), + Action::Swap(index) => stack.swap(index as usize), + Action::MoveUp(index) => stack.movup(index as usize), + Action::MoveDown(index) => stack.movdn(index as usize), + } + } - #[test] - fn operand_tactics_linear_proptest(problem in generate_linear_problem()) { - testing::solve_problem_with_tactic::(problem)? + for (index, expected) in problem.expected.iter().copied().enumerate() { + assert_eq!( + &stack[index], &expected, + "solution did not place {} at the correct location on the stack", + expected + ); } } + + /// Demonstrates the simplest cycle: the top two expected operands are swapped. + /// + /// The tactic should resolve this with a single `swap(1)`. + #[test] + fn linear_two_cycle_at_top_uses_single_swap() { + let problem = testing::make_problem_inputs(vec![1, 0], 2, 0); + let actions = solve_with_linear_tactic(&problem); + assert_eq!(actions, vec![Action::Swap(1)]); + assert_actions_place_expected_on_top(&problem, &actions); + } + + /// Demonstrates a 3-cycle permutation of expected operands. + /// + /// The tactic resolves the cycle by swapping the top operand into its destination, which + /// brings the next operand to the top, and repeats until the cycle is closed. + #[test] + fn linear_three_cycle_resolves_with_two_swaps() { + let problem = testing::make_problem_inputs(vec![2, 0, 1], 3, 0); + let actions = solve_with_linear_tactic(&problem); + assert_eq!(actions, vec![Action::Swap(2), Action::Swap(1)]); + assert_actions_place_expected_on_top(&problem, &actions); + } + + /// Demonstrates how the tactic resolves a cycle that does not include the top of stack. + /// + /// The tactic picks the shallowest member of the cycle, `movup`s it to the top to avoid + /// disturbing unrelated operands, performs swaps along the cycle, then `movdn`s back. + #[test] + fn linear_cycle_below_top_uses_movup_swap_movdn() { + let problem = testing::make_problem_inputs(vec![0, 1, 3, 2], 4, 0); + let actions = solve_with_linear_tactic(&problem); + assert_eq!(actions, vec![Action::MoveUp(2), Action::Swap(3), Action::MoveDown(2)]); + assert_actions_place_expected_on_top(&problem, &actions); + } + + /// Demonstrates how the tactic handles a non-expected operand that occupies a needed slot. + /// + /// The tactic forms a cycle that includes the extra value, so that resolving the cycle both + /// places expected operands and pushes the extra operand below the expected prefix. + #[test] + fn linear_evicts_non_expected_operand_by_forming_cycle() { + let problem = testing::make_problem_inputs(vec![1, 2, 0], 2, 0); + let actions = solve_with_linear_tactic(&problem); + assert_eq!(actions, vec![Action::Swap(1), Action::Swap(2)]); + assert_actions_place_expected_on_top(&problem, &actions); + } + + /// Demonstrates the "materialize copies first" phase. + /// + /// Here, the only missing expected operand is a copy of `v0`, so the tactic should emit a + /// single `dup` from the current position of `v0`. + #[test] + fn linear_materializes_copy_with_dup_from_source_index() { + let problem = testing::make_problem_inputs(vec![1, 0], 2, 0b0001); + let actions = solve_with_linear_tactic(&problem); + assert_eq!(actions, vec![Action::Copy(1)]); + assert_actions_place_expected_on_top(&problem, &actions); + } } diff --git a/codegen/masm/src/opt/operands/tactics/linear_stack_window.rs b/codegen/masm/src/opt/operands/tactics/linear_stack_window.rs new file mode 100644 index 000000000..3599a9871 --- /dev/null +++ b/codegen/masm/src/opt/operands/tactics/linear_stack_window.rs @@ -0,0 +1,405 @@ +use super::*; +use crate::opt::operands::MASM_STACK_WINDOW_FELTS; + +/// Represents the portion of the operand stack which is directly addressable by MASM stack +/// manipulation instructions. +#[derive(Debug, Copy, Clone)] +struct AddressableStackWindow { + /// The deepest stack operand index (0-based from the top) which remains addressable. + deepest_index: u8, + /// The total number of field elements contained in the addressable portion of the stack. + depth_felts: usize, +} +impl AddressableStackWindow { + /// Compute the addressable window for `stack`. + /// + /// Returns `None` if the top operand itself exceeds the MASM stack window. + fn for_stack(stack: &Stack) -> Option { + let mut depth_felts = 0usize; + let mut deepest_index = None; + for (pos, operand) in stack.iter().rev().enumerate() { + depth_felts += operand.stack_size(); + if depth_felts > MASM_STACK_WINDOW_FELTS { + break; + } + deepest_index = Some(pos as u8); + } + + deepest_index.map(|deepest_index| Self { + deepest_index, + depth_felts, + }) + } +} + +/// Returns the deepest addressable source index for materializing a copy of `value`. +/// +/// MASM stack manipulation instructions can only directly access the first 16 field elements on +/// the operand stack. Since a single operand may consist of multiple field elements, we must +/// ensure the copy source is within that addressable window. +fn find_deepest_addressable_copy_source(stack: &Stack, value: &ValueOrAlias) -> Option { + let target = value.unaliased(); + let mut required_depth = 0usize; + let mut source = None; + for (pos, operand) in stack.iter().rev().enumerate() { + required_depth += operand.stack_size(); + if required_depth > MASM_STACK_WINDOW_FELTS { + break; + } + if operand.unaliased() == target { + source = Some(pos as u8); + } + } + source +} + +/// Moves move-constrained expected operands towards the top if copy materialization would push them +/// beyond the MASM addressable window. +/// +/// Returns `true` if the stack state was modified. +fn preemptively_move_endangered_operands_to_top( + builder: &mut SolutionBuilder, + trace_target: &TraceTarget, +) -> bool { + let missing_copy_felts: usize = builder + .context() + .expected() + .iter() + .filter(|value| value.is_alias() && builder.get_current_position(value).is_none()) + .map(|value| value.stack_size()) + .sum(); + if missing_copy_felts == 0 { + return false; + } + + log::trace!( + target: &trace_target, + "preemptively moving endangered operands to preserve addressability: missing_copy_felts={missing_copy_felts}", + ); + + let mut changed = false; + + // Repeatedly move the deepest move-constrained operand that would fall out of the addressable + // window to the top. This avoids generating solutions that require unsupported stack access + // when copies are materialized. + loop { + let mut worst: Option<(u8, usize, ValueOrAlias)> = None; + for value in builder.context().expected().iter() { + if value.is_alias() { + continue; + } + let Some(pos) = builder.get_current_position(value) else { + continue; + }; + let current_depth: usize = builder + .stack() + .iter() + .rev() + .take(pos as usize + 1) + .map(|v| v.stack_size()) + .sum(); + let projected_depth = current_depth + missing_copy_felts; + if projected_depth > MASM_STACK_WINDOW_FELTS { + match worst { + None => worst = Some((pos, current_depth, *value)), + Some((_, best_depth, _)) if current_depth > best_depth => { + worst = Some((pos, current_depth, *value)) + } + _ => {} + } + } + } + + let Some((pos, current_depth, value)) = worst else { + break; + }; + if pos == 0 { + break; + } + log::trace!( + target: &trace_target, + "moving endangered operand {value:?} at index {pos} (depth_felts={current_depth}) to top", + ); + builder.movup(pos); + changed = true; + } + + changed +} + +/// Returns `true` if any expected copies are missing from the current stack. +fn has_missing_expected_copies(builder: &SolutionBuilder) -> bool { + builder + .context() + .expected() + .iter() + .any(|value| value.is_alias() && builder.get_current_position(value).is_none()) +} + +/// Materialize a missing expected copy with a bias towards keeping the top-of-stack window +/// addressable. +fn materialize_copy( + builder: &mut SolutionBuilder, + source_at: u8, + expected: ValueOrAlias, + trace_target: &TraceTarget, +) { + let expected_felts: usize = + builder.context().expected().iter().map(|value| value.stack_size()).sum(); + + // When the expected operands occupy the full MASM stack window, any materialized copy implies + // that at least one preserved source operand must be pushed out of the addressable window. + // + // We do this by moving the chosen source operand to the deepest addressable position before + // duplicating it. This ensures the source is pushed below the 16-felt window by the dup itself + // and avoids emitting `movdn(16)` / `movup(16)` patterns which MASM cannot encode. + if expected_felts == MASM_STACK_WINDOW_FELTS + && let Some(window) = AddressableStackWindow::for_stack(builder.stack()) + && window.depth_felts == MASM_STACK_WINDOW_FELTS + { + log::trace!( + target: &trace_target, + "materializing copy of {expected:?} from index {source_at} using window-preserving strategy (expected_felts={expected_felts})", + ); + if source_at > 0 { + builder.movup(source_at); + } + if window.deepest_index > 0 { + builder.movdn(window.deepest_index); + } + builder.dup(window.deepest_index, expected.unwrap_alias()); + return; + } + + log::trace!( + target: &trace_target, + "materializing copy of {expected:?} from index {source_at} to top of stack (expected_felts={expected_felts})", + ); + builder.dup(source_at, expected.unwrap_alias()); +} + +/// Materialize missing copies in a way which preserves addressability within the MASM stack window. +/// +/// Returns `true` if any actions were emitted. +fn materialize_missing_expected_copies( + builder: &mut SolutionBuilder, + trace_target: &TraceTarget, +) -> Result { + let mut changed = false; + loop { + let mut next_copy: Option<(u8, ValueOrAlias)> = None; + for expected in builder.context().expected().iter() { + if builder.get_current_position(expected).is_some() { + continue; + } + // `expected` isn't on the stack because it is a copy we haven't materialized yet + assert!(expected.is_alias()); + let source_at = find_deepest_addressable_copy_source(builder.stack(), expected) + .ok_or(TacticError::NotApplicable)?; + match next_copy { + None => next_copy = Some((source_at, *expected)), + Some((best_at, _)) if source_at > best_at => { + next_copy = Some((source_at, *expected)) + } + _ => {} + } + } + + let Some((source_at, expected)) = next_copy else { + break; + }; + + materialize_copy(builder, source_at, expected, trace_target); + + changed = true; + } + + Ok(changed) +} + +/// A wrapper around [Linear] that avoids copy materialization patterns which can exceed MASM's +/// 16-field-element addressing window. +/// +/// This tactic is intended as a fallback after [Linear] when expected copies are missing and copy +/// materialization risks pushing required operands beyond the MASM addressable window. +#[derive(Default)] +pub struct LinearStackWindow; +impl Tactic for LinearStackWindow { + fn cost(&self, context: &SolverContext) -> usize { + core::cmp::max(context.copies().len(), 1) + } + + fn apply(&mut self, builder: &mut SolutionBuilder) -> TacticResult { + let trace_target = builder.trace_target().clone().with_topic("solver:linear-window"); + + if !has_missing_expected_copies(builder) { + return Err(TacticError::NotApplicable); + } + + let moved = preemptively_move_endangered_operands_to_top(builder, &trace_target); + let materialized = materialize_missing_expected_copies(builder, &trace_target)?; + if moved || materialized { + log::trace!( + target: &trace_target, + "applied LinearStackWindow tactic: moved_endangered={moved} materialized_missing_copies={materialized}", + ); + } + + if builder.is_valid() { + Ok(()) + } else { + log::trace!( + target: &trace_target, + "produced invalid solution, falling back to Linear tactic", + ); + let mut linear = Linear; + linear.apply(builder) + } + } +} + +#[cfg(test)] +mod tests { + use std::rc::Rc; + + use midenc_hir::{self as hir, Type}; + + use super::*; + use crate::{ + Constraint, OperandStack, + opt::{ + OperandMovementConstraintSolver, + operands::{Action, SolverOptions}, + }, + }; + + /// Apply `actions` to the operand stack and assert that the expected prefix matches. + fn assert_actions_place_expected_on_top( + stack: &OperandStack, + expected: &[hir::ValueRef], + actions: &[Action], + ) { + let mut stack = stack.clone(); + for action in actions.iter().copied() { + match action { + Action::Copy(index) => stack.dup(index as usize), + Action::Swap(index) => stack.swap(index as usize), + Action::MoveUp(index) => stack.movup(index as usize), + Action::MoveDown(index) => stack.movdn(index as usize), + } + } + + for (index, expected) in expected.iter().copied().enumerate() { + assert_eq!( + &stack[index], &expected, + "solution did not place {} at the correct location on the stack", + expected + ); + } + } + + /// Demonstrates the full-window copy materialization pattern. + /// + /// When the expected operands occupy the entire 16-felt MASM stack window, copy + /// materialization can push operands out of the addressable window. The tactic avoids this by + /// moving the copy source to the deepest addressable position before duplicating. + #[test] + fn linear_stack_window_full_window_copy_materialization_moves_source_to_deepest_before_dup() { + let hir_ctx = Rc::new(hir::Context::default()); + let block = hir_ctx.create_block_with_params(core::iter::repeat_n(Type::I128, 4)); + let block = block.borrow(); + let block_args = block.arguments(); + + let mut stack = OperandStack::default(); + // Stack top is `[v1, v2, v3, v0]`. + for value in [ + block_args[0] as hir::ValueRef, + block_args[3] as hir::ValueRef, + block_args[2] as hir::ValueRef, + block_args[1] as hir::ValueRef, + ] { + stack.push(value); + } + + let expected = vec![ + block_args[0] as hir::ValueRef, + block_args[1] as hir::ValueRef, + block_args[2] as hir::ValueRef, + block_args[3] as hir::ValueRef, + ]; + let constraints = + vec![Constraint::Copy, Constraint::Move, Constraint::Move, Constraint::Move]; + + let actions = OperandMovementConstraintSolver::new_with_options( + &expected, + &constraints, + &stack, + SolverOptions { + fuel: 10, + ..Default::default() + }, + ) + .expect("expected solver context to be valid") + .solve_with_tactic::() + .expect("expected tactic to be applicable") + .expect("expected tactic to produce a full solution"); + + assert_eq!(actions, vec![Action::MoveUp(3), Action::MoveDown(3), Action::Copy(3)]); + assert_actions_place_expected_on_top(&stack, &expected, &actions); + } + + /// Demonstrates how the tactic preemptively moves endangered move-constrained operands. + /// + /// Here, the copy source starts on top of the stack, but materializing it would push the + /// deepest move-constrained expected operand out of MASM's 16-felt addressing window. The + /// tactic moves endangered operands to the top before materializing the copy. + #[test] + fn linear_stack_window_full_window_preemptively_moves_endangered_operands() { + let hir_ctx = Rc::new(hir::Context::default()); + let block = hir_ctx.create_block_with_params(core::iter::repeat_n(Type::I128, 4)); + let block = block.borrow(); + let block_args = block.arguments(); + + let mut stack = OperandStack::default(); + // Stack top is `[v0, v1, v2, v3]`. + for value in block_args.iter().copied().rev() { + stack.push(value as hir::ValueRef); + } + + let expected = vec![ + block_args[0] as hir::ValueRef, + block_args[1] as hir::ValueRef, + block_args[2] as hir::ValueRef, + block_args[3] as hir::ValueRef, + ]; + let constraints = + vec![Constraint::Copy, Constraint::Move, Constraint::Move, Constraint::Move]; + + let actions = OperandMovementConstraintSolver::new_with_options( + &expected, + &constraints, + &stack, + SolverOptions { + fuel: 10, + ..Default::default() + }, + ) + .expect("expected solver context to be valid") + .solve_with_tactic::() + .expect("expected tactic to be applicable") + .expect("expected tactic to produce a full solution"); + + assert_eq!( + actions, + vec![ + Action::MoveUp(3), + Action::MoveUp(3), + Action::MoveUp(3), + Action::MoveUp(3), + Action::MoveDown(3), + Action::Copy(3), + ] + ); + assert_actions_place_expected_on_top(&stack, &expected, &actions); + } +} diff --git a/codegen/masm/src/opt/operands/tactics/mod.rs b/codegen/masm/src/opt/operands/tactics/mod.rs index d387eb069..1c8f7893f 100644 --- a/codegen/masm/src/opt/operands/tactics/mod.rs +++ b/codegen/masm/src/opt/operands/tactics/mod.rs @@ -1,17 +1,21 @@ use core::num::NonZeroU8; +use midenc_hir::TraceTarget; + use super::{Action, Operand, SolverContext, Stack, ValueOrAlias}; mod copy_all; mod linear; +mod linear_stack_window; mod move_down_and_swap; mod move_up_and_swap; mod swap_and_move_up; mod two_args; pub use self::{ - copy_all::CopyAll, linear::Linear, move_down_and_swap::MoveDownAndSwap, - move_up_and_swap::MoveUpAndSwap, swap_and_move_up::SwapAndMoveUp, two_args::TwoArgs, + copy_all::CopyAll, linear::Linear, linear_stack_window::LinearStackWindow, + move_down_and_swap::MoveDownAndSwap, move_up_and_swap::MoveUpAndSwap, + swap_and_move_up::SwapAndMoveUp, two_args::TwoArgs, }; /// An error returned by an [OperandMovementConstraintSolver] tactic @@ -123,6 +127,11 @@ impl<'a> SolutionBuilder<'a> { self.context } + #[inline] + pub fn trace_target(&self) -> &TraceTarget { + &self.context.options().trace_target + } + /// Get a reference to the state of the stack after applying the pending solution #[inline(always)] pub fn stack(&self) -> &Stack { diff --git a/codegen/masm/src/opt/operands/tactics/move_down_and_swap.rs b/codegen/masm/src/opt/operands/tactics/move_down_and_swap.rs index 8b94a6c5c..b18023b23 100644 --- a/codegen/masm/src/opt/operands/tactics/move_down_and_swap.rs +++ b/codegen/masm/src/opt/operands/tactics/move_down_and_swap.rs @@ -21,10 +21,14 @@ use super::*; /// desired order, then this tactic was successful. #[derive(Default)] pub struct MoveDownAndSwap; + impl Tactic for MoveDownAndSwap { fn apply(&mut self, builder: &mut SolutionBuilder) -> TacticResult { + let trace_target = builder.trace_target().clone().with_topic("solver:move-down-and-swap"); + if builder.requires_copies() || builder.arity() < 2 { log::trace!( + target: &trace_target, "cannot apply tactic when there are required copies ({}) or fewer than 2 operands \ ({})", builder.requires_copies(), @@ -35,7 +39,7 @@ impl Tactic for MoveDownAndSwap { // If the top operand is already in position, this tactic cannot be applied if builder.is_expected(0) { - log::trace!("abandoning tactic: operand at index 0 is already in position"); + log::trace!(target: &trace_target, "abandoning tactic: operand at index 0 is already in position"); return Err(TacticError::NotApplicable); } @@ -44,9 +48,11 @@ impl Tactic for MoveDownAndSwap { // Extend the target position past any operands which should // come before the operand currently on top of the stack log::trace!( + target: &trace_target, "{actual0:?} expects to be at index {target_pos}, but is on top of the stack" ); log::trace!( + target: &trace_target, "looking for operands after index {target_pos} which need to come before \ {actual0:?} on the stack" ); @@ -71,6 +77,7 @@ impl Tactic for MoveDownAndSwap { }) as u8; // Move the operand to the position we've identified log::trace!( + target: &trace_target, "moving {actual0:?} to {}, shifting {:?} to the top of stack", target_pos + target_offset, builder.unwrap_current(1) @@ -80,6 +87,7 @@ impl Tactic for MoveDownAndSwap { let expected0 = builder.unwrap_expected(0); let expected0_at = builder.unwrap_current_position(&expected0); log::trace!( + target: &trace_target, "{actual0:?} is not an expected operand, but is occupying index {expected0_at}, \ where we expect {expected0:?}, evicting.." ); @@ -96,6 +104,7 @@ impl Tactic for MoveDownAndSwap { // potentially try combining this tactic with another // to find a solution log::trace!( + target: &trace_target, "item on top of the stack is now in position, so we cannot proceed further, \ returning possible solution" ); @@ -112,6 +121,7 @@ impl Tactic for MoveDownAndSwap { Some(0) => { // The target expects to be on top, so we can swap log::trace!( + target: &trace_target, "{actual0:?} is expected at {target_pos}, the occupant of which is \ expected on top of the stack, swapping.." ); @@ -120,13 +130,14 @@ impl Tactic for MoveDownAndSwap { Some(pos) if pos == target_pos - 1 => { // The target would be moved into place if we move the top down log::trace!( + target: &trace_target, "moving {actual0:?} to {target_pos}, the occupant of which is expected at \ {pos}" ); builder.movdn(target_pos); } Some(_) | None => { - log::trace!("unable to apply tactic, operands do not match expected pattern"); + log::trace!(target: &trace_target, "unable to apply tactic, operands do not match expected pattern"); return Err(TacticError::NotApplicable); } } @@ -137,6 +148,7 @@ impl Tactic for MoveDownAndSwap { let expected0 = builder.unwrap_expected(0); let expected0_at = builder.unwrap_expected_position(&expected0); log::trace!( + target: &trace_target, "{actual0:?} is not an expected operand, but is occupying index {expected0_at}, \ where we expect {expected0:?}, evicting.." ); diff --git a/codegen/masm/src/opt/operands/tactics/move_up_and_swap.rs b/codegen/masm/src/opt/operands/tactics/move_up_and_swap.rs index 1c459e790..e96086bb0 100644 --- a/codegen/masm/src/opt/operands/tactics/move_up_and_swap.rs +++ b/codegen/masm/src/opt/operands/tactics/move_up_and_swap.rs @@ -19,10 +19,14 @@ use super::*; /// solved with this tactic (alone anyway). #[derive(Default)] pub struct MoveUpAndSwap; + impl Tactic for MoveUpAndSwap { fn apply(&mut self, builder: &mut SolutionBuilder) -> TacticResult { + let trace_target = builder.trace_target().clone().with_topic("solver:move-up-and-swap"); + if builder.requires_copies() || builder.arity() < 2 { log::trace!( + target: &trace_target, "cannot apply tactic when there are required copies ({}) or fewer than 2 operands \ ({})", builder.requires_copies(), @@ -36,6 +40,7 @@ impl Tactic for MoveUpAndSwap { if actual0 == expected0 { let Some(expected1) = builder.get_expected(1) else { log::trace!( + target: &trace_target, "top two operands on the stack are already in position, returning possible \ solution" ); @@ -43,10 +48,11 @@ impl Tactic for MoveUpAndSwap { }; let move_from = builder.unwrap_current_position(&expected1); if move_from == 1 { - log::trace!("abandoning tactic because operand at index 1 is already in position"); + log::trace!(target: &trace_target, "abandoning tactic because operand at index 1 is already in position"); return Err(TacticError::NotApplicable); } log::trace!( + target: &trace_target, "moving {expected1:?} to top of stack from index {move_from}, then swapping with \ {expected0:?}" ); @@ -56,7 +62,7 @@ impl Tactic for MoveUpAndSwap { // The tactic was successfully applied, but it is // up to the solver to determine if a solution was // found - log::trace!("returning possible solution"); + log::trace!(target: &trace_target, "returning possible solution"); return Ok(()); } @@ -113,6 +119,7 @@ impl Tactic for MoveUpAndSwap { // If the pair includes `a` itself, then just move `a` to the top if a_expected == 0 { log::trace!( + target: &trace_target, "moving {:?} to the top of stack, shifting {:?} down", builder.stack()[a_actual as usize], builder.stack()[0] @@ -121,6 +128,7 @@ impl Tactic for MoveUpAndSwap { } else { if b_actual > 0 { log::trace!( + target: &trace_target, "moving {:?} to the top of stack, shifting {:?} down", builder.stack()[b_actual as usize], builder.stack()[0] @@ -129,6 +137,7 @@ impl Tactic for MoveUpAndSwap { } let expected0_at = builder.unwrap_current_position(&expected0); log::trace!( + target: &trace_target, "moving {:?} to the top of stack, shifting {:?} down", builder.stack()[expected0_at as usize], builder.stack()[0] @@ -147,6 +156,7 @@ impl Tactic for MoveUpAndSwap { // of which focus on moving elements from the top first, // and handle the various patterns that might arise there. log::trace!( + target: &trace_target, "abandoning tactic because by implication, operands are in order, and an unused \ operand must need eviction" ); diff --git a/codegen/masm/src/opt/operands/tactics/swap_and_move_up.rs b/codegen/masm/src/opt/operands/tactics/swap_and_move_up.rs index 2f61c9b7d..936d2a27a 100644 --- a/codegen/masm/src/opt/operands/tactics/swap_and_move_up.rs +++ b/codegen/masm/src/opt/operands/tactics/swap_and_move_up.rs @@ -17,10 +17,14 @@ use super::*; /// solved with this tactic (alone anyway). #[derive(Default)] pub struct SwapAndMoveUp; + impl Tactic for SwapAndMoveUp { fn apply(&mut self, builder: &mut SolutionBuilder) -> TacticResult { + let trace_target = builder.trace_target().clone().with_topic("solver:swap-and-move-up"); + if builder.requires_copies() || builder.arity() < 2 { log::trace!( + target: &trace_target, "cannot apply tactic when there are required copies ({}) or fewer than 2 operands \ ({})", builder.requires_copies(), @@ -32,18 +36,20 @@ impl Tactic for SwapAndMoveUp { // Find the operand that should be at index 1 and swap the top element // with it; then move up the value that should be at index 0 let Some(expected1) = builder.get_expected(1) else { - log::trace!("abandoning tactic because operand at index 1 is already in position"); + log::trace!(target: &trace_target, "abandoning tactic because operand at index 1 is already in position"); return Err(TacticError::NotApplicable); }; let expected1_pos = builder.unwrap_current_position(&expected1); if expected1_pos == 0 { log::trace!( + target: &trace_target, "swapping {expected1:?} from top of the stack, with {:?} at index 1", builder.stack()[1] ); builder.swap(1); } else { log::trace!( + target: &trace_target, "swapping {expected1:?} at index {expected1_pos} to the top of the stack, with \ {:?}", builder.stack()[0] @@ -56,6 +62,7 @@ impl Tactic for SwapAndMoveUp { let expected0_pos = builder.unwrap_current_position(&expected0); if expected0_pos > 0 { log::trace!( + target: &trace_target, "moving {expected0:?} from index {expected0_pos} to the top of stack, shifting \ {:?} down by one", builder.stack()[0] diff --git a/codegen/masm/src/opt/operands/testing.rs b/codegen/masm/src/opt/operands/testing.rs index 479ca98ce..cf32a05dd 100644 --- a/codegen/masm/src/opt/operands/testing.rs +++ b/codegen/masm/src/opt/operands/testing.rs @@ -9,9 +9,7 @@ use super::*; use crate::Constraint; pub fn logger_setup() { - use log::LevelFilter; - let _ = env_logger::builder() - .filter_level(LevelFilter::Trace) + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") .format_timestamp(None) .is_test(true) .try_init(); @@ -298,18 +296,22 @@ prop_compose! { } } +prop_compose! { + pub fn generate_linear_problem() (stack_size in 0usize..16) + (problem in testing::generate_stack_subset_copy_any_problem(stack_size)) -> ProblemInputs { + problem + } +} + pub fn solve_problem(problem: ProblemInputs) -> Result<(), TestCaseError> { - let _ = env_logger::Builder::from_env("MIDENC_TRACE").is_test(true).try_init(); + let _ = midenc_log::Builder::from_env("MIDENC_TRACE").is_test(true).try_init(); let block = problem.block.borrow(); let block_args = block.arguments(); match OperandMovementConstraintSolver::new_with_options( &problem.expected, &problem.constraints, &problem.stack, - SolverOptions { - fuel: 10, - ..Default::default() - }, + Default::default(), ) { Ok(solver) => { let result = solver.solve(); @@ -320,9 +322,14 @@ pub fn solve_problem(problem: ProblemInputs) -> Result<(), TestCaseError> { ); let actions = result.unwrap(); // We are expecting that if all operands are copies, that the number of actions is - // equal to the number of copies + // equal to the number of copies. + // + // NOTE: When the solver needs to work around MASM's 16-felt addressing window, it may + // introduce extra stack movements, but it must still materialize all expected copies. if problem.constraints.iter().all(|c| matches!(c, Constraint::Copy)) { - prop_assert_eq!(actions.len(), problem.expected.len()); + let num_copies = + actions.iter().filter(|action| matches!(action, Action::Copy(_))).count(); + prop_assert_eq!(num_copies, problem.expected.len()); } // We are expecting that applying `actions` to the input stack will produce a stack // that has all of the expected operands on top of the stack, @@ -362,6 +369,7 @@ pub fn solve_problem(problem: ProblemInputs) -> Result<(), TestCaseError> { } } +#[allow(unused)] pub fn solve_problem_with_tactic( problem: ProblemInputs, ) -> Result<(), TestCaseError> { diff --git a/codegen/masm/src/stack.rs b/codegen/masm/src/stack.rs index 2e974c1f3..d379ee405 100644 --- a/codegen/masm/src/stack.rs +++ b/codegen/masm/src/stack.rs @@ -328,7 +328,10 @@ impl OperandStack { /// /// The type is assumed to remain unchanged pub fn rename(&mut self, n: usize, value: ValueRef) { - match &mut self[n].operand { + let len = self.stack.len(); + assert!(n < len, "invalid operand stack index ({n}), only {len} operands are available"); + let index = len - n - 1; + match &mut self.stack[index].operand { OperandType::Value(prev_value) => { *prev_value = value; } diff --git a/dialects/arith/src/builders.rs b/dialects/arith/src/builders.rs index c368b0038..6d8277df3 100644 --- a/dialects/arith/src/builders.rs +++ b/dialects/arith/src/builders.rs @@ -1,5 +1,5 @@ use midenc_hir::{ - Builder, BuilderExt, Felt, OpBuilder, Overflow, Report, SourceSpan, ValueRef, + Builder, BuilderExt, Felt, OpBuilder, Overflow, Report, SmallVec, SourceSpan, Type, ValueRef, dialects::builtin::FunctionBuilder, }; @@ -499,18 +499,85 @@ pub trait ArithOpBuilder<'f, B: ?Sized + Builder> { Ok(op.borrow().result().as_value_ref()) } - fn join(&mut self, hi: ValueRef, lo: ValueRef, span: SourceSpan) -> Result { - let op_builder = self.builder_mut().create::(span); - let op = op_builder(hi, lo)?; + /// Join `limbs` into a single value of type `ty`, where limbs are ordered from + /// most-significant to least-significant. + fn join(&mut self, limbs: A, ty: Type, span: SourceSpan) -> Result + where + A: IntoIterator, + { + let op_builder = self.builder_mut().create::(span); + let op = op_builder(limbs, ty)?; Ok(op.borrow().result().as_value_ref()) } - fn split(&mut self, n: ValueRef, span: SourceSpan) -> Result<(ValueRef, ValueRef), Report> { + /// Join 2 limbs into a single value of type `ty`. + /// + /// Limbs are ordered from most-significant to least-significant. + fn join2( + &mut self, + high: ValueRef, + low: ValueRef, + ty: Type, + span: SourceSpan, + ) -> Result { + self.join([high, low], ty, span) + } + + /// Join 4 limbs into a single value of type `ty`. + /// + /// Limbs are ordered from most-significant to least-significant. + fn join4( + &mut self, + limbs: [ValueRef; 4], + ty: Type, + span: SourceSpan, + ) -> Result { + self.join(limbs, ty, span) + } + + /// Split `n` into limbs of type `limb_ty`, ordered from most-significant to least-significant. + fn split( + &mut self, + n: ValueRef, + limb_ty: Type, + span: SourceSpan, + ) -> Result, Report> { let op_builder = self.builder_mut().create::(span); - let op = op_builder(n)?.borrow(); - let lo = op.result_low().as_value_ref(); - let hi = op.result_high().as_value_ref(); - Ok((hi, lo)) + let op = op_builder(n, limb_ty)?; + let op = op.borrow(); + Ok(op.limbs().iter().map(|limb| limb.borrow().as_value_ref()).collect()) + } + + /// Split `n` into 2 limbs of type `limb_ty`. + /// + /// Returns limbs ordered from most-significant to least-significant. + fn split2( + &mut self, + n: ValueRef, + limb_ty: Type, + span: SourceSpan, + ) -> Result<(ValueRef, ValueRef), Report> { + let limbs = self.split(n, limb_ty, span)?; + match limbs.as_slice() { + [high, low] => Ok((*high, *low)), + _ => Err(Report::msg("invalid arith.split: expected 2 result limb values")), + } + } + + /// Split `n` into 4 limbs of type `limb_ty`. + /// + /// Returns limbs ordered from most-significant to least-significant. + fn split4( + &mut self, + n: ValueRef, + limb_ty: Type, + span: SourceSpan, + ) -> Result<[ValueRef; 4], Report> { + let limbs = self.split(n, limb_ty, span)?; + match limbs.as_slice() { + [a, b, c, d] => Ok([*a, *b, *c, *d]), + _ => Err(Report::msg("invalid arith.split: expected 4 result limb values")), + } } #[allow(clippy::wrong_self_convention)] diff --git a/dialects/arith/src/canonicalization.rs b/dialects/arith/src/canonicalization.rs new file mode 100644 index 000000000..1b1a25f5a --- /dev/null +++ b/dialects/arith/src/canonicalization.rs @@ -0,0 +1,297 @@ +//! Canonicalization patterns for the `arith` dialect. +//! +//! Currently includes a rewrite for 32-bit rotates of `i64`/`u64` to preserve the full 64-bit +//! payload when values represent felt values + +use alloc::rc::Rc; + +use midenc_hir::{ + interner::Symbol, + patterns::{Pattern, PatternBenefit, PatternInfo, PatternKind, RewritePattern}, + *, +}; + +use crate::*; + +/// Canonicalizes 32-bit rotations of `i64`/`u64` values into a swap of the 32-bit limbs. +/// +/// This is used to preserve the "extra" bits that may be present when `i64` values are actually +/// being used to operate over two felt values in memory. +pub(crate) struct CanonicalizeI64RotateBy32ToSwap { + info: PatternInfo, +} + +impl CanonicalizeI64RotateBy32ToSwap { + /// Create a canonicalization pattern for `op`. + pub fn for_op(context: Rc, op: OperationName) -> Self { + Self { + info: PatternInfo::new( + context, + "canonicalize-i64-rotate-by-32-to-swap", + PatternKind::Operation(op), + PatternBenefit::MAX, + ), + } + } +} + +impl Pattern for CanonicalizeI64RotateBy32ToSwap { + fn info(&self) -> &PatternInfo { + &self.info + } +} + +impl RewritePattern for CanonicalizeI64RotateBy32ToSwap { + fn match_and_rewrite( + &self, + operation: OperationRef, + rewriter: &mut dyn Rewriter, + ) -> Result { + let hir = Symbol::intern("hir"); + let arith = Symbol::intern("arith"); + let cast = Symbol::intern("cast"); + let bitcast = Symbol::intern("bitcast"); + let trunc = Symbol::intern("trunc"); + let sext = Symbol::intern("sext"); + let zext = Symbol::intern("zext"); + let max_depth = 4usize; + + // Try to recover a `u32` constant value from `value`, allowing a small set of passthrough + // casts/conversions, e.g. `hir.cast(arith.constant 32 : i64) : u32`. + let constant_u32 = |value: ValueRef| -> Option { + let mut current = value; + for _ in 0..max_depth { + let defining_op = current.borrow().get_defining_op()?; + let op = defining_op.borrow(); + if let Some(constant) = op.downcast_ref::() { + let imm = constant.value(); + return imm + .as_u32() + .or_else(|| imm.as_i32().and_then(|v| u32::try_from(v).ok())) + .or_else(|| imm.as_u64().and_then(|v| u32::try_from(v).ok())); + } + + let name = op.name(); + let dialect = name.dialect(); + let opcode = name.name(); + let is_passthrough = (dialect == hir && (opcode == cast || opcode == bitcast)) + || (dialect == arith && (opcode == trunc || opcode == sext || opcode == zext)); + if !is_passthrough { + return None; + } + + let mut operands = op.operands().iter(); + let operand = operands.next()?; + current = operand.borrow().as_value_ref(); + } + + None + }; + + let (span, lhs, lhs_ty, is_rotate_by_32) = { + let op = operation.borrow(); + let span = op.span(); + let Some((lhs, shift)) = op + .downcast_ref::() + .map(|rotl| (rotl.lhs().as_value_ref(), rotl.shift().as_operand_ref())) + .or_else(|| { + op.downcast_ref::() + .map(|rotr| (rotr.lhs().as_value_ref(), rotr.shift().as_operand_ref())) + }) + else { + return Ok(false); + }; + + let lhs_ty = lhs.borrow().ty().clone(); + if !matches!(lhs_ty, Type::I64 | Type::U64) { + return Ok(false); + } + + let is_rotate_by_32 = constant_u32(shift.borrow().as_value_ref()) == Some(32); + + (span, lhs, lhs_ty, is_rotate_by_32) + }; + + if !is_rotate_by_32 { + return Ok(false); + } + + let mut guard = InsertionGuard::new(rewriter); + guard.set_insertion_point_before(operation); + + // Split the `i64` into (felt, felt) limbs, swap them, then join back to the original type. + // + // Using felts (instead of 32-bit integer types) ensures the underlying values are not + // range-checked/normalized, which is required to preserve any extra bits. + let split = { + let op_builder = guard.create::(span); + op_builder(lhs, Type::Felt)? + }; + let (hi, lo) = { + let split = split.borrow(); + let [hi, lo] = split.limbs().as_slice() else { + unreachable!("expected arith.split to produce 2 limbs for i64/u64"); + }; + (hi.borrow().as_value_ref(), lo.borrow().as_value_ref()) + }; + let joined = { + let op_builder = guard.create::(span); + let join = op_builder([lo, hi], lhs_ty)?; + join.borrow().result().as_value_ref() + }; + + guard.replace_op_with_values(operation, &[Some(joined)]); + Ok(true) + } +} + +#[cfg(test)] +mod tests { + use alloc::rc::Rc; + + use midenc_hir::{ + AbiParam, BuilderExt, Context, Ident, OpBuilder, Report, Signature, SourceSpan, Type, + dialects::builtin::{BuiltinOpBuilder, Function, FunctionBuilder}, + patterns::{ + FrozenRewritePatternSet, GreedyRewriteConfig, RegionSimplificationLevel, + RewritePatternSet, apply_patterns_and_fold_greedily, + }, + traits::Canonicalizable, + }; + + use crate::{ArithDialect, ArithOpBuilder, Join, Rotl, Rotr, Split}; + + fn build_rotate_by_32( + context: Rc, + ty: Type, + is_rotr: bool, + ) -> Result { + let _arith = context.get_or_register_dialect::(); + + let span = SourceSpan::default(); + let mut builder = OpBuilder::new(context); + + let function = { + let builder = builder.create::(span); + let name = Ident::new("test".into(), span); + let signature = + Signature::new([AbiParam::new(ty.clone())], [AbiParam::new(ty.clone())]); + builder(name, signature)? + }; + + { + let mut builder = FunctionBuilder::new(function, &mut builder); + let input = builder.current_block().borrow().arguments()[0].upcast(); + let shift = builder.u32(32, span); + let rotated = if is_rotr { + builder.rotr(input, shift, span)? + } else { + builder.rotl(input, shift, span)? + }; + builder.ret(Some(rotated), span)?; + } + + Ok(function.as_operation_ref()) + } + + fn apply_rotate_canonicalization( + context: Rc, + function: midenc_hir::OperationRef, + ) -> bool { + let mut patterns = RewritePatternSet::new(context.clone()); + Rotl::get_canonicalization_patterns(&mut patterns, context.clone()); + Rotr::get_canonicalization_patterns(&mut patterns, context); + let patterns = Rc::new(FrozenRewritePatternSet::new(patterns)); + + let mut config = GreedyRewriteConfig::default(); + config.with_region_simplification_level(RegionSimplificationLevel::None); + + match apply_patterns_and_fold_greedily(function, patterns, config) { + Ok(changed) => changed, + Err(changed) => panic!("canonicalization failed (changed={changed})"), + } + } + + fn assert_rotate_by_32_rewritten(function: midenc_hir::OperationRef, ty: Type) { + let body = { + let function = function.borrow(); + let function = function.downcast_ref::().expect("expected builtin.function"); + function.body().as_region_ref() + }; + let entry = body + .borrow() + .entry_block_ref() + .expect("expected function body to have an entry block"); + + let mut rotl = false; + let mut rotr = false; + let mut split = None; + let mut join = None; + + for op in entry.borrow().body() { + let op = op.as_operation_ref(); + let operation = op.borrow(); + + rotl |= operation.downcast_ref::().is_some(); + rotr |= operation.downcast_ref::().is_some(); + + if operation.downcast_ref::().is_some() { + assert!(split.replace(op).is_none(), "expected a single arith.split"); + } + if operation.downcast_ref::().is_some() { + assert!(join.replace(op).is_none(), "expected a single arith.join"); + } + } + + assert!(!rotl, "expected arith.rotl to be eliminated"); + assert!(!rotr, "expected arith.rotr to be eliminated"); + + let split = split.expect("expected arith.split"); + let join = join.expect("expected arith.join"); + + let (hi, lo) = { + let split = split.borrow(); + let split = split.downcast_ref::().unwrap(); + assert_eq!(split.limb_ty(), &Type::Felt, "expected split to use `felt` limbs"); + let [hi, lo] = split.limbs().as_slice() else { + panic!("expected arith.split to produce 2 limbs for i64/u64"); + }; + (hi.borrow().as_value_ref(), lo.borrow().as_value_ref()) + }; + + let (high, low) = { + let join = join.borrow(); + let join = join.downcast_ref::().unwrap(); + assert_eq!(join.ty(), &ty, "expected join to reconstruct the original rotate type"); + let [high, low] = join.limbs().as_slice() else { + panic!("expected arith.join to consume 2 limbs for i64/u64"); + }; + (high.borrow().as_value_ref(), low.borrow().as_value_ref()) + }; + + assert_eq!(high, lo, "expected join high limb to use split low limb"); + assert_eq!(low, hi, "expected join low limb to use split high limb"); + } + + #[test] + fn canonicalize_rotl_u64_by_32_to_swap() -> Result<(), Report> { + let context = Rc::new(Context::default()); + let function = build_rotate_by_32(context.clone(), Type::U64, false)?; + + assert!(apply_rotate_canonicalization(context.clone(), function)); + assert_rotate_by_32_rewritten(function, Type::U64); + + Ok(()) + } + + #[test] + fn canonicalize_rotr_i64_by_32_to_swap() -> Result<(), Report> { + let context = Rc::new(Context::default()); + let function = build_rotate_by_32(context.clone(), Type::I64, true)?; + + assert!(apply_rotate_canonicalization(context.clone(), function)); + assert_rotate_by_32_rewritten(function, Type::I64); + + Ok(()) + } +} diff --git a/dialects/arith/src/lib.rs b/dialects/arith/src/lib.rs index caec65a40..6cb0dde2e 100644 --- a/dialects/arith/src/lib.rs +++ b/dialects/arith/src/lib.rs @@ -15,6 +15,7 @@ extern crate std; use alloc::boxed::Box; mod builders; +mod canonicalization; mod ops; use midenc_hir::{ diff --git a/dialects/arith/src/ops/binary.rs b/dialects/arith/src/ops/binary.rs index 5ff009bad..d46a9aeaf 100644 --- a/dialects/arith/src/ops/binary.rs +++ b/dialects/arith/src/ops/binary.rs @@ -1,3 +1,5 @@ +use alloc::rc::Rc; + use midenc_hir::{derive::operation, effects::*, traits::*, *}; use crate::ArithDialect; @@ -522,6 +524,19 @@ pub struct Rotl { infer_return_ty_for_binary_op!(Rotl); has_no_effects!(Rotl); +impl Canonicalizable for Rotl { + fn get_canonicalization_patterns( + rewrites: &mut patterns::RewritePatternSet, + context: Rc, + ) { + let name = context + .get_or_register_dialect::() + .expect_registered_name::(); + rewrites + .push(crate::canonicalization::CanonicalizeI64RotateBy32ToSwap::for_op(context, name)); + } +} + /// Bitwise rotate-right /// /// The rotation count must be < the bitwidth of the value type. @@ -542,6 +557,19 @@ pub struct Rotr { infer_return_ty_for_binary_op!(Rotr); has_no_effects!(Rotr); +impl Canonicalizable for Rotr { + fn get_canonicalization_patterns( + rewrites: &mut patterns::RewritePatternSet, + context: Rc, + ) { + let name = context + .get_or_register_dialect::() + .expect_registered_name::(); + rewrites + .push(crate::canonicalization::CanonicalizeI64RotateBy32ToSwap::for_op(context, name)); + } +} + /// Equality comparison #[operation( dialect = ArithDialect, diff --git a/dialects/arith/src/ops/coercions.rs b/dialects/arith/src/ops/coercions.rs index 6e6cf0ba9..b8466242c 100644 --- a/dialects/arith/src/ops/coercions.rs +++ b/dialects/arith/src/ops/coercions.rs @@ -1,4 +1,4 @@ -use alloc::boxed::Box; +use alloc::{boxed::Box, format}; use midenc_hir::{ derive::operation, effects::MemoryEffectOpInterface, matchers::Matcher, traits::*, *, @@ -230,56 +230,141 @@ impl Foldable for Sext { } } -/// Join two 64bit integers into one 128 bit integer. +/// Returns true if `ty` is a valid 32-bit limb type for `arith.split`/`arith.join`. +fn is_32bit_limb(ty: &Type) -> bool { + matches!(ty, Type::Felt | Type::I32 | Type::U32) +} + +/// Returns true if `ty` is a valid 64-bit limb type for `arith.split`/`arith.join`. +fn is_64bit_limb(ty: &Type) -> bool { + matches!(ty, Type::I64 | Type::U64) +} + +/// Join limbs into an integer value. +/// +/// The limbs are provided in most-significant to least-significant order. +/// +/// This operation supports the following combinations: +/// +/// - `i64`/`u64` from 2× `felt`/`i32`/`u32` +/// - `i128`/`u128` from 2× `i64`/`u64` +/// - `i128`/`u128` from 4× `felt`/`i32`/`u32` #[operation( dialect = ArithDialect, - traits(BinaryOp, SameTypeOperands), + traits(SameTypeOperands), implements(InferTypeOpInterface, MemoryEffectOpInterface) )] pub struct Join { - #[operand] - high_limb: Int64, - #[operand] - low_limb: Int64, + #[operands] + limbs: AnyInteger, + #[attr(hidden)] + ty: Type, #[result] - result: Int128, + result: AnyInteger, } has_no_effects!(Join); impl InferTypeOpInterface for Join { fn infer_return_types(&mut self, _context: &Context) -> Result<(), Report> { - self.result_mut().set_type(Type::I128); + let ty = self.ty().clone(); + self.result_mut().set_type(ty.clone()); + + let num_limbs = self.limbs().len(); + if !matches!(num_limbs, 2 | 4) { + return Err(Report::msg(format!( + "invalid operation arith.join: expected 2 or 4 limbs, but got {num_limbs}" + ))); + } + + let limb_ty = self.limbs()[0].borrow().as_value_ref().borrow().ty().clone(); + let is_limb_ty_32bit = is_32bit_limb(&limb_ty); + let is_limb_ty_64bit = is_64bit_limb(&limb_ty); + let is_valid = matches!( + (&ty, num_limbs, is_limb_ty_32bit, is_limb_ty_64bit), + (&Type::I64 | &Type::U64, 2, true, _) + | (&Type::I128 | &Type::U128, 2, _, true) + | (&Type::I128 | &Type::U128, 4, true, _) + ); + if !is_valid { + return Err(Report::msg(format!( + "invalid operation arith.join: cannot join {num_limbs} limb(s) of type \ + '{limb_ty}' into '{ty}'" + ))); + } + Ok(()) } } -/// Split a 128bit integer into two 64 bit integers. +/// Split an integer into one or more limbs. /// -/// The result is a pair of 64bit integers, e.g., `v1, v2 = arith.split v0 : i64, i64;` where `v1` -/// is the high limb and `v2` is the low limb. +/// The limbs are returned in most-significant to least-significant order. /// -/// It also will leave the high limb on the top of the working stack during codegen. +/// This operation supports the following combinations: +/// +/// - `i64`/`u64` into 2× `felt`/`i32`/`u32` +/// - `i128`/`u128` into 2× `i64`/`u64` +/// - `i128`/`u128` into 4× `felt`/`i32`/`u32` #[operation( dialect = ArithDialect, - traits(UnaryOp, SameTypeOperands), + traits(UnaryOp), implements(InferTypeOpInterface, MemoryEffectOpInterface) )] pub struct Split { #[operand] - operand: Int128, - #[result] - result_high: Int64, - #[result] - result_low: Int64, + operand: AnyInteger, + #[attr(hidden)] + limb_ty: Type, + #[results] + limbs: AnyInteger, } has_no_effects!(Split); impl InferTypeOpInterface for Split { - fn infer_return_types(&mut self, _context: &Context) -> Result<(), Report> { - self.result_low_mut().set_type(Type::I64); - self.result_high_mut().set_type(Type::I64); + fn infer_return_types(&mut self, context: &Context) -> Result<(), Report> { + let operand_ty = self.operand().as_value_ref().borrow().ty().clone(); + let limb_ty = self.limb_ty().clone(); + + let num_limbs = match operand_ty { + Type::I64 | Type::U64 if is_32bit_limb(&limb_ty) => 2, + Type::I128 | Type::U128 if is_64bit_limb(&limb_ty) => 2, + Type::I128 | Type::U128 if is_32bit_limb(&limb_ty) => 4, + _ => { + return Err(Report::msg(format!( + "invalid operation arith.split: cannot split '{operand_ty}' into limb type \ + '{limb_ty}'" + ))); + } + }; + + // We infer the number of limbs from (operand_ty, limb_ty), and once created, the result + // count must remain stable. + // + // When building `arith.split`, the op initially has no results, and we create them here. + // When validating an existing op, we ensure the result count matches what we would infer. + if !self.op.results.is_empty() && self.op.results.len() != num_limbs { + return Err(Report::msg(format!( + "invalid operation arith.split: expected {num_limbs} result(s) for '{operand_ty}' \ + split into '{limb_ty}', but got {}", + self.op.results.len() + ))); + } + + if self.op.results.is_empty() { + let span = self.span(); + let owner = self.as_operation_ref(); + for i in 0..num_limbs { + let value = context.make_result(span, limb_ty.clone(), owner, i as u8); + self.op.results.push(value); + } + } else { + for result in self.op.results.iter_mut() { + result.borrow_mut().set_type(limb_ty.clone()); + } + } + Ok(()) } } diff --git a/dialects/hir/Cargo.toml b/dialects/hir/Cargo.toml index 3f6502755..3070664d0 100644 --- a/dialects/hir/Cargo.toml +++ b/dialects/hir/Cargo.toml @@ -25,5 +25,8 @@ midenc-hir-transform.workspace = true [dev-dependencies] # Use local paths for dev-only dependency to avoid relying on crates.io during packaging +midenc-dialect-scf = { path = "../scf" } midenc-expect-test = { path = "../../tools/expect-test" } -env_logger.workspace = true +litcheck.workspace = true +litcheck-filecheck.workspace = true +midenc-log = { path = "../../midenc-log" } diff --git a/dialects/hir/src/transforms.rs b/dialects/hir/src/transforms.rs index 76247647f..ad046655f 100644 --- a/dialects/hir/src/transforms.rs +++ b/dialects/hir/src/transforms.rs @@ -1,3 +1,4 @@ +mod local2reg; mod spill; -pub use self::spill::TransformSpills; +pub use self::{local2reg::Local2Reg, spill::TransformSpills}; diff --git a/dialects/hir/src/transforms/local2reg.rs b/dialects/hir/src/transforms/local2reg.rs new file mode 100644 index 000000000..6fd506204 --- /dev/null +++ b/dialects/hir/src/transforms/local2reg.rs @@ -0,0 +1,641 @@ +use alloc::rc::Rc; + +use midenc_hir::{ + Backward, CallOpInterface, EntityMut, FxHashMap, Op, OperationName, OperationRef, ProgramPoint, + RawWalk, RegionBranchOpInterface, Report, Rewriter, SmallVec, Symbol, TraceTarget, ValueRef, + dialects::builtin::{Function, LocalVariable}, + pass::{Pass, PassExecutionState, PostPassStatus}, + patterns::{RewriterImpl, TracingRewriterListener}, + traits::BranchOpInterface, +}; + +use crate::{LoadLocal, StoreLocal}; +pub struct Local2Reg; + +impl Pass for Local2Reg { + type Target = Function; + + fn name(&self) -> &'static str { + "local2reg" + } + + fn argument(&self) -> &'static str { + "local2reg" + } + + fn can_schedule_on(&self, _name: &OperationName) -> bool { + true + } + + fn initialize(&mut self, context: Rc) -> Result<(), Report> { + context.get_or_register_dialect::(); + + Ok(()) + } + + fn run_on_operation( + &mut self, + op: EntityMut<'_, Self::Target>, + state: &mut PassExecutionState, + ) -> Result<(), Report> { + let function = op.into_entity_ref(); + + let trace_target = TraceTarget::category("pass") + .with_topic(self.name()) + .with_relevant_symbol(function.name().as_str()); + + log::debug!( + target: &trace_target, + sym = trace_target.relevant_symbol(); + "looking for locals to promote to SSA registers in: {}", + function.as_operation() + ); + + if function.is_declaration() { + log::debug!( + target: &trace_target, + sym = trace_target.relevant_symbol(); + "function has no body, nothing to do", + ); + state.preserved_analyses_mut().preserve_all(); + state.set_post_pass_status(PostPassStatus::Unchanged); + return Ok(()); + } + + if function.num_locals() == 0 { + log::debug!( + target: &trace_target, + sym = trace_target.relevant_symbol(); + "function has no locals, nothing to do", + ); + state.preserved_analyses_mut().preserve_all(); + state.set_post_pass_status(PostPassStatus::Unchanged); + return Ok(()); + } + + let locals = SmallVec::<[_; 4]>::from_iter(function.iter_locals().map(|(l, _)| l)); + let op = function.as_operation_ref(); + let context = function.as_operation().context_rc(); + drop(function); + + let mut rewriter = RewriterImpl::::new(context) + .with_listener(TracingRewriterListener); + + let mut loaded = FxHashMap::>::default(); + let mut stored = + FxHashMap::>::default(); + op.raw_postwalk_all::(|op: OperationRef| { + let operation = op.borrow(); + if let Some(load) = operation.downcast_ref::() { + let local = *load.local(); + log::trace!( + target: &trace_target, + sym = trace_target.relevant_symbol(); + "found load from local {local} @ {}", + ProgramPoint::before(op), + ); + loaded.entry(local).or_default().push(op); + } else if let Some(store) = operation.downcast_ref::() { + let stored_value = store.value().as_value_ref(); + let local = *store.local(); + log::trace!( + target: &trace_target, + sym = trace_target.relevant_symbol(); + "found store of {stored_value} to local {local} @ {}", + ProgramPoint::before(op), + ); + stored.entry(local).or_default().push((op, stored_value)); + } + }); + + let mut changed = PostPassStatus::Unchanged; + 'next_local: for local in locals.into_iter() { + if let Some(loads) = loaded.get(&local) { + if loads.len() > 1 { + // Ignore locals that are loaded multiple times for now + log::trace!( + target: &trace_target, + sym = trace_target.relevant_symbol(); + "ignoring {local}: loaded more than once", + ); + continue; + } + + // If we reach here, we've found a local that is loaded only once - determine if + // there is a corresponding store in the same block, with no intervening ops which + // have side effects or regions. + // + // If there are no corresponding stores, the value being loaded is poison, but for + // now we don't deal with that here, and instead just skip the op. + let Some(stores) = stored.get(&local) else { + log::trace!( + target: &trace_target, + sym = trace_target.relevant_symbol(); + "ignoring {local}: never stored, should be poison", + ); + continue; + }; + + // If the value is stored more than once, assume there is little benefit in + // promoting it to a register + if stores.len() > 1 { + log::trace!( + target: &trace_target, + sym = trace_target.relevant_symbol(); + "ignoring {local}: stored more than once", + ); + continue; + } + + // If we reach here, then we have a single load of a local stored just once - this + // is almost certainly a case of something promotable to a SSA register. The only + // caveat is when there is "distance" between the load and the store, where keeping + // the load and store is actually better for codegen. + // + // Our heuristic then for choosing whether to promote or not is based on the + // following criteria: + // + // 1. The load and store are in the same block + // 2. There is no control flow between the store and load, including function calls + let load = loads[0]; + let (store, stored_value) = stores.last().unwrap(); + + // 1. + if load.parent() != store.parent() { + log::trace!( + target: &trace_target, + sym = trace_target.relevant_symbol(); + "ignoring {local}: load and store are in different blocks", + ); + continue; + } + + // 2. + let mut next_op = store.next(); + while let Some(current) = next_op.take() { + if current == load { + break; + } + + next_op = current.next(); + + // Check if `curr` implements any control flow interfaces + let curr = current.borrow(); + if curr.implements::() + || curr.implements::() + || curr.implements::() + { + log::trace!( + target: &trace_target, + sym = trace_target.relevant_symbol(); + "ignoring {local}: found control flow between load and store", + ); + continue 'next_local; + } + } + + log::trace!( + target: &trace_target, + sym = trace_target.relevant_symbol(); + "found promotable local {local}: erasing store and replacing load with stored value", + ); + // If we reach here, then there is no control flow between the load and store, so + // remove the store, and replace the load with the stored value. + rewriter.erase_op(*store); + rewriter.replace_all_op_uses_with_values(load, &[Some(*stored_value)]); + rewriter.erase_op(load); + changed = PostPassStatus::Changed; + } else if let Some(stores) = stored.get(&local) { + // We've found a local which is stored to, but never loaded - these stores are all + // dead, and can be removed. + // + // We rely on region simplification/canonicalization to remove any ops/values made + // dead by erasing these stores. + for (store, _) in stores.iter() { + changed = PostPassStatus::Changed; + log::trace!( + target: &trace_target, + sym = trace_target.relevant_symbol(); + "found dead store for local {local}: erasing it", + ); + rewriter.erase_op(*store); + } + } else { + // This local is never loaded or stored - we should probably remove it, but this + // will require visiting all of the local load/store ops and rewriting them. For + // now we aren't doing this, but this note is left here for future reference. + } + } + + state.set_post_pass_status(changed); + + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use alloc::{boxed::Box, format, rc::Rc, string::ToString}; + + use litcheck_filecheck::filecheck; + use midenc_dialect_arith::ArithOpBuilder; + use midenc_hir::{ + AbiParam, Context, Ident, OpBuilder, OpPrinter, Report, Signature, SourceSpan, Type, + ValueRef, + dialects::builtin::{BuiltinOpBuilder, Function, FunctionBuilder, FunctionRef}, + pass::PassManager, + }; + + use super::Local2Reg; + use crate::HirOpBuilder; + + #[test] + fn promotes_redundant_load_store_pairs() { + let mut test = Test::new("promotes_redundant", &[Type::I32, Type::I32], &[Type::I32]); + + { + let mut builder = test.function_builder(); + let local0 = builder.alloc_local(Type::I32); + let local1 = builder.alloc_local(Type::I32); + let [v0, v1] = *builder.entry_block().borrow().arguments()[0..2].as_array().unwrap(); + let v0 = v0 as ValueRef; + let v1 = v1 as ValueRef; + builder.store_local(local0, v0, SourceSpan::UNKNOWN).unwrap(); + builder.store_local(local1, v1, SourceSpan::UNKNOWN).unwrap(); + let v2 = builder.load_local(local0, SourceSpan::UNKNOWN).unwrap(); + let v3 = builder.load_local(local1, SourceSpan::UNKNOWN).unwrap(); + let v4 = builder.add(v2, v3, SourceSpan::UNKNOWN).unwrap(); + builder.ret([v4], SourceSpan::UNKNOWN).unwrap(); + } + + test.run_local2reg(true).expect("invalid ir"); + + let output = + format!("{}", test.function().borrow().print(&Default::default(), &test.context)); + filecheck!( + output, + r#" +builtin.function @promotes_redundant(v0: i32, v1: i32) -> i32 { +// CHECK-LABEL: ^block0 +^block0(v0: i32, v1: i32): + hir.store_local v0 #[local = lv0]; + hir.store_local v1 #[local = lv1]; + v2 = hir.load_local : i32 #[local = lv0]; + v3 = hir.load_local : i32 #[local = lv1]; + // CHECK-NEXT: [[V4:v\d+]] = arith.add v0, v1 : i32 #[overflow = checked]; + v4 = arith.add v2, v3 : i32 #[overflow = checked] + // CHECK-NEXT: builtin.ret [[V4]]; + builtin.ret v4; +}; + "# + ); + } + + #[test] + fn erases_dead_stores() { + let mut test = Test::new("erases_dead_stores", &[Type::I32], &[Type::I32]); + + { + let mut builder = test.function_builder(); + let local0 = builder.alloc_local(Type::I32); + let v0 = builder.entry_block().borrow().arguments()[0] as ValueRef; + builder.store_local(local0, v0, SourceSpan::UNKNOWN).unwrap(); + builder.ret([v0], SourceSpan::UNKNOWN).unwrap(); + } + + test.run_local2reg(true).expect("invalid ir"); + + let output = + format!("{}", test.function().borrow().print(&Default::default(), &test.context)); + filecheck!( + output, + r#" +builtin.function @erases_dead_stores(v0: i32) -> i32 { +// CHECK-LABEL: ^block0 +^block0(v0: i32): + hir.store_local v0 #[local = lv0]; + // CHECK-NEXT: builtin.ret v0; + builtin.ret v0; +}; + "# + ); + } + + #[test] + fn does_not_promote_multiply_loaded_locals() { + let mut test = Test::new("ignores_multiple_loads", &[Type::I32, Type::I32], &[Type::I32]); + + { + let mut builder = test.function_builder(); + let local0 = builder.alloc_local(Type::I32); + let local1 = builder.alloc_local(Type::I32); + let [v0, v1] = *builder.entry_block().borrow().arguments()[0..2].as_array().unwrap(); + let v0 = v0 as ValueRef; + let v1 = v1 as ValueRef; + builder.store_local(local0, v0, SourceSpan::UNKNOWN).unwrap(); + builder.store_local(local1, v1, SourceSpan::UNKNOWN).unwrap(); + let v2 = builder.load_local(local0, SourceSpan::UNKNOWN).unwrap(); + let v3 = builder.load_local(local1, SourceSpan::UNKNOWN).unwrap(); + let v4 = builder.load_local(local1, SourceSpan::UNKNOWN).unwrap(); + let v5 = builder.add(v2, v3, SourceSpan::UNKNOWN).unwrap(); + let v6 = builder.add(v5, v4, SourceSpan::UNKNOWN).unwrap(); + builder.ret([v6], SourceSpan::UNKNOWN).unwrap(); + } + + test.run_local2reg(true).expect("invalid ir"); + + let output = + format!("{}", test.function().borrow().print(&Default::default(), &test.context)); + std::println!("output: {output}"); + filecheck!( + output, + r#" +builtin.function @ignores_multiple_loads(v0: i32, v1: i32) -> i32 { +// CHECK-LABEL: ^block0 +^block0(v0: i32, v1: i32): + hir.store_local v0 #[local = lv0]; + // CHECK-NEXT: hir.store_local v1 #[local = lv1] + hir.store_local v1 #[local = lv1]; + v2 = hir.load_local #[local = lv0] : i32; + // CHECK-NEXT: [[V3:v\d+]] = hir.load_local : i32 #[local = lv1]; + // CHECK-NEXT: [[V4:v\d+]] = hir.load_local : i32 #[local = lv1]; + v3 = hir.load_local : i32 #[local = lv1]; + v4 = hir.load_local : i32 #[local = lv1]; + // CHECK-NEXT: [[V5:v\d+]] = arith.add v0, [[V3]] : i32 #[overflow = checked]; + v5 = arith.add v2, v3 : i32 #[overflow = checked] + // CHECK-NEXT: [[V6:v\d+]] = arith.add [[V5]], [[V4]] : i32 #[overflow = checked]; + v6 = arith.add v5, v4 : i32 #[overflow = checked] + // CHECK-NEXT: builtin.ret [[V6]]; + builtin.ret v6; +}; + "# + ); + } + + #[test] + fn does_not_promote_multiply_stored_locals() { + let mut test = Test::new("ignores_multiple_stores", &[Type::I32, Type::I32], &[Type::I32]); + + { + let mut builder = test.function_builder(); + let local0 = builder.alloc_local(Type::I32); + let local1 = builder.alloc_local(Type::I32); + let [v0, v1] = *builder.entry_block().borrow().arguments()[0..2].as_array().unwrap(); + let v0 = v0 as ValueRef; + let v1 = v1 as ValueRef; + builder.store_local(local0, v0, SourceSpan::UNKNOWN).unwrap(); + builder.store_local(local1, v1, SourceSpan::UNKNOWN).unwrap(); + let v2 = builder.load_local(local0, SourceSpan::UNKNOWN).unwrap(); + let v3 = builder.load_local(local1, SourceSpan::UNKNOWN).unwrap(); + builder.store_local(local1, v1, SourceSpan::UNKNOWN).unwrap(); + let v4 = builder.add(v2, v3, SourceSpan::UNKNOWN).unwrap(); + builder.ret([v4], SourceSpan::UNKNOWN).unwrap(); + } + + test.run_local2reg(true).expect("invalid ir"); + + let output = + format!("{}", test.function().borrow().print(&Default::default(), &test.context)); + std::println!("output: {output}"); + filecheck!( + output, + r#" +builtin.function @ignores_multiple_stores(v0: i32, v1: i32) -> i32 { +// CHECK-LABEL: ^block0 +^block0(v0: i32, v1: i32): + hir.store_local v0 #[local = lv0]; + // CHECK-NEXT: hir.store_local v1 #[local = lv1] + hir.store_local v1 #[local = lv1]; + v2 = hir.load_local #[local = lv0] : i32; + // CHECK-NEXT: [[V3:v\d+]] = hir.load_local : i32 #[local = lv1]; + v3 = hir.load_local : i32 #[local = lv1]; + // CHECK-NEXT: hir.store_local v1 #[local = lv1] + hir.store_local v1 #[local = lv1]; + // CHECK-NEXT: [[V4:v\d+]] = arith.add v0, [[V3]] : i32 #[overflow = checked]; + v4 = arith.add v2, v3 : i32 #[overflow = checked] + // CHECK-NEXT: builtin.ret [[V4]]; + builtin.ret v4; +}; + "# + ); + } + + #[test] + fn does_not_promote_poison_loads() { + let mut test = Test::new("ignores_poison_loads", &[Type::I32, Type::I32], &[Type::I32]); + + { + let mut builder = test.function_builder(); + let local0 = builder.alloc_local(Type::I32); + let v0 = builder.entry_block().borrow().arguments()[0] as ValueRef; + let v2 = builder.load_local(local0, SourceSpan::UNKNOWN).unwrap(); + let v3 = builder.add(v0, v2, SourceSpan::UNKNOWN).unwrap(); + builder.ret([v3], SourceSpan::UNKNOWN).unwrap(); + } + + test.run_local2reg(true).expect("invalid ir"); + + let output = + format!("{}", test.function().borrow().print(&Default::default(), &test.context)); + filecheck!( + output, + r#" +builtin.function @ignores_poison_loads(v0: i32, v1: i32) -> i32 { +// CHECK-LABEL: ^block0 +^block0(v0: i32, v1: i32): + // CHECK-NEXT: [[V2:v\d+]] = hir.load_local : i32 #[local = lv0]; + v2 = hir.load_local : i32 #[local = lv0]; + // CHECK-NEXT: [[V3:v\d+]] = arith.add v0, [[V2]] : i32 #[overflow = checked]; + v3 = arith.add v0, v2 : i32 #[overflow = checked] + // CHECK-NEXT: builtin.ret [[V3]]; + builtin.ret v3; +}; + "# + ); + } + + #[test] + fn does_not_promote_across_blocks() { + use midenc_dialect_cf::ControlFlowOpBuilder; + + let mut test = Test::new("ignores_inter_block_candidates", &[Type::I32], &[Type::I32]); + + { + let mut builder = test.function_builder(); + let local0 = builder.alloc_local(Type::I32); + let v0 = builder.entry_block().borrow().arguments()[0] as ValueRef; + builder.store_local(local0, v0, SourceSpan::UNKNOWN).unwrap(); + + let block1 = builder.create_block(); + builder.br(block1, None, SourceSpan::UNKNOWN).unwrap(); + + builder.switch_to_block(block1); + + let v1 = builder.load_local(local0, SourceSpan::UNKNOWN).unwrap(); + let v2 = builder.add(v0, v1, SourceSpan::UNKNOWN).unwrap(); + builder.ret([v2], SourceSpan::UNKNOWN).unwrap(); + } + + test.run_local2reg(true).expect("invalid ir"); + + let output = + format!("{}", test.function().borrow().print(&Default::default(), &test.context)); + filecheck!( + output, + r#" +builtin.function @ignores_inter_block_candidates(v0: i32) -> i32 { +// CHECK-LABEL: ^block0 +^block0(v0: i32): + // CHECK-NEXT: hir.store_local v0 #[local = lv0]; + hir.store_local v0 #[local = lv0]; + // CHECK-NEXT: cf.br ^block1; + cf.br ^block1 +// CHECK-LABEL: ^block1: +^block1: + // CHECK-NEXT: [[V1:v\d+]] = hir.load_local : i32 #[local = lv0]; + v1 = hir.load_local : i32 #[local = lv0]; + // CHECK-NEXT: [[V2:v\d+]] = arith.add v0, [[V1]] : i32 #[overflow = checked]; + v2 = arith.add v0, v1 : i32 #[overflow = checked] + // CHECK-NEXT: builtin.ret [[V2]]; + builtin.ret v2; +}; + "# + ); + } + + #[test] + fn does_not_promote_across_region_control_flow() { + use midenc_dialect_scf::StructuredControlFlowOpBuilder; + use midenc_hir::Op; + + let mut test = Test::new("ignores_intervening_scf", &[Type::I32, Type::I1], &[Type::I32]); + + { + let mut builder = test.function_builder(); + let local0 = builder.alloc_local(Type::I32); + let [v0, v1] = *builder.entry_block().borrow().arguments()[0..2].as_array().unwrap(); + let v0 = v0 as ValueRef; + let v1 = v1 as ValueRef; + builder.store_local(local0, v0, SourceSpan::UNKNOWN).unwrap(); + + let if_op = builder.r#if(v1, &[Type::I32], SourceSpan::UNKNOWN).unwrap(); + let v2 = if_op.borrow().results()[0] as ValueRef; + let entry_block = builder.current_block(); + + { + let then_region = if_op.borrow().then_body().as_region_ref(); + let then_block = builder.create_block_in_region(then_region); + builder.switch_to_block(then_block); + let v3 = builder.i32(1, SourceSpan::UNKNOWN); + builder.r#yield(Some(v3), SourceSpan::UNKNOWN).unwrap(); + + let else_region = if_op.borrow().else_body().as_region_ref(); + let else_block = builder.create_block_in_region(else_region); + builder.switch_to_block(else_block); + let v4 = builder.i32(2, SourceSpan::UNKNOWN); + builder.r#yield(Some(v4), SourceSpan::UNKNOWN).unwrap(); + } + builder.switch_to_block(entry_block); + + let v5 = builder.load_local(local0, SourceSpan::UNKNOWN).unwrap(); + let v6 = builder.add(v5, v2, SourceSpan::UNKNOWN).unwrap(); + builder.ret([v6], SourceSpan::UNKNOWN).unwrap(); + } + + test.run_local2reg(true).expect("invalid ir"); + + let output = + format!("{}", ::print(&test.function().borrow(), &Default::default())); + std::println!("output: {output}"); + filecheck!( + output, + r#" +builtin.function @ignores_intervening_scf(v0: i32, v1: i1) -> i32 { +// CHECK-LABEL: ^block0 +^block0(v0: i32, v1: i1): + // CHECK-NEXT: hir.store_local v0 #[local = lv0]; + hir.store_local v0 #[local = lv0]; + // CHECK-NEXT: [[V2:v\d+]] = scf.if v1 : i32 { + // CHECK-NEXT: ^block{{\d+}}: + v2 = scf.if v1 : i32 { + ^block1: + // CHECK-NEXT: [[V3:v\d+]] = arith.constant 1 : i32; + v3 = arith.constant 1 : i32; + // CHECK-NEXT: scf.yield [[V3]]; + scf.yield v3; + // CHECK-NEXT: } else { + // CHECK-NEXT: ^block2: + } else { + ^block2: + // CHECK-NEXT: [[V4:v\d+]] = arith.constant 2 : i32; + v4 = arith.constant 2 : i32; + // CHECK-NEXT: scf.yield [[V4]]; + scf.yield v4; + // CHECK-NEXT: }; + }; + // CHECK-NEXT: [[V5:v\d+]] = hir.load_local : i32 #[local = lv0]; + v5 = hir.load_local : i32 #[local = lv0]; + // CHECK-NEXT: [[V6:v\d+]] = arith.add [[V5]], [[V2]] : i32 #[overflow = checked]; + v6 = arith.add v5, v2 : i32 #[overflow = checked]; + // CHECK-NEXT: builtin.ret [[V6]]; + builtin.ret v6; +}; + "# + ); + } + + fn enable_compiler_instrumentation() { + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") + .format_timestamp(None) + .is_test(true) + .try_init(); + } + + struct Test { + context: Rc, + builder: OpBuilder, + function: FunctionRef, + } + + impl Test { + pub fn new(name: &'static str, params: &[Type], results: &[Type]) -> Self { + enable_compiler_instrumentation(); + + let context = Rc::new(Context::default()); + let mut builder = OpBuilder::new(context.clone()); + let function = builder + .create_function( + Ident::with_empty_span(name.into()), + Signature::new( + params.iter().cloned().map(AbiParam::new), + results.iter().cloned().map(AbiParam::new), + ), + ) + .unwrap(); + + Self { + context, + builder, + function, + } + } + + pub fn function(&self) -> FunctionRef { + self.function + } + + pub fn function_builder(&mut self) -> FunctionBuilder<'_, OpBuilder> { + FunctionBuilder::new(self.function, &mut self.builder) + } + + pub fn run_local2reg(&self, verify: bool) -> Result<(), Report> { + let mut pm = PassManager::on::( + self.context.clone(), + midenc_hir::pass::Nesting::Explicit, + ); + pm.add_pass(Box::new(Local2Reg)); + pm.enable_verifier(verify); + pm.run(self.function.as_operation_ref()) + } + } +} diff --git a/dialects/hir/src/transforms/spill/tests.rs b/dialects/hir/src/transforms/spill/tests.rs index 32e680141..eb63af84f 100644 --- a/dialects/hir/src/transforms/spill/tests.rs +++ b/dialects/hir/src/transforms/spill/tests.rs @@ -1,12 +1,12 @@ -use alloc::{boxed::Box, rc::Rc, sync::Arc}; -use std::string::ToString; +use alloc::{boxed::Box, format, rc::Rc, string::ToString, sync::Arc}; use midenc_dialect_arith::ArithOpBuilder; use midenc_dialect_cf::ControlFlowOpBuilder as Cf; +use midenc_dialect_scf::{ScfDialect, StructuredControlFlowOpBuilder}; use midenc_expect_test::expect_file; use midenc_hir::{ - AbiParam, AddressSpace, Builder, Context, Ident, Op, OpBuilder, PointerType, Report, Signature, - SourceSpan, Type, ValueRef, + AbiParam, AddressSpace, Builder, Context, Ident, Op, OpBuilder, PointerType, ProgramPoint, + Report, Signature, SourceSpan, Type, ValueRef, dialects::builtin::{BuiltinOpBuilder, Function, FunctionBuilder}, pass::{Nesting, PassManager}, }; @@ -20,7 +20,7 @@ type TestResult = Result; /// materialized as `hir.store_local`/`hir.load_local`. #[test] fn materializes_spills_intra_block() -> TestResult<()> { - let _ = env_logger::Builder::from_env("MIDENC_TRACE") + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") .format_timestamp(None) .is_test(true) .try_init(); @@ -141,7 +141,7 @@ fn materializes_spills_intra_block() -> TestResult<()> { /// other are materialized as `store_local`/`load_local`, with edges split as needed. #[test] fn materializes_spills_branching_cfg() -> TestResult<()> { - let _ = env_logger::Builder::from_env("MIDENC_TRACE") + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") .format_timestamp(None) .is_test(true) .try_init(); @@ -275,3 +275,341 @@ fn materializes_spills_branching_cfg() -> TestResult<()> { assert!(loads == 1, "expected only one load_local op\n{after}"); Ok(()) } + +/// Build a small multi-block CFG containing a `scf.if`, where spilled values are only used inside +/// the nested regions of the `scf.if`. +/// +/// This is a regression test for issue #831, where spill/reload rewriting failed to account for +/// uses inside nested regions during CFG reconstruction. Without that rewrite, reloads appear +/// unused and are removed, causing their corresponding spills to be removed as well. +/// +/// Operand stack pressure before the `hir.exec @test/example` call: +/// +/// - The spills analysis models stack pressure in felts and enforces `K = 16`. +/// - The call arguments require 15 felts total: +/// - `v9: ptr` = 1 felt +/// - `v6: u128` = 4 felts +/// - `v10: u128` is passed twice = 8 felts +/// - `v11: u64` = 2 felts +/// - We keep `v4: u32` and `v5: ptr` live across the call (both used only after the call, inside +/// the `scf.if`), adding 2 more felts. +/// +/// Total pressure at the call is `15 + 2 = 17`, which exceeds `K`, so at least one of `{v4, v5}` +/// must be spilled. +/// +/// In this specific IR, `v4` and `v5` have equal spill priority: +/// +/// - Both are 1 felt +/// - Both have the same next use (`hir.store v5, v4` inside the `scf.if`) +/// +/// The MIN heuristic orders candidates stably and `W` preserves insertion order, so `{v4, v5}` stay +/// in that order and we pick from the end, which means we currently spill `v5`. +#[test] +fn materializes_spills_nested_scf_if() -> TestResult<()> { + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") + .format_timestamp(None) + .is_test(true) + .try_init(); + + let span = SourceSpan::UNKNOWN; + let context = Rc::new(Context::default()); + context.get_or_register_dialect::(); + let mut ob = OpBuilder::new(context.clone()); + + let module = ob.create_module(Ident::with_empty_span("test".into()))?; + let module_body = module.borrow().body().as_region_ref(); + ob.create_block(module_body, None, &[]); + let func = ob.create_function( + Ident::with_empty_span("test::spill_nested_scf_if".into()), + Signature::new( + [AbiParam::new(Type::Ptr(Arc::new(PointerType::new_with_address_space( + Type::U8, + AddressSpace::Element, + ))))], + [AbiParam::new(Type::U32)], + ), + )?; + + let callee_sig = Signature::new( + [ + AbiParam::new(Type::Ptr(Arc::new(PointerType::new_with_address_space( + Type::U128, + AddressSpace::Element, + )))), + AbiParam::new(Type::U128), + AbiParam::new(Type::U128), + AbiParam::new(Type::U128), + AbiParam::new(Type::U64), + ], + [AbiParam::new(Type::U32)], + ); + let callee = + ob.create_function(Ident::with_empty_span("example".into()), callee_sig.clone())?; + + { + let mut b = FunctionBuilder::new(func, &mut ob); + let entry = b.current_block(); + let exit = b.create_block(); + let exit_arg = b.append_block_param(exit, Type::U32, span); + let v0 = entry.borrow().arguments()[0] as ValueRef; + let v1 = b.ptrtoint(v0, Type::U32, span)?; + let k32 = b.u32(32, span); + let v2 = b.add_unchecked(v1, k32, span)?; + let v3 = b.inttoptr( + v2, + Type::Ptr(Arc::new(PointerType::new_with_address_space( + Type::U128, + AddressSpace::Element, + ))), + span, + )?; + let v4 = b.load(v3, span)?; + let k64 = b.u32(64, span); + let v5 = b.add_unchecked(v1, k64, span)?; + let v6 = b.inttoptr( + v5, + Type::Ptr(Arc::new(PointerType::new_with_address_space( + Type::U128, + AddressSpace::Element, + ))), + span, + )?; + let v7 = b.load(v6, span)?; + let one = b.u64(1, span); + let call = b.exec(callee, callee_sig.clone(), [v6, v4, v7, v7, one], span)?; + let v8 = call.borrow().results()[0] as ValueRef; + + // Make the branch condition depend only on the call result, so that values defined before + // the call are only used inside the nested `scf.if` regions. + let zero = b.u32(0, span); + let cond = b.eq(v8, zero, span)?; + + let mut if_op = b.r#if(cond, &[Type::U32], span)?; + let (then_block, else_block) = (context.create_block(), context.create_block()); + { + let mut if_op = if_op.borrow_mut(); + if_op.then_body_mut().push_back(then_block); + if_op.else_body_mut().push_back(else_block); + } + + // then + b.switch_to_block(then_block); + b.store(v3, v2, span)?; + b.r#yield([v8], span)?; + + // else + b.switch_to_block(else_block); + b.store(v3, v2, span)?; + b.r#yield([v8], span)?; + + // back to entry + b.switch_to_block(entry); + let v9 = if_op.as_operation_ref().borrow().results()[0] as ValueRef; + b.br(exit, [v9], span)?; + + // exit + b.switch_to_block(exit); + b.ret(Some(exit_arg), span)?; + } + + let mut pm = PassManager::on::(context, Nesting::Implicit); + pm.add_pass(Box::new(TransformSpills)); + pm.run(func.as_operation_ref())?; + + let after = func.as_operation_ref().borrow().to_string(); + + litcheck_filecheck::filecheck!( + &after, + r#" +; COM: Spill before call +; CHECK: hir.store_local +; CHECK: hir.exec @test/example +; CHECK: scf.if + +; COM: First reload in `then` +; CHECK-LABEL: ^block3: +; CHECK: hir.load_local +; CHECK-NEXT: hir.store + +; COM: Second reload in `else` +; CHECK-LABEL: ^block4: +; CHECK: hir.load_local +; CHECK-NEXT: hir.store +"# + ); + + Ok(()) +} + +/// Build a small multi-block CFG containing a `scf.while`, where spilled values are only used +/// inside the `after` region of the `scf.while`. +/// +/// This is a regression test for spill/reload rewriting in the CFG reconstruction pass: the +/// rewrite must account for uses inside *all* regions nested under a region-branch op. In +/// particular, `scf.while`'s `after` region is not directly reachable from the parent, but uses +/// within it still require reloads to be preserved and rewritten correctly. +#[test] +fn materializes_spills_nested_scf_while_after_region() -> TestResult<()> { + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") + .format_timestamp(None) + .is_test(true) + .try_init(); + + let span = SourceSpan::UNKNOWN; + let context = Rc::new(Context::default()); + context.get_or_register_dialect::(); + let mut ob = OpBuilder::new(context.clone()); + + let module = ob.create_module(Ident::with_empty_span("test".into()))?; + let module_body = module.borrow().body().as_region_ref(); + ob.create_block(module_body, None, &[]); + let func = ob.create_function( + Ident::with_empty_span("test::spill_nested_scf_while".into()), + Signature::new( + [AbiParam::new(Type::Ptr(Arc::new(PointerType::new_with_address_space( + Type::U8, + AddressSpace::Element, + ))))], + [AbiParam::new(Type::U32)], + ), + )?; + + let callee_sig = Signature::new( + [ + AbiParam::new(Type::Ptr(Arc::new(PointerType::new_with_address_space( + Type::U128, + AddressSpace::Element, + )))), + AbiParam::new(Type::U128), + AbiParam::new(Type::U128), + AbiParam::new(Type::U128), + AbiParam::new(Type::U64), + ], + [AbiParam::new(Type::U32)], + ); + let callee = + ob.create_function(Ident::with_empty_span("example".into()), callee_sig.clone())?; + + // We construct a synthetic spill/reload pair to focus this test on the rewrite logic. + // + // In particular, we spill a value before a call, reload it before the `scf.while`, and then + // ensure the only post-reload uses occur in the `after` region of the `scf.while`. + // + // The CFG rewrite must treat those nested uses as "real" uses, otherwise the reload appears + // unused and is removed, which then causes the spill to be removed as well. + let (call_op, while_op, spilled_value) = { + let mut b = FunctionBuilder::new(func, &mut ob); + let entry = b.current_block(); + let exit = b.create_block(); + let exit_arg = b.append_block_param(exit, Type::U32, span); + + let v0 = entry.borrow().arguments()[0] as ValueRef; + let v1 = b.ptrtoint(v0, Type::U32, span)?; + let k32 = b.u32(32, span); + let v2 = b.add_unchecked(v1, k32, span)?; + let v3 = b.inttoptr( + v2, + Type::Ptr(Arc::new(PointerType::new_with_address_space( + Type::U128, + AddressSpace::Element, + ))), + span, + )?; + let v4 = b.load(v3, span)?; + let k64 = b.u32(64, span); + let v5 = b.add_unchecked(v1, k64, span)?; + let v6 = b.inttoptr( + v5, + Type::Ptr(Arc::new(PointerType::new_with_address_space( + Type::U128, + AddressSpace::Element, + ))), + span, + )?; + let v7 = b.load(v6, span)?; + let one = b.u64(1, span); + let call = b.exec(callee, callee_sig.clone(), [v6, v4, v7, v7, one], span)?; + let call_op = call.as_operation_ref(); + let v8 = call.borrow().results()[0] as ValueRef; + + // Ensure the loop condition is not known at compile time, and does not depend on the + // values we want to force to be spilled across the call. + let zero = b.u32(0, span); + let cond = b.eq(v8, zero, span)?; + + let while_op = b.r#while(core::iter::empty::(), &[], span)?; + let while_op_ref = while_op.as_operation_ref(); + let (before_block, after_block) = { + let while_op = while_op.borrow(); + ( + while_op.before().entry_block_ref().unwrap(), + while_op.after().entry_block_ref().unwrap(), + ) + }; + + // before: if `cond` is true, enter the `after` region, otherwise exit the loop. + b.switch_to_block(before_block); + b.condition(cond, core::iter::empty::(), span)?; + + // after: use values defined before the call so they are live across it, but only used in + // the `after` region (and not forwarded via the `before` region terminator). + b.switch_to_block(after_block); + let k72 = b.u32(72, span); + let v9 = b.add_unchecked(v1, k72, span)?; + b.store(v3, v2, span)?; + b.store(v3, v9, span)?; + b.r#yield(core::iter::empty::(), span)?; + + // back to entry: exit the function. + b.switch_to_block(entry); + b.br(exit, [v8], span)?; + + b.switch_to_block(exit); + b.ret(Some(exit_arg), span)?; + (call_op, while_op_ref, v2) + }; + + let mut analysis = midenc_hir_analysis::analyses::SpillAnalysis::default(); + analysis.spilled.insert(spilled_value); + analysis.spills.push(midenc_hir_analysis::analyses::spills::SpillInfo { + id: midenc_hir_analysis::analyses::spills::Spill::new(0), + place: midenc_hir_analysis::analyses::spills::Placement::At(ProgramPoint::before(call_op)), + value: spilled_value, + span, + inst: None, + }); + analysis.reloads.push(midenc_hir_analysis::analyses::spills::ReloadInfo { + id: midenc_hir_analysis::analyses::spills::Reload::new(0), + place: midenc_hir_analysis::analyses::spills::Placement::At(ProgramPoint::before(while_op)), + value: spilled_value, + span, + inst: None, + }); + + let mut interface = super::TransformSpillsImpl { + function: func, + locals: Default::default(), + }; + let analysis_manager = midenc_hir::pass::AnalysisManager::new(func.as_operation_ref(), None); + midenc_hir_transform::transform_spills( + func.as_operation_ref(), + &mut analysis, + &mut interface, + analysis_manager, + )?; + + let after = func.as_operation_ref().borrow().to_string(); + + litcheck_filecheck::filecheck!( + &after, + r#" +; CHECK: hir.store_local +; CHECK: hir.exec @test/example +; CHECK: hir.load_local +; CHECK: scf.while +; CHECK: hir.store +"# + ); + + Ok(()) +} diff --git a/dialects/scf/Cargo.toml b/dialects/scf/Cargo.toml index a560ca34f..45b59e3da 100644 --- a/dialects/scf/Cargo.toml +++ b/dialects/scf/Cargo.toml @@ -27,4 +27,4 @@ bitvec.workspace = true [dev-dependencies] # Use local paths for dev-only dependency to avoid relying on crates.io during packaging midenc-expect-test = { path = "../../tools/expect-test" } -env_logger.workspace = true +midenc-log = { path = "../../midenc-log" } diff --git a/dialects/scf/src/canonicalization/fold_redundant_yields.rs b/dialects/scf/src/canonicalization/fold_redundant_yields.rs index 06ea171a3..2968c16f5 100644 --- a/dialects/scf/src/canonicalization/fold_redundant_yields.rs +++ b/dialects/scf/src/canonicalization/fold_redundant_yields.rs @@ -35,10 +35,10 @@ impl Pattern for FoldRedundantYields { impl RewritePattern for FoldRedundantYields { fn match_and_rewrite( &self, - mut op_ref: OperationRef, + op_ref: OperationRef, rewriter: &mut dyn Rewriter, ) -> Result { - let mut op = op_ref.borrow_mut(); + let op = op_ref.borrow(); let Some(br_op) = op.as_trait::() else { return Ok(false); @@ -56,6 +56,7 @@ impl RewritePattern for FoldRedundantYields { // Several assertions follow: an SCF region always has a single block, that block must // have a terminator which then implements RegionBranchTerminatorOpInterface. let region = region_ref.borrow(); + assert!(region.has_one_block()); let block = region.entry(); @@ -137,8 +138,11 @@ impl RewritePattern for FoldRedundantYields { // Next remove the redundant results. Iterate for each position in reverse to avoid // invalidating offsets as we go. redundant_result_positions.sort_unstable_by(|a, b| b.cmp(a)); - for idx in &redundant_result_positions { - op.results_mut().group_mut(0).erase(*idx); + { + let mut op = op.into_entity_mut().unwrap(); + for idx in &redundant_result_positions { + op.results_mut().group_mut(0).erase(*idx); + } } // And remove the redundant terminator operands. diff --git a/dialects/scf/src/canonicalization/if_remove_unused_results.rs b/dialects/scf/src/canonicalization/if_remove_unused_results.rs index 8bab5c695..353406def 100644 --- a/dialects/scf/src/canonicalization/if_remove_unused_results.rs +++ b/dialects/scf/src/canonicalization/if_remove_unused_results.rs @@ -37,23 +37,24 @@ impl IfRemoveUnusedResults { rewriter.merge_blocks(src, dest, &[]); // Replace the yield op with one that returns only the used values. - let yield_op = dest.borrow().terminator().unwrap(); + let op = { dest.borrow().terminator().unwrap() }; let mut yield_op = unsafe { - UnsafeIntrusiveEntityRef::from_raw(yield_op.borrow().downcast_ref::().unwrap()) + UnsafeIntrusiveEntityRef::from_raw(op.borrow().downcast_ref::().unwrap()) }; - let yield_ = yield_op.borrow(); let mut used_operands = SmallVec::<[ValueRef; 4]>::with_capacity(used_results.len()); - for used_result in used_results { - let value = yield_.operands()[used_result.borrow().index()].borrow().as_value_ref(); - used_operands.push(value); + { + let yield_ = yield_op.borrow(); + for used_result in used_results { + let operand = yield_.operands()[used_result.borrow().index()]; + used_operands.push(operand.borrow().as_value_ref()); + } } - let yield_operation = yield_op.as_operation_ref(); - let _guard = rewriter.modify_op_in_place(yield_operation); - let mut yield_op = yield_op.borrow_mut(); - let context = yield_op.as_operation().context_rc(); - yield_op.yielded_mut().set_operands(used_operands, yield_operation, &context); + let _guard = rewriter.modify_op_in_place(op); + let mut yield_ = yield_op.borrow_mut(); + let context = yield_.as_operation().context_rc(); + yield_.yielded_mut().set_operands(used_operands, op, &context); } } @@ -99,25 +100,17 @@ impl RewritePattern for IfRemoveUnusedResults { let new_if = rewriter.r#if(if_op.condition().as_value_ref(), &new_types, if_op.span())?; let new_if_op = new_if.borrow(); - let new_then_block = - rewriter.create_block(new_if_op.then_body().as_region_ref(), None, &[]); - let new_else_block = - rewriter.create_block(new_if_op.else_body().as_region_ref(), None, &[]); + let new_then_region = new_if_op.then_body().as_region_ref(); + let new_then_block = rewriter.create_block(new_then_region, None, &[]); + let new_else_region = new_if_op.else_body().as_region_ref(); + let new_else_block = rewriter.create_block(new_else_region, None, &[]); // Move the bodies and replace the terminators (note there is a then and an else region // since the operation returns results). - self.transfer_body( - if_op.then_body().entry_block_ref().unwrap(), - new_then_block, - &used_results, - rewriter, - ); - self.transfer_body( - if_op.else_body().entry_block_ref().unwrap(), - new_else_block, - &used_results, - rewriter, - ); + let then_entry = { if_op.then_body().entry_block_ref().unwrap() }; + self.transfer_body(then_entry, new_then_block, &used_results, rewriter); + let else_entry = { if_op.else_body().entry_block_ref().unwrap() }; + self.transfer_body(else_entry, new_else_block, &used_results, rewriter); drop(op); // Replace the operation by the new one. diff --git a/dialects/scf/src/canonicalization/while_unused_result.rs b/dialects/scf/src/canonicalization/while_unused_result.rs index d64ea8ae6..4892bc334 100644 --- a/dialects/scf/src/canonicalization/while_unused_result.rs +++ b/dialects/scf/src/canonicalization/while_unused_result.rs @@ -139,11 +139,8 @@ impl RewritePattern for WhileUnusedResult { rewriter.r#while(inits, &new_result_types, span)? }; - let new_after_block = rewriter.create_block( - new_while.borrow().after().as_region_ref(), - None, - &new_result_types, - ); + let new_after_region = { new_while.borrow().after().as_region_ref() }; + let new_after_block = new_after_region.borrow().entry_block_ref().unwrap(); // Build new results list and new after block args (unused entries will be None) let num_results = while_op.num_results(); @@ -161,10 +158,19 @@ impl RewritePattern for WhileUnusedResult { } let before_region = while_op.before().as_region_ref(); - let new_before_region = new_while.borrow().before().as_region_ref(); + let (new_before_region, new_before_block) = { + let new_while = new_while.borrow(); + ( + new_while.before().as_region_ref(), + new_while.before().entry_block_ref().unwrap(), + ) + }; let after_block = while_op.after().entry_block_ref().unwrap(); + drop(operation); + // Inline the old before region, but clear the new before region as we replacing it rewriter.inline_region_before(before_region, new_before_region); + rewriter.erase_block(new_before_block); rewriter.merge_blocks(after_block, new_after_block, &new_after_block_args); rewriter.replace_op_with_values(op, &new_results); diff --git a/dialects/scf/src/ops.rs b/dialects/scf/src/ops.rs index 7764a32df..58de84a7f 100644 --- a/dialects/scf/src/ops.rs +++ b/dialects/scf/src/ops.rs @@ -197,11 +197,7 @@ impl OpPrinter for While { use formatter::*; let result_types = print::render_operation_result_types(self.as_operation()); - let result_types = if result_types.is_empty() { - result_types - } else { - result_types + const_text(" ") - }; + let result_types = result_types + const_text(" "); let results = print::render_operation_results(self.as_operation()); let operands = print::render_operation_operands(self.as_operation()); let header = results + display(self.op.name()) + const_text(" ") + operands + result_types; diff --git a/dialects/scf/src/transforms/cfg_to_scf.rs b/dialects/scf/src/transforms/cfg_to_scf.rs index be7ad3c2b..14e320dbe 100644 --- a/dialects/scf/src/transforms/cfg_to_scf.rs +++ b/dialects/scf/src/transforms/cfg_to_scf.rs @@ -446,7 +446,7 @@ mod tests { /// the other branch performs additional computation before exiting. #[test] fn cfg_to_scf_lift_conditional_early_exit() -> Result<(), Report> { - let _ = env_logger::Builder::from_env("MIDENC_TRACE") + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") .is_test(true) .format_timestamp(None) .try_init(); diff --git a/docs/external/src/guides/debugger.md b/docs/external/src/guides/debugger.md index 25b43c6f7..3344d587f 100644 --- a/docs/external/src/guides/debugger.md +++ b/docs/external/src/guides/debugger.md @@ -27,10 +27,10 @@ The debugger may also be used as a library, but that is left as an exercise for ```shell # Compile a program to MAST from a rustc-generated Wasm module -midenc compile foo.wasm -o foo.masl +midenc compile foo.wasm -o foo.masp # Load that program into the debugger and start executing it -midenc debug foo.masl +midenc debug foo.masp ``` ## Program inputs @@ -48,7 +48,7 @@ To specify the contents of the operand stack, you can do so by following the raw Each operand must be a valid field element value, in either decimal or hexadecimal format. For example: ```shell -midenc debug foo.masl -- 1 2 0xdeadbeef +midenc debug foo.masp -- 1 2 0xdeadbeef ``` If you pass arguments via the command line in conjunction with `--inputs`, then the command line arguments diff --git a/docs/external/src/usage/cargo-miden.md b/docs/external/src/usage/cargo-miden.md index c8668d481..547f4f061 100644 --- a/docs/external/src/usage/cargo-miden.md +++ b/docs/external/src/usage/cargo-miden.md @@ -25,16 +25,11 @@ work. ::: -To install the extension, clone the compiler repo first: +To install the extension: ```bash -git clone https://github.com/0xMiden/compiler -``` - -Then, run the following in your shell in the cloned repo folder: +cargo +nightly-2025-12-10 install cargo-miden --locked -```bash -cargo install --path tools/cargo-miden --locked ``` This will take a minute to compile, but once complete, you can run `cargo help miden` or just @@ -42,33 +37,6 @@ This will take a minute to compile, but once complete, you can run `cargo help m To get help for a specific command, use `cargo miden help ` or `cargo miden --help`. -## Creating an example project - -If you're new to Miden and want to explore some example projects, you can use the `cargo miden example` command to create a project from one of our templates: - -```bash -cargo miden example -``` - -To see the list of available examples, run: - -```bash -cargo miden example --help -``` - -Available examples include: - -- **basic-wallet** - A basic wallet account implementation (creates both the wallet and a paired p2id-note) -- **p2id-note** - A pay-to-ID note script (creates both the note and a paired basic-wallet) -- **counter-contract** - A simple counter contract (creates both the contract and a paired counter-note) -- **counter-note** - A note script for interacting with the counter contract (creates both the note and paired counter-contract) -- **fibonacci** - A Fibonacci sequence calculator demonstrating basic computations -- **collatz** - An implementation of the Collatz conjecture -- **is-prime** - A prime number checker -- **storage-example** - Demonstrates storage operations in Miden - -Note that some examples create paired projects. For instance, running `cargo miden example basic-wallet` will create a directory containing both the `basic-wallet` account and the `p2id-note` script that interacts with it. - ## Creating a new project Your first step will be to create a new Rust project set up for compiling to Miden: diff --git a/examples/auth-component-no-auth/Cargo.lock b/examples/auth-component-no-auth/Cargo.lock index 474f5bc13..42ba6a5ec 100644 --- a/examples/auth-component-no-auth/Cargo.lock +++ b/examples/auth-component-no-auth/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + [[package]] name = "aead" version = "0.5.2" @@ -21,6 +36,56 @@ dependencies = [ "memchr", ] +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.0", +] + [[package]] name = "anyhow" version = "1.0.100" @@ -61,6 +126,30 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-link 0.2.0", +] + +[[package]] +name = "backtrace-ext" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" +dependencies = [ + "backtrace", +] + [[package]] name = "base16ct" version = "0.2.0" @@ -135,6 +224,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5252b3d2648e5eedbc1a6f501e3c795e07025c1e93bbf8bbdd6eef7f447a6d54" dependencies = [ "find-msvc-tools", + "jobserver", + "libc", "shlex", ] @@ -179,6 +270,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + [[package]] name = "const-oid" version = "0.9.6" @@ -272,7 +369,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -302,7 +399,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -397,15 +494,26 @@ dependencies = [ ] [[package]] -name = "enum_dispatch" -version = "0.3.13" +name = "env_filter" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn", + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", ] [[package]] @@ -414,6 +522,16 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.0", +] + [[package]] name = "ff" version = "0.13.1" @@ -460,6 +578,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "fs-err" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf68cef89750956493a66a10f512b9e58d9db21f2a573c079c0bdf1207a54a7" +dependencies = [ + "autocfg", +] + [[package]] name = "futures" version = "0.3.31" @@ -573,6 +700,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + [[package]] name = "glob" version = "0.3.3" @@ -655,6 +788,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "is_ci" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + [[package]] name = "itertools" version = "0.14.0" @@ -670,6 +815,40 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jiff" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.3", + "libc", +] + [[package]] name = "js-sys" version = "0.3.78" @@ -757,6 +936,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + [[package]] name = "lock_api" version = "0.4.13" @@ -803,10 +988,13 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.8.0" +version = "0.10.0" dependencies = [ "miden-base", + "miden-base-macros", "miden-base-sys", + "miden-field", + "miden-field-repr", "miden-sdk-alloc", "miden-stdlib-sys", "wit-bindgen 0.46.0", @@ -814,9 +1002,9 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" +checksum = "3d819876b9e9b630e63152400e6df2a201668a9bdfd33d54d6806b9d7b992ff8" dependencies = [ "miden-core", "miden-utils-indexing", @@ -827,9 +1015,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" +checksum = "24c6a18e29c03141cf9044604390a00691c7342924ec865b4acfdd560ff41ede" dependencies = [ "log", "miden-assembly-syntax", @@ -841,9 +1029,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" +checksum = "7458ff670f5a514bf972aa84d6e1851a4c4e9afa351f53b71bdc2218b99254b6" dependencies = [ "aho-corasick", "lalrpop", @@ -853,6 +1041,7 @@ dependencies = [ "miden-debug-types", "miden-utils-diagnostics", "midenc-hir-type", + "proptest", "regex", "rustc_version 0.4.1", "semver 1.0.26", @@ -862,23 +1051,22 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.8.0" +version = "0.10.0" dependencies = [ - "miden-base-macros", "miden-base-sys", "miden-stdlib-sys", ] [[package]] name = "miden-base-macros" -version = "0.8.0" +version = "0.10.0" dependencies = [ "heck", - "miden-objects", + "miden-protocol", "proc-macro2", "quote", "semver 1.0.26", - "syn", + "syn 2.0.106", "toml 0.8.23", "wit-bindgen-core", "wit-bindgen-rust", @@ -886,21 +1074,24 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.1" +version = "0.10.0" dependencies = [ + "miden-field-repr", "miden-stdlib-sys", ] [[package]] name = "miden-core" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" +checksum = "21a5c9c8c3d42ae8381ed49e47ff9ad2d2e345c4726761be36b7d4000ebb40ae" dependencies = [ - "enum_dispatch", + "derive_more", + "itertools", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-core-derive", "miden-utils-indexing", "num-derive", "num-traits", @@ -909,14 +1100,33 @@ dependencies = [ "winter-utils", ] +[[package]] +name = "miden-core-lib" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6556494ea5576803730fa15015bee6bd9d1a117450f22e7df0883421e7423674" +dependencies = [ + "env_logger", + "fs-err", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", + "sha2", + "thiserror", +] + [[package]] name = "miden-crypto" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" +checksum = "6e28b6e110f339c2edc2760a8cb94863f0a055ee658a49bc90c8560eff2feef4" dependencies = [ "blake3", + "cc", "chacha20poly1305", + "curve25519-dalek", "ed25519-dalek", "flume", "glob", @@ -929,6 +1139,7 @@ dependencies = [ "rand_chacha", "rand_core 0.9.3", "rand_hc", + "sha2", "sha3", "subtle", "thiserror", @@ -940,19 +1151,19 @@ dependencies = [ [[package]] name = "miden-crypto-derive" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +checksum = "f40e95b9c7c99ed6bbf073d9e02721d812dedd2c195019c0a0e0a3dbb9cbf034" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] name = "miden-debug-types" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" +checksum = "19123e896f24b575e69921a79a39a0a4babeb98404a8601017feb13b75d653b3" dependencies = [ "memchr", "miden-crypto", @@ -961,9 +1172,36 @@ dependencies = [ "miden-utils-indexing", "miden-utils-sync", "paste", + "serde", + "serde_spanned 1.0.0", "thiserror", ] +[[package]] +name = "miden-field" +version = "0.10.0" +dependencies = [ + "miden-core", +] + +[[package]] +name = "miden-field-repr" +version = "0.10.0" +dependencies = [ + "miden-core", + "miden-field", + "miden-field-repr-derive", +] + +[[package]] +name = "miden-field-repr-derive" +version = "0.10.0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + [[package]] name = "miden-formatting" version = "0.1.1" @@ -975,9 +1213,9 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" +checksum = "f0d6a322b91efa1bb71e224395ca1fb9ca00e2614f89427e35d8c42a903868a3" dependencies = [ "derive_more", "miden-assembly-syntax", @@ -991,6 +1229,8 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eef536978f24a179d94fa2a41e4f92b28e7d8aab14b8d23df28ad2a3d7098b20" dependencies = [ + "backtrace", + "backtrace-ext", "cfg-if", "futures", "indenter", @@ -1003,7 +1243,11 @@ dependencies = [ "serde_json", "spin", "strip-ansi-escapes", - "syn", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "syn 2.0.106", + "terminal_size", "textwrap", "thiserror", "trybuild", @@ -1018,63 +1262,93 @@ checksum = "86a905f3ea65634dd4d1041a4f0fd0a3e77aa4118341d265af1a94339182222f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] -name = "miden-objects" -version = "0.12.1" +name = "miden-processor" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" +checksum = "4a659fac55de14647e2695f03d96b83ff94fe65fd31e74d81c225ec52af25acf" +dependencies = [ + "itertools", + "miden-air", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", + "thiserror", + "tokio", + "tracing", + "winter-prover", +] + +[[package]] +name = "miden-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfed3ae85e2fabbf8a2e7416e388a40519e10cbf0cdceda222ef858c2f270b35" dependencies = [ "bech32", + "fs-err", "getrandom 0.3.3", "miden-assembly", "miden-assembly-syntax", "miden-core", + "miden-core-lib", "miden-crypto", "miden-mast-package", "miden-processor", + "miden-protocol-macros", "miden-utils-sync", "miden-verifier", "rand", + "regex", "semver 1.0.26", "thiserror", + "walkdir", ] [[package]] -name = "miden-processor" -version = "0.19.1" +name = "miden-protocol-macros" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" +checksum = "f41a93dd532baa3a4c821073baad5d700aab119b3831ef7fdf004e196c10157e" dependencies = [ - "itertools", - "miden-air", - "miden-core", - "miden-debug-types", - "miden-utils-diagnostics", - "miden-utils-indexing", - "paste", - "rayon", - "thiserror", - "tokio", - "tracing", - "winter-prover", + "proc-macro2", + "quote", + "syn 2.0.106", ] [[package]] name = "miden-sdk-alloc" -version = "0.8.0" +version = "0.10.0" [[package]] name = "miden-stdlib-sys" -version = "0.8.0" +version = "0.10.0" +dependencies = [ + "miden-field", +] + +[[package]] +name = "miden-utils-core-derive" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa207ffd8b26a79d9b5b246a352812f0015c0bb8f75492ec089c5c8e6d5f9e2b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] name = "miden-utils-diagnostics" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" +checksum = "6b2f55477d410542a5d8990ca04856adf5bef91bfa3b54ca3c03a5ff14a6e25c" dependencies = [ "miden-crypto", "miden-debug-types", @@ -1085,28 +1359,29 @@ dependencies = [ [[package]] name = "miden-utils-indexing" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +checksum = "f39efae17e14ec8f8a1266cffd29eb7a08ac837143cd09223b1af361bbb55730" dependencies = [ "thiserror", ] [[package]] name = "miden-utils-sync" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" +checksum = "da7fa8f5fd27f122c83f55752f2a964bbfc2b713de419e9c152f7dcc05c194ec" dependencies = [ "lock_api", "loom", + "parking_lot", ] [[package]] name = "miden-verifier" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" +checksum = "fbddac2e76486fb657929338323c68b9e7f40e33b8cfb593d0fb5bf637db046e" dependencies = [ "miden-air", "miden-core", @@ -1126,6 +1401,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + [[package]] name = "nanorand" version = "0.7.0" @@ -1191,7 +1475,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1235,12 +1519,27 @@ dependencies = [ "libm", ] +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "opaque-debug" version = "0.3.1" @@ -1273,7 +1572,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -1334,6 +1633,21 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -1356,7 +1670,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.106", ] [[package]] @@ -1368,6 +1682,21 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +dependencies = [ + "bitflags", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax", + "unarray", +] + [[package]] name = "quote" version = "1.0.40" @@ -1389,6 +1718,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ + "rand_chacha", "rand_core 0.9.3", ] @@ -1416,6 +1746,9 @@ name = "rand_core" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", +] [[package]] name = "rand_hc" @@ -1426,6 +1759,15 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.3", +] + [[package]] name = "rayon" version = "1.11.0" @@ -1494,6 +1836,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "rustc-demangle" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1512,6 +1860,19 @@ dependencies = [ "semver 1.0.26", ] +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + [[package]] name = "rustversion" version = "1.0.22" @@ -1585,22 +1946,32 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1743,6 +2114,38 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "supports-color" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c64fc7232dd8d2e4ac5ce4ef302b1d81e0b80d055b9d77c7c4f51f6aa4c867d6" +dependencies = [ + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e396b6523b11ccb83120b115a0b7366de372751aa6edf19844dfb13a6af97e91" + +[[package]] +name = "supports-unicode" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.106" @@ -1778,6 +2181,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix", + "windows-sys 0.48.0", +] + [[package]] name = "textwrap" version = "0.16.2" @@ -1806,7 +2219,7 @@ checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1927,7 +2340,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1991,6 +2404,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicode-ident" version = "1.0.18" @@ -2031,6 +2450,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "valuable" version = "0.1.1" @@ -2099,7 +2524,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-shared", ] @@ -2121,7 +2546,7 @@ checksum = "7bb4ce89b08211f923caf51d527662b75bdc9c9c7aab40f86dcb9fb85ac552aa" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2232,7 +2657,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2243,7 +2668,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2286,13 +2711,22 @@ dependencies = [ "windows-link 0.1.3", ] +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + [[package]] name = "windows-sys" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -2304,20 +2738,35 @@ dependencies = [ "windows-link 0.2.0", ] +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + [[package]] name = "windows-targets" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2329,18 +2778,36 @@ dependencies = [ "windows-link 0.1.3", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -2353,24 +2820,48 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -2438,7 +2929,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d31a19dae58475d019850e25b0170e94b16d382fbf6afee9c0e80fdc935e73e" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2511,7 +3002,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn", + "syn 2.0.106", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -2527,7 +3018,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -2596,7 +3087,7 @@ checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] diff --git a/examples/auth-component-rpo-falcon512/Cargo.lock b/examples/auth-component-rpo-falcon512/Cargo.lock index 9c5d77b2d..22d804c48 100644 --- a/examples/auth-component-rpo-falcon512/Cargo.lock +++ b/examples/auth-component-rpo-falcon512/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + [[package]] name = "aead" version = "0.5.2" @@ -21,6 +36,56 @@ dependencies = [ "memchr", ] +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.0", +] + [[package]] name = "anyhow" version = "1.0.100" @@ -61,6 +126,30 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-link 0.2.0", +] + +[[package]] +name = "backtrace-ext" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" +dependencies = [ + "backtrace", +] + [[package]] name = "base16ct" version = "0.2.0" @@ -135,6 +224,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65193589c6404eb80b450d618eaf9a2cafaaafd57ecce47370519ef674a7bd44" dependencies = [ "find-msvc-tools", + "jobserver", + "libc", "shlex", ] @@ -179,6 +270,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + [[package]] name = "const-oid" version = "0.9.6" @@ -272,7 +369,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -302,7 +399,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -397,15 +494,26 @@ dependencies = [ ] [[package]] -name = "enum_dispatch" -version = "0.3.13" +name = "env_filter" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn", + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", ] [[package]] @@ -414,6 +522,16 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.0", +] + [[package]] name = "ff" version = "0.13.1" @@ -460,6 +578,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "fs-err" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf68cef89750956493a66a10f512b9e58d9db21f2a573c079c0bdf1207a54a7" +dependencies = [ + "autocfg", +] + [[package]] name = "futures" version = "0.3.31" @@ -573,6 +700,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + [[package]] name = "glob" version = "0.3.3" @@ -656,6 +789,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "is_ci" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + [[package]] name = "itertools" version = "0.14.0" @@ -671,6 +816,40 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jiff" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.3", + "libc", +] + [[package]] name = "js-sys" version = "0.3.78" @@ -758,6 +937,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + [[package]] name = "lock_api" version = "0.4.13" @@ -804,10 +989,13 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.8.0" +version = "0.10.0" dependencies = [ "miden-base", + "miden-base-macros", "miden-base-sys", + "miden-field", + "miden-field-repr", "miden-sdk-alloc", "miden-stdlib-sys", "wit-bindgen", @@ -815,9 +1003,9 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" +checksum = "3d819876b9e9b630e63152400e6df2a201668a9bdfd33d54d6806b9d7b992ff8" dependencies = [ "miden-core", "miden-utils-indexing", @@ -828,9 +1016,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" +checksum = "24c6a18e29c03141cf9044604390a00691c7342924ec865b4acfdd560ff41ede" dependencies = [ "log", "miden-assembly-syntax", @@ -842,9 +1030,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" +checksum = "7458ff670f5a514bf972aa84d6e1851a4c4e9afa351f53b71bdc2218b99254b6" dependencies = [ "aho-corasick", "lalrpop", @@ -854,6 +1042,7 @@ dependencies = [ "miden-debug-types", "miden-utils-diagnostics", "midenc-hir-type", + "proptest", "regex", "rustc_version 0.4.1", "semver 1.0.27", @@ -863,23 +1052,22 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.8.0" +version = "0.10.0" dependencies = [ - "miden-base-macros", "miden-base-sys", "miden-stdlib-sys", ] [[package]] name = "miden-base-macros" -version = "0.8.0" +version = "0.10.0" dependencies = [ "heck", - "miden-objects", + "miden-protocol", "proc-macro2", "quote", "semver 1.0.27", - "syn", + "syn 2.0.106", "toml 0.8.23", "wit-bindgen-core", "wit-bindgen-rust", @@ -887,21 +1075,24 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.1" +version = "0.10.0" dependencies = [ + "miden-field-repr", "miden-stdlib-sys", ] [[package]] name = "miden-core" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" +checksum = "21a5c9c8c3d42ae8381ed49e47ff9ad2d2e345c4726761be36b7d4000ebb40ae" dependencies = [ - "enum_dispatch", + "derive_more", + "itertools", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-core-derive", "miden-utils-indexing", "num-derive", "num-traits", @@ -910,14 +1101,33 @@ dependencies = [ "winter-utils", ] +[[package]] +name = "miden-core-lib" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6556494ea5576803730fa15015bee6bd9d1a117450f22e7df0883421e7423674" +dependencies = [ + "env_logger", + "fs-err", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", + "sha2", + "thiserror", +] + [[package]] name = "miden-crypto" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" +checksum = "6e28b6e110f339c2edc2760a8cb94863f0a055ee658a49bc90c8560eff2feef4" dependencies = [ "blake3", + "cc", "chacha20poly1305", + "curve25519-dalek", "ed25519-dalek", "flume", "glob", @@ -930,6 +1140,7 @@ dependencies = [ "rand_chacha", "rand_core 0.9.3", "rand_hc", + "sha2", "sha3", "subtle", "thiserror", @@ -941,19 +1152,19 @@ dependencies = [ [[package]] name = "miden-crypto-derive" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +checksum = "f40e95b9c7c99ed6bbf073d9e02721d812dedd2c195019c0a0e0a3dbb9cbf034" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] name = "miden-debug-types" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" +checksum = "19123e896f24b575e69921a79a39a0a4babeb98404a8601017feb13b75d653b3" dependencies = [ "memchr", "miden-crypto", @@ -962,9 +1173,36 @@ dependencies = [ "miden-utils-indexing", "miden-utils-sync", "paste", + "serde", + "serde_spanned 1.0.1", "thiserror", ] +[[package]] +name = "miden-field" +version = "0.10.0" +dependencies = [ + "miden-core", +] + +[[package]] +name = "miden-field-repr" +version = "0.10.0" +dependencies = [ + "miden-core", + "miden-field", + "miden-field-repr-derive", +] + +[[package]] +name = "miden-field-repr-derive" +version = "0.10.0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + [[package]] name = "miden-formatting" version = "0.1.1" @@ -976,9 +1214,9 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" +checksum = "f0d6a322b91efa1bb71e224395ca1fb9ca00e2614f89427e35d8c42a903868a3" dependencies = [ "derive_more", "miden-assembly-syntax", @@ -992,6 +1230,8 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eef536978f24a179d94fa2a41e4f92b28e7d8aab14b8d23df28ad2a3d7098b20" dependencies = [ + "backtrace", + "backtrace-ext", "cfg-if", "futures", "indenter", @@ -1004,7 +1244,11 @@ dependencies = [ "serde_json", "spin", "strip-ansi-escapes", - "syn", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "syn 2.0.106", + "terminal_size", "textwrap", "thiserror", "trybuild", @@ -1019,63 +1263,93 @@ checksum = "86a905f3ea65634dd4d1041a4f0fd0a3e77aa4118341d265af1a94339182222f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] -name = "miden-objects" -version = "0.12.1" +name = "miden-processor" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" +checksum = "4a659fac55de14647e2695f03d96b83ff94fe65fd31e74d81c225ec52af25acf" +dependencies = [ + "itertools", + "miden-air", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", + "thiserror", + "tokio", + "tracing", + "winter-prover", +] + +[[package]] +name = "miden-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfed3ae85e2fabbf8a2e7416e388a40519e10cbf0cdceda222ef858c2f270b35" dependencies = [ "bech32", + "fs-err", "getrandom 0.3.3", "miden-assembly", "miden-assembly-syntax", "miden-core", + "miden-core-lib", "miden-crypto", "miden-mast-package", "miden-processor", + "miden-protocol-macros", "miden-utils-sync", "miden-verifier", "rand", + "regex", "semver 1.0.27", "thiserror", + "walkdir", ] [[package]] -name = "miden-processor" -version = "0.19.1" +name = "miden-protocol-macros" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" +checksum = "f41a93dd532baa3a4c821073baad5d700aab119b3831ef7fdf004e196c10157e" dependencies = [ - "itertools", - "miden-air", - "miden-core", - "miden-debug-types", - "miden-utils-diagnostics", - "miden-utils-indexing", - "paste", - "rayon", - "thiserror", - "tokio", - "tracing", - "winter-prover", + "proc-macro2", + "quote", + "syn 2.0.106", ] [[package]] name = "miden-sdk-alloc" -version = "0.8.0" +version = "0.10.0" [[package]] name = "miden-stdlib-sys" -version = "0.8.0" +version = "0.10.0" +dependencies = [ + "miden-field", +] + +[[package]] +name = "miden-utils-core-derive" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa207ffd8b26a79d9b5b246a352812f0015c0bb8f75492ec089c5c8e6d5f9e2b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] name = "miden-utils-diagnostics" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" +checksum = "6b2f55477d410542a5d8990ca04856adf5bef91bfa3b54ca3c03a5ff14a6e25c" dependencies = [ "miden-crypto", "miden-debug-types", @@ -1086,28 +1360,29 @@ dependencies = [ [[package]] name = "miden-utils-indexing" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +checksum = "f39efae17e14ec8f8a1266cffd29eb7a08ac837143cd09223b1af361bbb55730" dependencies = [ "thiserror", ] [[package]] name = "miden-utils-sync" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" +checksum = "da7fa8f5fd27f122c83f55752f2a964bbfc2b713de419e9c152f7dcc05c194ec" dependencies = [ "lock_api", "loom", + "parking_lot", ] [[package]] name = "miden-verifier" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" +checksum = "fbddac2e76486fb657929338323c68b9e7f40e33b8cfb593d0fb5bf637db046e" dependencies = [ "miden-air", "miden-core", @@ -1127,6 +1402,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + [[package]] name = "nanorand" version = "0.7.0" @@ -1192,7 +1476,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1236,12 +1520,27 @@ dependencies = [ "libm", ] +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "opaque-debug" version = "0.3.1" @@ -1274,7 +1573,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -1335,6 +1634,21 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -1357,7 +1671,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.106", ] [[package]] @@ -1369,6 +1683,21 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +dependencies = [ + "bitflags", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax", + "unarray", +] + [[package]] name = "quote" version = "1.0.40" @@ -1390,6 +1719,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ + "rand_chacha", "rand_core 0.9.3", ] @@ -1417,6 +1747,9 @@ name = "rand_core" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", +] [[package]] name = "rand_hc" @@ -1427,6 +1760,15 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.3", +] + [[package]] name = "rayon" version = "1.11.0" @@ -1495,6 +1837,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "rustc-demangle" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1513,6 +1861,19 @@ dependencies = [ "semver 1.0.27", ] +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + [[package]] name = "rustversion" version = "1.0.22" @@ -1592,6 +1953,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd6c24dee235d0da097043389623fb913daddf92c76e9f5a1db88607a0bcbd1d" dependencies = [ "serde_core", + "serde_derive", ] [[package]] @@ -1611,7 +1973,7 @@ checksum = "0ea936adf78b1f766949a4977b91d2f5595825bd6ec079aa9543ad2685fc4516" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1755,6 +2117,38 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "supports-color" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c64fc7232dd8d2e4ac5ce4ef302b1d81e0b80d055b9d77c7c4f51f6aa4c867d6" +dependencies = [ + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e396b6523b11ccb83120b115a0b7366de372751aa6edf19844dfb13a6af97e91" + +[[package]] +name = "supports-unicode" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.106" @@ -1790,6 +2184,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix", + "windows-sys 0.48.0", +] + [[package]] name = "textwrap" version = "0.16.2" @@ -1818,7 +2222,7 @@ checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1939,7 +2343,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2003,6 +2407,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicode-ident" version = "1.0.19" @@ -2043,6 +2453,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "valuable" version = "0.1.1" @@ -2120,7 +2536,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-shared", ] @@ -2142,7 +2558,7 @@ checksum = "7bb4ce89b08211f923caf51d527662b75bdc9c9c7aab40f86dcb9fb85ac552aa" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2253,7 +2669,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2264,7 +2680,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2307,13 +2723,22 @@ dependencies = [ "windows-link 0.1.3", ] +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + [[package]] name = "windows-sys" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -2325,20 +2750,35 @@ dependencies = [ "windows-link 0.2.0", ] +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + [[package]] name = "windows-targets" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2350,18 +2790,36 @@ dependencies = [ "windows-link 0.1.3", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -2374,24 +2832,48 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -2459,7 +2941,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d31a19dae58475d019850e25b0170e94b16d382fbf6afee9c0e80fdc935e73e" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2526,7 +3008,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn", + "syn 2.0.106", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -2542,7 +3024,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -2611,7 +3093,7 @@ checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] diff --git a/examples/auth-component-rpo-falcon512/src/lib.rs b/examples/auth-component-rpo-falcon512/src/lib.rs index 3ce7a8a57..62fd10dd0 100644 --- a/examples/auth-component-rpo-falcon512/src/lib.rs +++ b/examples/auth-component-rpo-falcon512/src/lib.rs @@ -4,8 +4,8 @@ extern crate alloc; use miden::{ - component, felt, hash_words, intrinsics::advice::adv_insert, native_account, tx, Felt, Value, - ValueAccess, Word, + Felt, Value, ValueAccess, Word, component, felt, hash_words, intrinsics::advice::adv_insert, + native_account, tx, }; /// Authentication component storage/layout. @@ -16,9 +16,8 @@ use miden::{ struct AuthComponent { /// The account owner's public key (RPO-Falcon512 public key hash). #[storage( - slot(0), description = "owner public key", - type = "auth::rpo_falcon512::pub_key" + type = "miden::standards::auth::falcon512_rpo::pub_key" )] owner_public_key: Value, } @@ -43,7 +42,6 @@ impl AuthComponent { // Insert tx summary into advice map under key `msg` adv_insert(msg, &tx_summary); - // Load public key from storage slot 0 let pub_key: Word = self.owner_public_key.read(); // Emit signature request event to advice stack, diff --git a/examples/basic-wallet-tx-script/Cargo.lock b/examples/basic-wallet-tx-script/Cargo.lock index 7266adbe7..703a7422a 100644 --- a/examples/basic-wallet-tx-script/Cargo.lock +++ b/examples/basic-wallet-tx-script/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + [[package]] name = "aead" version = "0.5.2" @@ -21,6 +36,56 @@ dependencies = [ "memchr", ] +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + [[package]] name = "anyhow" version = "1.0.100" @@ -54,6 +119,30 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-link 0.2.1", +] + +[[package]] +name = "backtrace-ext" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" +dependencies = [ + "backtrace", +] + [[package]] name = "base16ct" version = "0.2.0" @@ -134,6 +223,8 @@ version = "1.2.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -178,6 +269,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + [[package]] name = "const-oid" version = "0.9.6" @@ -271,7 +368,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -301,7 +398,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -396,15 +493,26 @@ dependencies = [ ] [[package]] -name = "enum_dispatch" -version = "0.3.13" +name = "env_filter" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn", + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", ] [[package]] @@ -413,6 +521,16 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + [[package]] name = "ff" version = "0.13.1" @@ -453,6 +571,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "fs-err" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf68cef89750956493a66a10f512b9e58d9db21f2a573c079c0bdf1207a54a7" +dependencies = [ + "autocfg", +] + [[package]] name = "futures" version = "0.3.31" @@ -566,6 +693,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + [[package]] name = "glob" version = "0.3.2" @@ -648,6 +781,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "is_ci" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + [[package]] name = "itertools" version = "0.14.0" @@ -663,6 +808,40 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jiff" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.3", + "libc", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -750,6 +929,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + [[package]] name = "lock_api" version = "0.4.13" @@ -796,10 +981,13 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.8.0" +version = "0.10.0" dependencies = [ "miden-base", + "miden-base-macros", "miden-base-sys", + "miden-field", + "miden-field-repr", "miden-sdk-alloc", "miden-stdlib-sys", "wit-bindgen", @@ -807,9 +995,9 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" +checksum = "3d819876b9e9b630e63152400e6df2a201668a9bdfd33d54d6806b9d7b992ff8" dependencies = [ "miden-core", "miden-utils-indexing", @@ -820,9 +1008,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" +checksum = "24c6a18e29c03141cf9044604390a00691c7342924ec865b4acfdd560ff41ede" dependencies = [ "log", "miden-assembly-syntax", @@ -834,9 +1022,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" +checksum = "7458ff670f5a514bf972aa84d6e1851a4c4e9afa351f53b71bdc2218b99254b6" dependencies = [ "aho-corasick", "lalrpop", @@ -846,6 +1034,7 @@ dependencies = [ "miden-debug-types", "miden-utils-diagnostics", "midenc-hir-type", + "proptest", "regex", "rustc_version 0.4.1", "semver 1.0.26", @@ -855,23 +1044,22 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.8.0" +version = "0.10.0" dependencies = [ - "miden-base-macros", "miden-base-sys", "miden-stdlib-sys", ] [[package]] name = "miden-base-macros" -version = "0.8.0" +version = "0.10.0" dependencies = [ "heck", - "miden-objects", + "miden-protocol", "proc-macro2", "quote", "semver 1.0.26", - "syn", + "syn 2.0.106", "toml 0.8.23", "wit-bindgen-core", "wit-bindgen-rust", @@ -879,21 +1067,24 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.1" +version = "0.10.0" dependencies = [ + "miden-field-repr", "miden-stdlib-sys", ] [[package]] name = "miden-core" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" +checksum = "21a5c9c8c3d42ae8381ed49e47ff9ad2d2e345c4726761be36b7d4000ebb40ae" dependencies = [ - "enum_dispatch", + "derive_more", + "itertools", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-core-derive", "miden-utils-indexing", "num-derive", "num-traits", @@ -902,14 +1093,33 @@ dependencies = [ "winter-utils", ] +[[package]] +name = "miden-core-lib" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6556494ea5576803730fa15015bee6bd9d1a117450f22e7df0883421e7423674" +dependencies = [ + "env_logger", + "fs-err", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", + "sha2", + "thiserror", +] + [[package]] name = "miden-crypto" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" +checksum = "6e28b6e110f339c2edc2760a8cb94863f0a055ee658a49bc90c8560eff2feef4" dependencies = [ "blake3", + "cc", "chacha20poly1305", + "curve25519-dalek", "ed25519-dalek", "flume", "glob", @@ -922,6 +1132,7 @@ dependencies = [ "rand_chacha", "rand_core 0.9.3", "rand_hc", + "sha2", "sha3", "subtle", "thiserror", @@ -933,19 +1144,19 @@ dependencies = [ [[package]] name = "miden-crypto-derive" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +checksum = "f40e95b9c7c99ed6bbf073d9e02721d812dedd2c195019c0a0e0a3dbb9cbf034" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] name = "miden-debug-types" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" +checksum = "19123e896f24b575e69921a79a39a0a4babeb98404a8601017feb13b75d653b3" dependencies = [ "memchr", "miden-crypto", @@ -954,9 +1165,36 @@ dependencies = [ "miden-utils-indexing", "miden-utils-sync", "paste", + "serde", + "serde_spanned 1.0.0", "thiserror", ] +[[package]] +name = "miden-field" +version = "0.10.0" +dependencies = [ + "miden-core", +] + +[[package]] +name = "miden-field-repr" +version = "0.10.0" +dependencies = [ + "miden-core", + "miden-field", + "miden-field-repr-derive", +] + +[[package]] +name = "miden-field-repr-derive" +version = "0.10.0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + [[package]] name = "miden-formatting" version = "0.1.1" @@ -968,9 +1206,9 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" +checksum = "f0d6a322b91efa1bb71e224395ca1fb9ca00e2614f89427e35d8c42a903868a3" dependencies = [ "derive_more", "miden-assembly-syntax", @@ -984,6 +1222,8 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eef536978f24a179d94fa2a41e4f92b28e7d8aab14b8d23df28ad2a3d7098b20" dependencies = [ + "backtrace", + "backtrace-ext", "cfg-if", "futures", "indenter", @@ -996,7 +1236,11 @@ dependencies = [ "serde_json", "spin", "strip-ansi-escapes", - "syn", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "syn 2.0.106", + "terminal_size", "textwrap", "thiserror", "trybuild", @@ -1011,63 +1255,93 @@ checksum = "86a905f3ea65634dd4d1041a4f0fd0a3e77aa4118341d265af1a94339182222f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] -name = "miden-objects" -version = "0.12.1" +name = "miden-processor" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" +checksum = "4a659fac55de14647e2695f03d96b83ff94fe65fd31e74d81c225ec52af25acf" +dependencies = [ + "itertools", + "miden-air", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", + "thiserror", + "tokio", + "tracing", + "winter-prover", +] + +[[package]] +name = "miden-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfed3ae85e2fabbf8a2e7416e388a40519e10cbf0cdceda222ef858c2f270b35" dependencies = [ "bech32", + "fs-err", "getrandom 0.3.3", "miden-assembly", "miden-assembly-syntax", "miden-core", + "miden-core-lib", "miden-crypto", "miden-mast-package", "miden-processor", + "miden-protocol-macros", "miden-utils-sync", "miden-verifier", "rand", + "regex", "semver 1.0.26", "thiserror", + "walkdir", ] [[package]] -name = "miden-processor" -version = "0.19.1" +name = "miden-protocol-macros" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" +checksum = "f41a93dd532baa3a4c821073baad5d700aab119b3831ef7fdf004e196c10157e" dependencies = [ - "itertools", - "miden-air", - "miden-core", - "miden-debug-types", - "miden-utils-diagnostics", - "miden-utils-indexing", - "paste", - "rayon", - "thiserror", - "tokio", - "tracing", - "winter-prover", + "proc-macro2", + "quote", + "syn 2.0.106", ] [[package]] name = "miden-sdk-alloc" -version = "0.8.0" +version = "0.10.0" [[package]] name = "miden-stdlib-sys" -version = "0.8.0" +version = "0.10.0" +dependencies = [ + "miden-field", +] + +[[package]] +name = "miden-utils-core-derive" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa207ffd8b26a79d9b5b246a352812f0015c0bb8f75492ec089c5c8e6d5f9e2b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] name = "miden-utils-diagnostics" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" +checksum = "6b2f55477d410542a5d8990ca04856adf5bef91bfa3b54ca3c03a5ff14a6e25c" dependencies = [ "miden-crypto", "miden-debug-types", @@ -1078,28 +1352,29 @@ dependencies = [ [[package]] name = "miden-utils-indexing" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +checksum = "f39efae17e14ec8f8a1266cffd29eb7a08ac837143cd09223b1af361bbb55730" dependencies = [ "thiserror", ] [[package]] name = "miden-utils-sync" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" +checksum = "da7fa8f5fd27f122c83f55752f2a964bbfc2b713de419e9c152f7dcc05c194ec" dependencies = [ "lock_api", "loom", + "parking_lot", ] [[package]] name = "miden-verifier" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" +checksum = "fbddac2e76486fb657929338323c68b9e7f40e33b8cfb593d0fb5bf637db046e" dependencies = [ "miden-air", "miden-core", @@ -1119,6 +1394,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + [[package]] name = "nanorand" version = "0.7.0" @@ -1185,7 +1469,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1229,12 +1513,27 @@ dependencies = [ "libm", ] +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "opaque-debug" version = "0.3.1" @@ -1273,7 +1572,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -1334,6 +1633,21 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -1356,7 +1670,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.106", ] [[package]] @@ -1368,6 +1682,21 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +dependencies = [ + "bitflags", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax 0.8.5", + "unarray", +] + [[package]] name = "quote" version = "1.0.40" @@ -1389,6 +1718,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ + "rand_chacha", "rand_core 0.9.3", ] @@ -1416,6 +1746,9 @@ name = "rand_core" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", +] [[package]] name = "rand_hc" @@ -1426,6 +1759,15 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.3", +] + [[package]] name = "rayon" version = "1.11.0" @@ -1509,6 +1851,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "rustc-demangle" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1527,6 +1875,19 @@ dependencies = [ "semver 1.0.26", ] +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.59.0", +] + [[package]] name = "rustversion" version = "1.0.21" @@ -1600,22 +1961,32 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1758,6 +2129,38 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "supports-color" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c64fc7232dd8d2e4ac5ce4ef302b1d81e0b80d055b9d77c7c4f51f6aa4c867d6" +dependencies = [ + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e396b6523b11ccb83120b115a0b7366de372751aa6edf19844dfb13a6af97e91" + +[[package]] +name = "supports-unicode" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.106" @@ -1781,7 +2184,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -1793,6 +2196,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix", + "windows-sys 0.48.0", +] + [[package]] name = "textwrap" version = "0.16.2" @@ -1821,7 +2234,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1942,7 +2355,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2006,6 +2419,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicode-ident" version = "1.0.18" @@ -2046,6 +2465,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "valuable" version = "0.1.1" @@ -2113,7 +2538,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-shared", ] @@ -2135,7 +2560,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2205,7 +2630,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -2223,7 +2648,7 @@ dependencies = [ "windows-collections", "windows-core", "windows-future", - "windows-link", + "windows-link 0.1.3", "windows-numerics", ] @@ -2244,7 +2669,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", - "windows-link", + "windows-link 0.1.3", "windows-result", "windows-strings", ] @@ -2256,7 +2681,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", "windows-threading", ] @@ -2268,7 +2693,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2279,7 +2704,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2288,6 +2713,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-numerics" version = "0.2.0" @@ -2295,7 +2726,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2304,7 +2735,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2313,7 +2744,16 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", ] [[package]] @@ -2322,7 +2762,31 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -2331,14 +2795,14 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2347,21 +2811,39 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -2374,24 +2856,48 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -2459,7 +2965,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d31a19dae58475d019850e25b0170e94b16d382fbf6afee9c0e80fdc935e73e" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2535,7 +3041,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn", + "syn 2.0.106", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -2551,7 +3057,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -2620,7 +3126,7 @@ checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] diff --git a/examples/basic-wallet-tx-script/src/lib.rs b/examples/basic-wallet-tx-script/src/lib.rs index 352dd3995..ae7c5d627 100644 --- a/examples/basic-wallet-tx-script/src/lib.rs +++ b/examples/basic-wallet-tx-script/src/lib.rs @@ -15,13 +15,11 @@ use crate::bindings::Account; // Input layout constants const TAG_INDEX: usize = 0; -const AUX_INDEX: usize = 1; -const NOTE_TYPE_INDEX: usize = 2; -const EXECUTION_HINT_INDEX: usize = 3; -const RECIPIENT_START: usize = 4; -const RECIPIENT_END: usize = 8; -const ASSET_START: usize = 8; -const ASSET_END: usize = 12; +const NOTE_TYPE_INDEX: usize = 1; +const RECIPIENT_START: usize = 2; +const RECIPIENT_END: usize = 6; +const ASSET_START: usize = 6; +const ASSET_END: usize = 10; #[tx_script] fn run(arg: Word, account: &mut Account) { @@ -32,12 +30,9 @@ fn run(arg: Word, account: &mut Account) { let commitment = arg; let input = adv_load_preimage(num_words, commitment); let tag = input[TAG_INDEX]; - let aux = input[AUX_INDEX]; let note_type = input[NOTE_TYPE_INDEX]; - let execution_hint = input[EXECUTION_HINT_INDEX]; let recipient: [Felt; 4] = input[RECIPIENT_START..RECIPIENT_END].try_into().unwrap(); - let note_idx = - output_note::create(tag.into(), aux, note_type.into(), execution_hint, recipient.into()); + let note_idx = output_note::create(tag.into(), note_type.into(), recipient.into()); let asset: [Felt; 4] = input[ASSET_START..ASSET_END].try_into().unwrap(); account.move_asset_to_note(asset.into(), note_idx); } diff --git a/examples/basic-wallet/Cargo.lock b/examples/basic-wallet/Cargo.lock index af9344a0f..3e52f4604 100644 --- a/examples/basic-wallet/Cargo.lock +++ b/examples/basic-wallet/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + [[package]] name = "aead" version = "0.5.2" @@ -21,6 +36,56 @@ dependencies = [ "memchr", ] +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + [[package]] name = "anyhow" version = "1.0.100" @@ -54,6 +119,30 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-link 0.2.1", +] + +[[package]] +name = "backtrace-ext" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" +dependencies = [ + "backtrace", +] + [[package]] name = "base16ct" version = "0.2.0" @@ -134,6 +223,8 @@ version = "1.2.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -178,6 +269,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + [[package]] name = "const-oid" version = "0.9.6" @@ -271,7 +368,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -301,7 +398,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -396,15 +493,26 @@ dependencies = [ ] [[package]] -name = "enum_dispatch" -version = "0.3.13" +name = "env_filter" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn", + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", ] [[package]] @@ -413,6 +521,16 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + [[package]] name = "ff" version = "0.13.1" @@ -453,6 +571,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "fs-err" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf68cef89750956493a66a10f512b9e58d9db21f2a573c079c0bdf1207a54a7" +dependencies = [ + "autocfg", +] + [[package]] name = "futures" version = "0.3.31" @@ -566,6 +693,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + [[package]] name = "glob" version = "0.3.2" @@ -648,6 +781,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "is_ci" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + [[package]] name = "itertools" version = "0.14.0" @@ -663,6 +808,40 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jiff" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.3", + "libc", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -750,6 +929,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + [[package]] name = "lock_api" version = "0.4.13" @@ -796,10 +981,13 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.8.0" +version = "0.10.0" dependencies = [ "miden-base", + "miden-base-macros", "miden-base-sys", + "miden-field", + "miden-field-repr", "miden-sdk-alloc", "miden-stdlib-sys", "wit-bindgen", @@ -807,9 +995,9 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" +checksum = "3d819876b9e9b630e63152400e6df2a201668a9bdfd33d54d6806b9d7b992ff8" dependencies = [ "miden-core", "miden-utils-indexing", @@ -820,9 +1008,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" +checksum = "24c6a18e29c03141cf9044604390a00691c7342924ec865b4acfdd560ff41ede" dependencies = [ "log", "miden-assembly-syntax", @@ -834,9 +1022,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" +checksum = "7458ff670f5a514bf972aa84d6e1851a4c4e9afa351f53b71bdc2218b99254b6" dependencies = [ "aho-corasick", "lalrpop", @@ -846,6 +1034,7 @@ dependencies = [ "miden-debug-types", "miden-utils-diagnostics", "midenc-hir-type", + "proptest", "regex", "rustc_version 0.4.1", "semver 1.0.26", @@ -855,23 +1044,22 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.8.0" +version = "0.10.0" dependencies = [ - "miden-base-macros", "miden-base-sys", "miden-stdlib-sys", ] [[package]] name = "miden-base-macros" -version = "0.8.0" +version = "0.10.0" dependencies = [ "heck", - "miden-objects", + "miden-protocol", "proc-macro2", "quote", "semver 1.0.26", - "syn", + "syn 2.0.106", "toml 0.8.23", "wit-bindgen-core", "wit-bindgen-rust", @@ -879,21 +1067,24 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.1" +version = "0.10.0" dependencies = [ + "miden-field-repr", "miden-stdlib-sys", ] [[package]] name = "miden-core" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" +checksum = "21a5c9c8c3d42ae8381ed49e47ff9ad2d2e345c4726761be36b7d4000ebb40ae" dependencies = [ - "enum_dispatch", + "derive_more", + "itertools", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-core-derive", "miden-utils-indexing", "num-derive", "num-traits", @@ -902,14 +1093,33 @@ dependencies = [ "winter-utils", ] +[[package]] +name = "miden-core-lib" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6556494ea5576803730fa15015bee6bd9d1a117450f22e7df0883421e7423674" +dependencies = [ + "env_logger", + "fs-err", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", + "sha2", + "thiserror", +] + [[package]] name = "miden-crypto" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" +checksum = "6e28b6e110f339c2edc2760a8cb94863f0a055ee658a49bc90c8560eff2feef4" dependencies = [ "blake3", + "cc", "chacha20poly1305", + "curve25519-dalek", "ed25519-dalek", "flume", "glob", @@ -922,6 +1132,7 @@ dependencies = [ "rand_chacha", "rand_core 0.9.3", "rand_hc", + "sha2", "sha3", "subtle", "thiserror", @@ -933,19 +1144,19 @@ dependencies = [ [[package]] name = "miden-crypto-derive" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +checksum = "f40e95b9c7c99ed6bbf073d9e02721d812dedd2c195019c0a0e0a3dbb9cbf034" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] name = "miden-debug-types" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" +checksum = "19123e896f24b575e69921a79a39a0a4babeb98404a8601017feb13b75d653b3" dependencies = [ "memchr", "miden-crypto", @@ -954,9 +1165,36 @@ dependencies = [ "miden-utils-indexing", "miden-utils-sync", "paste", + "serde", + "serde_spanned 1.0.0", "thiserror", ] +[[package]] +name = "miden-field" +version = "0.10.0" +dependencies = [ + "miden-core", +] + +[[package]] +name = "miden-field-repr" +version = "0.10.0" +dependencies = [ + "miden-core", + "miden-field", + "miden-field-repr-derive", +] + +[[package]] +name = "miden-field-repr-derive" +version = "0.10.0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + [[package]] name = "miden-formatting" version = "0.1.1" @@ -968,9 +1206,9 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" +checksum = "f0d6a322b91efa1bb71e224395ca1fb9ca00e2614f89427e35d8c42a903868a3" dependencies = [ "derive_more", "miden-assembly-syntax", @@ -984,6 +1222,8 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eef536978f24a179d94fa2a41e4f92b28e7d8aab14b8d23df28ad2a3d7098b20" dependencies = [ + "backtrace", + "backtrace-ext", "cfg-if", "futures", "indenter", @@ -996,7 +1236,11 @@ dependencies = [ "serde_json", "spin", "strip-ansi-escapes", - "syn", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "syn 2.0.106", + "terminal_size", "textwrap", "thiserror", "trybuild", @@ -1011,63 +1255,93 @@ checksum = "86a905f3ea65634dd4d1041a4f0fd0a3e77aa4118341d265af1a94339182222f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] -name = "miden-objects" -version = "0.12.1" +name = "miden-processor" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" +checksum = "4a659fac55de14647e2695f03d96b83ff94fe65fd31e74d81c225ec52af25acf" +dependencies = [ + "itertools", + "miden-air", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", + "thiserror", + "tokio", + "tracing", + "winter-prover", +] + +[[package]] +name = "miden-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfed3ae85e2fabbf8a2e7416e388a40519e10cbf0cdceda222ef858c2f270b35" dependencies = [ "bech32", + "fs-err", "getrandom 0.3.3", "miden-assembly", "miden-assembly-syntax", "miden-core", + "miden-core-lib", "miden-crypto", "miden-mast-package", "miden-processor", + "miden-protocol-macros", "miden-utils-sync", "miden-verifier", "rand", + "regex", "semver 1.0.26", "thiserror", + "walkdir", ] [[package]] -name = "miden-processor" -version = "0.19.1" +name = "miden-protocol-macros" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" +checksum = "f41a93dd532baa3a4c821073baad5d700aab119b3831ef7fdf004e196c10157e" dependencies = [ - "itertools", - "miden-air", - "miden-core", - "miden-debug-types", - "miden-utils-diagnostics", - "miden-utils-indexing", - "paste", - "rayon", - "thiserror", - "tokio", - "tracing", - "winter-prover", + "proc-macro2", + "quote", + "syn 2.0.106", ] [[package]] name = "miden-sdk-alloc" -version = "0.8.0" +version = "0.10.0" [[package]] name = "miden-stdlib-sys" -version = "0.8.0" +version = "0.10.0" +dependencies = [ + "miden-field", +] + +[[package]] +name = "miden-utils-core-derive" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa207ffd8b26a79d9b5b246a352812f0015c0bb8f75492ec089c5c8e6d5f9e2b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] name = "miden-utils-diagnostics" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" +checksum = "6b2f55477d410542a5d8990ca04856adf5bef91bfa3b54ca3c03a5ff14a6e25c" dependencies = [ "miden-crypto", "miden-debug-types", @@ -1078,28 +1352,29 @@ dependencies = [ [[package]] name = "miden-utils-indexing" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +checksum = "f39efae17e14ec8f8a1266cffd29eb7a08ac837143cd09223b1af361bbb55730" dependencies = [ "thiserror", ] [[package]] name = "miden-utils-sync" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" +checksum = "da7fa8f5fd27f122c83f55752f2a964bbfc2b713de419e9c152f7dcc05c194ec" dependencies = [ "lock_api", "loom", + "parking_lot", ] [[package]] name = "miden-verifier" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" +checksum = "fbddac2e76486fb657929338323c68b9e7f40e33b8cfb593d0fb5bf637db046e" dependencies = [ "miden-air", "miden-core", @@ -1119,6 +1394,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + [[package]] name = "nanorand" version = "0.7.0" @@ -1185,7 +1469,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1229,12 +1513,27 @@ dependencies = [ "libm", ] +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "opaque-debug" version = "0.3.1" @@ -1273,7 +1572,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -1334,6 +1633,21 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -1356,7 +1670,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.106", ] [[package]] @@ -1368,6 +1682,21 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +dependencies = [ + "bitflags", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax 0.8.5", + "unarray", +] + [[package]] name = "quote" version = "1.0.40" @@ -1389,6 +1718,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ + "rand_chacha", "rand_core 0.9.3", ] @@ -1416,6 +1746,9 @@ name = "rand_core" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", +] [[package]] name = "rand_hc" @@ -1426,6 +1759,15 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.3", +] + [[package]] name = "rayon" version = "1.11.0" @@ -1509,6 +1851,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "rustc-demangle" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1527,6 +1875,19 @@ dependencies = [ "semver 1.0.26", ] +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.59.0", +] + [[package]] name = "rustversion" version = "1.0.21" @@ -1600,22 +1961,32 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1758,6 +2129,38 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "supports-color" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c64fc7232dd8d2e4ac5ce4ef302b1d81e0b80d055b9d77c7c4f51f6aa4c867d6" +dependencies = [ + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e396b6523b11ccb83120b115a0b7366de372751aa6edf19844dfb13a6af97e91" + +[[package]] +name = "supports-unicode" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.106" @@ -1781,7 +2184,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -1793,6 +2196,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix", + "windows-sys 0.48.0", +] + [[package]] name = "textwrap" version = "0.16.2" @@ -1821,7 +2234,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1942,7 +2355,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2006,6 +2419,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicode-ident" version = "1.0.18" @@ -2046,6 +2465,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "valuable" version = "0.1.1" @@ -2113,7 +2538,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-shared", ] @@ -2135,7 +2560,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2205,7 +2630,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -2223,7 +2648,7 @@ dependencies = [ "windows-collections", "windows-core", "windows-future", - "windows-link", + "windows-link 0.1.3", "windows-numerics", ] @@ -2244,7 +2669,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", - "windows-link", + "windows-link 0.1.3", "windows-result", "windows-strings", ] @@ -2256,7 +2681,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", "windows-threading", ] @@ -2268,7 +2693,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2279,7 +2704,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2288,6 +2713,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-numerics" version = "0.2.0" @@ -2295,7 +2726,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2304,7 +2735,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2313,7 +2744,16 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", ] [[package]] @@ -2322,7 +2762,31 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -2331,14 +2795,14 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2347,21 +2811,39 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -2374,24 +2856,48 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -2459,7 +2965,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d31a19dae58475d019850e25b0170e94b16d382fbf6afee9c0e80fdc935e73e" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2535,7 +3041,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn", + "syn 2.0.106", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -2551,7 +3057,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -2620,7 +3126,7 @@ checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] diff --git a/examples/basic-wallet/src/lib.rs b/examples/basic-wallet/src/lib.rs index a77754667..38b78811d 100644 --- a/examples/basic-wallet/src/lib.rs +++ b/examples/basic-wallet/src/lib.rs @@ -7,7 +7,7 @@ // // extern crate alloc; -use miden::{component, native_account, output_note, Asset, NoteIdx}; +use miden::{Asset, NoteIdx, component, output_note}; #[component] struct MyAccount; diff --git a/examples/counter-contract/Cargo.lock b/examples/counter-contract/Cargo.lock index 4ebbd7848..9e3493875 100644 --- a/examples/counter-contract/Cargo.lock +++ b/examples/counter-contract/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + [[package]] name = "aead" version = "0.5.2" @@ -21,6 +36,56 @@ dependencies = [ "memchr", ] +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + [[package]] name = "anyhow" version = "1.0.100" @@ -54,6 +119,30 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-link 0.2.1", +] + +[[package]] +name = "backtrace-ext" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" +dependencies = [ + "backtrace", +] + [[package]] name = "base16ct" version = "0.2.0" @@ -127,6 +216,8 @@ version = "1.2.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -171,6 +262,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + [[package]] name = "const-oid" version = "0.9.6" @@ -271,7 +368,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -301,7 +398,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -396,15 +493,26 @@ dependencies = [ ] [[package]] -name = "enum_dispatch" -version = "0.3.13" +name = "env_filter" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn", + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", ] [[package]] @@ -413,6 +521,16 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + [[package]] name = "ff" version = "0.13.1" @@ -453,6 +571,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "fs-err" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf68cef89750956493a66a10f512b9e58d9db21f2a573c079c0bdf1207a54a7" +dependencies = [ + "autocfg", +] + [[package]] name = "futures" version = "0.3.31" @@ -566,6 +693,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + [[package]] name = "glob" version = "0.3.2" @@ -648,6 +781,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "is_ci" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + [[package]] name = "itertools" version = "0.14.0" @@ -663,6 +808,40 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jiff" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.3", + "libc", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -750,6 +929,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + [[package]] name = "lock_api" version = "0.4.13" @@ -796,10 +981,13 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.8.0" +version = "0.10.0" dependencies = [ "miden-base", + "miden-base-macros", "miden-base-sys", + "miden-field", + "miden-field-repr", "miden-sdk-alloc", "miden-stdlib-sys", "wit-bindgen", @@ -807,9 +995,9 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" +checksum = "3d819876b9e9b630e63152400e6df2a201668a9bdfd33d54d6806b9d7b992ff8" dependencies = [ "miden-core", "miden-utils-indexing", @@ -820,9 +1008,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" +checksum = "24c6a18e29c03141cf9044604390a00691c7342924ec865b4acfdd560ff41ede" dependencies = [ "log", "miden-assembly-syntax", @@ -834,9 +1022,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" +checksum = "7458ff670f5a514bf972aa84d6e1851a4c4e9afa351f53b71bdc2218b99254b6" dependencies = [ "aho-corasick", "lalrpop", @@ -846,6 +1034,7 @@ dependencies = [ "miden-debug-types", "miden-utils-diagnostics", "midenc-hir-type", + "proptest", "regex", "rustc_version 0.4.1", "semver 1.0.26", @@ -855,23 +1044,22 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.8.0" +version = "0.10.0" dependencies = [ - "miden-base-macros", "miden-base-sys", "miden-stdlib-sys", ] [[package]] name = "miden-base-macros" -version = "0.8.0" +version = "0.10.0" dependencies = [ "heck", - "miden-objects", + "miden-protocol", "proc-macro2", "quote", "semver 1.0.26", - "syn", + "syn 2.0.106", "toml 0.8.23", "wit-bindgen-core", "wit-bindgen-rust", @@ -879,21 +1067,24 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.1" +version = "0.10.0" dependencies = [ + "miden-field-repr", "miden-stdlib-sys", ] [[package]] name = "miden-core" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" +checksum = "21a5c9c8c3d42ae8381ed49e47ff9ad2d2e345c4726761be36b7d4000ebb40ae" dependencies = [ - "enum_dispatch", + "derive_more", + "itertools", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-core-derive", "miden-utils-indexing", "num-derive", "num-traits", @@ -902,14 +1093,33 @@ dependencies = [ "winter-utils", ] +[[package]] +name = "miden-core-lib" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6556494ea5576803730fa15015bee6bd9d1a117450f22e7df0883421e7423674" +dependencies = [ + "env_logger", + "fs-err", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", + "sha2", + "thiserror", +] + [[package]] name = "miden-crypto" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" +checksum = "6e28b6e110f339c2edc2760a8cb94863f0a055ee658a49bc90c8560eff2feef4" dependencies = [ "blake3", + "cc", "chacha20poly1305", + "curve25519-dalek", "ed25519-dalek", "flume", "glob", @@ -922,6 +1132,7 @@ dependencies = [ "rand_chacha", "rand_core 0.9.3", "rand_hc", + "sha2", "sha3", "subtle", "thiserror", @@ -933,19 +1144,19 @@ dependencies = [ [[package]] name = "miden-crypto-derive" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +checksum = "f40e95b9c7c99ed6bbf073d9e02721d812dedd2c195019c0a0e0a3dbb9cbf034" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] name = "miden-debug-types" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" +checksum = "19123e896f24b575e69921a79a39a0a4babeb98404a8601017feb13b75d653b3" dependencies = [ "memchr", "miden-crypto", @@ -954,9 +1165,36 @@ dependencies = [ "miden-utils-indexing", "miden-utils-sync", "paste", + "serde", + "serde_spanned 1.0.0", "thiserror", ] +[[package]] +name = "miden-field" +version = "0.10.0" +dependencies = [ + "miden-core", +] + +[[package]] +name = "miden-field-repr" +version = "0.10.0" +dependencies = [ + "miden-core", + "miden-field", + "miden-field-repr-derive", +] + +[[package]] +name = "miden-field-repr-derive" +version = "0.10.0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + [[package]] name = "miden-formatting" version = "0.1.1" @@ -968,9 +1206,9 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" +checksum = "f0d6a322b91efa1bb71e224395ca1fb9ca00e2614f89427e35d8c42a903868a3" dependencies = [ "derive_more", "miden-assembly-syntax", @@ -984,6 +1222,8 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eef536978f24a179d94fa2a41e4f92b28e7d8aab14b8d23df28ad2a3d7098b20" dependencies = [ + "backtrace", + "backtrace-ext", "cfg-if", "futures", "indenter", @@ -996,7 +1236,11 @@ dependencies = [ "serde_json", "spin", "strip-ansi-escapes", - "syn", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "syn 2.0.106", + "terminal_size", "textwrap", "thiserror", "trybuild", @@ -1011,63 +1255,93 @@ checksum = "86a905f3ea65634dd4d1041a4f0fd0a3e77aa4118341d265af1a94339182222f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] -name = "miden-objects" -version = "0.12.1" +name = "miden-processor" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" +checksum = "4a659fac55de14647e2695f03d96b83ff94fe65fd31e74d81c225ec52af25acf" +dependencies = [ + "itertools", + "miden-air", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", + "thiserror", + "tokio", + "tracing", + "winter-prover", +] + +[[package]] +name = "miden-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfed3ae85e2fabbf8a2e7416e388a40519e10cbf0cdceda222ef858c2f270b35" dependencies = [ "bech32", + "fs-err", "getrandom 0.3.3", "miden-assembly", "miden-assembly-syntax", "miden-core", + "miden-core-lib", "miden-crypto", "miden-mast-package", "miden-processor", + "miden-protocol-macros", "miden-utils-sync", "miden-verifier", "rand", + "regex", "semver 1.0.26", "thiserror", + "walkdir", ] [[package]] -name = "miden-processor" -version = "0.19.1" +name = "miden-protocol-macros" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" +checksum = "f41a93dd532baa3a4c821073baad5d700aab119b3831ef7fdf004e196c10157e" dependencies = [ - "itertools", - "miden-air", - "miden-core", - "miden-debug-types", - "miden-utils-diagnostics", - "miden-utils-indexing", - "paste", - "rayon", - "thiserror", - "tokio", - "tracing", - "winter-prover", + "proc-macro2", + "quote", + "syn 2.0.106", ] [[package]] name = "miden-sdk-alloc" -version = "0.8.0" +version = "0.10.0" [[package]] name = "miden-stdlib-sys" -version = "0.8.0" +version = "0.10.0" +dependencies = [ + "miden-field", +] + +[[package]] +name = "miden-utils-core-derive" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa207ffd8b26a79d9b5b246a352812f0015c0bb8f75492ec089c5c8e6d5f9e2b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] name = "miden-utils-diagnostics" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" +checksum = "6b2f55477d410542a5d8990ca04856adf5bef91bfa3b54ca3c03a5ff14a6e25c" dependencies = [ "miden-crypto", "miden-debug-types", @@ -1078,28 +1352,29 @@ dependencies = [ [[package]] name = "miden-utils-indexing" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +checksum = "f39efae17e14ec8f8a1266cffd29eb7a08ac837143cd09223b1af361bbb55730" dependencies = [ "thiserror", ] [[package]] name = "miden-utils-sync" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" +checksum = "da7fa8f5fd27f122c83f55752f2a964bbfc2b713de419e9c152f7dcc05c194ec" dependencies = [ "lock_api", "loom", + "parking_lot", ] [[package]] name = "miden-verifier" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" +checksum = "fbddac2e76486fb657929338323c68b9e7f40e33b8cfb593d0fb5bf637db046e" dependencies = [ "miden-air", "miden-core", @@ -1119,6 +1394,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + [[package]] name = "nanorand" version = "0.7.0" @@ -1185,7 +1469,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1229,12 +1513,27 @@ dependencies = [ "libm", ] +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "opaque-debug" version = "0.3.1" @@ -1273,7 +1572,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -1334,6 +1633,21 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -1356,7 +1670,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.106", ] [[package]] @@ -1368,6 +1682,21 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +dependencies = [ + "bitflags", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax 0.8.5", + "unarray", +] + [[package]] name = "quote" version = "1.0.40" @@ -1389,6 +1718,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ + "rand_chacha", "rand_core 0.9.3", ] @@ -1416,6 +1746,9 @@ name = "rand_core" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", +] [[package]] name = "rand_hc" @@ -1426,6 +1759,15 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.3", +] + [[package]] name = "rayon" version = "1.11.0" @@ -1509,6 +1851,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "rustc-demangle" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1527,6 +1875,19 @@ dependencies = [ "semver 1.0.26", ] +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.59.0", +] + [[package]] name = "rustversion" version = "1.0.21" @@ -1600,22 +1961,32 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1758,6 +2129,38 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "supports-color" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c64fc7232dd8d2e4ac5ce4ef302b1d81e0b80d055b9d77c7c4f51f6aa4c867d6" +dependencies = [ + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e396b6523b11ccb83120b115a0b7366de372751aa6edf19844dfb13a6af97e91" + +[[package]] +name = "supports-unicode" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.106" @@ -1781,7 +2184,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -1793,6 +2196,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix", + "windows-sys 0.48.0", +] + [[package]] name = "textwrap" version = "0.16.2" @@ -1821,7 +2234,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1942,7 +2355,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2006,6 +2419,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicode-ident" version = "1.0.18" @@ -2046,6 +2465,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "valuable" version = "0.1.1" @@ -2113,7 +2538,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-shared", ] @@ -2135,7 +2560,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2205,7 +2630,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -2223,7 +2648,7 @@ dependencies = [ "windows-collections", "windows-core", "windows-future", - "windows-link", + "windows-link 0.1.3", "windows-numerics", ] @@ -2244,7 +2669,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", - "windows-link", + "windows-link 0.1.3", "windows-result", "windows-strings", ] @@ -2256,7 +2681,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", "windows-threading", ] @@ -2268,7 +2693,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2279,7 +2704,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2288,6 +2713,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-numerics" version = "0.2.0" @@ -2295,7 +2726,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2304,7 +2735,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2313,7 +2744,16 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", ] [[package]] @@ -2322,7 +2762,31 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -2331,14 +2795,14 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2347,21 +2811,39 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -2374,24 +2856,48 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -2459,7 +2965,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d31a19dae58475d019850e25b0170e94b16d382fbf6afee9c0e80fdc935e73e" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2535,7 +3041,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn", + "syn 2.0.106", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -2551,7 +3057,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -2620,7 +3126,7 @@ checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] diff --git a/examples/counter-contract/src/lib.rs b/examples/counter-contract/src/lib.rs index 5567f44e0..cfea0814f 100644 --- a/examples/counter-contract/src/lib.rs +++ b/examples/counter-contract/src/lib.rs @@ -13,7 +13,7 @@ use miden::{Felt, StorageMap, StorageMapAccess, Word, component, felt}; #[component] struct CounterContract { /// Storage map holding the counter value. - #[storage(slot(0), description = "counter contract storage map")] + #[storage(description = "counter contract storage map")] count_map: StorageMap, } @@ -21,13 +21,13 @@ struct CounterContract { impl CounterContract { /// Returns the current counter value stored in the contract's storage map. pub fn get_count(&self) -> Felt { - let key = Word::from([felt!(0), felt!(0), felt!(0), felt!(1)]); + let key = Word::from_u64_unchecked(0, 0, 0, 1); self.count_map.get(&key) } /// Increments the counter value stored in the contract's storage map by one. pub fn increment_count(&mut self) -> Felt { - let key = Word::from([felt!(0), felt!(0), felt!(0), felt!(1)]); + let key = Word::from_u64_unchecked(0, 0, 0, 1); let current_value: Felt = self.count_map.get(&key); let new_value = current_value + felt!(1); self.count_map.set(key, new_value); diff --git a/examples/counter-note/Cargo.lock b/examples/counter-note/Cargo.lock index d24f7f6a5..42763f650 100644 --- a/examples/counter-note/Cargo.lock +++ b/examples/counter-note/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + [[package]] name = "aead" version = "0.5.2" @@ -21,6 +36,56 @@ dependencies = [ "memchr", ] +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + [[package]] name = "anyhow" version = "1.0.100" @@ -54,6 +119,30 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-link 0.2.1", +] + +[[package]] +name = "backtrace-ext" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" +dependencies = [ + "backtrace", +] + [[package]] name = "base16ct" version = "0.2.0" @@ -127,6 +216,8 @@ version = "1.2.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -171,6 +262,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + [[package]] name = "const-oid" version = "0.9.6" @@ -271,7 +368,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -301,7 +398,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -396,15 +493,26 @@ dependencies = [ ] [[package]] -name = "enum_dispatch" -version = "0.3.13" +name = "env_filter" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn", + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", ] [[package]] @@ -413,6 +521,16 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + [[package]] name = "ff" version = "0.13.1" @@ -453,6 +571,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "fs-err" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf68cef89750956493a66a10f512b9e58d9db21f2a573c079c0bdf1207a54a7" +dependencies = [ + "autocfg", +] + [[package]] name = "futures" version = "0.3.31" @@ -566,6 +693,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + [[package]] name = "glob" version = "0.3.2" @@ -648,6 +781,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "is_ci" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + [[package]] name = "itertools" version = "0.14.0" @@ -663,6 +808,40 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jiff" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.3", + "libc", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -750,6 +929,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + [[package]] name = "lock_api" version = "0.4.13" @@ -796,10 +981,13 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.8.0" +version = "0.10.0" dependencies = [ "miden-base", + "miden-base-macros", "miden-base-sys", + "miden-field", + "miden-field-repr", "miden-sdk-alloc", "miden-stdlib-sys", "wit-bindgen", @@ -807,9 +995,9 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" +checksum = "3d819876b9e9b630e63152400e6df2a201668a9bdfd33d54d6806b9d7b992ff8" dependencies = [ "miden-core", "miden-utils-indexing", @@ -820,9 +1008,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" +checksum = "24c6a18e29c03141cf9044604390a00691c7342924ec865b4acfdd560ff41ede" dependencies = [ "log", "miden-assembly-syntax", @@ -834,9 +1022,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" +checksum = "7458ff670f5a514bf972aa84d6e1851a4c4e9afa351f53b71bdc2218b99254b6" dependencies = [ "aho-corasick", "lalrpop", @@ -846,6 +1034,7 @@ dependencies = [ "miden-debug-types", "miden-utils-diagnostics", "midenc-hir-type", + "proptest", "regex", "rustc_version 0.4.1", "semver 1.0.26", @@ -855,23 +1044,22 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.8.0" +version = "0.10.0" dependencies = [ - "miden-base-macros", "miden-base-sys", "miden-stdlib-sys", ] [[package]] name = "miden-base-macros" -version = "0.8.0" +version = "0.10.0" dependencies = [ "heck", - "miden-objects", + "miden-protocol", "proc-macro2", "quote", "semver 1.0.26", - "syn", + "syn 2.0.106", "toml 0.8.23", "wit-bindgen-core", "wit-bindgen-rust", @@ -879,21 +1067,24 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.1" +version = "0.10.0" dependencies = [ + "miden-field-repr", "miden-stdlib-sys", ] [[package]] name = "miden-core" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" +checksum = "21a5c9c8c3d42ae8381ed49e47ff9ad2d2e345c4726761be36b7d4000ebb40ae" dependencies = [ - "enum_dispatch", + "derive_more", + "itertools", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-core-derive", "miden-utils-indexing", "num-derive", "num-traits", @@ -902,14 +1093,33 @@ dependencies = [ "winter-utils", ] +[[package]] +name = "miden-core-lib" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6556494ea5576803730fa15015bee6bd9d1a117450f22e7df0883421e7423674" +dependencies = [ + "env_logger", + "fs-err", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", + "sha2", + "thiserror", +] + [[package]] name = "miden-crypto" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" +checksum = "6e28b6e110f339c2edc2760a8cb94863f0a055ee658a49bc90c8560eff2feef4" dependencies = [ "blake3", + "cc", "chacha20poly1305", + "curve25519-dalek", "ed25519-dalek", "flume", "glob", @@ -922,6 +1132,7 @@ dependencies = [ "rand_chacha", "rand_core 0.9.3", "rand_hc", + "sha2", "sha3", "subtle", "thiserror", @@ -933,19 +1144,19 @@ dependencies = [ [[package]] name = "miden-crypto-derive" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +checksum = "f40e95b9c7c99ed6bbf073d9e02721d812dedd2c195019c0a0e0a3dbb9cbf034" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] name = "miden-debug-types" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" +checksum = "19123e896f24b575e69921a79a39a0a4babeb98404a8601017feb13b75d653b3" dependencies = [ "memchr", "miden-crypto", @@ -954,9 +1165,36 @@ dependencies = [ "miden-utils-indexing", "miden-utils-sync", "paste", + "serde", + "serde_spanned 1.0.0", "thiserror", ] +[[package]] +name = "miden-field" +version = "0.10.0" +dependencies = [ + "miden-core", +] + +[[package]] +name = "miden-field-repr" +version = "0.10.0" +dependencies = [ + "miden-core", + "miden-field", + "miden-field-repr-derive", +] + +[[package]] +name = "miden-field-repr-derive" +version = "0.10.0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + [[package]] name = "miden-formatting" version = "0.1.1" @@ -968,9 +1206,9 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" +checksum = "f0d6a322b91efa1bb71e224395ca1fb9ca00e2614f89427e35d8c42a903868a3" dependencies = [ "derive_more", "miden-assembly-syntax", @@ -984,6 +1222,8 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eef536978f24a179d94fa2a41e4f92b28e7d8aab14b8d23df28ad2a3d7098b20" dependencies = [ + "backtrace", + "backtrace-ext", "cfg-if", "futures", "indenter", @@ -996,7 +1236,11 @@ dependencies = [ "serde_json", "spin", "strip-ansi-escapes", - "syn", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "syn 2.0.106", + "terminal_size", "textwrap", "thiserror", "trybuild", @@ -1011,63 +1255,93 @@ checksum = "86a905f3ea65634dd4d1041a4f0fd0a3e77aa4118341d265af1a94339182222f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] -name = "miden-objects" -version = "0.12.1" +name = "miden-processor" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" +checksum = "4a659fac55de14647e2695f03d96b83ff94fe65fd31e74d81c225ec52af25acf" +dependencies = [ + "itertools", + "miden-air", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", + "thiserror", + "tokio", + "tracing", + "winter-prover", +] + +[[package]] +name = "miden-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfed3ae85e2fabbf8a2e7416e388a40519e10cbf0cdceda222ef858c2f270b35" dependencies = [ "bech32", + "fs-err", "getrandom 0.3.3", "miden-assembly", "miden-assembly-syntax", "miden-core", + "miden-core-lib", "miden-crypto", "miden-mast-package", "miden-processor", + "miden-protocol-macros", "miden-utils-sync", "miden-verifier", "rand", + "regex", "semver 1.0.26", "thiserror", + "walkdir", ] [[package]] -name = "miden-processor" -version = "0.19.1" +name = "miden-protocol-macros" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" +checksum = "f41a93dd532baa3a4c821073baad5d700aab119b3831ef7fdf004e196c10157e" dependencies = [ - "itertools", - "miden-air", - "miden-core", - "miden-debug-types", - "miden-utils-diagnostics", - "miden-utils-indexing", - "paste", - "rayon", - "thiserror", - "tokio", - "tracing", - "winter-prover", + "proc-macro2", + "quote", + "syn 2.0.106", ] [[package]] name = "miden-sdk-alloc" -version = "0.8.0" +version = "0.10.0" [[package]] name = "miden-stdlib-sys" -version = "0.8.0" +version = "0.10.0" +dependencies = [ + "miden-field", +] + +[[package]] +name = "miden-utils-core-derive" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa207ffd8b26a79d9b5b246a352812f0015c0bb8f75492ec089c5c8e6d5f9e2b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] name = "miden-utils-diagnostics" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" +checksum = "6b2f55477d410542a5d8990ca04856adf5bef91bfa3b54ca3c03a5ff14a6e25c" dependencies = [ "miden-crypto", "miden-debug-types", @@ -1078,28 +1352,29 @@ dependencies = [ [[package]] name = "miden-utils-indexing" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +checksum = "f39efae17e14ec8f8a1266cffd29eb7a08ac837143cd09223b1af361bbb55730" dependencies = [ "thiserror", ] [[package]] name = "miden-utils-sync" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" +checksum = "da7fa8f5fd27f122c83f55752f2a964bbfc2b713de419e9c152f7dcc05c194ec" dependencies = [ "lock_api", "loom", + "parking_lot", ] [[package]] name = "miden-verifier" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" +checksum = "fbddac2e76486fb657929338323c68b9e7f40e33b8cfb593d0fb5bf637db046e" dependencies = [ "miden-air", "miden-core", @@ -1119,6 +1394,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + [[package]] name = "nanorand" version = "0.7.0" @@ -1185,7 +1469,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1229,12 +1513,27 @@ dependencies = [ "libm", ] +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "opaque-debug" version = "0.3.1" @@ -1273,7 +1572,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -1334,6 +1633,21 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -1356,7 +1670,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.106", ] [[package]] @@ -1368,6 +1682,21 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +dependencies = [ + "bitflags", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax 0.8.5", + "unarray", +] + [[package]] name = "quote" version = "1.0.40" @@ -1389,6 +1718,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ + "rand_chacha", "rand_core 0.9.3", ] @@ -1416,6 +1746,9 @@ name = "rand_core" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", +] [[package]] name = "rand_hc" @@ -1426,6 +1759,15 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.3", +] + [[package]] name = "rayon" version = "1.11.0" @@ -1509,6 +1851,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "rustc-demangle" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1527,6 +1875,19 @@ dependencies = [ "semver 1.0.26", ] +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.59.0", +] + [[package]] name = "rustversion" version = "1.0.21" @@ -1600,22 +1961,32 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1758,6 +2129,38 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "supports-color" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c64fc7232dd8d2e4ac5ce4ef302b1d81e0b80d055b9d77c7c4f51f6aa4c867d6" +dependencies = [ + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e396b6523b11ccb83120b115a0b7366de372751aa6edf19844dfb13a6af97e91" + +[[package]] +name = "supports-unicode" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.106" @@ -1781,7 +2184,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -1793,6 +2196,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix", + "windows-sys 0.48.0", +] + [[package]] name = "textwrap" version = "0.16.2" @@ -1821,7 +2234,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1942,7 +2355,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2006,6 +2419,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicode-ident" version = "1.0.18" @@ -2046,6 +2465,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "valuable" version = "0.1.1" @@ -2113,7 +2538,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-shared", ] @@ -2135,7 +2560,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2205,7 +2630,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -2223,7 +2648,7 @@ dependencies = [ "windows-collections", "windows-core", "windows-future", - "windows-link", + "windows-link 0.1.3", "windows-numerics", ] @@ -2244,7 +2669,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", - "windows-link", + "windows-link 0.1.3", "windows-result", "windows-strings", ] @@ -2256,7 +2681,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", "windows-threading", ] @@ -2268,7 +2693,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2279,7 +2704,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2288,6 +2713,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-numerics" version = "0.2.0" @@ -2295,7 +2726,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2304,7 +2735,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2313,7 +2744,16 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", ] [[package]] @@ -2322,7 +2762,31 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -2331,14 +2795,14 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2347,21 +2811,39 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -2374,24 +2856,48 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -2459,7 +2965,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d31a19dae58475d019850e25b0170e94b16d382fbf6afee9c0e80fdc935e73e" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2535,7 +3041,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn", + "syn 2.0.106", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -2551,7 +3057,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -2620,7 +3126,7 @@ checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] diff --git a/examples/counter-note/src/lib.rs b/examples/counter-note/src/lib.rs index ac1f931b3..2d480918b 100644 --- a/examples/counter-note/src/lib.rs +++ b/examples/counter-note/src/lib.rs @@ -12,11 +12,17 @@ use miden::*; use crate::bindings::miden::counter_contract::counter_contract; -#[note_script] -fn run(_arg: Word) { - let initial_value = counter_contract::get_count(); - counter_contract::increment_count(); - let expected_value = initial_value + Felt::from_u32(1); - let final_value = counter_contract::get_count(); - assert_eq(final_value, expected_value); +#[note] +struct CounterNote; + +#[note] +impl CounterNote { + #[note_script] + pub fn run(self, _arg: Word) { + let initial_value = counter_contract::get_count(); + counter_contract::increment_count(); + let expected_value = initial_value + Felt::from_u32(1); + let final_value = counter_contract::get_count(); + assert_eq(final_value, expected_value); + } } diff --git a/examples/p2id-note/.cargo/config.toml b/examples/p2id-note/.cargo/config.toml new file mode 100644 index 000000000..82112cc9a --- /dev/null +++ b/examples/p2id-note/.cargo/config.toml @@ -0,0 +1,8 @@ +# This example is intended to be built as Wasm for the Miden VM. + +[build] +target = "wasm32-wasip2" + +[target.wasm32-wasip2] +# Force-enable `cfg(miden)` for Miden-VM-targeted builds (including editor/LSP workflows). +rustflags = ["--cfg", "miden"] diff --git a/examples/p2id-note/Cargo.lock b/examples/p2id-note/Cargo.lock index 10eb9225d..f2eafe1bc 100644 --- a/examples/p2id-note/Cargo.lock +++ b/examples/p2id-note/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + [[package]] name = "aead" version = "0.5.2" @@ -21,6 +36,56 @@ dependencies = [ "memchr", ] +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + [[package]] name = "anyhow" version = "1.0.100" @@ -54,6 +119,30 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-link 0.2.1", +] + +[[package]] +name = "backtrace-ext" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" +dependencies = [ + "backtrace", +] + [[package]] name = "base16ct" version = "0.2.0" @@ -127,6 +216,8 @@ version = "1.2.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -171,6 +262,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + [[package]] name = "const-oid" version = "0.9.6" @@ -264,7 +361,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -294,7 +391,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -389,15 +486,26 @@ dependencies = [ ] [[package]] -name = "enum_dispatch" -version = "0.3.13" +name = "env_filter" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn", + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", ] [[package]] @@ -406,6 +514,16 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + [[package]] name = "ff" version = "0.13.1" @@ -446,6 +564,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "fs-err" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf68cef89750956493a66a10f512b9e58d9db21f2a573c079c0bdf1207a54a7" +dependencies = [ + "autocfg", +] + [[package]] name = "futures" version = "0.3.31" @@ -559,6 +686,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + [[package]] name = "glob" version = "0.3.2" @@ -641,6 +774,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "is_ci" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + [[package]] name = "itertools" version = "0.14.0" @@ -656,6 +801,40 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jiff" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.3", + "libc", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -743,6 +922,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + [[package]] name = "lock_api" version = "0.4.13" @@ -789,10 +974,13 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.8.0" +version = "0.10.0" dependencies = [ "miden-base", + "miden-base-macros", "miden-base-sys", + "miden-field", + "miden-field-repr", "miden-sdk-alloc", "miden-stdlib-sys", "wit-bindgen", @@ -800,9 +988,9 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" +checksum = "3d819876b9e9b630e63152400e6df2a201668a9bdfd33d54d6806b9d7b992ff8" dependencies = [ "miden-core", "miden-utils-indexing", @@ -813,9 +1001,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" +checksum = "24c6a18e29c03141cf9044604390a00691c7342924ec865b4acfdd560ff41ede" dependencies = [ "log", "miden-assembly-syntax", @@ -827,9 +1015,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" +checksum = "7458ff670f5a514bf972aa84d6e1851a4c4e9afa351f53b71bdc2218b99254b6" dependencies = [ "aho-corasick", "lalrpop", @@ -839,6 +1027,7 @@ dependencies = [ "miden-debug-types", "miden-utils-diagnostics", "midenc-hir-type", + "proptest", "regex", "rustc_version 0.4.1", "semver 1.0.26", @@ -848,23 +1037,22 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.8.0" +version = "0.10.0" dependencies = [ - "miden-base-macros", "miden-base-sys", "miden-stdlib-sys", ] [[package]] name = "miden-base-macros" -version = "0.8.0" +version = "0.10.0" dependencies = [ "heck", - "miden-objects", + "miden-protocol", "proc-macro2", "quote", "semver 1.0.26", - "syn", + "syn 2.0.106", "toml 0.8.23", "wit-bindgen-core", "wit-bindgen-rust", @@ -872,21 +1060,24 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.1" +version = "0.10.0" dependencies = [ + "miden-field-repr", "miden-stdlib-sys", ] [[package]] name = "miden-core" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" +checksum = "21a5c9c8c3d42ae8381ed49e47ff9ad2d2e345c4726761be36b7d4000ebb40ae" dependencies = [ - "enum_dispatch", + "derive_more", + "itertools", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-core-derive", "miden-utils-indexing", "num-derive", "num-traits", @@ -895,14 +1086,33 @@ dependencies = [ "winter-utils", ] +[[package]] +name = "miden-core-lib" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6556494ea5576803730fa15015bee6bd9d1a117450f22e7df0883421e7423674" +dependencies = [ + "env_logger", + "fs-err", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", + "sha2", + "thiserror", +] + [[package]] name = "miden-crypto" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" +checksum = "6e28b6e110f339c2edc2760a8cb94863f0a055ee658a49bc90c8560eff2feef4" dependencies = [ "blake3", + "cc", "chacha20poly1305", + "curve25519-dalek", "ed25519-dalek", "flume", "glob", @@ -915,6 +1125,7 @@ dependencies = [ "rand_chacha", "rand_core 0.9.3", "rand_hc", + "sha2", "sha3", "subtle", "thiserror", @@ -926,19 +1137,19 @@ dependencies = [ [[package]] name = "miden-crypto-derive" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +checksum = "f40e95b9c7c99ed6bbf073d9e02721d812dedd2c195019c0a0e0a3dbb9cbf034" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] name = "miden-debug-types" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" +checksum = "19123e896f24b575e69921a79a39a0a4babeb98404a8601017feb13b75d653b3" dependencies = [ "memchr", "miden-crypto", @@ -947,9 +1158,36 @@ dependencies = [ "miden-utils-indexing", "miden-utils-sync", "paste", + "serde", + "serde_spanned 1.0.0", "thiserror", ] +[[package]] +name = "miden-field" +version = "0.10.0" +dependencies = [ + "miden-core", +] + +[[package]] +name = "miden-field-repr" +version = "0.10.0" +dependencies = [ + "miden-core", + "miden-field", + "miden-field-repr-derive", +] + +[[package]] +name = "miden-field-repr-derive" +version = "0.10.0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + [[package]] name = "miden-formatting" version = "0.1.1" @@ -961,9 +1199,9 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" +checksum = "f0d6a322b91efa1bb71e224395ca1fb9ca00e2614f89427e35d8c42a903868a3" dependencies = [ "derive_more", "miden-assembly-syntax", @@ -977,6 +1215,8 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eef536978f24a179d94fa2a41e4f92b28e7d8aab14b8d23df28ad2a3d7098b20" dependencies = [ + "backtrace", + "backtrace-ext", "cfg-if", "futures", "indenter", @@ -989,7 +1229,11 @@ dependencies = [ "serde_json", "spin", "strip-ansi-escapes", - "syn", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "syn 2.0.106", + "terminal_size", "textwrap", "thiserror", "trybuild", @@ -1004,63 +1248,93 @@ checksum = "86a905f3ea65634dd4d1041a4f0fd0a3e77aa4118341d265af1a94339182222f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] -name = "miden-objects" -version = "0.12.1" +name = "miden-processor" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" +checksum = "4a659fac55de14647e2695f03d96b83ff94fe65fd31e74d81c225ec52af25acf" +dependencies = [ + "itertools", + "miden-air", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", + "thiserror", + "tokio", + "tracing", + "winter-prover", +] + +[[package]] +name = "miden-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfed3ae85e2fabbf8a2e7416e388a40519e10cbf0cdceda222ef858c2f270b35" dependencies = [ "bech32", + "fs-err", "getrandom 0.3.3", "miden-assembly", "miden-assembly-syntax", "miden-core", + "miden-core-lib", "miden-crypto", "miden-mast-package", "miden-processor", + "miden-protocol-macros", "miden-utils-sync", "miden-verifier", "rand", + "regex", "semver 1.0.26", "thiserror", + "walkdir", ] [[package]] -name = "miden-processor" -version = "0.19.1" +name = "miden-protocol-macros" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" +checksum = "f41a93dd532baa3a4c821073baad5d700aab119b3831ef7fdf004e196c10157e" dependencies = [ - "itertools", - "miden-air", - "miden-core", - "miden-debug-types", - "miden-utils-diagnostics", - "miden-utils-indexing", - "paste", - "rayon", - "thiserror", - "tokio", - "tracing", - "winter-prover", + "proc-macro2", + "quote", + "syn 2.0.106", ] [[package]] name = "miden-sdk-alloc" -version = "0.8.0" +version = "0.10.0" [[package]] name = "miden-stdlib-sys" -version = "0.8.0" +version = "0.10.0" +dependencies = [ + "miden-field", +] + +[[package]] +name = "miden-utils-core-derive" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa207ffd8b26a79d9b5b246a352812f0015c0bb8f75492ec089c5c8e6d5f9e2b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] name = "miden-utils-diagnostics" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" +checksum = "6b2f55477d410542a5d8990ca04856adf5bef91bfa3b54ca3c03a5ff14a6e25c" dependencies = [ "miden-crypto", "miden-debug-types", @@ -1071,28 +1345,29 @@ dependencies = [ [[package]] name = "miden-utils-indexing" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +checksum = "f39efae17e14ec8f8a1266cffd29eb7a08ac837143cd09223b1af361bbb55730" dependencies = [ "thiserror", ] [[package]] name = "miden-utils-sync" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" +checksum = "da7fa8f5fd27f122c83f55752f2a964bbfc2b713de419e9c152f7dcc05c194ec" dependencies = [ "lock_api", "loom", + "parking_lot", ] [[package]] name = "miden-verifier" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" +checksum = "fbddac2e76486fb657929338323c68b9e7f40e33b8cfb593d0fb5bf637db046e" dependencies = [ "miden-air", "miden-core", @@ -1112,6 +1387,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + [[package]] name = "nanorand" version = "0.7.0" @@ -1178,7 +1462,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1222,12 +1506,27 @@ dependencies = [ "libm", ] +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "opaque-debug" version = "0.3.1" @@ -1273,7 +1572,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -1334,6 +1633,21 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -1356,7 +1670,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.106", ] [[package]] @@ -1368,6 +1682,21 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +dependencies = [ + "bitflags", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax 0.8.5", + "unarray", +] + [[package]] name = "quote" version = "1.0.40" @@ -1389,6 +1718,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ + "rand_chacha", "rand_core 0.9.3", ] @@ -1416,6 +1746,9 @@ name = "rand_core" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", +] [[package]] name = "rand_hc" @@ -1426,6 +1759,15 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.3", +] + [[package]] name = "rayon" version = "1.11.0" @@ -1509,6 +1851,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "rustc-demangle" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1527,6 +1875,19 @@ dependencies = [ "semver 1.0.26", ] +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.59.0", +] + [[package]] name = "rustversion" version = "1.0.21" @@ -1600,22 +1961,32 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1758,6 +2129,38 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "supports-color" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c64fc7232dd8d2e4ac5ce4ef302b1d81e0b80d055b9d77c7c4f51f6aa4c867d6" +dependencies = [ + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e396b6523b11ccb83120b115a0b7366de372751aa6edf19844dfb13a6af97e91" + +[[package]] +name = "supports-unicode" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.106" @@ -1781,7 +2184,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -1793,6 +2196,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix", + "windows-sys 0.48.0", +] + [[package]] name = "textwrap" version = "0.16.2" @@ -1821,7 +2234,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1942,7 +2355,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2006,6 +2419,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicode-ident" version = "1.0.18" @@ -2046,6 +2465,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "valuable" version = "0.1.1" @@ -2113,7 +2538,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-shared", ] @@ -2135,7 +2560,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2205,7 +2630,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -2223,7 +2648,7 @@ dependencies = [ "windows-collections", "windows-core", "windows-future", - "windows-link", + "windows-link 0.1.3", "windows-numerics", ] @@ -2244,7 +2669,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", - "windows-link", + "windows-link 0.1.3", "windows-result", "windows-strings", ] @@ -2256,7 +2681,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", "windows-threading", ] @@ -2268,7 +2693,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2279,7 +2704,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2288,6 +2713,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-numerics" version = "0.2.0" @@ -2295,7 +2726,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2304,7 +2735,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2313,7 +2744,16 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", ] [[package]] @@ -2322,7 +2762,31 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -2331,14 +2795,14 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2347,21 +2811,39 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -2374,24 +2856,48 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -2459,7 +2965,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d31a19dae58475d019850e25b0170e94b16d382fbf6afee9c0e80fdc935e73e" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2535,7 +3041,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn", + "syn 2.0.106", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -2551,7 +3057,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -2620,7 +3126,7 @@ checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] diff --git a/examples/p2id-note/src/lib.rs b/examples/p2id-note/src/lib.rs index 73a0d4d55..c316fa22b 100644 --- a/examples/p2id-note/src/lib.rs +++ b/examples/p2id-note/src/lib.rs @@ -2,28 +2,25 @@ #![no_std] #![feature(alloc_error_handler)] -// However, we could still use some standard library types while -// remaining no-std compatible, if we uncommented the following lines: -// -// extern crate alloc; -// use alloc::vec::Vec; - -use miden::*; +use miden::{AccountId, Word, active_note, note}; use crate::bindings::Account; -#[note_script] -fn run(_arg: Word, account: &mut Account) { - let inputs = active_note::get_inputs(); - let target_account_id_prefix = inputs[0]; - let target_account_id_suffix = inputs[1]; +#[note] +struct P2idNote { + target_account_id: AccountId, +} - let target_account = AccountId::from(target_account_id_prefix, target_account_id_suffix); - let current_account = account.get_id(); - assert_eq!(current_account, target_account); +#[note] +impl P2idNote { + #[note_script] + pub fn run(self, _arg: Word, account: &mut Account) { + let current_account = account.get_id(); + assert_eq!(current_account, self.target_account_id); - let assets = active_note::get_assets(); - for asset in assets { - account.receive_asset(asset); + let assets = active_note::get_assets(); + for asset in assets { + account.receive_asset(asset); + } } } diff --git a/examples/p2ide-note/Cargo.lock b/examples/p2ide-note/Cargo.lock index d089ccfe0..d3eb5ad90 100644 --- a/examples/p2ide-note/Cargo.lock +++ b/examples/p2ide-note/Cargo.lock @@ -361,7 +361,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -391,7 +391,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -485,18 +485,6 @@ dependencies = [ "log", ] -[[package]] -name = "enum_dispatch" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" -dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "env_filter" version = "0.1.4" @@ -533,7 +521,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -834,7 +822,7 @@ checksum = "980af8b43c3ad5d8d349ace167ec8170839f753a42d233ba19e08afe1850fa69" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -986,10 +974,13 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.8.0" +version = "0.10.0" dependencies = [ "miden-base", + "miden-base-macros", "miden-base-sys", + "miden-field", + "miden-field-repr", "miden-sdk-alloc", "miden-stdlib-sys", "wit-bindgen", @@ -997,9 +988,9 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" +checksum = "3d819876b9e9b630e63152400e6df2a201668a9bdfd33d54d6806b9d7b992ff8" dependencies = [ "miden-core", "miden-utils-indexing", @@ -1010,9 +1001,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" +checksum = "24c6a18e29c03141cf9044604390a00691c7342924ec865b4acfdd560ff41ede" dependencies = [ "log", "miden-assembly-syntax", @@ -1024,9 +1015,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" +checksum = "7458ff670f5a514bf972aa84d6e1851a4c4e9afa351f53b71bdc2218b99254b6" dependencies = [ "aho-corasick", "lalrpop", @@ -1046,23 +1037,22 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.8.0" +version = "0.10.0" dependencies = [ - "miden-base-macros", "miden-base-sys", "miden-stdlib-sys", ] [[package]] name = "miden-base-macros" -version = "0.8.0" +version = "0.10.0" dependencies = [ "heck", - "miden-objects", + "miden-protocol", "proc-macro2", "quote", "semver 1.0.26", - "syn", + "syn 2.0.106", "toml 0.8.23", "wit-bindgen-core", "wit-bindgen-rust", @@ -1070,21 +1060,24 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.1" +version = "0.10.0" dependencies = [ + "miden-field-repr", "miden-stdlib-sys", ] [[package]] name = "miden-core" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" +checksum = "21a5c9c8c3d42ae8381ed49e47ff9ad2d2e345c4726761be36b7d4000ebb40ae" dependencies = [ - "enum_dispatch", + "derive_more", + "itertools", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-core-derive", "miden-utils-indexing", "num-derive", "num-traits", @@ -1093,15 +1086,33 @@ dependencies = [ "winter-utils", ] +[[package]] +name = "miden-core-lib" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6556494ea5576803730fa15015bee6bd9d1a117450f22e7df0883421e7423674" +dependencies = [ + "env_logger", + "fs-err", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", + "sha2", + "thiserror", +] + [[package]] name = "miden-crypto" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" +checksum = "6e28b6e110f339c2edc2760a8cb94863f0a055ee658a49bc90c8560eff2feef4" dependencies = [ "blake3", "cc", "chacha20poly1305", + "curve25519-dalek", "ed25519-dalek", "flume", "glob", @@ -1114,6 +1125,7 @@ dependencies = [ "rand_chacha", "rand_core 0.9.3", "rand_hc", + "sha2", "sha3", "subtle", "thiserror", @@ -1125,19 +1137,19 @@ dependencies = [ [[package]] name = "miden-crypto-derive" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +checksum = "f40e95b9c7c99ed6bbf073d9e02721d812dedd2c195019c0a0e0a3dbb9cbf034" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] name = "miden-debug-types" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" +checksum = "19123e896f24b575e69921a79a39a0a4babeb98404a8601017feb13b75d653b3" dependencies = [ "memchr", "miden-crypto", @@ -1151,6 +1163,31 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-field" +version = "0.10.0" +dependencies = [ + "miden-core", +] + +[[package]] +name = "miden-field-repr" +version = "0.10.0" +dependencies = [ + "miden-core", + "miden-field", + "miden-field-repr-derive", +] + +[[package]] +name = "miden-field-repr-derive" +version = "0.10.0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + [[package]] name = "miden-formatting" version = "0.1.1" @@ -1162,9 +1199,9 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" +checksum = "f0d6a322b91efa1bb71e224395ca1fb9ca00e2614f89427e35d8c42a903868a3" dependencies = [ "derive_more", "miden-assembly-syntax", @@ -1195,7 +1232,7 @@ dependencies = [ "supports-color", "supports-hyperlinks", "supports-unicode", - "syn", + "syn 2.0.106", "terminal_size", "textwrap", "thiserror", @@ -1211,36 +1248,14 @@ checksum = "86a905f3ea65634dd4d1041a4f0fd0a3e77aa4118341d265af1a94339182222f" dependencies = [ "proc-macro2", "quote", - "syn", -] - -[[package]] -name = "miden-objects" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57ea15ca33d7735e08e81afd9c9f4f02fc0259ec019fcb4ec44192c205743553" -dependencies = [ - "bech32", - "getrandom 0.3.3", - "miden-assembly", - "miden-assembly-syntax", - "miden-core", - "miden-crypto", - "miden-mast-package", - "miden-processor", - "miden-stdlib", - "miden-utils-sync", - "miden-verifier", - "rand", - "semver 1.0.26", - "thiserror", + "syn 2.0.106", ] [[package]] name = "miden-processor" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" +checksum = "4a659fac55de14647e2695f03d96b83ff94fe65fd31e74d81c225ec52af25acf" dependencies = [ "itertools", "miden-air", @@ -1257,34 +1272,69 @@ dependencies = [ ] [[package]] -name = "miden-sdk-alloc" -version = "0.8.0" - -[[package]] -name = "miden-stdlib" -version = "0.19.1" +name = "miden-protocol" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e90a5de45a1e6213ff17b66fff8accde0bbc64264e2c22bbcb9a895f8f3b767" +checksum = "dfed3ae85e2fabbf8a2e7416e388a40519e10cbf0cdceda222ef858c2f270b35" dependencies = [ - "env_logger", + "bech32", "fs-err", + "getrandom 0.3.3", "miden-assembly", + "miden-assembly-syntax", "miden-core", + "miden-core-lib", "miden-crypto", + "miden-mast-package", "miden-processor", + "miden-protocol-macros", "miden-utils-sync", + "miden-verifier", + "rand", + "regex", + "semver 1.0.26", "thiserror", + "walkdir", +] + +[[package]] +name = "miden-protocol-macros" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f41a93dd532baa3a4c821073baad5d700aab119b3831ef7fdf004e196c10157e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", ] +[[package]] +name = "miden-sdk-alloc" +version = "0.10.0" + [[package]] name = "miden-stdlib-sys" -version = "0.8.0" +version = "0.10.0" +dependencies = [ + "miden-field", +] + +[[package]] +name = "miden-utils-core-derive" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa207ffd8b26a79d9b5b246a352812f0015c0bb8f75492ec089c5c8e6d5f9e2b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] name = "miden-utils-diagnostics" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" +checksum = "6b2f55477d410542a5d8990ca04856adf5bef91bfa3b54ca3c03a5ff14a6e25c" dependencies = [ "miden-crypto", "miden-debug-types", @@ -1295,18 +1345,18 @@ dependencies = [ [[package]] name = "miden-utils-indexing" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +checksum = "f39efae17e14ec8f8a1266cffd29eb7a08ac837143cd09223b1af361bbb55730" dependencies = [ "thiserror", ] [[package]] name = "miden-utils-sync" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" +checksum = "da7fa8f5fd27f122c83f55752f2a964bbfc2b713de419e9c152f7dcc05c194ec" dependencies = [ "lock_api", "loom", @@ -1315,9 +1365,9 @@ dependencies = [ [[package]] name = "miden-verifier" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" +checksum = "fbddac2e76486fb657929338323c68b9e7f40e33b8cfb593d0fb5bf637db046e" dependencies = [ "miden-air", "miden-core", @@ -1412,7 +1462,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1620,7 +1670,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.106", ] [[package]] @@ -1936,7 +1986,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2100,6 +2150,17 @@ version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.106" @@ -2123,7 +2184,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -2173,7 +2234,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2294,7 +2355,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2477,7 +2538,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-shared", ] @@ -2499,7 +2560,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2632,7 +2693,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2643,7 +2704,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2904,7 +2965,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d31a19dae58475d019850e25b0170e94b16d382fbf6afee9c0e80fdc935e73e" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2980,7 +3041,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn", + "syn 2.0.106", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -2996,7 +3057,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -3065,7 +3126,7 @@ checksum = "c640b22cd9817fae95be82f0d2f90b11f7605f6c319d16705c459b27ac2cbc26" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] diff --git a/examples/p2ide-note/src/lib.rs b/examples/p2ide-note/src/lib.rs index 955ad649e..72e5ed5e0 100644 --- a/examples/p2ide-note/src/lib.rs +++ b/examples/p2ide-note/src/lib.rs @@ -29,34 +29,40 @@ fn reclaim_assets(account: &mut Account, consuming_account: AccountId) { } } -#[note_script] -fn run(_arg: Word, account: &mut Account) { - let inputs = active_note::get_inputs(); +#[note] +struct P2ideNote; - // make sure the number of inputs is 4 - assert_eq((inputs.len() as u32).into(), felt!(4)); +#[note] +impl P2ideNote { + #[note_script] + pub fn run(self, _arg: Word, account: &mut Account) { + let inputs = active_note::get_inputs(); - let target_account_id_prefix = inputs[0]; - let target_account_id_suffix = inputs[1]; + // make sure the number of inputs is 4 + assert_eq((inputs.len() as u32).into(), felt!(4)); - let timelock_height = inputs[2]; - let reclaim_height = inputs[3]; + let target_account_id_prefix = inputs[0]; + let target_account_id_suffix = inputs[1]; - // get block number - let block_number = tx::get_block_number(); - assert!(block_number >= timelock_height); + let timelock_height = inputs[2]; + let reclaim_height = inputs[3]; - // get consuming account id - let consuming_account_id = account.get_id(); + // get block number + let block_number = tx::get_block_number(); + assert!(block_number >= timelock_height); - // target account id - let target_account_id = AccountId::from(target_account_id_prefix, target_account_id_suffix); + // get consuming account id + let consuming_account_id = account.get_id(); - let is_target = target_account_id == consuming_account_id; - if is_target { - consume_assets(account); - } else { - assert!(reclaim_height >= block_number); - reclaim_assets(account, consuming_account_id); + // target account id + let target_account_id = AccountId::new(target_account_id_prefix, target_account_id_suffix); + + let is_target = target_account_id == consuming_account_id; + if is_target { + consume_assets(account); + } else { + assert!(reclaim_height >= block_number); + reclaim_assets(account, consuming_account_id); + } } } diff --git a/examples/storage-example/Cargo.lock b/examples/storage-example/Cargo.lock index 1567751f5..650c1e298 100644 --- a/examples/storage-example/Cargo.lock +++ b/examples/storage-example/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + [[package]] name = "aead" version = "0.5.2" @@ -21,6 +36,56 @@ dependencies = [ "memchr", ] +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + [[package]] name = "anyhow" version = "1.0.100" @@ -54,6 +119,30 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-link 0.2.1", +] + +[[package]] +name = "backtrace-ext" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" +dependencies = [ + "backtrace", +] + [[package]] name = "base16ct" version = "0.2.0" @@ -127,6 +216,8 @@ version = "1.2.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -171,6 +262,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + [[package]] name = "const-oid" version = "0.9.6" @@ -264,7 +361,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -294,7 +391,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -389,15 +486,26 @@ dependencies = [ ] [[package]] -name = "enum_dispatch" -version = "0.3.13" +name = "env_filter" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn", + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", ] [[package]] @@ -406,6 +514,16 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + [[package]] name = "ff" version = "0.13.1" @@ -446,6 +564,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "fs-err" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf68cef89750956493a66a10f512b9e58d9db21f2a573c079c0bdf1207a54a7" +dependencies = [ + "autocfg", +] + [[package]] name = "futures" version = "0.3.31" @@ -559,6 +686,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + [[package]] name = "glob" version = "0.3.2" @@ -641,6 +774,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "is_ci" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + [[package]] name = "itertools" version = "0.14.0" @@ -656,6 +801,40 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jiff" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.3", + "libc", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -743,6 +922,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + [[package]] name = "lock_api" version = "0.4.13" @@ -789,10 +974,13 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.8.0" +version = "0.10.0" dependencies = [ "miden-base", + "miden-base-macros", "miden-base-sys", + "miden-field", + "miden-field-repr", "miden-sdk-alloc", "miden-stdlib-sys", "wit-bindgen", @@ -800,9 +988,9 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" +checksum = "3d819876b9e9b630e63152400e6df2a201668a9bdfd33d54d6806b9d7b992ff8" dependencies = [ "miden-core", "miden-utils-indexing", @@ -813,9 +1001,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" +checksum = "24c6a18e29c03141cf9044604390a00691c7342924ec865b4acfdd560ff41ede" dependencies = [ "log", "miden-assembly-syntax", @@ -827,9 +1015,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" +checksum = "7458ff670f5a514bf972aa84d6e1851a4c4e9afa351f53b71bdc2218b99254b6" dependencies = [ "aho-corasick", "lalrpop", @@ -839,6 +1027,7 @@ dependencies = [ "miden-debug-types", "miden-utils-diagnostics", "midenc-hir-type", + "proptest", "regex", "rustc_version 0.4.1", "semver 1.0.26", @@ -848,23 +1037,22 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.8.0" +version = "0.10.0" dependencies = [ - "miden-base-macros", "miden-base-sys", "miden-stdlib-sys", ] [[package]] name = "miden-base-macros" -version = "0.8.0" +version = "0.10.0" dependencies = [ "heck", - "miden-objects", + "miden-protocol", "proc-macro2", "quote", "semver 1.0.26", - "syn", + "syn 2.0.106", "toml 0.8.23", "wit-bindgen-core", "wit-bindgen-rust", @@ -872,21 +1060,24 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.1" +version = "0.10.0" dependencies = [ + "miden-field-repr", "miden-stdlib-sys", ] [[package]] name = "miden-core" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" +checksum = "21a5c9c8c3d42ae8381ed49e47ff9ad2d2e345c4726761be36b7d4000ebb40ae" dependencies = [ - "enum_dispatch", + "derive_more", + "itertools", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-core-derive", "miden-utils-indexing", "num-derive", "num-traits", @@ -895,14 +1086,33 @@ dependencies = [ "winter-utils", ] +[[package]] +name = "miden-core-lib" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6556494ea5576803730fa15015bee6bd9d1a117450f22e7df0883421e7423674" +dependencies = [ + "env_logger", + "fs-err", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", + "sha2", + "thiserror", +] + [[package]] name = "miden-crypto" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" +checksum = "6e28b6e110f339c2edc2760a8cb94863f0a055ee658a49bc90c8560eff2feef4" dependencies = [ "blake3", + "cc", "chacha20poly1305", + "curve25519-dalek", "ed25519-dalek", "flume", "glob", @@ -915,6 +1125,7 @@ dependencies = [ "rand_chacha", "rand_core 0.9.3", "rand_hc", + "sha2", "sha3", "subtle", "thiserror", @@ -926,19 +1137,19 @@ dependencies = [ [[package]] name = "miden-crypto-derive" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +checksum = "f40e95b9c7c99ed6bbf073d9e02721d812dedd2c195019c0a0e0a3dbb9cbf034" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] name = "miden-debug-types" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" +checksum = "19123e896f24b575e69921a79a39a0a4babeb98404a8601017feb13b75d653b3" dependencies = [ "memchr", "miden-crypto", @@ -947,9 +1158,36 @@ dependencies = [ "miden-utils-indexing", "miden-utils-sync", "paste", + "serde", + "serde_spanned 1.0.0", "thiserror", ] +[[package]] +name = "miden-field" +version = "0.10.0" +dependencies = [ + "miden-core", +] + +[[package]] +name = "miden-field-repr" +version = "0.10.0" +dependencies = [ + "miden-core", + "miden-field", + "miden-field-repr-derive", +] + +[[package]] +name = "miden-field-repr-derive" +version = "0.10.0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + [[package]] name = "miden-formatting" version = "0.1.1" @@ -961,9 +1199,9 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" +checksum = "f0d6a322b91efa1bb71e224395ca1fb9ca00e2614f89427e35d8c42a903868a3" dependencies = [ "derive_more", "miden-assembly-syntax", @@ -977,6 +1215,8 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eef536978f24a179d94fa2a41e4f92b28e7d8aab14b8d23df28ad2a3d7098b20" dependencies = [ + "backtrace", + "backtrace-ext", "cfg-if", "futures", "indenter", @@ -989,7 +1229,11 @@ dependencies = [ "serde_json", "spin", "strip-ansi-escapes", - "syn", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "syn 2.0.106", + "terminal_size", "textwrap", "thiserror", "trybuild", @@ -1004,63 +1248,93 @@ checksum = "86a905f3ea65634dd4d1041a4f0fd0a3e77aa4118341d265af1a94339182222f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] -name = "miden-objects" -version = "0.12.1" +name = "miden-processor" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" +checksum = "4a659fac55de14647e2695f03d96b83ff94fe65fd31e74d81c225ec52af25acf" +dependencies = [ + "itertools", + "miden-air", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", + "thiserror", + "tokio", + "tracing", + "winter-prover", +] + +[[package]] +name = "miden-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfed3ae85e2fabbf8a2e7416e388a40519e10cbf0cdceda222ef858c2f270b35" dependencies = [ "bech32", + "fs-err", "getrandom 0.3.3", "miden-assembly", "miden-assembly-syntax", "miden-core", + "miden-core-lib", "miden-crypto", "miden-mast-package", "miden-processor", + "miden-protocol-macros", "miden-utils-sync", "miden-verifier", "rand", + "regex", "semver 1.0.26", "thiserror", + "walkdir", ] [[package]] -name = "miden-processor" -version = "0.19.1" +name = "miden-protocol-macros" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" +checksum = "f41a93dd532baa3a4c821073baad5d700aab119b3831ef7fdf004e196c10157e" dependencies = [ - "itertools", - "miden-air", - "miden-core", - "miden-debug-types", - "miden-utils-diagnostics", - "miden-utils-indexing", - "paste", - "rayon", - "thiserror", - "tokio", - "tracing", - "winter-prover", + "proc-macro2", + "quote", + "syn 2.0.106", ] [[package]] name = "miden-sdk-alloc" -version = "0.8.0" +version = "0.10.0" [[package]] name = "miden-stdlib-sys" -version = "0.8.0" +version = "0.10.0" +dependencies = [ + "miden-field", +] + +[[package]] +name = "miden-utils-core-derive" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa207ffd8b26a79d9b5b246a352812f0015c0bb8f75492ec089c5c8e6d5f9e2b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] name = "miden-utils-diagnostics" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" +checksum = "6b2f55477d410542a5d8990ca04856adf5bef91bfa3b54ca3c03a5ff14a6e25c" dependencies = [ "miden-crypto", "miden-debug-types", @@ -1071,28 +1345,29 @@ dependencies = [ [[package]] name = "miden-utils-indexing" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +checksum = "f39efae17e14ec8f8a1266cffd29eb7a08ac837143cd09223b1af361bbb55730" dependencies = [ "thiserror", ] [[package]] name = "miden-utils-sync" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" +checksum = "da7fa8f5fd27f122c83f55752f2a964bbfc2b713de419e9c152f7dcc05c194ec" dependencies = [ "lock_api", "loom", + "parking_lot", ] [[package]] name = "miden-verifier" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" +checksum = "fbddac2e76486fb657929338323c68b9e7f40e33b8cfb593d0fb5bf637db046e" dependencies = [ "miden-air", "miden-core", @@ -1112,6 +1387,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + [[package]] name = "nanorand" version = "0.7.0" @@ -1178,7 +1462,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1222,12 +1506,27 @@ dependencies = [ "libm", ] +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "opaque-debug" version = "0.3.1" @@ -1266,7 +1565,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -1327,6 +1626,21 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -1349,7 +1663,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.106", ] [[package]] @@ -1361,6 +1675,21 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +dependencies = [ + "bitflags", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax 0.8.5", + "unarray", +] + [[package]] name = "quote" version = "1.0.40" @@ -1382,6 +1711,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ + "rand_chacha", "rand_core 0.9.3", ] @@ -1409,6 +1739,9 @@ name = "rand_core" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", +] [[package]] name = "rand_hc" @@ -1419,6 +1752,15 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.3", +] + [[package]] name = "rayon" version = "1.11.0" @@ -1502,6 +1844,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "rustc-demangle" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1520,6 +1868,19 @@ dependencies = [ "semver 1.0.26", ] +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.59.0", +] + [[package]] name = "rustversion" version = "1.0.21" @@ -1593,22 +1954,32 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1758,6 +2129,38 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "supports-color" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c64fc7232dd8d2e4ac5ce4ef302b1d81e0b80d055b9d77c7c4f51f6aa4c867d6" +dependencies = [ + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e396b6523b11ccb83120b115a0b7366de372751aa6edf19844dfb13a6af97e91" + +[[package]] +name = "supports-unicode" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.106" @@ -1781,7 +2184,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -1793,6 +2196,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix", + "windows-sys 0.48.0", +] + [[package]] name = "textwrap" version = "0.16.2" @@ -1821,7 +2234,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1942,7 +2355,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2006,6 +2419,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicode-ident" version = "1.0.18" @@ -2046,6 +2465,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "valuable" version = "0.1.1" @@ -2113,7 +2538,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-shared", ] @@ -2135,7 +2560,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2205,7 +2630,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -2223,7 +2648,7 @@ dependencies = [ "windows-collections", "windows-core", "windows-future", - "windows-link", + "windows-link 0.1.3", "windows-numerics", ] @@ -2244,7 +2669,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", - "windows-link", + "windows-link 0.1.3", "windows-result", "windows-strings", ] @@ -2256,7 +2681,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", "windows-threading", ] @@ -2268,7 +2693,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2279,7 +2704,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2288,6 +2713,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-numerics" version = "0.2.0" @@ -2295,7 +2726,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2304,7 +2735,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2313,7 +2744,16 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", ] [[package]] @@ -2322,7 +2762,31 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -2331,14 +2795,14 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2347,21 +2811,39 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -2374,24 +2856,48 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -2459,7 +2965,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d31a19dae58475d019850e25b0170e94b16d382fbf6afee9c0e80fdc935e73e" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2535,7 +3041,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn", + "syn 2.0.106", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -2551,7 +3057,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -2620,7 +3126,7 @@ checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] diff --git a/examples/storage-example/src/lib.rs b/examples/storage-example/src/lib.rs index 563f7d208..ad88966db 100644 --- a/examples/storage-example/src/lib.rs +++ b/examples/storage-example/src/lib.rs @@ -14,30 +14,20 @@ use crate::bindings::exports::miden::storage_example::*; miden::generate!(); bindings::export!(MyAccount); +/// An example account demonstrating storage value and map usage. #[component] struct MyAccount { - #[storage( - slot(0), - description = "test value", - type = "auth::rpo_falcon512::pub_key" - )] + /// Public key authorized to update the stored asset quantities. + #[storage(description = "owner public key")] owner_public_key: Value, - #[storage(slot(1), description = "test map")] + /// A map from asset identifier to quantity held by the account. + #[storage(description = "asset quantity map")] asset_qty_map: StorageMap, } -// // generated by the `component` and `storage` attribute macros -// impl Default for MyAccount { -// fn default() -> Self { -// Self { -// owner_public_key: Value { slot: 0 }, -// asset_qty_map: StorageMap { slot: 1 }, -// } -// } -// } - impl foo::Guest for MyAccount { + /// Sets the quantity for `asset` if `pub_key` matches the stored owner key. fn set_asset_qty(pub_key: Word, asset: Asset, qty: Felt) { let mut my_account = MyAccount::default(); let owner_key: Word = my_account.owner_public_key.read(); @@ -46,6 +36,7 @@ impl foo::Guest for MyAccount { } } + /// Returns the stored quantity for `asset`, or 0 if not present. fn get_asset_qty(asset: Asset) -> Felt { let my_account = MyAccount::default(); my_account.asset_qty_map.get(&asset) diff --git a/frontend/wasm/Cargo.toml b/frontend/wasm/Cargo.toml index 271b39d9e..be2179c25 100644 --- a/frontend/wasm/Cargo.toml +++ b/frontend/wasm/Cargo.toml @@ -13,7 +13,7 @@ edition.workspace = true [features] default = ["std"] -std = ["wasmparser/std", "gimli/std", "midenc-hir-symbol/std"] +std = ["wasmparser/std", "gimli/std", "midenc-hir-symbol/std", "dep:wasmprinter"] [dependencies] anyhow.workspace = true @@ -32,6 +32,7 @@ midenc-hir-symbol.workspace = true midenc-session.workspace = true thiserror.workspace = true wasmparser.workspace = true +wasmprinter = { workspace = true, optional = true } [dev-dependencies] # Use local paths for dev-only dependency to avoid relying on crates.io during packaging diff --git a/frontend/wasm/src/code_translator/mod.rs b/frontend/wasm/src/code_translator/mod.rs index e83d3243e..5383d781c 100644 --- a/frontend/wasm/src/code_translator/mod.rs +++ b/frontend/wasm/src/code_translator/mod.rs @@ -70,12 +70,14 @@ pub fn translate_operator( * disappear in the Miden IR ***********************************************************************************/ Operator::LocalGet { local_index } => { - let val = builder.use_var(Variable::from_u32(*local_index)); + let local = builder.get_local(Variable::from_u32(*local_index)); + let val = builder.load_local(local, span)?; state.push1(val); } Operator::LocalSet { local_index } => { - let val = state.pop1(); let var = Variable::from_u32(*local_index); + let local = builder.get_local(var); + let val = state.pop1(); let expected_ty = builder.variable_type(var).clone(); let value_ty = val.borrow().ty().clone(); let val = if expected_ty != value_ty { @@ -90,11 +92,27 @@ pub fn translate_operator( } else { val }; - builder.def_var(var, val); + builder.store_local(local, val, span)?; } Operator::LocalTee { local_index } => { + let var = Variable::from_u32(*local_index); + let local = builder.get_local(var); let val = state.peek1(); - builder.def_var(Variable::from_u32(*local_index), val); + let expected_ty = builder.variable_type(var).clone(); + let value_ty = val.borrow().ty().clone(); + let val = if expected_ty != value_ty { + if expected_ty == I32 && value_ty == U32 { + builder.bitcast(val, I32, span)? + } else if expected_ty == I64 && value_ty == U64 { + builder.bitcast(val, I64, span)? + } else { + let expected_ty = expected_ty.clone(); + builder.cast(val, expected_ty, span)? + } + } else { + val + }; + builder.store_local(local, val, span)?; } /********************************** Globals ****************************************/ Operator::GlobalGet { global_index } => { @@ -340,13 +358,13 @@ pub fn translate_operator( let (rhs_hi, rhs_lo) = state.pop2(); let (lhs_hi, lhs_lo) = state.pop2(); - let lhs = builder.join(lhs_hi, lhs_lo, span)?; - let rhs = builder.join(rhs_hi, rhs_lo, span)?; + let lhs = builder.join2(lhs_hi, lhs_lo, Type::I128, span)?; + let rhs = builder.join2(rhs_hi, rhs_lo, Type::I128, span)?; let res = builder.add_wrapping(lhs, rhs, span)?; // Ensure the high limb is left on the top of the value stack. - let (res_hi, res_lo) = builder.split(res, span)?; + let (res_hi, res_lo) = builder.split2(res, Type::I64, span)?; state.pushn(&[res_lo, res_hi]); } Operator::I32And | Operator::I64And => { @@ -435,13 +453,13 @@ pub fn translate_operator( let (rhs_hi, rhs_lo) = state.pop2(); let (lhs_hi, lhs_lo) = state.pop2(); - let lhs = builder.join(lhs_hi, lhs_lo, span)?; - let rhs = builder.join(rhs_hi, rhs_lo, span)?; + let lhs = builder.join2(lhs_hi, lhs_lo, Type::I128, span)?; + let rhs = builder.join2(rhs_hi, rhs_lo, Type::I128, span)?; let res = builder.sub_wrapping(lhs, rhs, span)?; // Ensure the high limb is left on the top of the value stack. - let (res_hi, res_lo) = builder.split(res, span)?; + let (res_hi, res_lo) = builder.split2(res, Type::I64, span)?; state.pushn(&[res_lo, res_hi]); } Operator::I32Mul | Operator::I64Mul => { @@ -462,7 +480,7 @@ pub fn translate_operator( let res = builder.mul_wrapping(lhs, rhs, span)?; // Ensure the high limb is left on the top of the value stack. - let (res_hi, res_lo) = builder.split(res, span)?; + let (res_hi, res_lo) = builder.split2(res, Type::U64, span)?; state.pushn(&[res_lo, res_hi]); } Operator::I64MulWideS => { @@ -474,7 +492,7 @@ pub fn translate_operator( let res = builder.mul_wrapping(lhs, rhs, span)?; // Ensure the high limb is left on the top of the value stack. - let (res_hi, res_lo) = builder.split(res, span)?; + let (res_hi, res_lo) = builder.split2(res, Type::I64, span)?; state.pushn(&[res_lo, res_hi]); } Operator::I32DivS | Operator::I64DivS => { diff --git a/frontend/wasm/src/emit.rs b/frontend/wasm/src/emit.rs new file mode 100644 index 000000000..45319b3e2 --- /dev/null +++ b/frontend/wasm/src/emit.rs @@ -0,0 +1,108 @@ +//! Utilities for emitting frontend-specific artifacts. + +use alloc::string::String; + +use midenc_session::{Emit, OutputMode, OutputType, Session, Writer}; + +/// A wrapper that emits WebAssembly text format (WAT). +#[derive(Debug, Copy, Clone)] +pub struct WatEmit<'a>(pub &'a str); + +impl Emit for WatEmit<'_> { + fn name(&self) -> Option { + None + } + + fn output_type(&self, _mode: OutputMode) -> OutputType { + OutputType::Wat + } + + fn write_to( + &self, + mut writer: W, + mode: OutputMode, + _session: &Session, + ) -> anyhow::Result<()> { + if mode != OutputMode::Text { + anyhow::bail!("wat emission does not support binary mode"); + } + writer.write_fmt(core::format_args!("{}", self.0))?; + Ok(()) + } +} + +/// Convert a WebAssembly binary to WAT text, filtering out highly variable custom sections. +#[cfg(feature = "std")] +pub fn wasm_to_wat(wasm_bytes: &[u8]) -> anyhow::Result { + use core::fmt; + + // Disable printing of the various custom sections, e.g. "producers", either because they + // contain strings which are highly variable (but not important), or because they are debug info + // related. + struct NoCustomSectionsPrinter(T); + impl wasmprinter::Print for NoCustomSectionsPrinter { + fn write_str(&mut self, s: &str) -> std::io::Result<()> { + self.0.write_str(s) + } + + fn newline(&mut self) -> std::io::Result<()> { + self.0.newline() + } + + fn start_line(&mut self, binary_offset: Option) { + self.0.start_line(binary_offset); + } + + fn write_fmt(&mut self, args: fmt::Arguments<'_>) -> std::io::Result<()> { + self.0.write_fmt(args) + } + + fn print_custom_section( + &mut self, + name: &str, + binary_offset: usize, + data: &[u8], + ) -> std::io::Result { + match name { + "producers" | "target_features" => Ok(true), + debug if debug.starts_with(".debug") => Ok(true), + _ => self.0.print_custom_section(name, binary_offset, data), + } + } + + fn start_literal(&mut self) -> std::io::Result<()> { + self.0.start_literal() + } + + fn start_name(&mut self) -> std::io::Result<()> { + self.0.start_name() + } + + fn start_keyword(&mut self) -> std::io::Result<()> { + self.0.start_keyword() + } + + fn start_type(&mut self) -> std::io::Result<()> { + self.0.start_type() + } + + fn start_comment(&mut self) -> std::io::Result<()> { + self.0.start_comment() + } + + fn reset_color(&mut self) -> std::io::Result<()> { + self.0.reset_color() + } + + fn supports_async_color(&self) -> bool { + self.0.supports_async_color() + } + } + + // WAT text should be at least ~3x larger than the binary Wasm representation + let mut wat = String::with_capacity(wasm_bytes.len() * 3); + let config = wasmprinter::Config::new(); + let mut wasm_printer = NoCustomSectionsPrinter(wasmprinter::PrintFmtWrite(&mut wat)); + config.print(wasm_bytes, &mut wasm_printer)?; + Ok(wat) +} diff --git a/frontend/wasm/src/intrinsics/advice.rs b/frontend/wasm/src/intrinsics/advice.rs index a6e398208..96cdaf98a 100644 --- a/frontend/wasm/src/intrinsics/advice.rs +++ b/frontend/wasm/src/intrinsics/advice.rs @@ -7,7 +7,6 @@ use midenc_hir::{ use crate::{error::WasmResult, module::function_builder_ext::FunctionBuilderExt}; -pub(crate) const MODULE_ID: &str = "intrinsics::advice"; /// The module path prefix for advice intrinsics, not including the function name pub const MODULE_PREFIX: &[SymbolNameComponent] = &[ SymbolNameComponent::Root, diff --git a/frontend/wasm/src/intrinsics/crypto.rs b/frontend/wasm/src/intrinsics/crypto.rs index 7ca4a8869..f9e4df6b9 100644 --- a/frontend/wasm/src/intrinsics/crypto.rs +++ b/frontend/wasm/src/intrinsics/crypto.rs @@ -12,7 +12,6 @@ use midenc_hir::{ use crate::{error::WasmResult, module::function_builder_ext::FunctionBuilderExt}; -pub(crate) const MODULE_ID: &str = "intrinsics::crypto"; pub(crate) const MODULE_PREFIX: &[SymbolNameComponent] = &[ SymbolNameComponent::Root, SymbolNameComponent::Component(symbols::Intrinsics), diff --git a/frontend/wasm/src/intrinsics/debug.rs b/frontend/wasm/src/intrinsics/debug.rs index a75a0c00f..acc019bf9 100644 --- a/frontend/wasm/src/intrinsics/debug.rs +++ b/frontend/wasm/src/intrinsics/debug.rs @@ -8,7 +8,6 @@ use midenc_hir::{ use crate::{error::WasmResult, module::function_builder_ext::FunctionBuilderExt}; -pub(crate) const MODULE_ID: &str = "intrinsics::debug"; pub(crate) const MODULE_PREFIX: &[SymbolNameComponent] = &[ SymbolNameComponent::Root, SymbolNameComponent::Component(symbols::Intrinsics), diff --git a/frontend/wasm/src/intrinsics/felt.rs b/frontend/wasm/src/intrinsics/felt.rs index 87e262a4e..5c2542c9b 100644 --- a/frontend/wasm/src/intrinsics/felt.rs +++ b/frontend/wasm/src/intrinsics/felt.rs @@ -9,7 +9,6 @@ use midenc_hir::{ use crate::{error::WasmResult, module::function_builder_ext::FunctionBuilderExt}; -pub(crate) const MODULE_ID: &str = "intrinsics::felt"; pub(crate) const MODULE_PREFIX: &[SymbolNameComponent] = &[ SymbolNameComponent::Root, SymbolNameComponent::Component(symbols::Intrinsics), @@ -28,7 +27,7 @@ pub(crate) fn convert_felt_intrinsics( // Conversion operations "from_u64_unchecked" => { assert_eq!(args.len(), 1, "{function} takes exactly one argument"); - let inst = builder.cast(args[0], Type::Felt, span)?; + let inst = builder.trunc(args[0], Type::Felt, span)?; Ok(smallvec![inst]) } "from_u32" => { diff --git a/frontend/wasm/src/intrinsics/mem.rs b/frontend/wasm/src/intrinsics/mem.rs index 4600a5d56..751e61537 100644 --- a/frontend/wasm/src/intrinsics/mem.rs +++ b/frontend/wasm/src/intrinsics/mem.rs @@ -8,7 +8,6 @@ use midenc_hir::{ use crate::{error::WasmResult, module::function_builder_ext::FunctionBuilderExt}; -pub(crate) const MODULE_ID: &str = "intrinsics::mem"; pub(crate) const MODULE_PREFIX: &[SymbolNameComponent] = &[ SymbolNameComponent::Root, SymbolNameComponent::Component(symbols::Intrinsics), diff --git a/frontend/wasm/src/lib.rs b/frontend/wasm/src/lib.rs index b7eb35aa4..c84cee496 100644 --- a/frontend/wasm/src/lib.rs +++ b/frontend/wasm/src/lib.rs @@ -14,6 +14,7 @@ mod callable; mod code_translator; mod component; mod config; +mod emit; mod error; mod intrinsics; mod miden_abi; @@ -29,7 +30,9 @@ use midenc_hir::{Context, dialects::builtin}; use module::build_ir::translate_module_as_component; use wasmparser::WasmFeatures; -pub use self::{config::*, error::WasmError}; +#[cfg(feature = "std")] +pub use self::emit::wasm_to_wat; +pub use self::{config::*, emit::WatEmit, error::WasmError}; /// The output of the frontend Wasm translation stage pub struct FrontendOutput { diff --git a/frontend/wasm/src/miden_abi/mod.rs b/frontend/wasm/src/miden_abi/mod.rs index 7f84b44ed..d319cc27e 100644 --- a/frontend/wasm/src/miden_abi/mod.rs +++ b/frontend/wasm/src/miden_abi/mod.rs @@ -22,8 +22,11 @@ fn is_miden_stdlib_module(module_path: &SymbolPath) -> bool { } pub fn miden_abi_function_type(path: &SymbolPath) -> FunctionType { - const STD: &[SymbolNameComponent] = - &[SymbolNameComponent::Root, SymbolNameComponent::Component(symbols::Std)]; + const STD: &[SymbolNameComponent] = &[ + SymbolNameComponent::Root, + SymbolNameComponent::Component(symbols::Miden), + SymbolNameComponent::Component(symbols::Core), + ]; if path.is_prefixed_by(STD) { miden_stdlib_function_type(path) diff --git a/frontend/wasm/src/miden_abi/stdlib.rs b/frontend/wasm/src/miden_abi/stdlib.rs index 0ce68361e..de907f2f4 100644 --- a/frontend/wasm/src/miden_abi/stdlib.rs +++ b/frontend/wasm/src/miden_abi/stdlib.rs @@ -14,7 +14,7 @@ pub(crate) fn signatures() -> &'static ModuleFunctionTypeMap { m.extend(collections::smt::signatures()); m.extend(crypto::hashes::blake3::signatures()); m.extend(crypto::hashes::sha256::signatures()); - m.extend(crypto::hashes::rpo::signatures()); + m.extend(crypto::hashes::rpo256::signatures()); m.extend(crypto::dsa::rpo_falcon512::signatures()); m.extend(mem::signatures()); m diff --git a/frontend/wasm/src/miden_abi/stdlib/collections/smt.rs b/frontend/wasm/src/miden_abi/stdlib/collections/smt.rs index 3ae457e14..8a914a524 100644 --- a/frontend/wasm/src/miden_abi/stdlib/collections/smt.rs +++ b/frontend/wasm/src/miden_abi/stdlib/collections/smt.rs @@ -6,8 +6,6 @@ use midenc_hir::{ use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; -pub(crate) const MODULE_ID: &str = "std::collections::smt"; - pub(crate) const GET: &str = "get"; pub(crate) const SET: &str = "set"; @@ -39,39 +37,11 @@ pub(crate) fn signatures() -> ModuleFunctionTypeMap { ); let module_path = SymbolPath::from_iter([ SymbolNameComponent::Root, - SymbolNameComponent::Component(symbols::Std), - SymbolNameComponent::Component(Symbol::intern("collections")), - SymbolNameComponent::Component(Symbol::intern("smt")), + SymbolNameComponent::Component(symbols::Miden), + SymbolNameComponent::Component(symbols::Core), + SymbolNameComponent::Component(symbols::Collections), + SymbolNameComponent::Component(symbols::Smt), ]); m.insert(module_path, funcs); - let mut env_funcs: FunctionTypeMap = Default::default(); - env_funcs.insert( - Symbol::intern("std::collections::smt::get"), - FunctionType::new( - CallConv::Wasm, - [Felt, Felt, Felt, Felt, Felt, Felt, Felt, Felt], - [Felt, Felt, Felt, Felt, Felt, Felt, Felt, Felt], - ), - ); - env_funcs.insert( - Symbol::intern("std::collections::smt::set"), - FunctionType::new( - CallConv::Wasm, - [ - Felt, Felt, Felt, Felt, // value - Felt, Felt, Felt, Felt, // key - Felt, Felt, Felt, Felt, // root - ], - [ - Felt, Felt, Felt, Felt, // old value - Felt, Felt, Felt, Felt, // new root - ], - ), - ); - let env_module_path = SymbolPath::from_iter([ - SymbolNameComponent::Root, - SymbolNameComponent::Component(Symbol::intern("env")), - ]); - m.insert(env_module_path, env_funcs); m } diff --git a/frontend/wasm/src/miden_abi/stdlib/crypto/dsa/rpo_falcon512.rs b/frontend/wasm/src/miden_abi/stdlib/crypto/dsa/rpo_falcon512.rs index 97d4fc455..350e8b569 100644 --- a/frontend/wasm/src/miden_abi/stdlib/crypto/dsa/rpo_falcon512.rs +++ b/frontend/wasm/src/miden_abi/stdlib/crypto/dsa/rpo_falcon512.rs @@ -6,18 +6,17 @@ use midenc_hir::{ use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; -pub(crate) const MODULE_ID: &str = "std::crypto::dsa::rpo_falcon512"; - pub(crate) const RPO_FALCON512_VERIFY: &str = "verify"; fn module_path() -> SymbolPath { // Build 'std::crypto::dsa::rpo_falcon512' using interned symbol components let parts = [ SymbolNameComponent::Root, - SymbolNameComponent::Component(symbols::Std), + SymbolNameComponent::Component(symbols::Miden), + SymbolNameComponent::Component(symbols::Core), SymbolNameComponent::Component(symbols::Crypto), SymbolNameComponent::Component(symbols::Dsa), - SymbolNameComponent::Component(symbols::RpoFalcon512), + SymbolNameComponent::Component(symbols::Falcon512Rpo), ]; SymbolPath::from_iter(parts) } diff --git a/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/blake3.rs b/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/blake3.rs index e5dacc283..bd408598b 100644 --- a/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/blake3.rs +++ b/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/blake3.rs @@ -6,23 +6,23 @@ use midenc_hir::{ use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; -pub const MODULE_ID: &str = "std::crypto::hashes::blake3"; pub(crate) const MODULE_PREFIX: &[SymbolNameComponent] = &[ SymbolNameComponent::Root, - SymbolNameComponent::Component(symbols::Std), + SymbolNameComponent::Component(symbols::Miden), + SymbolNameComponent::Component(symbols::Core), SymbolNameComponent::Component(symbols::Crypto), SymbolNameComponent::Component(symbols::Hashes), SymbolNameComponent::Component(symbols::Blake3), ]; -pub(crate) const HASH_1TO1: &str = "hash_1to1"; -pub(crate) const HASH_2TO1: &str = "hash_2to1"; +pub(crate) const HASH: &str = "hash"; +pub(crate) const MERGE: &str = "merge"; pub(crate) fn signatures() -> ModuleFunctionTypeMap { let mut m: ModuleFunctionTypeMap = Default::default(); let mut blake3: FunctionTypeMap = Default::default(); blake3.insert( - Symbol::from(HASH_1TO1), + Symbol::from(HASH), FunctionType::new( CallConv::Wasm, [I32, I32, I32, I32, I32, I32, I32, I32], @@ -30,7 +30,7 @@ pub(crate) fn signatures() -> ModuleFunctionTypeMap { ), ); blake3.insert( - Symbol::from(HASH_2TO1), + Symbol::from(MERGE), FunctionType::new( CallConv::Wasm, [I32, I32, I32, I32, I32, I32, I32, I32, I32, I32, I32, I32, I32, I32, I32, I32], diff --git a/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/mod.rs b/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/mod.rs index d37382e82..6d280fde0 100644 --- a/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/mod.rs +++ b/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/mod.rs @@ -1,3 +1,3 @@ pub mod blake3; -pub mod rpo; +pub mod rpo256; pub mod sha256; diff --git a/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/rpo.rs b/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/rpo256.rs similarity index 60% rename from frontend/wasm/src/miden_abi/stdlib/crypto/hashes/rpo.rs rename to frontend/wasm/src/miden_abi/stdlib/crypto/hashes/rpo256.rs index 8701fdcfe..6815ea635 100644 --- a/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/rpo.rs +++ b/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/rpo256.rs @@ -6,31 +6,30 @@ use midenc_hir::{ use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; -pub const MODULE_ID: &str = "std::crypto::hashes::rpo"; - -pub const HASH_MEMORY: &str = "hash_memory"; -pub const HASH_MEMORY_WORDS: &str = "hash_memory_words"; +pub const HASH_ELEMENTS: &str = "hash_elements"; +pub const HASH_WORDS: &str = "hash_words"; pub(crate) fn signatures() -> ModuleFunctionTypeMap { let mut m: ModuleFunctionTypeMap = Default::default(); let mut rpo: FunctionTypeMap = Default::default(); - // hash_memory takes (ptr: u32, num_elements: u32) and returns 4 Felt values on the stack + // hash_elements takes (ptr: u32, num_elements: u32) and returns 4 Felt values on the stack rpo.insert( - Symbol::from(HASH_MEMORY), + Symbol::from(HASH_ELEMENTS), FunctionType::new(CallConv::Wasm, [I32, I32], [Felt, Felt, Felt, Felt]), ); - // hash_memory_words takes (start_addr: u32, end_addr: u32) and returns 4 Felt values on the stack + // hash_words takes (start_addr: u32, end_addr: u32) and returns 4 Felt values on the stack rpo.insert( - Symbol::from(HASH_MEMORY_WORDS), + Symbol::from(HASH_WORDS), FunctionType::new(CallConv::Wasm, [I32, I32], [Felt, Felt, Felt, Felt]), ); let module_path = SymbolPath::from_iter([ SymbolNameComponent::Root, - SymbolNameComponent::Component(symbols::Std), + SymbolNameComponent::Component(symbols::Miden), + SymbolNameComponent::Component(symbols::Core), SymbolNameComponent::Component(symbols::Crypto), SymbolNameComponent::Component(symbols::Hashes), - SymbolNameComponent::Component(Symbol::intern("rpo")), + SymbolNameComponent::Component(symbols::Rpo256), ]); m.insert(module_path, rpo); m diff --git a/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/sha256.rs b/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/sha256.rs index 77534c255..b998a5c63 100644 --- a/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/sha256.rs +++ b/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/sha256.rs @@ -6,16 +6,14 @@ use midenc_hir::{ use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; -pub const MODULE_ID: &str = "std::crypto::hashes::sha256"; - -pub const HASH_1TO1: &str = "hash_1to1"; -pub const HASH_2TO1: &str = "hash_2to1"; +pub const HASH: &str = "hash"; +pub const MERGE: &str = "merge"; pub(crate) fn signatures() -> ModuleFunctionTypeMap { let mut m: ModuleFunctionTypeMap = Default::default(); let mut sha256: FunctionTypeMap = Default::default(); sha256.insert( - Symbol::from(HASH_1TO1), + Symbol::from(HASH), FunctionType::new( CallConv::Wasm, [I32, I32, I32, I32, I32, I32, I32, I32], @@ -23,7 +21,7 @@ pub(crate) fn signatures() -> ModuleFunctionTypeMap { ), ); sha256.insert( - Symbol::from(HASH_2TO1), + Symbol::from(MERGE), FunctionType::new( CallConv::Wasm, [I32, I32, I32, I32, I32, I32, I32, I32, I32, I32, I32, I32, I32, I32, I32, I32], @@ -33,10 +31,11 @@ pub(crate) fn signatures() -> ModuleFunctionTypeMap { let module_path = SymbolPath::from_iter([ SymbolNameComponent::Root, - SymbolNameComponent::Component(symbols::Std), + SymbolNameComponent::Component(symbols::Miden), + SymbolNameComponent::Component(symbols::Core), SymbolNameComponent::Component(symbols::Crypto), SymbolNameComponent::Component(symbols::Hashes), - SymbolNameComponent::Component(Symbol::intern("sha256")), + SymbolNameComponent::Component(symbols::Sha256), ]); m.insert(module_path, sha256); m diff --git a/frontend/wasm/src/miden_abi/stdlib/mem.rs b/frontend/wasm/src/miden_abi/stdlib/mem.rs index 05630983d..37c0e9d4e 100644 --- a/frontend/wasm/src/miden_abi/stdlib/mem.rs +++ b/frontend/wasm/src/miden_abi/stdlib/mem.rs @@ -6,10 +6,10 @@ use midenc_hir::{ use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; -pub(crate) const MODULE_ID: &str = "std::mem"; pub(crate) const MODULE_PREFIX: &[SymbolNameComponent] = &[ SymbolNameComponent::Root, - SymbolNameComponent::Component(symbols::Std), + SymbolNameComponent::Component(symbols::Miden), + SymbolNameComponent::Component(symbols::Core), SymbolNameComponent::Component(symbols::Mem), ]; diff --git a/frontend/wasm/src/miden_abi/transform.rs b/frontend/wasm/src/miden_abi/transform.rs index 4f3f83cca..9413564d6 100644 --- a/frontend/wasm/src/miden_abi/transform.rs +++ b/frontend/wasm/src/miden_abi/transform.rs @@ -24,196 +24,210 @@ fn get_transform_strategy(path: &SymbolPath) -> Option { components.next_if_eq(&SymbolNameComponent::Root); match components.next()?.as_symbol_name() { - symbols::Std => match components.next()?.as_symbol_name() { - symbols::Mem => match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { - stdlib::mem::PIPE_WORDS_TO_MEMORY | stdlib::mem::PIPE_DOUBLE_WORDS_TO_MEMORY => { - Some(TransformStrategy::ReturnViaPointer) + symbols::Miden => match components.next()?.as_symbol_name() { + symbols::Core => match components.next()?.as_symbol_name() { + symbols::Mem => { + match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { + stdlib::mem::PIPE_WORDS_TO_MEMORY + | stdlib::mem::PIPE_DOUBLE_WORDS_TO_MEMORY => { + Some(TransformStrategy::ReturnViaPointer) + } + stdlib::mem::PIPE_PREIMAGE_TO_MEMORY => { + Some(TransformStrategy::NoTransform) + } + _ => None, + } } - stdlib::mem::PIPE_PREIMAGE_TO_MEMORY => Some(TransformStrategy::NoTransform), - _ => None, - }, - symbols::Crypto => match components.next()?.as_symbol_name() { - symbols::Hashes => match components.next()?.as_symbol_name() { - symbols::Blake3 => { - match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { - stdlib::crypto::hashes::blake3::HASH_1TO1 - | stdlib::crypto::hashes::blake3::HASH_2TO1 => { - Some(TransformStrategy::ReturnViaPointer) + symbols::Crypto => match components.next()?.as_symbol_name() { + symbols::Hashes => match components.next()?.as_symbol_name() { + symbols::Blake3 => { + match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { + stdlib::crypto::hashes::blake3::HASH + | stdlib::crypto::hashes::blake3::MERGE => { + Some(TransformStrategy::ReturnViaPointer) + } + _ => None, } - _ => None, } - } - symbols::Sha256 => { - match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { - stdlib::crypto::hashes::sha256::HASH_1TO1 - | stdlib::crypto::hashes::sha256::HASH_2TO1 => { - Some(TransformStrategy::ReturnViaPointer) + symbols::Sha256 => { + match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { + stdlib::crypto::hashes::sha256::HASH + | stdlib::crypto::hashes::sha256::MERGE => { + Some(TransformStrategy::ReturnViaPointer) + } + _ => None, } - _ => None, } - } - symbols::Rpo => { - match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { - stdlib::crypto::hashes::rpo::HASH_MEMORY - | stdlib::crypto::hashes::rpo::HASH_MEMORY_WORDS => { - Some(TransformStrategy::ReturnViaPointer) + symbols::Rpo256 => { + match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { + stdlib::crypto::hashes::rpo256::HASH_ELEMENTS + | stdlib::crypto::hashes::rpo256::HASH_WORDS => { + Some(TransformStrategy::ReturnViaPointer) + } + _ => None, } - _ => None, } - } + _ => None, + }, + symbols::Dsa => match components.next()?.as_symbol_name() { + symbols::Falcon512Rpo => { + match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { + stdlib::crypto::dsa::rpo_falcon512::RPO_FALCON512_VERIFY => { + Some(TransformStrategy::NoTransform) + } + _ => None, + } + } + _ => None, + }, _ => None, }, - symbols::Dsa => match components.next()?.as_symbol_name() { - symbols::RpoFalcon512 => { - match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { - stdlib::crypto::dsa::rpo_falcon512::RPO_FALCON512_VERIFY => { - Some(TransformStrategy::NoTransform) + symbols::Collections => { + let submodule = components.next()?.as_symbol_name(); + if submodule == symbols::Smt { + return match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() + { + stdlib::collections::smt::GET | stdlib::collections::smt::SET => { + Some(TransformStrategy::ReturnViaPointer) } _ => None, - } + }; } - _ => None, - }, + None + } _ => None, }, - symbols::Collections => { - let submodule = components.next()?.as_symbol_name(); - if submodule == symbols::Smt { - return match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { - stdlib::collections::smt::GET | stdlib::collections::smt::SET => { + symbols::Protocol => match components.next()?.as_symbol_name() { + symbols::NativeAccount => { + match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { + tx_kernel::native_account::ADD_ASSET + | tx_kernel::native_account::REMOVE_ASSET + | tx_kernel::native_account::COMPUTE_DELTA_COMMITMENT + | tx_kernel::native_account::SET_STORAGE_ITEM + | tx_kernel::native_account::SET_STORAGE_MAP_ITEM => { Some(TransformStrategy::ReturnViaPointer) } + tx_kernel::native_account::INCR_NONCE + | tx_kernel::native_account::WAS_PROCEDURE_CALLED => { + Some(TransformStrategy::NoTransform) + } _ => None, - }; - } - None - } - _ => None, - }, - symbols::Miden => match components.next()?.as_symbol_name() { - symbols::NativeAccount => { - match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { - tx_kernel::native_account::ADD_ASSET - | tx_kernel::native_account::REMOVE_ASSET - | tx_kernel::native_account::COMPUTE_DELTA_COMMITMENT - | tx_kernel::native_account::SET_STORAGE_ITEM - | tx_kernel::native_account::SET_STORAGE_MAP_ITEM => { - Some(TransformStrategy::ReturnViaPointer) } - tx_kernel::native_account::INCR_NONCE - | tx_kernel::native_account::WAS_PROCEDURE_CALLED => { - Some(TransformStrategy::NoTransform) - } - _ => None, } - } - symbols::ActiveAccount => { - match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { - tx_kernel::active_account::GET_NONCE - | tx_kernel::active_account::GET_BALANCE - | tx_kernel::active_account::GET_INITIAL_BALANCE - | tx_kernel::active_account::GET_NUM_PROCEDURES - | tx_kernel::active_account::HAS_NON_FUNGIBLE_ASSET - | tx_kernel::active_account::HAS_PROCEDURE => { - Some(TransformStrategy::NoTransform) - } - tx_kernel::active_account::GET_ID - | tx_kernel::active_account::GET_INITIAL_COMMITMENT - | tx_kernel::active_account::GET_CODE_COMMITMENT - | tx_kernel::active_account::COMPUTE_COMMITMENT - | tx_kernel::active_account::GET_INITIAL_STORAGE_COMMITMENT - | tx_kernel::active_account::COMPUTE_STORAGE_COMMITMENT - | tx_kernel::active_account::GET_STORAGE_ITEM - | tx_kernel::active_account::GET_INITIAL_STORAGE_ITEM - | tx_kernel::active_account::GET_STORAGE_MAP_ITEM - | tx_kernel::active_account::GET_INITIAL_STORAGE_MAP_ITEM - | tx_kernel::active_account::GET_INITIAL_VAULT_ROOT - | tx_kernel::active_account::GET_VAULT_ROOT - | tx_kernel::active_account::GET_PROCEDURE_ROOT => { - Some(TransformStrategy::ReturnViaPointer) + symbols::ActiveAccount => { + match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { + tx_kernel::active_account::GET_NONCE + | tx_kernel::active_account::GET_BALANCE + | tx_kernel::active_account::GET_INITIAL_BALANCE + | tx_kernel::active_account::GET_NUM_PROCEDURES + | tx_kernel::active_account::HAS_NON_FUNGIBLE_ASSET + | tx_kernel::active_account::HAS_PROCEDURE => { + Some(TransformStrategy::NoTransform) + } + tx_kernel::active_account::GET_ID + | tx_kernel::active_account::GET_INITIAL_COMMITMENT + | tx_kernel::active_account::GET_CODE_COMMITMENT + | tx_kernel::active_account::COMPUTE_COMMITMENT + | tx_kernel::active_account::GET_INITIAL_STORAGE_COMMITMENT + | tx_kernel::active_account::COMPUTE_STORAGE_COMMITMENT + | tx_kernel::active_account::GET_STORAGE_ITEM + | tx_kernel::active_account::GET_INITIAL_STORAGE_ITEM + | tx_kernel::active_account::GET_STORAGE_MAP_ITEM + | tx_kernel::active_account::GET_INITIAL_STORAGE_MAP_ITEM + | tx_kernel::active_account::GET_INITIAL_VAULT_ROOT + | tx_kernel::active_account::GET_VAULT_ROOT + | tx_kernel::active_account::GET_PROCEDURE_ROOT => { + Some(TransformStrategy::ReturnViaPointer) + } + _ => None, } - _ => None, } - } - symbols::Asset => { - match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { - tx_kernel::asset::BUILD_FUNGIBLE_ASSET - | tx_kernel::asset::BUILD_NON_FUNGIBLE_ASSET => { - Some(TransformStrategy::ReturnViaPointer) + symbols::Asset => { + match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { + tx_kernel::asset::BUILD_FUNGIBLE_ASSET + | tx_kernel::asset::BUILD_NON_FUNGIBLE_ASSET => { + Some(TransformStrategy::ReturnViaPointer) + } + _ => None, } - _ => None, } - } - symbols::Faucet => { - match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { - tx_kernel::faucet::CREATE_FUNGIBLE_ASSET - | tx_kernel::faucet::CREATE_NON_FUNGIBLE_ASSET - | tx_kernel::faucet::MINT - | tx_kernel::faucet::BURN => Some(TransformStrategy::ReturnViaPointer), - tx_kernel::faucet::GET_TOTAL_ISSUANCE - | tx_kernel::faucet::IS_NON_FUNGIBLE_ASSET_ISSUED => { - Some(TransformStrategy::NoTransform) + symbols::Faucet => { + match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { + tx_kernel::faucet::CREATE_FUNGIBLE_ASSET + | tx_kernel::faucet::CREATE_NON_FUNGIBLE_ASSET + | tx_kernel::faucet::MINT + | tx_kernel::faucet::BURN => Some(TransformStrategy::ReturnViaPointer), + tx_kernel::faucet::GET_TOTAL_ISSUANCE + | tx_kernel::faucet::IS_NON_FUNGIBLE_ASSET_ISSUED => { + Some(TransformStrategy::NoTransform) + } + _ => None, } - _ => None, } - } - symbols::ActiveNote => { - match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { - tx_kernel::active_note::GET_INPUTS => Some(TransformStrategy::ListReturn), - tx_kernel::active_note::GET_ASSETS => Some(TransformStrategy::ListReturn), - tx_kernel::active_note::GET_SENDER - | tx_kernel::active_note::GET_RECIPIENT - | tx_kernel::active_note::GET_SCRIPT_ROOT - | tx_kernel::active_note::GET_SERIAL_NUMBER - | tx_kernel::active_note::GET_METADATA => { - Some(TransformStrategy::ReturnViaPointer) + symbols::ActiveNote => { + match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { + tx_kernel::active_note::GET_INPUTS => Some(TransformStrategy::ListReturn), + tx_kernel::active_note::GET_ASSETS => Some(TransformStrategy::ListReturn), + tx_kernel::active_note::GET_SENDER + | tx_kernel::active_note::GET_RECIPIENT + | tx_kernel::active_note::GET_SCRIPT_ROOT + | tx_kernel::active_note::GET_SERIAL_NUMBER + | tx_kernel::active_note::GET_METADATA => { + Some(TransformStrategy::ReturnViaPointer) + } + _ => None, } - tx_kernel::active_note::ADD_ASSETS_TO_ACCOUNT => { - Some(TransformStrategy::NoTransform) + } + symbols::InputNote => { + match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { + tx_kernel::input_note::GET_ASSETS => Some(TransformStrategy::ListReturn), + tx_kernel::input_note::GET_ASSETS_INFO + | tx_kernel::input_note::GET_RECIPIENT + | tx_kernel::input_note::GET_METADATA + | tx_kernel::input_note::GET_SENDER + | tx_kernel::input_note::GET_INPUTS_INFO + | tx_kernel::input_note::GET_SCRIPT_ROOT + | tx_kernel::input_note::GET_SERIAL_NUMBER => { + Some(TransformStrategy::ReturnViaPointer) + } + _ => None, } - _ => None, } - } - symbols::InputNote => { - match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { - tx_kernel::input_note::GET_ASSETS => Some(TransformStrategy::ListReturn), - tx_kernel::input_note::GET_ASSETS_INFO - | tx_kernel::input_note::GET_RECIPIENT - | tx_kernel::input_note::GET_METADATA - | tx_kernel::input_note::GET_SENDER - | tx_kernel::input_note::GET_INPUTS_INFO - | tx_kernel::input_note::GET_SCRIPT_ROOT - | tx_kernel::input_note::GET_SERIAL_NUMBER => { - Some(TransformStrategy::ReturnViaPointer) + symbols::OutputNote => { + match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { + tx_kernel::output_note::CREATE => Some(TransformStrategy::NoTransform), + tx_kernel::output_note::ADD_ASSET => Some(TransformStrategy::NoTransform), + tx_kernel::output_note::SET_ATTACHMENT + | tx_kernel::output_note::SET_WORD_ATTACHMENT + | tx_kernel::output_note::SET_ARRAY_ATTACHMENT => { + Some(TransformStrategy::NoTransform) + } + tx_kernel::output_note::GET_ASSETS => Some(TransformStrategy::ListReturn), + tx_kernel::output_note::GET_ASSETS_INFO + | tx_kernel::output_note::GET_RECIPIENT + | tx_kernel::output_note::GET_METADATA => { + Some(TransformStrategy::ReturnViaPointer) + } + _ => None, } - _ => None, } - } - symbols::OutputNote => { - match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { - tx_kernel::output_note::CREATE => Some(TransformStrategy::NoTransform), - tx_kernel::output_note::ADD_ASSET => Some(TransformStrategy::NoTransform), - tx_kernel::output_note::GET_ASSETS => Some(TransformStrategy::ListReturn), - tx_kernel::output_note::GET_ASSETS_INFO - | tx_kernel::output_note::GET_RECIPIENT - | tx_kernel::output_note::GET_METADATA => { + symbols::Tx => match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() + { + tx_kernel::tx::GET_BLOCK_NUMBER + | tx_kernel::tx::GET_BLOCK_TIMESTAMP + | tx_kernel::tx::GET_NUM_INPUT_NOTES + | tx_kernel::tx::GET_NUM_OUTPUT_NOTES + | tx_kernel::tx::GET_EXPIRATION_BLOCK_DELTA + | tx_kernel::tx::UPDATE_EXPIRATION_BLOCK_DELTA => { + Some(TransformStrategy::NoTransform) + } + tx_kernel::tx::GET_INPUT_NOTES_COMMITMENT + | tx_kernel::tx::GET_OUTPUT_NOTES_COMMITMENT + | tx_kernel::tx::GET_BLOCK_COMMITMENT => { Some(TransformStrategy::ReturnViaPointer) } _ => None, - } - } - symbols::Tx => match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { - tx_kernel::tx::GET_BLOCK_NUMBER - | tx_kernel::tx::GET_BLOCK_TIMESTAMP - | tx_kernel::tx::GET_NUM_INPUT_NOTES - | tx_kernel::tx::GET_NUM_OUTPUT_NOTES - | tx_kernel::tx::GET_EXPIRATION_BLOCK_DELTA - | tx_kernel::tx::UPDATE_EXPIRATION_BLOCK_DELTA => { - Some(TransformStrategy::NoTransform) - } - tx_kernel::tx::GET_INPUT_NOTES_COMMITMENT - | tx_kernel::tx::GET_OUTPUT_NOTES_COMMITMENT - | tx_kernel::tx::GET_BLOCK_COMMITMENT => Some(TransformStrategy::ReturnViaPointer), + }, _ => None, }, _ => None, diff --git a/frontend/wasm/src/miden_abi/tx_kernel/active_account.rs b/frontend/wasm/src/miden_abi/tx_kernel/active_account.rs index fa2dcf01a..52e59b06a 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel/active_account.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel/active_account.rs @@ -9,6 +9,7 @@ use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; pub(crate) const MODULE_PREFIX: &[SymbolNameComponent] = &[ SymbolNameComponent::Root, SymbolNameComponent::Component(symbols::Miden), + SymbolNameComponent::Component(symbols::Protocol), SymbolNameComponent::Component(symbols::ActiveAccount), ]; @@ -61,19 +62,27 @@ pub(crate) fn signatures() -> ModuleFunctionTypeMap { ); active_account.insert( Symbol::from(GET_STORAGE_ITEM), - FunctionType::new(CallConv::Wasm, [Felt], [Felt, Felt, Felt, Felt]), + FunctionType::new(CallConv::Wasm, [Felt, Felt], [Felt, Felt, Felt, Felt]), ); active_account.insert( Symbol::from(GET_INITIAL_STORAGE_ITEM), - FunctionType::new(CallConv::Wasm, [Felt], [Felt, Felt, Felt, Felt]), + FunctionType::new(CallConv::Wasm, [Felt, Felt], [Felt, Felt, Felt, Felt]), ); active_account.insert( Symbol::from(GET_STORAGE_MAP_ITEM), - FunctionType::new(CallConv::Wasm, [Felt, Felt, Felt, Felt, Felt], [Felt, Felt, Felt, Felt]), + FunctionType::new( + CallConv::Wasm, + [Felt, Felt, Felt, Felt, Felt, Felt], + [Felt, Felt, Felt, Felt], + ), ); active_account.insert( Symbol::from(GET_INITIAL_STORAGE_MAP_ITEM), - FunctionType::new(CallConv::Wasm, [Felt, Felt, Felt, Felt, Felt], [Felt, Felt, Felt, Felt]), + FunctionType::new( + CallConv::Wasm, + [Felt, Felt, Felt, Felt, Felt, Felt], + [Felt, Felt, Felt, Felt], + ), ); active_account.insert( Symbol::from(GET_BALANCE), diff --git a/frontend/wasm/src/miden_abi/tx_kernel/active_note.rs b/frontend/wasm/src/miden_abi/tx_kernel/active_note.rs index 800b20957..93188fc46 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel/active_note.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel/active_note.rs @@ -6,10 +6,10 @@ use midenc_hir::{ use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; -pub const MODULE_ID: &str = "miden::active_note"; pub(crate) const MODULE_PREFIX: &[SymbolNameComponent] = &[ SymbolNameComponent::Root, SymbolNameComponent::Component(symbols::Miden), + SymbolNameComponent::Component(symbols::Protocol), SymbolNameComponent::Component(symbols::ActiveNote), ]; @@ -20,7 +20,6 @@ pub const GET_RECIPIENT: &str = "get_recipient"; pub const GET_SCRIPT_ROOT: &str = "get_script_root"; pub const GET_SERIAL_NUMBER: &str = "get_serial_number"; pub const GET_METADATA: &str = "get_metadata"; -pub const ADD_ASSETS_TO_ACCOUNT: &str = "add_assets_to_account"; pub(crate) fn signatures() -> ModuleFunctionTypeMap { let mut m: ModuleFunctionTypeMap = Default::default(); @@ -42,9 +41,15 @@ pub(crate) fn signatures() -> ModuleFunctionTypeMap { ); note.insert( Symbol::from(GET_METADATA), - FunctionType::new(CallConv::Wasm, [], [Felt, Felt, Felt, Felt]), + FunctionType::new( + CallConv::Wasm, + [], + [ + Felt, Felt, Felt, Felt, // NOTE_ATTACHMENT + Felt, Felt, Felt, Felt, // METADATA_HEADER + ], + ), ); - note.insert(Symbol::from(ADD_ASSETS_TO_ACCOUNT), FunctionType::new(CallConv::Wasm, [], [])); m.insert(SymbolPath::from_iter(MODULE_PREFIX.iter().copied()), note); m } diff --git a/frontend/wasm/src/miden_abi/tx_kernel/asset.rs b/frontend/wasm/src/miden_abi/tx_kernel/asset.rs index b541098af..bb4180cf2 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel/asset.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel/asset.rs @@ -6,13 +6,11 @@ use midenc_hir::{ use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; -pub const MODULE_ID: &str = "miden::asset"; - fn module_path() -> SymbolPath { let parts = [ SymbolNameComponent::Root, SymbolNameComponent::Component(symbols::Miden), - SymbolNameComponent::Component(Symbol::intern("asset")), + SymbolNameComponent::Component(symbols::Asset), ]; SymbolPath::from_iter(parts) } diff --git a/frontend/wasm/src/miden_abi/tx_kernel/faucet.rs b/frontend/wasm/src/miden_abi/tx_kernel/faucet.rs index 3e1f31e35..80fe3c52c 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel/faucet.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel/faucet.rs @@ -6,13 +6,11 @@ use midenc_hir::{ use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; -pub const MODULE_ID: &str = "miden::faucet"; - fn module_path() -> SymbolPath { let parts = [ SymbolNameComponent::Root, SymbolNameComponent::Component(symbols::Miden), - SymbolNameComponent::Component(Symbol::intern("faucet")), + SymbolNameComponent::Component(symbols::Faucet), ]; SymbolPath::from_iter(parts) } diff --git a/frontend/wasm/src/miden_abi/tx_kernel/input_note.rs b/frontend/wasm/src/miden_abi/tx_kernel/input_note.rs index 9ca66b5dd..7df318e81 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel/input_note.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel/input_note.rs @@ -6,13 +6,11 @@ use midenc_hir::{ use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; -pub const MODULE_ID: &str = "miden::input_note"; - fn module_path() -> SymbolPath { let parts = [ SymbolNameComponent::Root, SymbolNameComponent::Component(symbols::Miden), - SymbolNameComponent::Component(Symbol::intern("input_note")), + SymbolNameComponent::Component(symbols::InputNote), ]; SymbolPath::from_iter(parts) } @@ -43,7 +41,14 @@ pub(crate) fn signatures() -> ModuleFunctionTypeMap { ); funcs.insert( Symbol::from(GET_METADATA), - FunctionType::new(CallConv::Wasm, [Felt], [Felt, Felt, Felt, Felt]), + FunctionType::new( + CallConv::Wasm, + [Felt], + [ + Felt, Felt, Felt, Felt, // NOTE_ATTACHMENT + Felt, Felt, Felt, Felt, // METADATA_HEADER + ], + ), ); funcs.insert( Symbol::from(GET_SENDER), diff --git a/frontend/wasm/src/miden_abi/tx_kernel/native_account.rs b/frontend/wasm/src/miden_abi/tx_kernel/native_account.rs index 91f0f070d..4982586fc 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel/native_account.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel/native_account.rs @@ -9,6 +9,7 @@ use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; pub(crate) const MODULE_PREFIX: &[SymbolNameComponent] = &[ SymbolNameComponent::Root, SymbolNameComponent::Component(symbols::Miden), + SymbolNameComponent::Component(symbols::Protocol), SymbolNameComponent::Component(symbols::NativeAccount), ]; @@ -40,16 +41,23 @@ pub(crate) fn signatures() -> ModuleFunctionTypeMap { Symbol::from(SET_STORAGE_ITEM), FunctionType::new( CallConv::Wasm, - [Felt, Felt, Felt, Felt, Felt], - [Felt, Felt, Felt, Felt, Felt, Felt, Felt, Felt], + [ + Felt, Felt, // slot_id_prefix, slot_id_suffix + Felt, Felt, Felt, Felt, // value components + ], + [Felt, Felt, Felt, Felt], // old value ), ); native_account.insert( Symbol::from(SET_STORAGE_MAP_ITEM), FunctionType::new( CallConv::Wasm, - [Felt, Felt, Felt, Felt, Felt, Felt, Felt, Felt, Felt], - [Felt, Felt, Felt, Felt, Felt, Felt, Felt, Felt], + [ + Felt, Felt, // slot_id_prefix, slot_id_suffix + Felt, Felt, Felt, Felt, // key components + Felt, Felt, Felt, Felt, // value components + ], + [Felt, Felt, Felt, Felt], // old value ), ); native_account.insert(Symbol::from(INCR_NONCE), FunctionType::new(CallConv::Wasm, [], [Felt])); diff --git a/frontend/wasm/src/miden_abi/tx_kernel/output_note.rs b/frontend/wasm/src/miden_abi/tx_kernel/output_note.rs index fb1dbee48..16a4053c5 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel/output_note.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel/output_note.rs @@ -6,15 +6,18 @@ use midenc_hir::{ use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; -pub const MODULE_ID: &str = "miden::output_note"; pub(crate) const MODULE_PREFIX: &[SymbolNameComponent] = &[ SymbolNameComponent::Root, SymbolNameComponent::Component(symbols::Miden), + SymbolNameComponent::Component(symbols::Protocol), SymbolNameComponent::Component(symbols::OutputNote), ]; pub const CREATE: &str = "create"; pub const ADD_ASSET: &str = "add_asset"; +pub const SET_ATTACHMENT: &str = "set_attachment"; +pub const SET_WORD_ATTACHMENT: &str = "set_word_attachment"; +pub const SET_ARRAY_ATTACHMENT: &str = "set_array_attachment"; pub const GET_ASSETS_INFO: &str = "get_assets_info"; pub const GET_ASSETS: &str = "get_assets"; pub const GET_RECIPIENT: &str = "get_recipient"; @@ -29,9 +32,7 @@ pub(crate) fn signatures() -> ModuleFunctionTypeMap { CallConv::Wasm, [ Felt, // tag - Felt, // aux Felt, // note_type - Felt, // execution hint Felt, Felt, Felt, Felt, // recipient components ], [Felt], @@ -48,6 +49,43 @@ pub(crate) fn signatures() -> ModuleFunctionTypeMap { [], ), ); + output_note.insert( + Symbol::from(SET_ATTACHMENT), + FunctionType::new( + CallConv::Wasm, + [ + Felt, // note_idx + Felt, // attachment_scheme + Felt, // attachment_kind + Felt, Felt, Felt, Felt, // attachment word + ], + [], + ), + ); + output_note.insert( + Symbol::from(SET_WORD_ATTACHMENT), + FunctionType::new( + CallConv::Wasm, + [ + Felt, // note_idx + Felt, // attachment_scheme + Felt, Felt, Felt, Felt, // attachment word + ], + [], + ), + ); + output_note.insert( + Symbol::from(SET_ARRAY_ATTACHMENT), + FunctionType::new( + CallConv::Wasm, + [ + Felt, // note_idx + Felt, // attachment_scheme + Felt, Felt, Felt, Felt, // attachment commitment + ], + [], + ), + ); output_note.insert( Symbol::from(GET_ASSETS_INFO), FunctionType::new(CallConv::Wasm, [Felt], [Felt, Felt, Felt, Felt, Felt]), @@ -62,7 +100,14 @@ pub(crate) fn signatures() -> ModuleFunctionTypeMap { ); output_note.insert( Symbol::from(GET_METADATA), - FunctionType::new(CallConv::Wasm, [Felt], [Felt, Felt, Felt, Felt]), + FunctionType::new( + CallConv::Wasm, + [Felt], + [ + Felt, Felt, Felt, Felt, // NOTE_ATTACHMENT + Felt, Felt, Felt, Felt, // METADATA_HEADER + ], + ), ); m.insert(SymbolPath::from_iter(MODULE_PREFIX.iter().copied()), output_note); m diff --git a/frontend/wasm/src/miden_abi/tx_kernel/tx.rs b/frontend/wasm/src/miden_abi/tx_kernel/tx.rs index f89275378..dec9b8c56 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel/tx.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel/tx.rs @@ -6,10 +6,10 @@ use midenc_hir::{ use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; -pub const MODULE_ID: &str = "miden::tx"; pub(crate) const MODULE_PREFIX: &[SymbolNameComponent] = &[ SymbolNameComponent::Root, SymbolNameComponent::Component(symbols::Miden), + SymbolNameComponent::Component(symbols::Protocol), SymbolNameComponent::Component(symbols::Tx), ]; diff --git a/frontend/wasm/src/module/build_ir.rs b/frontend/wasm/src/module/build_ir.rs index eb67234bb..0fb225f69 100644 --- a/frontend/wasm/src/module/build_ir.rs +++ b/frontend/wasm/src/module/build_ir.rs @@ -1,8 +1,9 @@ -use core::mem; +use core::{mem, str::FromStr}; use std::rc::Rc; use midenc_hir::{ - Builder, BuilderExt, Context, FxHashMap, Ident, Op, OpBuilder, Visibility, + Builder, BuilderExt, Context, FunctionIdent, FxHashMap, Ident, Op, OpBuilder, SymbolPath, + Visibility, constants::ConstantData, dialects::builtin::{ self, BuiltinOpBuilder, ComponentBuilder, ModuleBuilder, World, WorldBuilder, @@ -19,9 +20,11 @@ use super::{ use crate::{ WasmTranslationConfig, error::WasmResult, + intrinsics::Intrinsic, module::{ + DefinedFuncIndex, func_translator::FuncTranslator, - linker_stubs::maybe_lower_linker_stub, + linker_stubs::{is_unreachable_stub, maybe_lower_linker_stub}, module_env::{FunctionBodyData, ModuleEnvironment, ParsedModule}, types::ir_type, }, @@ -115,11 +118,63 @@ pub fn build_ir_module( }) .into_diagnostic()?; let mut func_translator = FuncTranslator::new(context.clone()); - // Although this renders this parsed module invalid(without functiong + // Although this renders this parsed module invalid(without function // bodies), we don't support multiple module instances. Thus, this // ParseModule will not be used again to make another module instance. let func_body_inputs = mem::take(&mut parsed_module.function_body_inputs); + + // Two-pass approach for linker stub inlining: + // Pass 1: Detect and register intrinsic linker stubs that can be inlined as operations. + // This ensures that when we translate function bodies in pass 2, + // all inline-able stubs are known and calls to them will be inlined regardless + // of function ordering in the WASM file. + let mut inlined_stub_indices: Vec = Vec::new(); + for (defined_func_idx, body_data) in &func_body_inputs { + if !is_unreachable_stub(&body_data.body) { + continue; + } + + let func_index = parsed_module.module.func_index(defined_func_idx); + let func_name = parsed_module.module.func_name(func_index).as_str(); + + // Try to parse the function name as a MASM function ident to get the symbol path + let Ok(func_ident) = FunctionIdent::from_str(func_name) else { + continue; + }; + let import_path: SymbolPath = SymbolPath::from_masm_function_id(func_ident); + + // Try to recognize as an intrinsic + let Ok(intrinsic) = Intrinsic::try_from(&import_path) else { + continue; + }; + + // Check if this intrinsic can be inlined as an operation + let Some(conv) = intrinsic.conversion_result() else { + continue; + }; + + if !conv.is_operation() { + continue; + } + + // Register the stub so calls to it will be inlined as operations + if let Some(mut function_ref) = module_state.register_linker_stub(func_index, intrinsic)? { + // Erase the stub function from the module since it will be inlined at call sites + function_ref.borrow_mut().as_operation_mut().erase(); + inlined_stub_indices.push(defined_func_idx); + } + } + + // Pass 2: Translate function bodies. + // - Inline-able stubs were registered in pass 1 and are skipped here. + // - Function-type stubs get their bodies synthesized. + // - Regular functions are translated normally. for (defined_func_idx, body_data) in func_body_inputs { + // Skip stubs that were inlined in pass 1 + if inlined_stub_indices.contains(&defined_func_idx) { + continue; + } + let func_index = parsed_module.module.func_index(defined_func_idx); let func_name = parsed_module.module.func_name(func_index).as_str(); @@ -127,9 +182,9 @@ pub fn build_ir_module( module_state.module_builder.get_function(func_name).unwrap_or_else(|| { panic!("cannot build {func_name} function, since it is not defined in the module.") }); - // If this is a linker stub, synthesize its body to exec the MASM callee. - // Note: Intrinsics and Miden ABI (SDK/stdlib) calls are expected to be - // surfaced via such linker stubs rather than as core-wasm imports. + + // If this is a linker stub that needs a synthesized body (function-type intrinsics + // or Miden ABI calls), handle it here. if maybe_lower_linker_stub(function_ref, &body_data.body, module_state)? { continue; } diff --git a/frontend/wasm/src/module/func_translator.rs b/frontend/wasm/src/module/func_translator.rs index 4dbb32b98..f0ecd58e3 100644 --- a/frontend/wasm/src/module/func_translator.rs +++ b/frontend/wasm/src/module/func_translator.rs @@ -34,7 +34,6 @@ use crate::{ types::{convert_valtype, ir_type}, }, ssa::Variable, - translation_utils::emit_zero, }; /// WebAssembly to Miden IR function translator. @@ -126,16 +125,18 @@ fn declare_parameters( builder: &mut FunctionBuilderExt<'_, B>, entry_block: BlockRef, ) -> usize { + use midenc_dialect_hir::HirOpBuilder; let sig_len = builder.signature().params().len(); let mut next_local = 0; for i in 0..sig_len { let abi_param = builder.signature().params()[i].clone(); - let local = Variable::new(next_local); - builder.declare_var(local, abi_param.ty); + let var = Variable::new(next_local); + let local = builder.declare_local(var, abi_param.ty); next_local += 1; let param_value = entry_block.borrow().arguments()[i]; - builder.def_var(local, param_value); + builder.def_var(var, param_value); + builder.store_local(local, param_value, SourceSpan::UNKNOWN).unwrap(); } next_local } @@ -174,12 +175,9 @@ fn declare_locals( diagnostics: &DiagnosticsHandler, ) -> WasmResult<()> { let ty = ir_type(convert_valtype(wasm_type), diagnostics)?; - // All locals are initialized to 0. - let init = emit_zero(&ty, builder, diagnostics)?; for _ in 0..count { - let local = Variable::new(*next_local); - builder.declare_var(local, ty.clone()); - builder.def_var(local, init); + let var = Variable::new(*next_local); + let _local = builder.declare_local(var, ty.clone()); *next_local += 1; } Ok(()) @@ -206,7 +204,11 @@ fn parse_function_body( debug_assert_eq!(state.control_stack.len(), 1, "State not initialized"); let func_name = builder.name(); - let mut end_span = SourceSpan::default(); + let mut end_span = SourceSpan::UNKNOWN; + // Track the last valid span to use as a fallback for instructions without DWARF debug info. + // This is particularly useful for `unreachable` instructions that follow panic calls, + // where the unreachable itself has no source location but should inherit the panic call's span. + let mut last_valid_span = SourceSpan::UNKNOWN; while !reader.eof() { let pos = reader.original_position(); let (op, offset) = reader.read_with_offset().into_diagnostic()?; @@ -215,7 +217,7 @@ fn parse_function_body( let offset = (offset as u64) .checked_sub(module.wasm_file.code_section_offset) .expect("offset occurs before start of code section"); - let mut span = SourceSpan::default(); + let mut span = SourceSpan::UNKNOWN; if let Some(loc) = addr2line.find_location(offset).into_diagnostic()? { if let Some(file) = loc.file { let path = std::path::Path::new(file); @@ -267,7 +269,12 @@ fn parse_function_body( session.source_manager.load_file(&absolute_path).into_diagnostic()?; let line = loc.line.and_then(LineNumber::new).unwrap_or_default(); let column = loc.column.and_then(ColumnNumber::new).unwrap_or_default(); - span = source_file.line_column_to_span(line, column).unwrap_or_default(); + span = source_file + .line_column_to_span(line, column) + .unwrap_or(SourceSpan::UNKNOWN); + if !span.is_unknown() { + last_valid_span = span; + } } else { log::debug!(target: "module-parser", "failed to resolve source path '{file}' for instruction at offset \ @@ -287,6 +294,15 @@ fn parse_function_body( end_span = span; } + let effective_span = if span.is_unknown() && !last_valid_span.is_unknown() { + log::debug!(target: "module-parser", + "using last valid span as fallback for {:?} at offset {offset} in function {func_name}", op + ); + last_valid_span + } else { + span + }; + translate_operator( &op, builder, @@ -295,7 +311,7 @@ fn parse_function_body( &module.module, mod_types, &session.diagnostics, - span, + effective_span, )?; } let pos = reader.original_position(); diff --git a/frontend/wasm/src/module/function_builder_ext.rs b/frontend/wasm/src/module/function_builder_ext.rs index 643e66ba8..94bf94376 100644 --- a/frontend/wasm/src/module/function_builder_ext.rs +++ b/frontend/wasm/src/module/function_builder_ext.rs @@ -10,7 +10,7 @@ use midenc_hir::{ BlockRef, Builder, Context, EntityRef, FxHashMap, FxHashSet, Ident, Listener, ListenerType, OpBuilder, OperationRef, ProgramPoint, RegionRef, Signature, SmallVec, SourceSpan, Type, ValueRef, - dialects::builtin::{BuiltinOpBuilder, FunctionBuilder, FunctionRef}, + dialects::builtin::{BuiltinOpBuilder, FunctionBuilder, FunctionRef, LocalVariable}, traits::{BranchOpInterface, Terminator}, }; @@ -21,6 +21,7 @@ pub struct FunctionBuilderContext { ssa: SSABuilder, status: FxHashMap, types: SecondaryMap, + locals: FxHashMap, } impl FunctionBuilderContext { @@ -29,6 +30,7 @@ impl FunctionBuilderContext { ssa: SSABuilder::new(context), status: Default::default(), types: SecondaryMap::with_default(Type::Unknown), + locals: Default::default(), } } @@ -40,6 +42,7 @@ impl FunctionBuilderContext { self.ssa.clear(); self.status.clear(); self.types.clear(); + self.locals.clear(); } /// Returns `true` if and only if no instructions have been added and the block is empty. @@ -285,6 +288,24 @@ impl FunctionBuilderExt<'_, B> { self.func_ctx.borrow().types[var].clone() } + #[inline] + pub fn get_local(&self, var: Variable) -> LocalVariable { + self.func_ctx.borrow().locals[&var] + } + + pub fn declare_local(&mut self, var: Variable, ty: Type) -> LocalVariable { + let mut ctx = self.func_ctx.borrow_mut(); + assert_eq!( + ctx.types[var], + Type::Unknown, + "attempted to declare a local for the same variable {var:?} twice" + ); + let local = self.inner.alloc_local(ty.clone()); + ctx.types[var] = ty; + ctx.locals.insert(var, local); + local + } + /// Declares the type of a variable, so that it can be used later (by calling /// [`FunctionBuilderExt::use_var`]). This function will return an error if the variable /// has been previously declared. diff --git a/frontend/wasm/src/module/module_translation_state.rs b/frontend/wasm/src/module/module_translation_state.rs index 31f6ce9e0..698b62a5e 100644 --- a/frontend/wasm/src/module/module_translation_state.rs +++ b/frontend/wasm/src/module/module_translation_state.rs @@ -1,6 +1,8 @@ use midenc_hir::{ - CallConv, FxHashMap, Signature, SymbolNameComponent, SymbolPath, Visibility, - dialects::builtin::{ModuleBuilder, WorldBuilder}, + AbiParam, CallConv, FunctionType, FxHashMap, Signature, SymbolNameComponent, SymbolPath, + Visibility, + diagnostics::WrapErr, + dialects::builtin::{FunctionRef, ModuleBuilder, WorldBuilder}, interner::Symbol, smallvec, }; @@ -9,7 +11,8 @@ use midenc_session::diagnostics::{DiagnosticsHandler, Severity}; use super::{FuncIndex, Module, instance::ModuleArgument, ir_func_type, types::ModuleTypesBuilder}; use crate::{ callable::CallableFunction, component::lower_imports::generate_import_lowering_function, - error::WasmResult, translation_utils::sig_from_func_type, + error::WasmResult, intrinsics::Intrinsic, miden_abi::miden_abi_function_type, + translation_utils::sig_from_func_type, }; pub struct ModuleTranslationState<'a> { @@ -99,6 +102,82 @@ impl<'a> ModuleTranslationState<'a> { let defined_func = self.functions[&index].clone(); Ok(defined_func) } + + /// Register a linker stub function as an intrinsic so that calls to it will be inlined. + /// + /// This updates the function's entry in the functions map from `CallableFunction::Function` + /// to either `CallableFunction::Instruction` (for inline operations) or + /// `CallableFunction::Intrinsic` (for MASM function calls). + /// + /// Returns the FunctionRef if the stub was registered (so it can be removed from the module), + /// or None if the function wasn't found or isn't a valid intrinsic stub. + pub(crate) fn register_linker_stub( + &mut self, + func_index: FuncIndex, + intrinsic: Intrinsic, + ) -> WasmResult> { + let Some(callable) = self.functions.get(&func_index) else { + return Ok(None); + }; + + let CallableFunction::Function { + function_ref, + signature, + .. + } = callable + else { + return Ok(None); + }; + + let function_ref = *function_ref; + let signature = signature.clone(); + + // Determine if this intrinsic is inlined as an op or needs a function call + let Some(conv) = intrinsic.conversion_result() else { + return Ok(None); + }; + + if conv.is_function() { + // Create import function reference for the intrinsic + let import_path = intrinsic.into_symbol_path(); + let import_ft: FunctionType = intrinsic + .function_type() + .unwrap_or_else(|| miden_abi_function_type(&import_path)); + let import_sig = Signature::new( + import_ft.params.into_iter().map(AbiParam::new), + import_ft.results.into_iter().map(AbiParam::new), + ); + + let import_module_ref = self + .world_builder + .declare_module_tree(&import_path.without_leaf()) + .wrap_err("failed to create module for intrinsic imports")?; + let mut import_module_builder = ModuleBuilder::new(import_module_ref); + let intrinsic_func_ref = import_module_builder + .define_function(import_path.name().into(), import_sig) + .wrap_err("failed to create intrinsic function ref")?; + + self.functions.insert( + func_index, + CallableFunction::Intrinsic { + intrinsic, + function_ref: intrinsic_func_ref, + signature, + }, + ); + } else { + // Inline as an operation + self.functions.insert( + func_index, + CallableFunction::Instruction { + intrinsic, + signature, + }, + ); + } + + Ok(Some(function_ref)) + } } /// Returns [`CallableFunction`] translated from the core Wasm module import diff --git a/hir-analysis/Cargo.toml b/hir-analysis/Cargo.toml index 242667006..6f954ae97 100644 --- a/hir-analysis/Cargo.toml +++ b/hir-analysis/Cargo.toml @@ -21,5 +21,6 @@ midenc-hir.workspace = true midenc-dialect-hir = { path = "../dialects/hir" } midenc-dialect-arith = { path = "../dialects/arith" } midenc-dialect-cf = { path = "../dialects/cf" } +midenc-dialect-scf = { path = "../dialects/scf" } midenc-expect-test = { path = "../tools/expect-test" } -env_logger.workspace = true +midenc-log = { path = "../midenc-log" } diff --git a/hir-analysis/src/analyses/constant_propagation.rs b/hir-analysis/src/analyses/constant_propagation.rs index ebd3ac2e4..952597e8e 100644 --- a/hir-analysis/src/analyses/constant_propagation.rs +++ b/hir-analysis/src/analyses/constant_propagation.rs @@ -154,13 +154,13 @@ impl SparseForwardDataFlowAnalysis for SparseConstantPropagation { results: &mut [AnalysisStateGuardMut<'_, Self::Lattice>], solver: &mut DataFlowSolver, ) -> Result<(), Report> { - log::debug!("visiting operation {op}"); + log::debug!(target: self.debug_name(), "visiting operation {op}"); // Don't try to simulate the results of a region operation as we can't guarantee that // folding will be out-of-place. We don't allow in-place folds as the desire here is for // simulated execution, and not general folding. if op.has_regions() { - log::trace!("op has regions so conservatively setting results to entry state"); + log::trace!(target: self.debug_name(), "op has regions so conservatively setting results to entry state"); sparse::set_all_to_entry_states(self, results); return Ok(()); } @@ -169,6 +169,7 @@ impl SparseForwardDataFlowAnalysis for SparseConstantPropagation { SmallVec::<[Option>; 8]>::with_capacity(op.num_operands()); for (index, operand_lattice) in operands.iter().enumerate() { log::trace!( + target: self.debug_name(), "operand lattice for {} is {}", op.operands()[index].borrow().as_value_ref(), operand_lattice.value() @@ -200,12 +201,14 @@ impl SparseForwardDataFlowAnalysis for SparseConstantPropagation { OpFoldResult::Attribute(value) => { let new_lattice = ConstantValue::new(value, op.dialect()); log::trace!( + target: self.debug_name(), "setting lattice for {} to {new_lattice} from {}", lattice.anchor(), lattice.value() ); let change_result = lattice.join(&new_lattice); log::debug!( + target: self.debug_name(), "setting constant value for {} to {new_lattice}: {change_result} as {}", lattice.anchor(), lattice.value() @@ -214,6 +217,7 @@ impl SparseForwardDataFlowAnalysis for SparseConstantPropagation { OpFoldResult::Value(value) => { let new_lattice = solver.get_or_create_mut::, _>(value); log::trace!( + target: self.debug_name(), "setting lattice for {} to {} from {}", lattice.anchor(), new_lattice.value(), @@ -221,6 +225,7 @@ impl SparseForwardDataFlowAnalysis for SparseConstantPropagation { ); let change_result = lattice.join(new_lattice.value()); log::debug!( + target: self.debug_name(), "setting constant value for {} to {}: {change_result} as {}", lattice.anchor(), new_lattice.value(), @@ -234,10 +239,11 @@ impl SparseForwardDataFlowAnalysis for SparseConstantPropagation { } fn set_to_entry_state(&self, lattice: &mut AnalysisStateGuardMut<'_, Self::Lattice>) { - log::trace!("setting lattice to entry state from {}", lattice.value()); + log::trace!(target: self.debug_name(), "setting lattice to entry state from {}", lattice.value()); let entry_state = ConstantValue::unknown(); let change_result = lattice.join(&entry_state); log::debug!( + target: self.debug_name(), "setting constant value for {} to {entry_state}: {change_result} as {}", lattice.anchor(), lattice.value() diff --git a/hir-analysis/src/analyses/dce.rs b/hir-analysis/src/analyses/dce.rs index 8a5b627e1..79ff3f1da 100644 --- a/hir-analysis/src/analyses/dce.rs +++ b/hir-analysis/src/analyses/dce.rs @@ -752,6 +752,15 @@ impl DeadCodeAnalysis { let succ = successor.block.borrow(); (succ.predecessor(), succ.successor()) }; + let point = ProgramPoint::at_start_of(to); + let mut predecessors = solver.get_or_create_mut::(point); + let change_result = predecessors.change(|ps| { + ps.join_with_inputs(branch.as_operation_ref(), successor.successor_operands()) + }); + log::debug!( + target: self.debug_name(), "adding {} as predecessor for {point}: {change_result}", + branch.as_operation().name() + ); self.mark_edge_live(&from.borrow(), &to.borrow(), solver); } else { // Otherwise, mark all successors as executable and outgoing edges. @@ -759,6 +768,15 @@ impl DeadCodeAnalysis { let block_operand = successor.block.borrow(); let from = block_operand.predecessor(); let to = block_operand.successor(); + let point = ProgramPoint::at_start_of(to); + let mut predecessors = solver.get_or_create_mut::(point); + let change_result = predecessors.change(|ps| { + ps.join_with_inputs(branch.as_operation_ref(), successor.successor_operands()) + }); + log::debug!( + target: self.debug_name(), "adding {} as predecessor for {point}: {change_result}", + branch.as_operation().name() + ); self.mark_edge_live(&from.borrow(), &to.borrow(), solver); } } diff --git a/hir-analysis/src/analyses/liveness.rs b/hir-analysis/src/analyses/liveness.rs index 82b9c4600..23a112340 100644 --- a/hir-analysis/src/analyses/liveness.rs +++ b/hir-analysis/src/analyses/liveness.rs @@ -473,6 +473,7 @@ impl DenseBackwardDataFlowAnalysis for Liveness { // 4. (None, None) => { log::debug!( + target: self.debug_name(), "control flow does not visit any child regions, visiting like a regular op" ); self.visit_operation(branch.as_operation(), after, before, solver) @@ -481,6 +482,7 @@ impl DenseBackwardDataFlowAnalysis for Liveness { // 1. (None, Some(region_to)) => { log::debug!( + target: self.debug_name(), "propagating live-in set of region entry block to live-in of region branch op" ); // We're only interested in propagating liveness out of `region_to` for values that @@ -536,6 +538,7 @@ impl DenseBackwardDataFlowAnalysis for Liveness { // 2. (Some(region_from), None) => { log::debug!( + target: self.debug_name(), "propagating live-out set of region branch op to live-out set of region exit \ block" ); @@ -551,6 +554,7 @@ impl DenseBackwardDataFlowAnalysis for Liveness { let is_loop_exit = branch.is_repetitive_region(region_from.borrow().region_number()); log::debug!( + target: self.debug_name(), "exit region is part of a loop, so this control flow edge represents a loop \ exit" ); @@ -590,7 +594,7 @@ impl DenseBackwardDataFlowAnalysis for Liveness { // Ensure the analysis state for `terminator` is initialized with `before_live_out` let point = ProgramPoint::after(terminator); - log::debug!("propagating live-out lattice of {pp} to live-out of {point}"); + log::debug!(target: self.debug_name(), "propagating live-out lattice of {pp} to live-out of {point}"); let mut term_liveness = solver.get_or_create_mut::, _>(point); if term_liveness.value() != &before_live_out { *term_liveness.value_mut() = before_live_out; @@ -620,6 +624,7 @@ impl DenseBackwardDataFlowAnalysis for Liveness { } if is_loop_exit { log::debug!( + target: self.debug_name(), "predecessor region is part of a loop, but successor is not, so this \ control flow edge represents a loop exit" ); @@ -653,7 +658,7 @@ impl DenseBackwardDataFlowAnalysis for Liveness { // Ensure the analysis state for `terminator` is initialized with `before_live_out` let point = ProgramPoint::after(terminator); - log::debug!("propagating live-out lattice of {pp} to live-out of {point}"); + log::debug!(target: self.debug_name(), "propagating live-out lattice of {pp} to live-out of {point}"); let mut term_liveness = solver.get_or_create_mut::, _>(point); if term_liveness.value() != &before_live_out { *term_liveness.value_mut() = before_live_out; @@ -678,6 +683,7 @@ impl Liveness { // Is this the first op in the block? if let Some(prev) = op.as_operation_ref().prev() { log::debug!( + target: self.debug_name(), "propagating live-in of {} to live-out of {}", ProgramPoint::before(op), ProgramPoint::after(prev) @@ -711,6 +717,7 @@ impl Liveness { } } else { log::debug!( + target: self.debug_name(), "propagating live-in of {} to live-in of {}", ProgramPoint::before(op), ProgramPoint::at_start_of(parent_block) diff --git a/hir-analysis/src/analyses/spills.rs b/hir-analysis/src/analyses/spills.rs index 5533d5564..3c4156876 100644 --- a/hir-analysis/src/analyses/spills.rs +++ b/hir-analysis/src/analyses/spills.rs @@ -4,7 +4,7 @@ use midenc_hir::{ AttributeValue, Block, BlockRef, FxHashMap, FxHashSet, LoopLikeOpInterface, Op, Operation, OperationRef, ProgramPoint, Region, RegionBranchOpInterface, RegionBranchPoint, RegionBranchTerminatorOpInterface, Report, SmallVec, SourceSpan, Spanned, SuccessorOperands, - Value, ValueOrAlias, ValueRange, ValueRef, + TraceTarget, Value, ValueOrAlias, ValueRange, ValueRef, adt::{SmallOrdMap, SmallSet}, cfg::Graph, dialects::builtin::Function, @@ -228,6 +228,10 @@ pub struct SpillAnalysis { pub spills: SmallVec<[SpillInfo; 4]>, // The set of instructions corresponding to the reload of a spilled value pub reloads: SmallVec<[ReloadInfo; 4]>, + // Index spills by (placement, spilled value) for fast global deduplication. + spill_ids: FxHashMap<(Placement, ValueRef), Spill>, + // Index reloads by (placement, spilled value) for fast global deduplication. + reload_ids: FxHashMap<(Placement, ValueRef), Reload>, // The set of operands in registers on entry to a given program point w_entries: FxHashMap>, // The set of operands that have been spilled upon entry to a given program point @@ -236,6 +240,10 @@ pub struct SpillAnalysis { w_exits: FxHashMap>, // The set of operands that have been spilled so far, on exit from a given program point s_exits: FxHashMap>, + /// The trace target for the analysis, includes the symbol name of the current function/op + /// + /// This is used in tracing targets so that we can filter traces by symbol + trace_target: TraceTarget, } /// Represents a single predecessor for some [ProgramPoint] @@ -429,6 +437,15 @@ pub enum Placement { Split(Split), } +impl core::fmt::Display for Placement { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + Self::At(point) => core::fmt::Display::fmt(point, f), + Self::Split(split) => write!(f, "split({})", split.as_usize()), + } + } +} + /// The maximum number of operand stack slots which can be assigned without spills. const K: usize = 16; @@ -444,7 +461,16 @@ impl Analysis for SpillAnalysis { op: &Self::Target, analysis_manager: AnalysisManager, ) -> Result<(), Report> { - log::debug!(target: "spills", "running spills analysis for {}", op.as_operation()); + self.trace_target = TraceTarget::category("analysis") + .with_topic(self.name()) + .with_relevant_symbol(op.name().as_symbol()); + + log::debug!( + target: &self.trace_target, + symbol = self.trace_target.relevant_symbol(); + "running spills analysis for {}", + op.as_operation() + ); let liveness = analysis_manager.get_analysis::()?; self.compute(op, &liveness, analysis_manager) @@ -489,15 +515,18 @@ impl SpillAnalysis { /// Returns true if `value` is spilled at the given program point (i.e. inserted before) pub fn is_spilled_at(&self, value: ValueRef, pp: ProgramPoint) -> bool { let place = match pp { - ProgramPoint::Block { - block: split_block, .. - } => match self.splits.iter().find(|split| split.split == Some(split_block)) { - Some(split) => Placement::Split(split.id), - None => Placement::At(ProgramPoint::at_end_of(split_block)), - }, + ProgramPoint::Block { block, .. } => { + match self.splits.iter().find(|split| split.split == Some(block)) { + // Treat a query using the materialized split block as a query on the + // corresponding edge split placement. + Some(split) => Placement::Split(split.id), + // Preserve the original program point (including before/after) for non-split blocks. + None => Placement::At(pp), + } + } point => Placement::At(point), }; - self.spills.iter().any(|info| info.value == value && info.place == place) + self.spill_ids.contains_key(&(place, value)) } /// Returns true if `value` will be spilled in the given split @@ -512,11 +541,6 @@ impl SpillAnalysis { self.spills.as_slice() } - /// Same as [SpillAnalysis::spills], but as a mutable reference - pub fn spills_mut(&mut self) -> &mut [SpillInfo] { - self.spills.as_mut_slice() - } - /// Returns true if `value` is reloaded at some point pub fn is_reloaded(&self, value: &ValueRef) -> bool { self.reloads.iter().any(|info| &info.value == value) @@ -525,15 +549,18 @@ impl SpillAnalysis { /// Returns true if `value` is reloaded at the given program point (i.e. inserted before) pub fn is_reloaded_at(&self, value: ValueRef, pp: ProgramPoint) -> bool { let place = match pp { - ProgramPoint::Block { - block: split_block, .. - } => match self.splits.iter().find(|split| split.split == Some(split_block)) { - Some(split) => Placement::Split(split.id), - None => Placement::At(ProgramPoint::at_end_of(split_block)), - }, + ProgramPoint::Block { block, .. } => { + match self.splits.iter().find(|split| split.split == Some(block)) { + // Treat a query using the materialized split block as a query on the + // corresponding edge split placement. + Some(split) => Placement::Split(split.id), + // Preserve the original program point (including before/after) for non-split blocks. + None => Placement::At(pp), + } + } point => Placement::At(point), }; - self.reloads.iter().any(|info| info.value == value && info.place == place) + self.reload_ids.contains_key(&(place, value)) } /// Returns true if `value` will be reloaded in the given split @@ -548,11 +575,6 @@ impl SpillAnalysis { self.reloads.as_slice() } - /// Same as [SpillAnalysis::reloads], but as a mutable reference - pub fn reloads_mut(&mut self) -> &mut [ReloadInfo] { - self.reloads.as_mut_slice() - } - /// Returns the operands in W upon entry to `point` pub fn w_entry(&self, point: &ProgramPoint) -> &[ValueOrAlias] { self.w_entries[point].as_slice() @@ -595,9 +617,6 @@ impl SpillAnalysis { assert!(_deferred.is_empty()); Ok(()) } else { - // We generally expect that control flow lifting will have removed all but the entry - // block, but in some cases there can be some remaining unstructured control flow, so - // we handle that in the usual way here let dominfo = analysis_manager.get_analysis::()?; let loops = analysis_manager.get_analysis::()?; let entry_region = function.body().as_region_ref(); @@ -631,10 +650,16 @@ impl SpillAnalysis { liveness: &LivenessAnalysis, analysis_manager: AnalysisManager, ) -> Result<(), Report> { - log::trace!(target: "spills", "visiting cfg"); - // Visit the blocks of the CFG in reverse postorder (top-down) - let mut block_q = VecDeque::from(domtree.reverse_postorder()); + let mut block_q = VecDeque::with_capacity(32); + for block in midenc_hir::PostOrderBlockIter::new(domtree.root()) { + block_q.push_front(block); + } + log::debug!( + target: &self.trace_target, + symbol = self.trace_target.relevant_symbol(); + "visiting cfg (reverse post-order): {}", DisplayValues::new(block_q.iter()) + ); // If a block has a predecessor which it dominates (i.e. control flow always flows through // the block in question before the given predecessor), then we must defer computing spills @@ -642,11 +667,7 @@ impl SpillAnalysis { // track deferred edges for each block. let mut deferred = Vec::<(BlockRef, SmallVec<[BlockRef; 2]>)>::default(); - while let Some(node) = block_q.pop_front() { - let Some(block_ref) = node.block() else { - continue; - }; - + while let Some(block_ref) = block_q.pop_front() { self.visit_single_block( op, &block_ref.borrow(), @@ -704,7 +725,7 @@ impl SpillAnalysis { liveness: &LivenessAnalysis, analysis_manager: AnalysisManager, ) -> Result<(), Report> { - log::trace!(target: "spills", "visiting region cfg"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); "visiting region cfg"); // Visit the blocks of the CFG in reverse postorder (top-down) let region = entry.parent().unwrap(); @@ -782,17 +803,23 @@ impl SpillAnalysis { ) -> Result<(), Report> { let block_ref = block.as_block_ref(); - log::trace!(target: "spills", "visiting {block}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); "visiting {block}"); // Compute W^entry(B) self.compute_w_entry(op, block, loops, liveness); // Derive S^entry(B) from W^entry(B) and compute live predecessors at block start let w_entry = self.w_entries[&ProgramPoint::at_start_of(block)].clone(); - log::trace!(target: "spills", "computing block information"); let block_info = self.block_entry_info(op, block, liveness, w_entry); - log::trace!(target: "spills", " W^entry({block}) = {{{}}}", DisplayValues::new(block_info.w_entry.iter())); - log::trace!(target: "spills", " S^entry({block}) = {{{}}}", DisplayValues::new(block_info.s_entry.iter())); + log::trace!( + target: &self.trace_target, + symbol = self.trace_target.relevant_symbol(); + "computing block information + W^entry({block}) = {{{}}} + S^entry({block}) = {{{}}}\n", + DisplayValues::new(block_info.w_entry.iter()), + DisplayValues::new(block_info.s_entry.iter()), + ); // For each predecessor P of B, insert spills/reloads along the inbound control flow // edge as follows: @@ -924,9 +951,14 @@ impl SpillAnalysis { liveness: &LivenessAnalysis, analysis_manager: AnalysisManager, ) -> Result<(), Report> { - log::trace!(target: "spills", "visiting region branch op '{}'", branch.as_operation()); - log::trace!(target: "spills", " W^in = {w:?}"); - log::trace!(target: "spills", " S^in = {s:?}"); + log::trace!( + target: &self.trace_target, + symbol = self.trace_target.relevant_symbol(); + "visiting region branch op '{}' + W^in = {w:?} + S^in = {s:?}\n", + branch.as_operation(), + ); // PHASE 1: // @@ -958,16 +990,16 @@ impl SpillAnalysis { to_reload.swap_remove(pos); } } - log::trace!(target: "spills", " require reloading = {to_reload:#?}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " require reloading = {to_reload:#?}"); // Precompute the starting stack usage of W let w_used = w.iter().map(|o| o.stack_size()).sum::(); - log::trace!(target: "spills", " current stack usage = {w_used}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " current stack usage = {w_used}"); // Compute the needed operand stack space for all operands not currently in W, i.e. those // which must be reloaded from a spill slot let in_needed = to_reload.iter().map(|o| o.stack_size()).sum::(); - log::trace!(target: "spills", " required by reloads = {in_needed}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " required by reloads = {in_needed}"); // If we have room for operands and results in W, then no spills are needed, // otherwise we require two passes to compute the spills we will need to issue @@ -980,7 +1012,11 @@ impl SpillAnalysis { // the size of any operands which must be reloaded. let max_usage_in = w_used + in_needed; if max_usage_in > K { - log::trace!(target: "spills", " max usage on entry ({max_usage_in}) exceeds K ({K}), spills required"); + log::trace!( + target: &self.trace_target, + symbol = self.trace_target.relevant_symbol(); + " max usage on entry ({max_usage_in}) exceeds K ({K}), spills required" + ); // We must spill enough capacity to keep K >= 16 let mut must_spill = max_usage_in - K; // Our initial set of candidates consists of values in W which are not operands @@ -1009,10 +1045,10 @@ impl SpillAnalysis { to_spill.insert(candidate); } } else { - log::trace!(target: "spills", " spills required on entry: no"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " spills required on entry: no"); } - log::trace!(target: "spills", " spills = {to_spill:?}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " spills = {to_spill:?}"); // Emit spills first, to make space for reloaded values on the operand stack for spill in to_spill.iter() { @@ -1038,8 +1074,8 @@ impl SpillAnalysis { self.w_entries.insert(before_op, w.clone()); self.s_entries.insert(before_op, s.clone()); - log::trace!(target: "spills", " W^entry = {w:?}"); - log::trace!(target: "spills", " S^entry = {s:?}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " W^entry = {w:?}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " S^entry = {s:?}"); // PHASE 2: // @@ -1069,9 +1105,6 @@ impl SpillAnalysis { } for successor in branch.get_entry_successor_regions(&operands) { - //let mut w_entry = w.clone(); - //let mut s_entry = s.clone(); - // Fixup W and S based on successor operands let branch_point = *successor.branch_point(); let inputs = branch.get_entry_successor_operands(branch_point); @@ -1084,7 +1117,7 @@ impl SpillAnalysis { Some(region) => { let region = region.borrow(); let block = region.entry(); - log::trace!(target: "spills", " processing successor {block}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " processing successor {block}"); // Visit the contents of `region` // @@ -1102,7 +1135,7 @@ impl SpillAnalysis { // TODO(pauls): Need to compute W and S on exit from `branch` as if the exit // point of `branch` is the entry of a new block, i.e. as computed via // `compute_w_entry_normal` - log::trace!(target: "spills", " processing self as successor"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " processing self as successor"); todo!() } } @@ -1120,7 +1153,12 @@ impl SpillAnalysis { // are live after `branch`, but not live on exit from all predecessors, we must issue a // reload for that value. Correspondingly, if there are any values in S which are live after // `branch`, but not spilled in every predecessor, we must issue a spill for that value. - log::trace!(target: "spills", " computing W^exit for '{}'..", branch.as_operation().name()); + log::trace!( + target: &self.trace_target, + symbol = self.trace_target.relevant_symbol(); + " computing W^exit for '{}'..", + branch.as_operation().name() + ); // First, compute W^exit(branch) self.compute_w_exit_region_branch_op(branch, liveness); @@ -1139,8 +1177,8 @@ impl SpillAnalysis { *w = w_exit; *s = s_exit; - log::trace!(target: "spills", " W^exit = {w:?}"); - log::trace!(target: "spills", " S^exit = {s:?}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " W^exit = {w:?}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " S^exit = {s:?}"); Ok(()) } @@ -1158,6 +1196,14 @@ impl SpillAnalysis { } fn spill(&mut self, place: Placement, value: ValueRef, span: SourceSpan) -> Spill { + // Spills are computed by multiple routines (MIN, edge reconciliation, over-K entry/results + // handling). Deduplicate globally to avoid materializing the same spill multiple times when + // distinct control-flow edges are forced to share a single insertion point. + let key = (place, value); + if let Some(existing) = self.spill_ids.get(&key).copied() { + self.spilled.insert(value); + return existing; + } let id = Spill::new(self.spills.len()); self.spilled.insert(value); self.spills.push(SpillInfo { @@ -1167,10 +1213,16 @@ impl SpillAnalysis { span, inst: None, }); + self.spill_ids.insert(key, id); id } fn reload(&mut self, place: Placement, value: ValueRef, span: SourceSpan) -> Reload { + // See `spill` for details on why reloads are globally deduplicated. + let key = (place, value); + if let Some(existing) = self.reload_ids.get(&key).copied() { + return existing; + } let id = Reload::new(self.reloads.len()); self.reloads.push(ReloadInfo { id, @@ -1179,6 +1231,7 @@ impl SpillAnalysis { span, inst: None, }); + self.reload_ids.insert(key, id); id } @@ -1204,20 +1257,40 @@ impl SpillAnalysis { if let Some(loop_info) = loops.and_then(|loops| loops.loop_for(block_ref).filter(|l| l.header() == block_ref)) { - log::trace!(target: "spills", "computing W^entry for loop header {block}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); "computing W^entry for loop header {block}"); return self.compute_w_entry_loop(block, &loop_info, liveness); } else if let Some(loop_like) = op.as_trait::() { let region = block.parent().unwrap(); if loop_like.get_loop_header_region() == region && block.is_entry_block() { - log::trace!(target: "spills", "computing W^entry for loop-like header {block}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); "computing W^entry for loop-like header {block}"); return self.compute_w_entry_loop_like(loop_like, block, liveness); } } - log::trace!(target: "spills", "computing W^entry normally for {block}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); "computing W^entry normally for {block}"); self.compute_w_entry_normal(op, block, liveness); } + /// Spill values from the end of `ordered` until `usage` fits within `K`. + /// + /// Returns the updated stack usage after inserting spill records. + fn spill_trailing_until_fits( + &mut self, + take: &mut SmallSet, + ordered: &mut SmallVec<[ValueOrAlias; 4]>, + mut usage: usize, + place: Placement, + ) -> usize { + while usage > K { + let value = + ordered.pop().expect("expected at least one value when spilling over-K usage"); + take.remove(&value); + usage = usage.checked_sub(value.stack_size()).expect("spill usage underflow"); + self.spill(place, value.value(), value.value().borrow().span()); + } + usage + } + fn compute_w_entry_normal( &mut self, op: &Operation, @@ -1229,23 +1302,23 @@ impl SpillAnalysis { let mut cand = SmallSet::::default(); // Block arguments are always in w_entry by definition + // + // However, it is possible for a block to have more than K stack slots' worth of arguments. + // When this occurs, we proactively spill as many of the highest-indexed block arguments as + // needed to ensure W^entry fits within K, inserting those spills at the start of the block. + let start_of_block = ProgramPoint::at_start_of(block); + let mut block_args = SmallVec::<[ValueOrAlias; 4]>::default(); for arg in block.arguments().iter().copied() { - take.insert(ValueOrAlias::new(arg as ValueRef)); + let arg = ValueOrAlias::new(arg as ValueRef); + take.insert(arg); + block_args.push(arg); + } + let w_entry_usage = take.iter().map(|o| o.stack_size()).sum::(); + if w_entry_usage > K { + let place = Placement::At(start_of_block); + let _ = + self.spill_trailing_until_fits(&mut take, &mut block_args, w_entry_usage, place); } - - // TODO(pauls): We likely need to account for the implicit spilling that occurs when the - // operand stack space required by the function arguments exceeds K. In such cases, the W set - // contains the function parameters up to the first parameter that would cause the operand - // stack to overflow, all subsequent parameters are placed on the advice stack, and are assumed - // to be moved from the advice stack to locals in the same order as they appear in the function - // signature as part of the function prologue. Thus, the S set is preloaded with those values - // which were spilled in this manner. - // - // NOTE: It should never be the case that the set of block arguments consumes more than K - assert!( - take.iter().map(|o| o.stack_size()).sum::() <= K, - "unhandled spills implied by function/block parameter list" - ); // If this is the entry block to an IsolatedFromAbove region, the operands in w_entry are // guaranteed to be equal to the set of region arguments, so we're done. @@ -1257,15 +1330,14 @@ impl SpillAnalysis { // If this block is the entry block of a RegionBranchOpInterface op, then we compute the // set of predecessors differently than unstructured CFG ops. let mut predecessor_count = 0; + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); "loading predecessor state for {}", ProgramPoint::at_start_of(block)); + let predecessors = liveness + .solver() + .get::(&ProgramPoint::at_start_of(block)) + .expect("expected all predecessors of block to be known"); + assert!(predecessors.all_predecessors_known(), "unexpected unresolved region successors"); + if op.implements::() && block.is_entry_block() { - let predecessors = liveness - .solver() - .get::(&ProgramPoint::at_start_of(block)) - .expect("expected all predecessors of region block to be known"); - assert!( - predecessors.all_predecessors_known(), - "unexpected unresolved region successors" - ); let operation = op.as_operation_ref(); for predecessor in predecessors.known_predecessors().iter().copied() { if predecessor == operation { @@ -1297,20 +1369,20 @@ impl SpillAnalysis { } } } else { - for pred in block.predecessors() { - let predecessor = pred.predecessor(); + for predecessor in predecessors.known_predecessors() { + let predecessor_block = predecessor.parent().unwrap(); // Skip control edges that aren't executable. - let edge = CfgEdge::new(predecessor, pred.successor(), block.span()); + let edge = CfgEdge::new(predecessor_block, block.as_block_ref(), block.span()); if !liveness.solver().get::(&edge).is_none_or(|exe| exe.is_live()) { continue; } predecessor_count += 1; - let end_of_pred = ProgramPoint::at_end_of(predecessor); + let end_of_pred = ProgramPoint::at_end_of(predecessor_block); for o in self.w_exits[&end_of_pred].iter().copied() { // Do not add candidates which are not live-after the predecessor - if liveness.is_live_at_end(o, predecessor) { + if liveness.is_live_at_end(o, predecessor_block) { *freq.entry(o).or_insert(0) += 1; cand.insert(o); } @@ -1383,14 +1455,18 @@ impl SpillAnalysis { let mut cand = SmallSet::::default(); // Op results are always in W^exit by definition + let after_branch = ProgramPoint::after(branch.as_operation()); + let mut results = SmallVec::<[ValueOrAlias; 4]>::default(); for result in branch.results().iter().copied() { - take.insert(ValueOrAlias::new(result as ValueRef)); + let result = ValueOrAlias::new(result as ValueRef); + take.insert(result); + results.push(result); + } + let w_exit_usage = take.iter().map(|o| o.stack_size()).sum::(); + if w_exit_usage > K { + let place = Placement::At(after_branch); + let _ = self.spill_trailing_until_fits(&mut take, &mut results, w_exit_usage, place); } - - assert!( - take.iter().map(|o| o.stack_size()).sum::() <= K, - "unhandled spills implied by results of region branch op" - ); // If this block is the entry block of a RegionBranchOpInterface op, then we compute the // set of predecessors differently than unstructured CFG ops. @@ -1408,7 +1484,7 @@ impl SpillAnalysis { if predecessor == operation { predecessor_count += 1; let end_of_pred = ProgramPoint::before(operation); - log::trace!(target: "spills", "examining exit predecessor {end_of_pred}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); "examining exit predecessor {end_of_pred}"); for o in self.w_entries[&end_of_pred].iter().copied() { // Do not add candidates which are not live-after the predecessor if liveness.is_live_after_entry(o, branch.as_operation()) { @@ -1426,7 +1502,7 @@ impl SpillAnalysis { predecessor_count += 1; let end_of_pred = ProgramPoint::at_end_of(predecessor_block); - log::trace!(target: "spills", "examining exit predecessor {end_of_pred}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); "examining exit predecessor {end_of_pred}"); for o in self.w_exits[&end_of_pred].iter().copied() { // Do not add candidates which are not live-after the predecessor if liveness.is_live_at_end(o, predecessor_block) { @@ -1506,7 +1582,7 @@ impl SpillAnalysis { } })); - log::trace!(target: "spills", " alive at loop entry: {{{}}}", DisplayValues::new(alive.iter())); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " alive at loop entry: {{{}}}", DisplayValues::new(alive.iter())); // Initial candidates are values live at block entry which are used in the loop body let mut cand = alive @@ -1515,18 +1591,18 @@ impl SpillAnalysis { .copied() .collect::>(); - log::trace!(target: "spills", " initial candidates: {{{}}}", DisplayValues::new(cand.iter())); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " initial candidates: {{{}}}", DisplayValues::new(cand.iter())); // Values which are "live through" the loop, are those which are live at entry, but not // used within the body of the loop. If we have excess available operand stack capacity, // then we can avoid issuing spills/reloads for at least some of these values. let live_through = alive.difference(&cand); - log::trace!(target: "spills", " live through loop: {{{}}}", DisplayValues::new(live_through.iter())); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " live through loop: {{{}}}", DisplayValues::new(live_through.iter())); let w_used = cand.iter().map(|o| o.stack_size()).sum::(); - let max_loop_pressure = max_loop_pressure(loop_info, liveness); - log::trace!(target: "spills", " w_used={w_used}, K={K}, loop_pressure={max_loop_pressure}"); + let max_loop_pressure = max_loop_pressure(loop_info, liveness, &self.trace_target); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " w_used={w_used}, K={K}, loop_pressure={max_loop_pressure}"); if w_used < K { if let Some(mut free_in_loop) = K.checked_sub(max_loop_pressure) { @@ -1803,13 +1879,13 @@ impl SpillAnalysis { /// /// If the stack depth never reaches K, the excess capacity represents an opportunity to /// avoid issuing spills/reloads for values which are live through the loop. -fn max_loop_pressure(loop_info: &Loop, liveness: &LivenessAnalysis) -> usize { +fn max_loop_pressure(loop_info: &Loop, liveness: &LivenessAnalysis, trace_target: &str) -> usize { let header = loop_info.header(); let mut max = max_block_pressure(&header.borrow(), liveness); let mut block_q = VecDeque::from_iter([header]); let mut visited = SmallSet::::default(); - log::trace!(target: "spills", "computing max pressure for loop headed by {header}"); + log::trace!(target: trace_target, "computing max pressure for loop headed by {header}"); while let Some(block) = block_q.pop_front() { if !visited.insert(block) { @@ -1817,21 +1893,21 @@ fn max_loop_pressure(loop_info: &Loop, liveness: &LivenessAnalysis) -> usize { } let children = BlockRef::children(block).collect::>(); - log::trace!(target: "spills", " children of {block}: {children:?}"); + log::trace!(target: trace_target, " children of {block}: {children:?}"); let loop_children = children .iter() .filter(|b| loop_info.contains_block(**b)) .copied() .collect::>(); - log::trace!(target: "spills", " children in loop: {loop_children:?}"); + log::trace!(target: trace_target, " children in loop: {loop_children:?}"); block_q.extend(loop_children); let max_block_pressure = max_block_pressure(&block.borrow(), liveness); - log::trace!(target: "spills", " block {block} pressure = {max_block_pressure}"); + log::trace!(target: trace_target, " block {block} pressure = {max_block_pressure}"); max = core::cmp::max(max, max_block_pressure); } - log::trace!(target: "spills", " max loop pressure = {max}"); + log::trace!(target: trace_target, " max loop pressure = {max}"); max } @@ -2077,11 +2153,34 @@ impl SpillAnalysis { return; } - // Otherwise, we need to split the edge from P to B, and place any spills/reloads in the split, - // S, moving any block arguments for B, to the unconditional branch in S. - let split = self.split(info.point, *pred); - let place = Placement::Split(split); - let span = pred.operation(info.point).span(); + // If spills/reloads are needed on this edge, we need a placement for those instructions. + // + // For unstructured control flow (i.e. an explicit branch op), we split the edge and insert + // spills/reloads in the split block so they are executed only along that predecessor edge. + // + // For structured control flow edges (i.e. predecessor is `Parent` or `Region`), we insert + // spills/reloads at the destination when it has a single live predecessor, otherwise we + // fall back to placing them before the predecessor operation, as we do not currently + // support splitting such edges during transformation. + let (place, span) = match pred { + Predecessor::Block { .. } => { + let split = self.split(info.point, *pred); + (Placement::Split(split), pred.operation(info.point).span()) + } + Predecessor::Parent | Predecessor::Region(_) => { + // If the destination has a single live predecessor, placing at the destination is + // effectively edge-specific. + if info.live_predecessors.len() == 1 { + (Placement::At(info.point), pred.operation(info.point).span()) + } else { + let predecessor = pred.operation(info.point); + // NOTE: This placement is not edge-specific. Multiple distinct structured edges + // may map to the same insertion point, so we rely on spill/reload deduplication + // to avoid materializing duplicates. + (Placement::At(ProgramPoint::before(predecessor)), predecessor.span()) + } + } + }; // Insert spills first, to end the live ranges of as many variables as possible for spill in to_spill { @@ -2118,16 +2217,39 @@ impl SpillAnalysis { let place = Placement::At(before_op); let span = op.span(); - log::trace!(target: "spills", "scheduling spills/reloads at {before_op}"); - log::trace!(target: "spills", " W^entry = {w:?}"); - log::trace!(target: "spills", " S^entry = {s:?}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); "scheduling spills/reloads at {before_op}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " W^entry = {w:?}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " S^entry = {s:?}"); + + if op.implements::() { + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " region terminator = true"); + // Region branch terminators forward successor operands across region boundaries. + // + // These operands can exceed K, but since control flow transfers immediately, we do not + // need to keep the entire set addressable for subsequent instructions in the current + // block. Instead, we ensure that any required operands are present in W and leave edge + // reconciliation to the normal mechanisms (e.g. spills inserted at join points). + w.retain(|o| liveness.is_live_before(o, op)); + let to_reload = ValueRange::<4>::from(op.operands().all()); + for reload in to_reload.into_iter().map(ValueOrAlias::new) { + if w.insert(reload) { + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " emitting reload for {reload}"); + // By definition, if we are emitting a reload, the value must have been spilled + s.insert(reload); + self.reload(place, reload.value(), span); + } + } + + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " W^exit = {w:?}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " S^exit = {s:?}"); + return; + } - let is_terminator = op.implements::() - && !(op.implements::() - || op.implements::()); + let is_terminator = + op.implements::() && !op.implements::(); if is_terminator { - log::trace!(target: "spills", " terminator = true"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " terminator = true"); // A non-branching terminator is either a return, or an unreachable. // In the latter case, there are no operands or results, so there is no // effect on W or S In the former case, the operands to the instruction are @@ -2138,13 +2260,13 @@ impl SpillAnalysis { let to_reload = ValueRange::<4>::from(op.operands().all()); for reload in to_reload.into_iter().map(ValueOrAlias::new) { if w.insert(reload) { - log::trace!(target: "spills", " emitting reload for {reload}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " emitting reload for {reload}"); self.reload(place, reload.value(), span); } } - log::trace!(target: "spills", " W^exit = {w:?}"); - log::trace!(target: "spills", " S^exit = {s:?}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " W^exit = {w:?}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " S^exit = {s:?}"); return; } @@ -2193,12 +2315,12 @@ impl SpillAnalysis { }) .sum::(); - log::trace!(target: "spills", " results = {results}"); - log::trace!(target: "spills", " require copy/reload = {to_reload:?}"); - log::trace!(target: "spills", " current stack usage = {w_used}"); - log::trace!(target: "spills", " required by reloads = {in_needed}"); - log::trace!(target: "spills", " required by results = {out_needed}"); - log::trace!(target: "spills", " freed by op = {in_consumed}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " results = {results}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " require copy/reload = {to_reload:?}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " current stack usage = {w_used}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " required by reloads = {in_needed}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " required by results = {out_needed}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " freed by op = {in_consumed}"); // If we have room for operands and results in W, then no spills are needed, // otherwise we require two passes to compute the spills we will need to issue @@ -2211,7 +2333,7 @@ impl SpillAnalysis { // the size of any operands which must be reloaded. let max_usage_in = w_used + in_needed; if max_usage_in > K { - log::trace!(target: "spills", "max usage on entry ({max_usage_in}) exceeds K ({K}), spills required"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); "max usage on entry ({max_usage_in}) exceeds K ({K}), spills required"); // We must spill enough capacity to keep K >= 16 let mut must_spill = max_usage_in - K; // Our initial set of candidates consists of values in W which are not operands @@ -2240,18 +2362,18 @@ impl SpillAnalysis { to_spill.insert(candidate); } } else { - log::trace!(target: "spills", " spills required on entry: no"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " spills required on entry: no"); } // Second pass: compute spills for exit from I (making room for results) let spilled = to_spill.iter().map(|o| o.stack_size()).sum::(); - log::trace!(target: "spills", " freed by spills = {spilled}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " freed by spills = {spilled}"); // The max usage out is computed by adding the space required for all results of I, to // the max usage in, then subtracting the size of all operands which are consumed by I, // as well as the size of those values in W which we have spilled. let max_usage_out = (max_usage_in + out_needed).saturating_sub(in_consumed + spilled); if max_usage_out > K { - log::trace!(target: "spills", "max usage on exit ({max_usage_out}) exceeds K ({K}), additional spills required"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); "max usage on exit ({max_usage_out}) exceeds K ({K}), additional spills required"); // We must spill enough capacity to keep K >= 16 let mut must_spill = max_usage_out - K; // For this pass, the set of candidates consists of values in W which are not @@ -2295,13 +2417,13 @@ impl SpillAnalysis { to_spill.insert(candidate); } } else { - log::trace!(target: "spills", " spills required on exit: no"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " spills required on exit: no"); } // Emit spills first, to make space for reloaded values on the operand stack for spill in to_spill.iter() { if s.insert(*spill) { - log::trace!(target: "spills", "emitting spill for {spill}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); "emitting spill for {spill}"); self.spill(place, spill.value(), span); } @@ -2313,7 +2435,7 @@ impl SpillAnalysis { for reload in to_reload { // We only need to emit a reload for a given value once if w.insert(reload) { - log::trace!(target: "spills", "emitting reload for {reload}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); "emitting reload for {reload}"); // By definition, if we are emitting a reload, the value must have been spilled s.insert(reload); self.reload(place, reload.value(), span); @@ -2330,9 +2452,9 @@ impl SpillAnalysis { // or reload along each control flow edge. // // Second, if applicable, we add in the instruction results - log::trace!(target: "spills", " applying effects of operation to W.."); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " applying effects of operation to W.."); if let Some(branch) = op.as_trait::() { - log::trace!(target: "spills", " op is a control flow branch, attempting to resolve a single successor"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " op is a control flow branch, attempting to resolve a single successor"); // Try to determine if we can select a single successor here let mut operands = SmallVec::<[Option>; 4]>::with_capacity( op.operands().group(0).len(), @@ -2351,7 +2473,7 @@ impl SpillAnalysis { } if let Some(succ) = branch.get_successor_for_operands(&operands) { - log::trace!(target: "spills", " resolved single succeessor {}", succ.successor()); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " resolved single succeessor {}", succ.successor()); w.retain(|o| { op.operands() .group(succ.successor_operand_group()) @@ -2372,7 +2494,7 @@ impl SpillAnalysis { } }) .collect::>(); - log::trace!(target: "spills", " resolved {} successors", successor_operand_groups.len()); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " resolved {} successors", successor_operand_groups.len()); w.retain(|o| { let is_succ_arg = successor_operand_groups.iter().copied().any(|succ| { op.operands() @@ -2384,16 +2506,16 @@ impl SpillAnalysis { }); } } else { - log::trace!(target: "spills", " '{}' is a primitive operation", op.name()); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " '{}' is a primitive operation", op.name()); // This is a simple operation - log::trace!(target: "spills", " removing dead operands from W"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " removing dead operands from W"); w.retain(|o| liveness.is_live_after(o, op)); - log::trace!(target: "spills", " adding results to W"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " adding results to W"); w.extend(results.iter().map(ValueOrAlias::new)); } - log::trace!(target: "spills", " W^exit = {w:?}"); - log::trace!(target: "spills", " S^exit = {s:?}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " W^exit = {w:?}"); + log::trace!(target: &self.trace_target, symbol = self.trace_target.relevant_symbol(); " S^exit = {s:?}"); } } diff --git a/hir-analysis/src/analyses/spills/tests.rs b/hir-analysis/src/analyses/spills/tests.rs index c35243ec0..a70a504a0 100644 --- a/hir-analysis/src/analyses/spills/tests.rs +++ b/hir-analysis/src/analyses/spills/tests.rs @@ -4,10 +4,11 @@ use std::string::ToString; use midenc_dialect_arith::ArithOpBuilder as Arith; use midenc_dialect_cf::ControlFlowOpBuilder as Cf; use midenc_dialect_hir::HirOpBuilder; +use midenc_dialect_scf::StructuredControlFlowOpBuilder as Scf; use midenc_expect_test::expect_file; use midenc_hir::{ - AbiParam, AddressSpace, BlockRef, Builder, Context, Ident, Op, OpBuilder, PointerType, - ProgramPoint, Report, Signature, SourceSpan, SymbolTable, Type, ValueRef, + AbiParam, AddressSpace, BlockRef, Builder, Context, Ident, Op, OpBuilder, OperationRef, + PointerType, ProgramPoint, Report, Signature, SourceSpan, SymbolTable, Type, ValueRef, dialects::builtin::{BuiltinOpBuilder, Function, FunctionBuilder}, pass::AnalysisManager, }; @@ -62,7 +63,7 @@ type AnalysisResult = Result; /// ``` #[test] fn spills_intra_block() -> AnalysisResult<()> { - let _ = env_logger::Builder::from_env("MIDENC_TRACE") + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") .format_timestamp(None) .is_test(true) .try_init(); @@ -225,7 +226,7 @@ fn spills_intra_block() -> AnalysisResult<()> { /// ``` #[test] fn spills_branching_control_flow() -> AnalysisResult<()> { - let _ = env_logger::Builder::from_env("MIDENC_TRACE") + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") .format_timestamp(None) .is_test(true) .try_init(); @@ -438,7 +439,7 @@ fn spills_branching_control_flow() -> AnalysisResult<()> { /// ``` #[test] fn spills_loop_nest() -> AnalysisResult<()> { - let _ = env_logger::Builder::from_env("MIDENC_TRACE") + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") .format_timestamp(None) .is_test(true) .try_init(); @@ -608,3 +609,152 @@ fn spills_loop_nest() -> AnalysisResult<()> { Ok(()) } + +#[test] +fn spills_entry_block_args_over_k() -> AnalysisResult<()> { + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") + .format_timestamp(None) + .is_test(true) + .try_init(); + + let span = SourceSpan::UNKNOWN; + let context = Rc::new(Context::default()); + let mut ob = OpBuilder::new(context.clone()); + + let mut module = ob.create_module(Ident::with_empty_span("test".into()))?; + let module_body = module.borrow().body().as_region_ref(); + ob.create_block(module_body, None, &[]); + + // Construct a function whose entry block arguments alone exceed K=16 stack slots. + // + // Each `u64` occupies 2 felts on the Miden stack, so 9×`u64` => 18 felts, which forces at least + // one spill at the start of the entry block. + let params = (0..9).map(|_| AbiParam::new(Type::U64)).collect::>(); + let func = ob.create_function( + Ident::with_empty_span("test::spill_entry_args_over_k".into()), + Signature::new(params, [AbiParam::new(Type::U32)]), + )?; + module.borrow_mut().symbol_manager_mut().insert_new(func, ProgramPoint::Invalid); + + let entry_block: BlockRef; + let block_args: alloc::vec::Vec; + { + let mut b = FunctionBuilder::new(func, &mut ob); + entry_block = b.current_block(); + // Capture the entry block arguments so we can assert which one is spilled, and where. + block_args = entry_block + .borrow() + .arguments() + .iter() + .copied() + .map(|v| v as ValueRef) + .collect(); + + // Keep the function body minimal so the only stack pressure comes from the entry arguments. + let zero = b.u32(0, span); + b.ret(Some(zero), span)?; + } + + let am = AnalysisManager::new(func.as_operation_ref(), None); + let spills = am.get_analysis_for::()?; + + // If entry args exceed K, SpillAnalysis must proactively spill enough args at block start so + // W^entry fits in the working stack. + assert!(spills.has_spills(), "expected spills when entry args exceed K"); + + let entry = ProgramPoint::at_start_of(entry_block); + let w_entry_usage = spills.w_entry(&entry).iter().map(|o| o.stack_size()).sum::(); + // Regression check: after inserting entry spills, the live working set on entry must be <= K. + assert!(w_entry_usage <= 16, "expected W^entry to fit within K=16, got {w_entry_usage}"); + + // We expect the highest-index argument(s) to be the first spill candidates. + let spilled_arg = + *block_args.last().expect("expected at least one block argument in over-K test"); + assert!(spills.is_spilled(&spilled_arg)); + // Regression check: the spill should be recorded at the start-of-block program point (not + // remapped to end-of-block). + assert!(spills.is_spilled_at(spilled_arg, entry)); + + Ok(()) +} + +#[test] +fn spills_region_branch_results_over_k() -> AnalysisResult<()> { + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") + .format_timestamp(None) + .is_test(true) + .try_init(); + + let span = SourceSpan::UNKNOWN; + let context = Rc::new(Context::default()); + let mut ob = OpBuilder::new(context.clone()); + + let mut module = ob.create_module(Ident::with_empty_span("test".into()))?; + let module_body = module.borrow().body().as_region_ref(); + ob.create_block(module_body, None, &[]); + + // Construct a function which returns an `scf.if` result set which alone exceeds K=16 stack slots. + // + // Each `u64` occupies 2 felts on the Miden stack, so 9×`u64` => 18 felts, which forces at least + // one spill at `ProgramPoint::after(if_op)`. + let func = ob.create_function( + Ident::with_empty_span("test::spill_region_branch_results_over_k".into()), + Signature::new([], [AbiParam::new(Type::U64)]), + )?; + module.borrow_mut().symbol_manager_mut().insert_new(func, ProgramPoint::Invalid); + + let if_op: OperationRef; + let if_results: alloc::vec::Vec; + { + let mut b = FunctionBuilder::new(func, &mut ob); + let entry = b.current_block(); + + let cond = b.i1(true, span); + let result_tys = alloc::vec![Type::U64; 9]; + let scf_if = b.r#if(cond, &result_tys, span)?; + if_op = scf_if.as_operation_ref(); + if_results = if_op + .borrow() + .results() + .all() + .iter() + .map(|r| r.borrow().as_value_ref()) + .collect(); + + // Populate the `then` and `else` regions with yields for all results. + let (then_region, else_region) = { + let if_op = scf_if.borrow(); + (if_op.then_body().as_region_ref(), if_op.else_body().as_region_ref()) + }; + + let then_block = b.create_block_in_region(then_region); + b.switch_to_block(then_block); + let then_values = + (0..result_tys.len()).map(|_| b.u64(0, span)).collect::>(); + b.r#yield(then_values, span)?; + + let else_block = b.create_block_in_region(else_region); + b.switch_to_block(else_block); + let else_values = + (0..result_tys.len()).map(|_| b.u64(1, span)).collect::>(); + b.r#yield(else_values, span)?; + + // Return the first result so the `scf.if` is reachable and well-formed. + b.switch_to_block(entry); + let first = *if_results.first().expect("expected at least one `scf.if` result"); + b.ret(Some(first), span)?; + } + + let am = AnalysisManager::new(func.as_operation_ref(), None); + let spills = am.get_analysis_for::()?; + + assert!(spills.has_spills(), "expected spills when region branch results exceed K"); + + let after_if = ProgramPoint::after(if_op); + let spilled_result = + *if_results.last().expect("expected at least one `scf.if` result in over-K test"); + assert!(spills.is_spilled(&spilled_result)); + assert!(spills.is_spilled_at(spilled_result, after_if)); + + Ok(()) +} diff --git a/hir-analysis/src/analysis/state/guard.rs b/hir-analysis/src/analysis/state/guard.rs index ac46997d7..e80f3de7f 100644 --- a/hir-analysis/src/analysis/state/guard.rs +++ b/hir-analysis/src/analysis/state/guard.rs @@ -173,9 +173,9 @@ impl<'a, T: AnalysisState + 'static> AnalysisStateGuardMut<'a, T> { where F: FnOnce(&mut T) -> ChangeResult, { - log::trace!("starting analysis state change of type {}", core::any::type_name::()); + log::trace!(target: "analysis:state", "starting analysis state change of type {}", core::any::type_name::()); let result = callback(unsafe { self.state.as_mut() }); - log::trace!("analysis state changed: {}", result.changed()); + log::trace!(target: "analysis:state", "analysis state changed: {}", result.changed()); self.changed |= result; result } @@ -199,6 +199,24 @@ impl<'a, T: AnalysisState + 'static> AnalysisStateGuardMut<'a, T> { Self::subscribe_nonnull(guard, analysis); } + /// Require this analysis state at `dependent` + /// + /// This is meant to be used in cases where calling `DataFlowSolver::require` is not possible + /// because you already hold an `AnalysisStateGuardMut` for the state, but you still need to + /// ensure that we execute the `on_require_analysis` hook for `dependent`. + pub fn require(&mut self, analysis: &A, dependent: ProgramPoint) + where + A: DataFlowAnalysis + 'static, + { + let analysis = analysis as *const dyn DataFlowAnalysis; + let analysis = unsafe { NonNull::new_unchecked(analysis.cast_mut()) }; + let info = unsafe { self.info.as_mut() }; + let state = unsafe { self.state.as_ref() }; + ::on_require_analysis( + state, info, analysis, dependent, + ); + } + /// Subscribe `analysis` to any changes of the lattice anchor. /// /// This is handled by invoking the [AnalysisStateSubscriptionBehavior::on_subscribe] callback, @@ -224,12 +242,14 @@ impl<'a, T: AnalysisState + 'static> AnalysisStateGuardMut<'a, T> { let mut worklist = self.worklist.borrow_mut(); let anchor = info.anchor(); log::trace!( + target: "analysis:state", "committing changes to analysis state {} at {anchor}", core::any::type_name::() ); let state = unsafe { self.state.as_ref() }; // Handle the change for each subscriber to this analysis state log::trace!( + target: "analysis:state", "there are {} subscriptions to notify of this change", info.subscriptions().len() ); @@ -240,7 +260,7 @@ impl<'a, T: AnalysisState + 'static> AnalysisStateGuardMut<'a, T> { } } // Invoke any custom on-update logic for this analysis state type - log::trace!("invoking on_update callback to notify user-defined subscriptions"); + log::trace!(target: "analysis:state", "invoking on_update callback to notify user-defined subscriptions"); ::on_update(state, info, &mut worklist); } } diff --git a/hir-analysis/src/analysis/state/info.rs b/hir-analysis/src/analysis/state/info.rs index a4d028c34..a1b727ede 100644 --- a/hir-analysis/src/analysis/state/info.rs +++ b/hir-analysis/src/analysis/state/info.rs @@ -167,6 +167,7 @@ impl AnalysisStateSubscription { A: alloc::alloc::Allocator, { log::trace!( + target: "analysis:subscription", "handling analysis state change to anchor '{anchor}' for {}", core::any::type_name::() ); @@ -175,7 +176,7 @@ impl AnalysisStateSubscription { Self::OnUpdate { analysis: _ } => (), // Re-run `analysis` at `point` Self::AtPoint { analysis, point } => { - log::trace!("enqueuing {} at {point}", unsafe { analysis.as_ref().debug_name() }); + log::trace!(target: "analysis:subscription", "enqueuing {} at {point}", unsafe { analysis.as_ref().debug_name() }); worklist.push_back(QueuedAnalysis { point, analysis }); } // Re-run `analysis` for all uses of the current value @@ -216,6 +217,7 @@ pub trait AnalysisStateSubscriptionBehavior: AnalysisState { /// Called when an analysis subscribes to any changes to the current [AnalysisState]. fn on_subscribe(&self, subscriber: NonNull, info: &AnalysisStateInfo) { log::trace!( + target: "analysis:subscription", "subscribing {} to state updates for analysis state {} at {}", unsafe { subscriber.as_ref().debug_name() }, info.debug_name(), @@ -250,6 +252,7 @@ impl AnalysisStateSubscriptionBehavior for T { info: &AnalysisStateInfo, ) { log::trace!( + target: "analysis:subscription", "subscribing {} to state updates for analysis state {} at {}", unsafe { subscriber.as_ref().debug_name() }, info.debug_name(), @@ -265,6 +268,7 @@ impl AnalysisStateSubscriptionBehavior for T { /// may be directly/indirectly affected by the changes. default fn on_update(&self, info: &mut AnalysisStateInfo, worklist: &mut AnalysisQueue) { log::trace!( + target: "analysis:subscription", "notifying {} subscribers of update to sparse lattice at {}", info.on_update_subscribers_count(), info.anchor() @@ -296,6 +300,7 @@ pub fn on_require_analysis_fallback( dependent: ProgramPoint, ) { log::trace!( + target: "analysis:subscription", "applying default subscriptions for {} at {} for {dependent} for analysis state {}", unsafe { current_analysis.as_ref().debug_name() }, info.anchor(), diff --git a/hir-analysis/src/dense/backward.rs b/hir-analysis/src/dense/backward.rs index 551a86cc1..e4743f526 100644 --- a/hir-analysis/src/dense/backward.rs +++ b/hir-analysis/src/dense/backward.rs @@ -179,7 +179,7 @@ pub fn process_operation( where A: DenseBackwardDataFlowAnalysis, { - log::trace!("processing op {}", op.name()); + log::trace!(target: analysis.analysis.debug_name(), "processing op {}", op.name()); let point = ProgramPoint::before(op); // If the containing block is not executable, bail out. if op.parent().is_none_or(|block| { @@ -187,16 +187,16 @@ where .require::(ProgramPoint::at_start_of(block), point) .is_live() }) { - log::trace!("skipping analysis for {}: containing block is dead/not executable", op.name()); + log::trace!(target: analysis.analysis.debug_name(), "skipping analysis for {}: containing block is dead/not executable", op.name()); return Ok(()); } // Get the dense lattice to update. - log::trace!("getting 'before' analysis state for {point}"); + log::trace!(target: analysis.analysis.debug_name(), "getting 'before' analysis state for {point}"); let mut before = solver.get_or_create_mut(point); // Get the dense state after execution of this op. - log::trace!("getting 'after' analysis state for {}", ProgramPoint::after(op)); + log::trace!(target: analysis.analysis.debug_name(), "getting 'after' analysis state for {}", ProgramPoint::after(op)); // If this is the last operation in it's block, propagate the liveness of the block end to // after this op let after = if op.as_operation_ref().next().is_none() { @@ -217,7 +217,7 @@ where // Special cases where control flow may dictate data flow. if let Some(branch) = op.as_trait::() { - log::trace!("op implements RegionBranchOpInterface, handling as special case"); + log::trace!(target: analysis.analysis.debug_name(), "op implements RegionBranchOpInterface, handling as special case"); visit_region_branch_operation( analysis, point, @@ -230,13 +230,13 @@ where } if let Some(call) = op.as_trait::() { - log::trace!("op implements CallOpInterface, handling as special case"); + log::trace!(target: analysis.analysis.debug_name(), "op implements CallOpInterface, handling as special case"); visit_call_operation(analysis, call, &after, &mut before, solver); return Ok(()); } // Invoke the operation transfer function. - log::trace!("invoking {}::visit_operation", core::any::type_name::()); + log::trace!(target: analysis.analysis.debug_name(), "invoking {}::visit_operation", core::any::type_name::()); analysis.visit_operation(op, &after, &mut before, solver) } @@ -249,14 +249,14 @@ pub fn visit_block( ) where A: DenseBackwardDataFlowAnalysis, { - log::trace!("processing block {}", block.id()); + log::trace!(target: analysis.analysis.debug_name(), "processing block {}", block.id()); let point = ProgramPoint::at_end_of(block); // If the block is not executable, bail out. if !solver .require::(ProgramPoint::at_start_of(block), point) .is_live() { - log::trace!("skipping analysis for {}: it is dead/not executable", block.id()); + log::trace!(target: analysis.analysis.debug_name(), "skipping analysis for {}: it is dead/not executable", block.id()); return; } @@ -276,17 +276,18 @@ pub fn visit_block( }; if is_region_exit_block(block) { - log::trace!("{} is a region exit block", block.id()); + log::trace!(target: analysis.analysis.debug_name(), "{} is a region exit block", block.id()); // If this block is exiting from a callable, the successors of exiting from a callable are // the successors of all call sites. And the call sites themselves are predecessors of the // callable. let parent_op = block.parent_op().expect("orphaned block"); let region = block.parent().unwrap(); if let Some(callable) = parent_op.borrow().as_trait::() { - log::trace!("{}'s parent implements CallableOpInterface", block.id()); + log::trace!(target: analysis.analysis.debug_name(), "{}'s parent implements CallableOpInterface", block.id()); let callable_region = callable.get_callable_region(); if callable_region.is_some_and(|r| r == region) { log::trace!( + target: analysis.analysis.debug_name(), "{}'s parent region is a callable region - getting analysis state for call \ sites", block.id() @@ -297,8 +298,8 @@ pub fn visit_block( ); // If not all call sites are known, conservative mark all lattices as // having reached their pessimistic fix points. - log::trace!("all predecessors known: {}", callsites.all_predecessors_known()); - log::trace!("solver is inter-procedural: {}", solver.config().is_interprocedural()); + log::trace!(target: analysis.analysis.debug_name(), "all predecessors known: {}", callsites.all_predecessors_known()); + log::trace!(target: analysis.analysis.debug_name(), "solver is inter-procedural: {}", solver.config().is_interprocedural()); if !callsites.all_predecessors_known() || !solver.config().is_interprocedural() { return analysis.set_to_exit_state(&mut before, solver); } @@ -307,6 +308,7 @@ pub fn visit_block( let call = callsite.borrow(); let call = call.as_trait::().expect("invalid callsite"); log::trace!( + target: analysis.analysis.debug_name(), "visiting control flow transfer exit from call to {}", call.callable_for_callee() ); @@ -327,7 +329,7 @@ pub fn visit_block( // If this block is exiting from an operation with region-based control flow, propagate the // lattice back along the control flow edge. if let Some(branch) = parent_op.borrow().as_trait::() { - log::trace!("{}'s parent implements RegionBranchOpInterface", block.id()); + log::trace!(target: analysis.analysis.debug_name(), "{}'s parent implements RegionBranchOpInterface", block.id()); return visit_region_branch_operation( analysis, point, @@ -339,12 +341,13 @@ pub fn visit_block( } // Cannot reason about successors of an exit block, set the pessimistic fixpoint. - log::trace!("cannot reason about successors of {} - setting to exit state", block.id()); + log::trace!(target: analysis.analysis.debug_name(), "cannot reason about successors of {} - setting to exit state", block.id()); return analysis.set_to_exit_state(&mut before, solver); } // Meet the state with the state before block's successors. log::trace!( + target: analysis.analysis.debug_name(), "meeting the before lattice with the after lattice of {}'s successors", block.id() ); @@ -357,6 +360,7 @@ pub fn visit_block( .is_live() { log::trace!( + target: analysis.analysis.debug_name(), "skipping dead/non-executable control flow edge {} -> {successor}", block.id() ); @@ -365,7 +369,7 @@ pub fn visit_block( // Merge in the state from the successor: either the first operation, or the block itself // when empty. - log::trace!("meeting before lattice of {} and after lattice of {successor}", block.id()); + log::trace!(target: analysis.analysis.debug_name(), "meeting before lattice of {} and after lattice of {successor}", block.id()); let after = solver.require(ProgramPoint::before(successor), point); analysis.visit_branch_control_flow_transfer(block, successor, &after, &mut before, solver); } @@ -467,16 +471,17 @@ pub fn visit_region_branch_operation( ) where A: DenseBackwardDataFlowAnalysis, { - log::trace!("visiting region branch operation from {point}"); + log::trace!(target: analysis.analysis.debug_name(), "visiting region branch operation from {point}"); // The successors of the operation may be either the first operation of the entry block of each // possible successor region, or the next operation when the branch is a successor of itself. for successor in branch.get_successor_regions(branch_point) { - log::trace!("visiting region branch successor {}", successor.branch_point()); + log::trace!(target: analysis.analysis.debug_name(), "visiting region branch successor {}", successor.branch_point()); let successor_region = successor.successor(); let after = match successor_region.as_ref() { None => { // The successor is `branch` itself log::trace!( + target: analysis.analysis.debug_name(), "getting 'after' analysis state for {}", ProgramPoint::after(branch.as_operation()) ); @@ -487,6 +492,7 @@ pub fn visit_region_branch_operation( let block = region.borrow().entry_block_ref().expect("unexpected empty successor region"); log::trace!( + target: analysis.analysis.debug_name(), "getting 'after' analysis state for {}", ProgramPoint::at_start_of(block) ); @@ -495,6 +501,7 @@ pub fn visit_region_branch_operation( .is_live() { log::trace!( + target: analysis.analysis.debug_name(), "skipping successor {region} because its entry block is \ dead/non-executable", ); diff --git a/hir-analysis/src/solver.rs b/hir-analysis/src/solver.rs index b498f38bc..c40465cfe 100644 --- a/hir-analysis/src/solver.rs +++ b/hir-analysis/src/solver.rs @@ -211,7 +211,7 @@ impl DataFlowSolver { // Log a warning when this happens, since the calling code might benefit from not // even instantiating the solver in the first place. let location = core::panic::Location::caller(); - log::warn!(target: "dataflow-solver", "dataflow solver was run without any loaded analyses at {location}"); + log::warn!(target: "dataflow:solver", "dataflow solver was run without any loaded analyses at {location}"); return Ok(()); } @@ -228,7 +228,7 @@ impl DataFlowSolver { /// Once initialization is complete, every analysis has been run exactly once, but some may have /// been re-enqueued due to dependencies on analysis states which changed during initialization. fn analyze(&mut self, op: &Operation, analysis_manager: AnalysisManager) -> Result<(), Report> { - log::debug!(target: "dataflow-solver", "initializing loaded analyses"); + log::debug!(target: "dataflow:solver", "initializing loaded analyses"); for mut analysis in core::mem::take(&mut self.child_analyses) { // priming analysis {analysis.debug_name()} @@ -243,7 +243,7 @@ impl DataFlowSolver { self.current_analysis = None; } - log::debug!(target: "dataflow-solver", "initialization complete!"); + log::debug!(target: "dataflow:solver", "initialization complete!"); Ok(()) } @@ -304,7 +304,7 @@ impl DataFlowSolver { /// value. The "most-maximal" state in this analysis however, is a conflict, i.e. the value is /// over specified, because we are able to observe a counter-example. fn run_to_fixpoint(&mut self) -> Result<(), Report> { - log::debug!(target: "dataflow-solver", "running queued dataflow analyses to fixpoint.."); + log::debug!(target: "dataflow:solver", "running queued dataflow analyses to fixpoint.."); // Run the analysis until fixpoint while let Some(QueuedAnalysis { @@ -379,23 +379,23 @@ impl DataFlowSolver { { use hashbrown::hash_map::Entry; - log::trace!(target: "dataflow-solver", "computing analysis state entry key"); - log::trace!(target: "dataflow-solver", " loc = {}", core::panic::Location::caller()); - log::trace!(target: "dataflow-solver", " anchor = {anchor}"); - log::trace!(target: "dataflow-solver", " anchor ty = {}", core::any::type_name::()); + log::trace!(target: "dataflow:solver", "computing analysis state entry key"); + log::trace!(target: "dataflow:solver", " loc = {}", core::panic::Location::caller()); + log::trace!(target: "dataflow:solver", " anchor = {anchor}"); + log::trace!(target: "dataflow:solver", " anchor ty = {}", core::any::type_name::()); let anchor = self.create_lattice_anchor::(anchor); - log::trace!(target: "dataflow-solver", " anchor id = {}", anchor.anchor_id()); + log::trace!(target: "dataflow:solver", " anchor id = {}", anchor.anchor_id()); let key = AnalysisStateKey::new::(anchor); - log::trace!(target: "dataflow-solver", " key = {key:?}"); - log::trace!(target: "dataflow-solver", " lattice = {}", core::any::type_name::()); + log::trace!(target: "dataflow:solver", " key = {key:?}"); + log::trace!(target: "dataflow:solver", " lattice = {}", core::any::type_name::()); match self.analysis_state.borrow_mut().entry(key) { Entry::Occupied(entry) => { - log::trace!(target: "dataflow-solver", "found existing analysis state entry"); + log::trace!(target: "dataflow:solver", "found existing analysis state entry"); let info = *entry.get(); unsafe { AnalysisStateGuard::::new(info) } } Entry::Vacant(entry) => { - log::trace!(target: "dataflow-solver", "creating new analysis state entry"); + log::trace!(target: "dataflow:solver", "creating new analysis state entry"); use crate::analysis::state::RawAnalysisStateInfo; let raw_info = RawAnalysisStateInfo::::alloc( &self.alloc, @@ -440,23 +440,23 @@ impl DataFlowSolver { { use hashbrown::hash_map::Entry; - log::trace!(target: "dataflow-solver", "computing analysis state entry key"); - log::trace!(target: "dataflow-solver", " loc = {}", core::panic::Location::caller()); - log::trace!(target: "dataflow-solver", " anchor = {anchor}"); - log::trace!(target: "dataflow-solver", " anchor ty = {}", core::any::type_name::()); + log::trace!(target: "dataflow:solver", "computing analysis state entry key"); + log::trace!(target: "dataflow:solver", " loc = {}", core::panic::Location::caller()); + log::trace!(target: "dataflow:solver", " anchor = {anchor}"); + log::trace!(target: "dataflow:solver", " anchor ty = {}", core::any::type_name::()); let anchor = self.create_lattice_anchor::(anchor); - log::trace!(target: "dataflow-solver", " anchor id = {}", anchor.anchor_id()); + log::trace!(target: "dataflow:solver", " anchor id = {}", anchor.anchor_id()); let key = AnalysisStateKey::new::(anchor); - log::trace!(target: "dataflow-solver", " key = {key:?}"); - log::trace!(target: "dataflow-solver", " lattice = {}", core::any::type_name::()); + log::trace!(target: "dataflow:solver", " key = {key:?}"); + log::trace!(target: "dataflow:solver", " lattice = {}", core::any::type_name::()); match self.analysis_state.borrow_mut().entry(key) { Entry::Occupied(entry) => { - log::trace!(target: "dataflow-solver", "found existing analysis state entry"); + log::trace!(target: "dataflow:solver", "found existing analysis state entry"); let info = *entry.get(); unsafe { AnalysisStateGuardMut::::new(info, self.worklist.clone()) } } Entry::Vacant(entry) => { - log::trace!(target: "dataflow-solver", "creating new analysis state entry"); + log::trace!(target: "dataflow:solver", "creating new analysis state entry"); use crate::analysis::state::RawAnalysisStateInfo; let raw_info = RawAnalysisStateInfo::::alloc( &self.alloc, @@ -500,24 +500,24 @@ impl DataFlowSolver { analysis::state::{RawAnalysisStateInfo, RawAnalysisStateInfoHandle}, }; - log::trace!(target: "dataflow-solver", "computing analysis state entry key"); - log::trace!(target: "dataflow-solver", " loc = {}", core::panic::Location::caller()); - log::trace!(target: "dataflow-solver", " anchor = {anchor}"); - log::trace!(target: "dataflow-solver", " anchor ty = {}", core::any::type_name::()); + log::trace!(target: "dataflow:solver", "computing analysis state entry key"); + log::trace!(target: "dataflow:solver", " loc = {}", core::panic::Location::caller()); + log::trace!(target: "dataflow:solver", " anchor = {anchor}"); + log::trace!(target: "dataflow:solver", " anchor ty = {}", core::any::type_name::()); let anchor = self.create_lattice_anchor::(anchor); - log::trace!(target: "dataflow-solver", " anchor id = {}", anchor.anchor_id()); + log::trace!(target: "dataflow:solver", " anchor id = {}", anchor.anchor_id()); let key = AnalysisStateKey::new::(anchor); - log::trace!(target: "dataflow-solver", " key = {key:?}"); - log::trace!(target: "dataflow-solver", " lattice = {}", core::any::type_name::()); - log::trace!(target: "dataflow-solver", " dependent = {dependent}"); + log::trace!(target: "dataflow:solver", " key = {key:?}"); + log::trace!(target: "dataflow:solver", " lattice = {}", core::any::type_name::()); + log::trace!(target: "dataflow:solver", " dependent = {dependent}"); let (info, mut handle) = match self.analysis_state.borrow_mut().entry(key) { Entry::Occupied(entry) => { - log::trace!(target: "dataflow-solver", "found existing analysis state entry"); + log::trace!(target: "dataflow:solver", "found existing analysis state entry"); let info = *entry.get(); (info, unsafe { RawAnalysisStateInfoHandle::new(info) }) } Entry::Vacant(entry) => { - log::trace!(target: "dataflow-solver", "creating new analysis state entry"); + log::trace!(target: "dataflow:solver", "creating new analysis state entry"); let raw_info = RawAnalysisStateInfo::::alloc( &self.alloc, &mut self.analysis_state_impls, diff --git a/hir-analysis/src/sparse/backward.rs b/hir-analysis/src/sparse/backward.rs index 6c7cf28fa..919975637 100644 --- a/hir-analysis/src/sparse/backward.rs +++ b/hir-analysis/src/sparse/backward.rs @@ -87,12 +87,12 @@ pub(super) fn initialize_recursively( where A: SparseBackwardDataFlowAnalysis, { - log::trace!("initializing op recursively"); + log::trace!(target: analysis.analysis.debug_name(), "initializing op recursively"); visit_operation(analysis, op, solver)?; for region in op.regions() { for block in region.body() { - log::trace!("initializing analysis for block {}", block.id()); + log::trace!(target: analysis.analysis.debug_name(), "initializing analysis for block {}", block.id()); { let state = solver.get_or_create::(ProgramPoint::at_start_of(&*block)); @@ -102,14 +102,14 @@ where // Initialize ops in reverse order, so we can do as much initial propagation as possible // without having to go through the solver queue. let mut ops = block.body().back(); - log::trace!("initializing ops of {} bottom-up", block.id()); + log::trace!(target: analysis.analysis.debug_name(), "initializing ops of {} bottom-up", block.id()); while let Some(op) = ops.as_pointer() { ops.move_prev(); let op = op.borrow(); initialize_recursively(analysis, &op, solver)?; } - log::trace!("all ops of {} have been initialized", block.id()); + log::trace!(target: analysis.analysis.debug_name(), "all ops of {} have been initialized", block.id()); } } @@ -134,24 +134,25 @@ where .is_live() }); if in_dead_block { - log::trace!("skipping analysis for op in dead/non-executable block: {op}"); + log::trace!(target: analysis.analysis.debug_name(), "skipping analysis for op in dead/non-executable block: {op}"); return Ok(()); } let current_point = ProgramPoint::after(op); - let mut operands = get_lattice_elements_mut::(op.operands().all(), solver); - let results = get_lattice_elements_for::(current_point, op.results().all(), solver); + let mut operands = get_lattice_elements_mut::(analysis, op.operands().all(), solver); + let results = + get_lattice_elements_for::(analysis, current_point, op.results().all(), solver); // Block arguments of region branch operations flow back into the operands of the parent op if let Some(branch) = op.as_trait::() { - log::trace!("op implements RegionBranchOpInterface - handling as special case"); + log::trace!(target: analysis.analysis.debug_name(), "op implements RegionBranchOpInterface - handling as special case"); visit_region_successors(analysis, branch, solver); return Ok(()); } // Block arguments of successor blocks flow back into our operands. if let Some(branch) = op.as_trait::() { - log::trace!("op implements BranchOpInterface - handling as special case"); + log::trace!(target: analysis.analysis.debug_name(), "op implements BranchOpInterface - handling as special case"); // We remember all operands not forwarded to any block in a bitvector. // We can't just cut out a range here, since the non-forwarded ops might be non-contiguous @@ -168,9 +169,13 @@ where if let Some(block_arg) = branch.get_successor_block_argument(operand_index + num_produced) { - let mut operand_lattice = - get_lattice_element_mut::(operand.borrow().as_value_ref(), solver); + let mut operand_lattice = get_lattice_element_mut::( + analysis, + operand.borrow().as_value_ref(), + solver, + ); let result_lattice = get_lattice_element_for::( + analysis, current_point, block_arg.borrow().as_value_ref(), solver, @@ -194,15 +199,15 @@ where // For function calls, connect the arguments of the entry blocks to the operands of the call op // that are forwarded to these arguments. if let Some(call) = op.as_trait::() { - log::trace!("op implements CallOpInterface - handling as special case"); + log::trace!(target: analysis.analysis.debug_name(), "op implements CallOpInterface - handling as special case"); // TODO: resolve_in_symbol_table if let Some(callable_symbol) = call.resolve() { let callable_symbol = callable_symbol.borrow(); - log::trace!("resolved callee as {}", callable_symbol.name()); + log::trace!(target: analysis.analysis.debug_name(), "resolved callee as {}", callable_symbol.name()); let callable_op = callable_symbol.as_symbol_operation(); if let Some(callable) = callable_op.as_trait::() { - log::trace!("{} implements CallableOpInterface", callable_symbol.name()); + log::trace!(target: analysis.analysis.debug_name(), "{} implements CallableOpInterface", callable_symbol.name()); // Not all operands of a call op forward to arguments. Such operands are stored in // `unaccounted`. let mut unaccounted = bitvec![1; op.num_operands()]; @@ -215,21 +220,25 @@ where if region.as_ref().is_none_or(|region| { region.borrow().is_empty() || !solver.config().is_interprocedural() }) { - log::trace!("{} is an external callee", callable_symbol.name()); + log::trace!(target: analysis.analysis.debug_name(), "{} is an external callee", callable_symbol.name()); analysis.visit_external_call(call, &mut operands, &results, solver); return Ok(()); } // Otherwise, propagate information from the entry point of the function back to // operands whenever possible. - log::trace!("propagating value lattices from callee entry to call operands"); + log::trace!(target: analysis.analysis.debug_name(), "propagating value lattices from callee entry to call operands"); let region = region.unwrap(); let region = region.borrow(); let block = region.entry(); for (block_arg, arg_operand) in block.arguments().iter().zip(arg_operands.iter()) { - let mut arg_lattice = - get_lattice_element_mut::(arg_operand.borrow().as_value_ref(), solver); + let mut arg_lattice = get_lattice_element_mut::( + analysis, + arg_operand.borrow().as_value_ref(), + solver, + ); let result_lattice = get_lattice_element_for::( + analysis, current_point, block_arg.borrow().as_value_ref(), solver, @@ -258,11 +267,12 @@ where // operands: the operands of this op itself and the operands of the terminators of the regions // of this op. if let Some(terminator) = op.as_trait::() { - log::trace!("op implements RegionBranchTerminatorOpInterface"); + log::trace!(target: analysis.analysis.debug_name(), "op implements RegionBranchTerminatorOpInterface"); let parent_op = op.parent_op().unwrap(); let parent_op = parent_op.borrow(); if let Some(branch) = parent_op.as_trait::() { log::trace!( + target: analysis.analysis.debug_name(), "op's parent implements RegionBranchOpInterface - handling as special case" ); visit_region_successors_from_terminator(analysis, terminator, branch, solver); @@ -271,27 +281,32 @@ where } if op.implements::() { - log::trace!("op implements ReturnLike"); + log::trace!(target: analysis.analysis.debug_name(), "op implements ReturnLike"); // Going backwards, the operands of the return are derived from the results of all CallOps // calling this CallableOp. let parent_op = op.parent_op().unwrap(); let parent_op = parent_op.borrow(); if let Some(callable) = parent_op.as_trait::() { - log::trace!("op's parent implements CallableOpInterface - visiting call sites"); + log::trace!(target: analysis.analysis.debug_name(), "op's parent implements CallableOpInterface - visiting call sites"); let callsites = solver.require::( ProgramPoint::after(callable.as_operation()), current_point, ); if callsites.all_predecessors_known() { log::trace!( + target: analysis.analysis.debug_name(), "found all {} call sites of the current callable op", callsites.known_predecessors().len() ); - log::trace!("meeting lattices of return values and call site results"); + log::trace!(target: analysis.analysis.debug_name(), "meeting lattices of return values and call site results"); for call in callsites.known_predecessors() { let call = call.borrow(); - let call_result_lattices = - get_lattice_elements_for::(current_point, call.results().all(), solver); + let call_result_lattices = get_lattice_elements_for::( + analysis, + current_point, + call.results().all(), + solver, + ); for (op, result) in operands.iter_mut().zip(call_result_lattices.into_iter()) { op.meet(result.lattice()); } @@ -301,6 +316,7 @@ where // Note that, in particular, this will trigger for the return ops of any public // functions. log::trace!( + target: analysis.analysis.debug_name(), "not all call sites are known - setting return value lattices to exit state" ); set_all_to_exit_states(analysis, &mut operands); @@ -309,7 +325,7 @@ where } } - log::trace!("invoking {}::visit_operation", core::any::type_name::()); + log::trace!(target: analysis.analysis.debug_name(), "invoking {}::visit_operation", core::any::type_name::()); analysis.visit_operation(op, &mut operands, &results, solver) } @@ -338,9 +354,11 @@ fn visit_region_successors( for (operand, input) in operands.forwarded().iter().zip(inputs.iter()) { let operand = operand.borrow(); let operand_index = operand.index as usize; - let mut operand_lattice = get_lattice_element_mut::(operand.as_value_ref(), solver); + let mut operand_lattice = + get_lattice_element_mut::(analysis, operand.as_value_ref(), solver); let point = ProgramPoint::after(op); - let input_lattice = get_lattice_element_for::(point, input, solver); + let input_lattice = get_lattice_element_for::(analysis, point, input, solver); + operand_lattice.meet(input_lattice.lattice()); unaccounted.set(operand_index, false); } @@ -391,9 +409,10 @@ fn visit_region_successors_from_terminator( let operands = terminator.get_successor_operands(*successor.branch_point()); for (operand, input) in operands.forwarded().iter().zip(inputs.iter()) { let operand = operand.borrow(); - let mut operand_lattice = get_lattice_element_mut::(operand.as_value_ref(), solver); + let mut operand_lattice = + get_lattice_element_mut::(analysis, operand.as_value_ref(), solver); let point = ProgramPoint::after(terminator_op); - let input_lattice = get_lattice_element_for::(point, input, solver); + let input_lattice = get_lattice_element_for::(analysis, point, input, solver); operand_lattice.meet(input_lattice.lattice()); unaccounted.set(operand.index(), false); } @@ -408,18 +427,20 @@ fn visit_region_successors_from_terminator( #[inline] fn get_lattice_element_mut<'guard, A>( + analysis: &SparseDataFlowAnalysis, value: ValueRef, solver: &mut DataFlowSolver, ) -> AnalysisStateGuardMut<'guard, ::Lattice> where A: SparseBackwardDataFlowAnalysis, { - log::trace!("getting lattice for {value}"); + log::trace!(target: analysis.debug_name(), "getting lattice for {value}"); solver.get_or_create_mut::<_, _>(value) } #[inline] fn get_lattice_element_for<'guard, A>( + analysis: &SparseDataFlowAnalysis, point: ProgramPoint, value: ValueRef, solver: &mut DataFlowSolver, @@ -427,18 +448,19 @@ fn get_lattice_element_for<'guard, A>( where A: SparseBackwardDataFlowAnalysis, { - log::trace!("getting lattice for {value} at {point}"); + log::trace!(target: analysis.debug_name(), "getting lattice for {value} at {point}"); solver.require::<_, _>(value, point) } fn get_lattice_elements_mut<'guard, A>( + analysis: &SparseDataFlowAnalysis, values: OpOperandRange<'_>, solver: &mut DataFlowSolver, ) -> SmallVec<[AnalysisStateGuardMut<'guard, ::Lattice>; 2]> where A: SparseBackwardDataFlowAnalysis, { - log::trace!("getting lattices for {:#?}", values.as_slice()); + log::trace!(target: analysis.debug_name(), "getting lattices for {:#?}", values.as_slice()); let mut results = SmallVec::with_capacity(values.len()); for value in values.iter() { let lattice = solver.get_or_create_mut::<_, _>(value.borrow().as_value_ref()); @@ -450,6 +472,7 @@ where /// Get the lattice elements for a range of values, and also set up dependencies so that the /// analysis on the given ProgramPoint is re-invoked if any of the values change. fn get_lattice_elements_for<'guard, A>( + analysis: &SparseDataFlowAnalysis, point: ProgramPoint, values: OpResultRange<'_>, solver: &mut DataFlowSolver, @@ -457,7 +480,7 @@ fn get_lattice_elements_for<'guard, A>( where A: SparseBackwardDataFlowAnalysis, { - log::trace!("getting lattices for {:#?}", values.as_slice()); + log::trace!(target: analysis.debug_name(), "getting lattices for {:#?}", values.as_slice()); let mut results = SmallVec::with_capacity(values.len()); for value in values.iter() { let lattice = solver.require(value.borrow().as_value_ref(), point); diff --git a/hir-analysis/src/sparse/forward.rs b/hir-analysis/src/sparse/forward.rs index ade2ed582..a993db9a6 100644 --- a/hir-analysis/src/sparse/forward.rs +++ b/hir-analysis/src/sparse/forward.rs @@ -280,18 +280,19 @@ pub(super) fn visit_block( return; } - // Get the argument lattices. - let mut arg_lattices = SmallVec::<[_; 4]>::with_capacity(block.num_arguments()); - for argument in block.arguments().iter().copied() { - log::trace!(target: analysis.debug_name(), "getting/initializing lattice for {argument}"); - let lattice = get_lattice_element_mut::(argument as ValueRef, solver); - arg_lattices.push(lattice); - } - // The argument lattices of entry blocks are set by region control-flow or the callgraph. let current_point = ProgramPoint::at_start_of(block); if block.is_entry_block() { log::trace!(target: analysis.debug_name(), "{block} is a region entry block"); + + // Get the argument lattices. + let mut arg_lattices = SmallVec::<[_; 4]>::with_capacity(block.num_arguments()); + for argument in block.arguments().iter().copied() { + log::trace!(target: analysis.debug_name(), "getting/initializing lattice for {argument}"); + let lattice = get_lattice_element_mut::(argument as ValueRef, solver); + arg_lattices.push(lattice); + } + // Check if this block is the entry block of a callable region. let parent_op = block.parent_op().unwrap(); let parent_op = parent_op.borrow(); @@ -339,6 +340,7 @@ pub(super) fn visit_block( target: analysis.debug_name(), "{block} is the entry of an region control flow op", ); + return visit_region_successors( analysis, current_point, @@ -399,19 +401,35 @@ pub(super) fn visit_block( pred.index ); let operands = branch.get_successor_operands(pred.index()); - for (idx, lattice) in arg_lattices.iter_mut().enumerate() { + + for (idx, argument) in block.arguments().iter().copied().enumerate() { + let arg = argument as ValueRef; if let Some(operand) = operands.get(idx).and_then(|operand| operand.into_value_ref()) { - log::trace!(target: analysis.debug_name(), "joining lattice for {} with {operand}", lattice.anchor()); + log::trace!(target: analysis.debug_name(), "joining lattice for {arg} with {operand}"); + // If the block argument is being passed as a successor opernad in the same + // position, then we could end up attempting to obtain the same lattice twice, + // thus special handling is needed let operand_lattice = get_lattice_element_for::(current_point, operand, solver); - let change_result = lattice.join(operand_lattice.lattice()); - log::debug!(target: analysis.debug_name(), "updated lattice for {} to {:#?}: {change_result}", lattice.anchor(), lattice); + let (change_result, arg_lattice) = if arg == operand { + let lattice_value = operand_lattice.lattice().clone(); + drop(operand_lattice); + let mut arg_lattice = get_lattice_element_mut::(arg, solver); + let change_result = arg_lattice.join(&lattice_value); + (change_result, arg_lattice) + } else { + let mut arg_lattice = get_lattice_element_mut::(arg, solver); + let change_result = arg_lattice.join(operand_lattice.lattice()); + (change_result, arg_lattice) + }; + log::debug!(target: analysis.debug_name(), "updated lattice for {arg} to {:#?}: {change_result}", &arg_lattice); } else { // Conservatively consider internally produced arguments as entry points. - log::trace!(target: analysis.debug_name(), "setting lattice for internally-produced argument {} to entry state", lattice.anchor()); - analysis.set_to_entry_state(lattice); + log::trace!(target: analysis.debug_name(), "setting lattice for internally-produced argument {arg} to entry state"); + let mut arg_lattice = get_lattice_element_mut::(arg, solver); + analysis.set_to_entry_state(&mut arg_lattice); } } } else { @@ -420,6 +438,13 @@ pub(super) fn visit_block( "unable to reason about predecessor control flow - setting argument lattices to \ entry state" ); + // Get the argument lattices. + let mut arg_lattices = SmallVec::<[_; 4]>::with_capacity(block.num_arguments()); + for argument in block.arguments().iter().copied() { + log::trace!(target: analysis.debug_name(), "getting/initializing lattice for {argument}"); + let lattice = get_lattice_element_mut::(argument as ValueRef, solver); + arg_lattices.push(lattice); + } return set_all_to_entry_states(analysis, &mut arg_lattices); } } diff --git a/hir-analysis/src/sparse/lattice.rs b/hir-analysis/src/sparse/lattice.rs index 8e0d6d766..f1326aa3f 100644 --- a/hir-analysis/src/sparse/lattice.rs +++ b/hir-analysis/src/sparse/lattice.rs @@ -5,7 +5,7 @@ use crate::{AnalysisState, ChangeResult}; /// It is propagated through the IR by sparse data-flow analysis. #[allow(unused_variables)] pub trait SparseLattice: AnalysisState + core::fmt::Debug { - type Lattice; + type Lattice: Clone; /// Get the underlying lattice value fn lattice(&self) -> &Self::Lattice; diff --git a/hir-symbol/src/symbols.toml b/hir-symbol/src/symbols.toml index 5a6a25bc8..8485978d4 100644 --- a/hir-symbol/src/symbols.toml +++ b/hir-symbol/src/symbols.toml @@ -121,9 +121,10 @@ mem = {} note = {} output_note = {} faucet = {} -rpo_falcon512 = {} -std = {} +falcon512rpo = {} tx = {} -rpo = {} +rpo256 = {} collections = {} smt = {} +protocol = {} +core = {} diff --git a/hir-transform/Cargo.toml b/hir-transform/Cargo.toml index 392098ed5..9869f26f9 100644 --- a/hir-transform/Cargo.toml +++ b/hir-transform/Cargo.toml @@ -16,3 +16,11 @@ log.workspace = true midenc-hir.workspace = true midenc-hir-analysis.workspace = true midenc-session.workspace = true + +[dev-dependencies] +litcheck.workspace = true +litcheck-filecheck.workspace = true +midenc-dialect-arith = { path = "../dialects/arith" } +midenc-dialect-hir = { path = "../dialects/hir" } +midenc-dialect-scf = { path = "../dialects/scf" } +midenc-log = { path = "../midenc-log" } diff --git a/hir-transform/src/canonicalization.rs b/hir-transform/src/canonicalization.rs index ad57b0f97..83a26d590 100644 --- a/hir-transform/src/canonicalization.rs +++ b/hir-transform/src/canonicalization.rs @@ -32,6 +32,8 @@ impl Default for Canonicalizer { } impl Canonicalizer { + const NAME: &str = "canonicalizer"; + pub fn new(config: GreedyRewriteConfig, require_convergence: bool) -> Self { Self { config, @@ -59,11 +61,11 @@ impl Pass for Canonicalizer { type Target = Operation; fn name(&self) -> &'static str { - "canonicalizer" + Self::NAME } fn argument(&self) -> &'static str { - "canonicalizer" + Self::NAME } fn description(&self) -> &'static str { @@ -75,7 +77,7 @@ impl Pass for Canonicalizer { } fn initialize(&mut self, context: Rc) -> Result<(), Report> { - log::trace!(target: "canonicalization", "initializing canonicalizer pass"); + log::trace!(target: Self::NAME, "initializing canonicalizer pass"); let mut rewrites = RewritePatternSet::new(context.clone()); for dialect in context.registered_dialects().values() { @@ -95,21 +97,21 @@ impl Pass for Canonicalizer { state: &mut PassExecutionState, ) -> Result<(), Report> { let Some(rewrites) = self.rewrites.as_ref() else { - log::debug!(target: "canonicalization", "skipping canonicalization as there are no rewrite patterns to apply"); + log::debug!(target: Self::NAME, "skipping canonicalization as there are no rewrite patterns to apply"); state.set_post_pass_status(PostPassStatus::Unchanged); return Ok(()); }; let op = { let ptr = op.as_operation_ref(); drop(op); - log::debug!(target: "canonicalization", "applying canonicalization to {}", ptr.borrow()); - log::debug!(target: "canonicalization", " require_convergence = {}", self.require_convergence); + log::debug!(target: Self::NAME, "applying canonicalization to {}", ptr.borrow()); + log::debug!(target: Self::NAME, " require_convergence = {}", self.require_convergence); ptr }; let converged = patterns::apply_patterns_and_fold_greedily(op, rewrites.clone(), self.config.clone()); if self.require_convergence && converged.is_err() { - log::debug!(target: "canonicalization", "canonicalization could not converge"); + log::debug!(target: Self::NAME, "canonicalization could not converge"); let span = op.borrow().span(); return Err(state .context() @@ -132,12 +134,12 @@ impl Pass for Canonicalizer { let op = op.borrow(); let changed = match converged { Ok(changed) => { - log::debug!(target: "canonicalization", "canonicalization converged for '{}', changed={changed}", op.name()); + log::debug!(target: Self::NAME, "canonicalization converged for '{}', changed={changed}", op.name()); changed } Err(changed) => { log::warn!( - target: "canonicalization", + target: Self::NAME, "canonicalization failed to converge for '{}', changed={changed}", op.name() ); diff --git a/hir-transform/src/cfg_to_scf/transform.rs b/hir-transform/src/cfg_to_scf/transform.rs index 9869b83f3..999e56669 100644 --- a/hir-transform/src/cfg_to_scf/transform.rs +++ b/hir-transform/src/cfg_to_scf/transform.rs @@ -913,11 +913,6 @@ impl<'a> TransformationContext<'a> { let loop_header_arguments_prior = loop_header.borrow().arguments().iter().copied().collect::>(); - // Ensure the dominance tree DFS numbers have been computed - if !self.region.borrow().has_one_block() { - self.dominance_info.dominance(self.region).update_dfs_numbers(); - } - // Go over all values defined within the loop body. If any of them are used outside the loop // body, create a block argument on the exit block and loop header and replace the outside // uses with the exit block argument. The loop header block argument is added to satisfy diff --git a/hir-transform/src/cse.rs b/hir-transform/src/cse.rs new file mode 100644 index 000000000..ff879ccb5 --- /dev/null +++ b/hir-transform/src/cse.rs @@ -0,0 +1,1318 @@ +use alloc::{rc::Rc, vec::Vec}; + +use midenc_hir::{ + AsValueRange, BlockRef, EntityMut, FxHashMap, Operation, OperationName, OperationRef, + RegionRef, Report, Rewriter, RewriterExt, SmallVec, ValueRef, + adt::SmallDenseMap, + cfg::Graph, + dominance::{DomTreeNode, DominanceInfo, PostDominanceInfo}, + effects::MemoryEffect, + pass::{Pass, PassExecutionState, PostPassStatus}, + patterns::{RewriterImpl, RewriterListener, TracingRewriterListener}, + traits::{IsolatedFromAbove, Terminator}, +}; + +/// This transformation pass performs a simple common sub-expression elimination algorithm on +/// operations within a region. +pub struct CommonSubexpressionElimination; + +impl Pass for CommonSubexpressionElimination { + type Target = Operation; + + fn name(&self) -> &'static str { + "cse" + } + + fn argument(&self) -> &'static str { + "common-subexpression-elimination" + } + + fn can_schedule_on(&self, _name: &OperationName) -> bool { + true + } + + fn run_on_operation( + &mut self, + op: EntityMut<'_, Self::Target>, + state: &mut PassExecutionState, + ) -> Result<(), Report> { + // Run sparse constant propagation + dead code analysis + let op = op.into_entity_ref(); + + // Rewrite based on results of analysis + let context = op.context_rc(); + let op = { + let op_ref = op.as_operation_ref(); + drop(op); + op_ref + }; + + let dominfo = state.analysis_manager().get_analysis::()?; + let mut rewriter = RewriterImpl::::new(context) + .with_listener(TracingRewriterListener); + + let mut driver = CSEDriver { + rewriter: &mut rewriter, + domtree: dominfo, + ops_to_erase: Default::default(), + mem_effects_cache: Default::default(), + }; + + let status = driver.simplify(op); + + if status.ir_changed() { + // We currently don't remove region operations, so mark dominance as preserved. + state.preserved_analyses_mut().preserve::(); + state.preserved_analyses_mut().preserve::(); + } else { + // If there was no change to the IR, we mark all analyses as preserved. + state.preserved_analyses_mut().preserve_all(); + } + + Ok(()) + } +} + +/// Simple common sub-expression elimination. +struct CSEDriver<'a> { + rewriter: &'a mut RewriterImpl, + /// Operations marked as dead and to be erased. + ops_to_erase: Vec, + /// Dominance info provided by the current analysis state + domtree: Rc, + /// Cache holding MemoryEffect information between two operations. + /// + /// The first operation is the key, the second operation is paired with whatever effect exists + /// between the two operations. If the effect is None, then we assume there is no operation with + /// `MemoryEffect::Write` between the two operations. + mem_effects_cache: SmallDenseMap)>, +} + +type ScopedMap = FxHashMap; + +impl CSEDriver<'_> { + pub fn simplify(&mut self, op: OperationRef) -> PostPassStatus { + // Simplify all regions. + let mut known_values = ScopedMap::default(); + let mut next_region = op.borrow().regions().front().as_pointer(); + let mut status = PostPassStatus::Unchanged; + while let Some(region) = next_region.take() { + next_region = region.next(); + + status |= self.simplify_region(&mut known_values, region); + } + + // Erase any operations that were marked as dead during simplification. + status |= PostPassStatus::from(!self.ops_to_erase.is_empty()); + for op in self.ops_to_erase.drain(..) { + self.rewriter.erase_op(op); + } + + status + } + + /// Attempt to eliminate a redundant operation. + /// + /// Returns success if the operation was marked for removal, failure otherwise. + fn simplify_operation( + &mut self, + known_values: &mut ScopedMap, + op: OperationRef, + has_ssa_dominance: bool, + ) -> PostPassStatus { + // Don't simplify terminator operations. + let operation = op.borrow(); + if operation.implements::() { + return PostPassStatus::Unchanged; + } + + // If the operation is already trivially dead just add it to the erase list. + if operation.is_trivially_dead() { + self.ops_to_erase.push(op); + return PostPassStatus::Changed; + } + + // Don't simplify operations with regions that have multiple blocks. + // TODO: We need additional tests to verify that we handle such IR correctly. + if !operation.regions().iter().all(|r| r.is_empty() || r.has_one_block()) { + return PostPassStatus::Unchanged; + } + + // Some simple use case of operation with memory side-effect are dealt with here. + // Operations with no side-effect are done after. + if !operation.is_memory_effect_free() { + // TODO: Only basic use case for operations with MemoryEffects::Read can be + // eleminated now. More work needs to be done for more complicated patterns + // and other side-effects. + if !operation.has_single_memory_effect(MemoryEffect::Read) { + return PostPassStatus::Unchanged; + } + + // Look for an existing definition for the operation. + if let Some(existing) = known_values.get(&OpKey(op)).copied() + && existing.parent() == op.parent() + && !self.has_other_side_effecting_op_in_between(existing, op) + { + // The operation that can be deleted has been reach with no + // side-effecting operations in between the existing operation and + // this one so we can remove the duplicate. + self.replace_uses_and_delete(known_values, op, existing, has_ssa_dominance); + return PostPassStatus::Changed; + } + known_values.insert(OpKey(op), op); + return PostPassStatus::Unchanged; + } + + // Look for an existing definition for the operation. + if let Some(existing) = known_values.get(&OpKey(op)).copied() { + self.replace_uses_and_delete(known_values, op, existing, has_ssa_dominance); + PostPassStatus::Changed + } else { + // Otherwise, we add this operation to the known values map. + known_values.insert(OpKey(op), op); + PostPassStatus::Unchanged + } + } + + fn simplify_block( + &mut self, + known_values: &mut ScopedMap, + block: BlockRef, + has_ssa_dominance: bool, + ) -> PostPassStatus { + let mut changed = PostPassStatus::Unchanged; + let mut next_op = block.borrow().body().front().as_pointer(); + while let Some(op) = next_op.take() { + next_op = op.next(); + + // Most operations don't have regions, so fast path that case. + let operation = op.borrow(); + if operation.has_regions() { + // If this operation is isolated above, we can't process nested regions with the + // given 'known_values' map. This would cause the insertion of implicit captures in + // explicit capture only regions. + if operation.implements::() { + let mut nested_known_values = ScopedMap::default(); + let mut next_region = operation.regions().front().as_pointer(); + while let Some(region) = next_region.take() { + next_region = region.next(); + + changed |= self.simplify_region(&mut nested_known_values, region); + } + } else { + // Otherwise, process nested regions normally. + let mut next_region = operation.regions().front().as_pointer(); + while let Some(region) = next_region.take() { + next_region = region.next(); + + changed |= self.simplify_region(known_values, region); + } + } + } + + changed |= self.simplify_operation(known_values, op, has_ssa_dominance); + } + + // Clear the MemoryEffect cache since its usage is by block only. + self.mem_effects_cache.clear(); + + changed + } + + fn simplify_region( + &mut self, + known_values: &mut ScopedMap, + region: RegionRef, + ) -> PostPassStatus { + // If the region is empty there is nothing to do. + let region = region.borrow(); + if region.is_empty() { + return PostPassStatus::Unchanged; + } + + let has_ssa_dominance = self.domtree.has_ssa_dominance(region.as_region_ref()); + + // If the region only contains one block, then simplify it directly. + if region.has_one_block() { + let mut scope = known_values.clone(); + let block = region.entry_block_ref().unwrap(); + drop(region); + return self.simplify_block(&mut scope, block, has_ssa_dominance); + } + + // If the region does not have dominanceInfo, then skip it. + // TODO: Regions without SSA dominance should define a different traversal order which is + // appropriate and can be used here. + if !has_ssa_dominance { + return PostPassStatus::Unchanged; + } + + // Process the nodes of the dom tree for this region. + let mut stack = Vec::::with_capacity(16); + let dominfo = self.domtree.dominance(region.as_region_ref()); + stack.push(CfgStackNode::new(known_values.clone(), dominfo.root_node().unwrap())); + + let mut changed = PostPassStatus::Unchanged; + while let Some(current_node) = stack.last_mut() { + // Check to see if we need to process this node. + if !current_node.processed { + current_node.processed = true; + changed |= self.simplify_block( + &mut current_node.scope, + current_node.node.block().unwrap(), + has_ssa_dominance, + ); + } + + // Otherwise, check to see if we need to process a child node. + if let Some(next_child) = current_node.children.next() { + let scope = current_node.scope.clone(); + stack.push(CfgStackNode::new(scope, next_child)); + } else { + // Finally, if the node and all of its children have been processed then we delete + // the node. + stack.pop(); + } + } + changed + } + + fn replace_uses_and_delete( + &mut self, + known_values: &ScopedMap, + op: OperationRef, + mut existing: OperationRef, + has_ssa_dominance: bool, + ) { + // If we find one then replace all uses of the current operation with the existing one and + // mark it for deletion. We can only replace an operand in an operation if it has not been + // visited yet. + if has_ssa_dominance { + // If the region has SSA dominance, then we are guaranteed to have not visited any use + // of the current operation. + self.rewriter.notify_operation_replaced(op, existing); + // Replace all uses, but do not remove the operation yet. This does not notify the + // listener because the original op is not erased. + let operation = op.borrow(); + let existing = existing.borrow(); + let op_results = operation.results().as_value_range().into_smallvec(); + let existing_results = existing + .results() + .iter() + .copied() + .map(|result| Some(result as ValueRef)) + .collect::>(); + self.rewriter.replace_all_uses_with(&op_results, &existing_results); + self.ops_to_erase.push(op); + } else { + // When the region does not have SSA dominance, we need to check if we have visited a + // use before replacing any use. + let was_visited = |operand: &midenc_hir::OpOperandImpl| { + !known_values.contains_key(&OpKey(operand.owner)) + }; + + let op_results = op.borrow().results().as_value_range().into_smallvec(); + let should_replace_op = op_results.iter().all(|v| { + let v = v.borrow(); + v.iter_uses().all(|user| was_visited(&user)) + }); + if should_replace_op { + self.rewriter.notify_operation_replaced(op, existing); + } + + // Replace all uses, but do not remove the operation yet. This does not notify the + // listener because the original op is not erased. + let existing_results = existing.borrow().results().as_value_range().into_smallvec(); + self.rewriter + .maybe_replace_uses_with(&op_results, &existing_results, was_visited); + + // There may be some remaining uses of the operation. + if !op.borrow().is_used() { + self.ops_to_erase.push(op); + } + } + + // If the existing operation has an unknown location and the current operation doesn't, + // then set the existing op's location to that of the current op. + let mut existing = existing.borrow_mut(); + let op_span = op.borrow().span; + if existing.span.is_unknown() && !op_span.is_unknown() { + existing.set_span(op_span); + } + } + + /// Check if there is side-effecting operations other than the given effect between the two + /// operations. + fn has_other_side_effecting_op_in_between( + &mut self, + from: OperationRef, + to: OperationRef, + ) -> bool { + assert_eq!(from.parent(), to.parent(), "expected operations to be in the same block"); + let from_op = from.borrow(); + assert!( + from_op.has_memory_effect(MemoryEffect::Read), + "expected read effect on `from` op" + ); + assert!( + to.borrow().has_memory_effect(MemoryEffect::Read), + "expected read effect on `to` op" + ); + + let result = self.mem_effects_cache.entry(from).or_insert((from, None)); + let mut next_op = if result.1.is_none() { + // No `MemoryEffect::Write` has been detected until the cached operation, continue + // looking from the cached operation to `to`. + Some(result.0) + } else { + // MemoryEffects::Write has been detected before so there is no need to check + // further. + return true; + }; + + while let Some(next) = next_op.take() + && next != to + { + next_op = next.next(); + + let effects = next.borrow().get_effects_recursively::(); + if let Some(effects) = effects.as_deref() { + for effect in effects { + if effect.effect() == MemoryEffect::Write { + *result = (next, Some(MemoryEffect::Write)); + return true; + } + } + } else { + // TODO: Do we need to handle other effects generically? + // If the operation does not implement the MemoryEffectOpInterface we conservatively + // assume it writes. + *result = (next, Some(MemoryEffect::Write)); + return true; + } + } + + *result = (to, None); + false + } +} + +/// Represents a single entry in the depth first traversal of a CFG. +struct CfgStackNode { + /// Scope for the known values. + scope: ScopedMap, + node: Rc, + children: as Graph>::ChildIter, + /// If this node has been fully processed yet or not. + processed: bool, +} + +impl CfgStackNode { + pub fn new(scope: ScopedMap, node: Rc) -> Self { + let children = as Graph>::children(node.clone()); + Self { + scope, + node, + children, + processed: false, + } + } +} + +/// A wrapper type for [OperationRef] which hashes/compares using operation equivalence flags that +/// ignore locations and result values, considering only operands and properties of the operation +/// itself +#[derive(Copy, Clone)] +struct OpKey(OperationRef); + +impl core::hash::Hash for OpKey { + fn hash(&self, state: &mut H) { + use midenc_hir::equivalence::{ + DefaultValueHasher, IgnoreValueHasher, OperationEquivalenceFlags, + }; + self.0.borrow().hash_with_options( + OperationEquivalenceFlags::IGNORE_LOCATIONS, + DefaultValueHasher, + IgnoreValueHasher, + state, + ); + } +} + +impl Eq for OpKey {} +impl PartialEq for OpKey { + fn eq(&self, other: &Self) -> bool { + use midenc_hir::equivalence::OperationEquivalenceFlags; + + if self.0 == other.0 { + return true; + } + let lhs = self.0.borrow(); + let rhs = other.0.borrow(); + + lhs.is_equivalent_with_options(&rhs, OperationEquivalenceFlags::IGNORE_LOCATIONS, |l, r| { + core::ptr::addr_eq(l, r) + }) + } +} + +#[cfg(test)] +mod tests { + use alloc::{boxed::Box, format, string::ToString, sync::Arc}; + + use litcheck_filecheck::filecheck; + use midenc_dialect_arith::ArithOpBuilder; + use midenc_hir::{ + AbiParam, Context, Ident, OpBuilder, OpPrinter, PointerType, Signature, SourceSpan, Type, + dialects::builtin::{BuiltinOpBuilder, Function, FunctionBuilder, FunctionRef}, + pass::PassManager, + }; + + use super::*; + + #[test] + fn simple_constant() { + let mut test = Test::new("simple_constant", &[], &[Type::I32, Type::I32]); + { + let mut builder = test.function_builder(); + let v0 = builder.i32(1, SourceSpan::UNKNOWN); + let v1 = builder.i32(1, SourceSpan::UNKNOWN); + builder.ret([v0, v1], SourceSpan::UNKNOWN).unwrap(); + } + + test.run_cse(true).expect("invalid ir"); + + let output = + format!("{}", test.function().borrow().print(&Default::default(), &test.context)); + filecheck!( + output, + r#" +builtin.function @simple_constant() -> (i32, i32) { +^block0: + // CHECK: [[V0:v\d+]] = arith.constant 1 : i32; + v0 = arith.constant 1 : i32; + + // CHECK-NEXT: builtin.ret [[V0]], [[V0]]; + v1 = arith.constant 1 : i32; + builtin.ret v0, v1; +}; + "# + ); + } + + #[test] + fn basic() { + let mut test = Test::new("basic", &[], &[Type::I32, Type::I32]); + { + let mut builder = test.function_builder(); + let v0 = builder.i32(0, SourceSpan::UNKNOWN); + let v1 = builder.i32(0, SourceSpan::UNKNOWN); + let v2 = builder.i32(1, SourceSpan::UNKNOWN); + let v3 = builder.mul(v0, v2, SourceSpan::UNKNOWN).unwrap(); + let v4 = builder.mul(v1, v2, SourceSpan::UNKNOWN).unwrap(); + builder.ret([v3, v4], SourceSpan::UNKNOWN).unwrap(); + } + + test.run_cse(true).expect("invalid ir"); + + let output = + format!("{}", test.function().borrow().print(&Default::default(), &test.context)); + filecheck!( + output, + r#" +builtin.function @basic() -> (i32, i32) { +^block0: + // CHECK: [[V0:v\d+]] = arith.constant 0 : i32; + v0 = arith.constant 0 : i32; + v1 = arith.constant 0 : i32; + + // CHECK-NEXT: [[V2:v\d+]] = arith.constant 1 : i32; + v2 = arith.constant 1 : i32; + + // CHECK-NEXT: [[V3:v\d+]] = arith.mul [[V0]], [[V2]] : i32 #[overflow = checked]; + v3 = arith.mul v0, v2 : i32 #[overflow = checked]; + v4 = arith.mul v1, v2 : i32 #[overflow = checked]; + + // CHECK-NEXT: builtin.ret [[V3]], [[V3]]; + builtin.ret v3, v3; +}; + "# + ); + } + + #[test] + fn many() { + let mut test = Test::new("many", &[Type::I32, Type::I32], &[Type::I32]); + { + let mut builder = test.function_builder(); + let [v0, v1] = *builder.entry_block().borrow().arguments()[0..2].as_array().unwrap(); + let v0 = v0 as ValueRef; + let v1 = v1 as ValueRef; + let v2 = builder.add(v0, v1, SourceSpan::UNKNOWN).unwrap(); + let v3 = builder.add(v0, v1, SourceSpan::UNKNOWN).unwrap(); + let v4 = builder.add(v0, v1, SourceSpan::UNKNOWN).unwrap(); + let v5 = builder.add(v0, v1, SourceSpan::UNKNOWN).unwrap(); + let v6 = builder.add(v2, v3, SourceSpan::UNKNOWN).unwrap(); + let v7 = builder.add(v4, v5, SourceSpan::UNKNOWN).unwrap(); + let v8 = builder.add(v2, v4, SourceSpan::UNKNOWN).unwrap(); + let v9 = builder.add(v6, v7, SourceSpan::UNKNOWN).unwrap(); + let v10 = builder.add(v7, v8, SourceSpan::UNKNOWN).unwrap(); + let v11 = builder.add(v9, v10, SourceSpan::UNKNOWN).unwrap(); + builder.ret([v11], SourceSpan::UNKNOWN).unwrap(); + } + + test.run_cse(true).expect("invalid ir"); + + let output = + format!("{}", test.function().borrow().print(&Default::default(), &test.context)); + filecheck!( + output, + r#" +builtin.function @many(v0: i32, v1: i32) -> i32 { +^block0(v0: i32, v1: i32): + // CHECK: [[V2:v\d+]] = arith.add v{{\d+}}, v{{\d+}} : i32 #[overflow = checked]; + v2 = arith.add v0 v1 : i32 #[overflow = checked]; + v3 = arith.add v0 v1 : i32 #[overflow = checked]; + v4 = arith.add v0 v1 : i32 #[overflow = checked]; + v5 = arith.add v0 v1 : i32 #[overflow = checked]; + + // CHECK-NEXT: [[V6:v\d+]] = arith.add [[V2]], [[V2]] : i32 #[overflow = checked]; + v6 = arith.add v2, v3 : i32 #[overflow = checked]; + v7 = arith.add v4, v5 : i32 #[overflow = checked]; + v8 = arith.add v2, v4 : i32 #[overflow = checked]; + + // CHECK-NEXT: [[V9:v\d+]] = arith.add [[V6]], [[V6]] : i32 #[overflow = checked]; + v9 = arith.add v6, v7 : i32 #[overflow = checked]; + v10 = arith.add v7, v8 : i32 #[overflow = checked]; + + // CHECK-NEXT: [[V11:v\d+]] = arith.add [[V9]], [[V9]] : i32 #[overflow = checked]; + v11 = arith.add v9, v10 : i32 #[overflow = checked]; + + // CHECK-NEXT: builtin.ret [[V11]]; + builtin.ret v11; +}; + "# + ); + } + + /// Check that operations are not eliminated if they have different operands. + #[test] + fn ops_with_different_operands_are_not_elimited() { + let mut test = Test::new("different_operands", &[], &[Type::I32, Type::I32]); + { + let mut builder = test.function_builder(); + let v0 = builder.i32(0, SourceSpan::UNKNOWN); + let v1 = builder.i32(1, SourceSpan::UNKNOWN); + builder.ret([v0, v1], SourceSpan::UNKNOWN).unwrap(); + } + + test.run_cse(true).expect("invalid ir"); + + let output = + format!("{}", test.function().borrow().print(&Default::default(), &test.context)); + filecheck!( + output, + r#" +builtin.function @different_operands() -> (i32, i32) { +^block0: + // CHECK: [[V0:v\d+]] = arith.constant 0 : i32; + // CHECK-NEXT: [[V1:v\d+]] = arith.constant 1 : i32; + v0 = arith.constant 0 : i32; + v1 = arith.constant 1 : i32; + + // CHECK-NEXT: builtin.ret [[V0]], [[V1]]; + builtin.ret v0, v1; +}; + "# + ); + } + + /// Check that operations are not eliminated if they have different result types. + #[test] + fn ops_with_different_result_types_are_not_elimited() { + let mut test = Test::new("different_results", &[Type::I32], &[Type::I64, Type::I128]); + { + let mut builder = test.function_builder(); + let v0 = builder.entry_block().borrow().arguments()[0] as ValueRef; + let v1 = builder.sext(v0, Type::I64, SourceSpan::UNKNOWN).unwrap(); + let v2 = builder.sext(v0, Type::I128, SourceSpan::UNKNOWN).unwrap(); + builder.ret([v1, v2], SourceSpan::UNKNOWN).unwrap(); + } + + test.run_cse(true).expect("invalid ir"); + + let output = + format!("{}", test.function().borrow().print(&Default::default(), &test.context)); + filecheck!( + output, + r#" +builtin.function @different_results(v0: i32) -> (i64, i128) { +^block0(v0: i32): + // CHECK: [[V1:v\d+]] = arith.sext v0 : i64; + // CHECK-NEXT: [[V2:v\d+]] = arith.sext v0 : i128; + v1 = arith.cast v0 : i64; + v2 = arith.cast v0 : i128; + + // CHECK-NEXT: builtin.ret [[V1]], [[V2]]; + builtin.ret v1, v2; +}; + "# + ); + } + + /// Check that operations are not eliminated if they have different attributes. + #[test] + fn ops_with_different_attributes_are_not_elimited() { + let mut test = Test::new("different_attributes", &[Type::I32], &[Type::I32, Type::I32]); + { + let mut builder = test.function_builder(); + let v0 = builder.entry_block().borrow().arguments()[0] as ValueRef; + let v1 = builder.i32(1, SourceSpan::UNKNOWN); + let v2 = builder.add(v0, v1, SourceSpan::UNKNOWN).unwrap(); + let v3 = builder.add_unchecked(v0, v1, SourceSpan::UNKNOWN).unwrap(); + builder.ret([v2, v3], SourceSpan::UNKNOWN).unwrap(); + } + + test.run_cse(true).expect("invalid ir"); + + let output = + format!("{}", test.function().borrow().print(&Default::default(), &test.context)); + filecheck!( + output, + r#" +builtin.function @different_attributes(v0: i32) -> (i32, i32) { +^block0(v0: i32): + // CHECK: [[V1:v\d+]] = arith.constant 1 : i32; + v1 = arith.constant 1 : i32; + + // CHECK-NEXT: [[V2:v\d+]] = arith.add v0, v1 : i32 #[overflow = checked]; + v2 = arith.add v0, v1 : i32 #[overflow = checked]; + + // CHECK-NEXT: [[V3:v\d+]] = arith.add v0, v1 : i32 #[overflow = unchecked]; + v3 = arith.add v0, v1 : i32 #[overflow = unchecked]; + + // CHECK-NEXT: builtin.ret [[V2]], [[V3]]; + builtin.ret v2, v3; +}; + "# + ); + } + + /// Check that operations with side effects are not eliminated. + #[test] + fn ops_with_side_effects_are_not_elimited() { + use midenc_dialect_hir::HirOpBuilder; + + let byte_ptr = Type::Ptr(Arc::new(PointerType::new(Type::U8))); + let mut test = + Test::new("side_effect", core::slice::from_ref(&byte_ptr), &[Type::U8, Type::U8]); + { + let mut builder = test.function_builder(); + let v0 = builder.entry_block().borrow().arguments()[0] as ValueRef; + let v1 = builder.u8(1, SourceSpan::UNKNOWN); + builder.store(v0, v1, SourceSpan::UNKNOWN).unwrap(); + let v2 = builder.load(v0, SourceSpan::UNKNOWN).unwrap(); + builder.store(v0, v1, SourceSpan::UNKNOWN).unwrap(); + let v3 = builder.load(v0, SourceSpan::UNKNOWN).unwrap(); + builder.ret([v2, v3], SourceSpan::UNKNOWN).unwrap(); + } + + test.run_cse(true).expect("invalid ir"); + + let output = + format!("{}", test.function().borrow().print(&Default::default(), &test.context)); + filecheck!( + output, + r#" +builtin.function @side_effect(v0: ptr) -> (u8, u8) { +^block0(v0: ptr): + // CHECK: [[V1:v\d+]] = arith.constant 1 : u8; + v1 = arith.constant 1 : u8; + + // CHECK-NEXT: hir.store v0, v1; + // CHECK-NEXT: [[V2:v\d+]] = hir.load v0 : u8; + hir.store v0, v1; + v2 = hir.load v0 : u8; + + // CHECK-NEXT: hir.store v0, v1; + // CHECK-NEXT: [[V3:v\d+]] = hir.load v0 : u8; + hir.store v0, v1; + v3 = hir.load v0 : u8; + + // CHECK-NEXT: builtin.ret [[V2]], [[V3]]; + builtin.ret v2, v3; +}; + "# + ); + } + + /// Check that operation definitions are properly propagated down the dominance tree. + #[test] + fn proper_propagation_of_ops_down_dominance_tree() { + use midenc_dialect_scf::StructuredControlFlowOpBuilder; + + let mut test = Test::new("down_propagate_while", &[], &[]); + { + let mut builder = test.function_builder(); + let v0 = builder.i32(0, SourceSpan::UNKNOWN); + let v1 = builder.i32(1, SourceSpan::UNKNOWN); + let v2 = builder.i32(4, SourceSpan::UNKNOWN); + let while_op = builder.r#while([v0, v1], &[], SourceSpan::UNKNOWN).unwrap(); + builder.ret(None, SourceSpan::UNKNOWN).unwrap(); + { + let before_block = while_op.borrow().before().entry().as_block_ref(); + let after_block = while_op.borrow().after().entry().as_block_ref(); + builder.switch_to_block(before_block); + let [v3, v4] = *before_block.borrow().arguments()[0..2].as_array().unwrap(); + let v3 = v3 as ValueRef; + let v4 = v4 as ValueRef; + let v5 = builder.i32(1, SourceSpan::UNKNOWN); + let v6 = builder.add(v3, v5, SourceSpan::UNKNOWN).unwrap(); + let v7 = builder.lt(v6, v2, SourceSpan::UNKNOWN).unwrap(); + builder.condition(v7, [v6, v4], SourceSpan::UNKNOWN).unwrap(); + + builder.switch_to_block(after_block); + let v8 = builder.append_block_param(after_block, Type::I32, SourceSpan::UNKNOWN); + let v9 = builder.append_block_param(after_block, Type::I32, SourceSpan::UNKNOWN); + builder.r#yield([v8 as ValueRef, v9 as ValueRef], SourceSpan::UNKNOWN).unwrap(); + } + } + + test.run_cse(true).expect("invalid ir"); + + let output = + format!("{}", test.function().borrow().print(&Default::default(), &test.context)); + std::println!("output: {output}"); + filecheck!( + output, + r#" +builtin.function @down_propagate_while() { +^block0: + // CHECK: [[V0:v\d+]] = arith.constant 0 : i32; + v0 = arith.constant 0 : i32; + // CHECK: [[V1:v\d+]] = arith.constant 1 : i32; + v1 = arith.constant 1 : i32; + // CHECK: [[V2:v\d+]] = arith.constant 4 : i32; + v2 = arith.constant 4 : i32; + + // CHECK-NEXT: scf.while v0, v1 { + // CHECK-NEXT: ^block{{\d}}([[V3:v\d+]]: i32, [[V4:v\d+]]: i32): + scf.while v0, v1 { + ^block1(v3: i32, v4: i32): + // CHECK-NEXT: [[V6:v\d+]] = arith.add [[V3]], [[V1]] : i32 #[overflow = checked]; + v5 = arith.constant 1 : i32; + v6 = arith.add v3, v5 : i32 #[overflow = checked]; + // CHECK-NEXT: [[V7:v\d+]] = arith.lt [[V6]], [[V2]] : i1; + v7 = arith.lt v6, v2 : i1; + // CHECK-NEXT: scf.condition [[V7]], [[V6]], [[V4]]; + scf.condition v7, v6, v4; + } do { + ^block2(v8: i32, v9: i32): + // CHECK-NEXT: } do { + // CHECK-NEXT: ^block{{\d}}([[V8:v\d+]]: i32, [[V9:v\d+]]: i32): + // CHECK-NEXT: scf.yield [[V8]], [[V9]]; + scf.yield v8, v9; + } + + // CHECK: builtin.ret ; + builtin.ret; +}; + "# + ); + } + + fn enable_compiler_instrumentation() { + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") + .format_timestamp(None) + .is_test(true) + .try_init(); + } + + struct Test { + context: Rc, + builder: OpBuilder, + function: FunctionRef, + } + + impl Test { + pub fn new(name: &'static str, params: &[Type], results: &[Type]) -> Self { + enable_compiler_instrumentation(); + + let context = Rc::new(Context::default()); + let mut builder = OpBuilder::new(context.clone()); + let function = builder + .create_function( + Ident::with_empty_span(name.into()), + Signature::new( + params.iter().cloned().map(AbiParam::new), + results.iter().cloned().map(AbiParam::new), + ), + ) + .unwrap(); + + Self { + context, + builder, + function, + } + } + + pub fn function(&self) -> FunctionRef { + self.function + } + + pub fn function_builder(&mut self) -> FunctionBuilder<'_, OpBuilder> { + FunctionBuilder::new(self.function, &mut self.builder) + } + + pub fn run_cse(&self, verify: bool) -> Result<(), Report> { + let mut pm = PassManager::on::( + self.context.clone(), + midenc_hir::pass::Nesting::Explicit, + ); + pm.add_pass(Box::new(CommonSubexpressionElimination)); + pm.enable_verifier(verify); + pm.run(self.function.as_operation_ref()) + } + } +} + +//------------ TESTS TO FINISH TRANSLATING +/* + +// CHECK-LABEL: @down_propagate +func.func @down_propagate() -> i32 { + // CHECK-NEXT: %[[VAR_c1_i32:[0-9a-zA-Z_]+]] = arith.constant 1 : i32 + %0 = arith.constant 1 : i32 + + // CHECK-NEXT: %[[VAR_true:[0-9a-zA-Z_]+]] = arith.constant true + %cond = arith.constant true + + // CHECK-NEXT: cf.cond_br %[[VAR_true]], ^bb1, ^bb2(%[[VAR_c1_i32]] : i32) + cf.cond_br %cond, ^bb1, ^bb2(%0 : i32) + +^bb1: // CHECK: ^bb1: + // CHECK-NEXT: cf.br ^bb2(%[[VAR_c1_i32]] : i32) + %1 = arith.constant 1 : i32 + cf.br ^bb2(%1 : i32) + +^bb2(%arg : i32): + return %arg : i32 +} + +// ----- + +/// Check that operation definitions are NOT propagated up the dominance tree. +// CHECK-LABEL: @up_propagate_for +func.func @up_propagate_for() -> i32 { + // CHECK: affine.for {{.*}} = 0 to 4 { + affine.for %i = 0 to 4 { + // CHECK-NEXT: %[[VAR_c1_i32_0:[0-9a-zA-Z_]+]] = arith.constant 1 : i32 + // CHECK-NEXT: "foo"(%[[VAR_c1_i32_0]]) : (i32) -> () + %0 = arith.constant 1 : i32 + "foo"(%0) : (i32) -> () + } + + // CHECK: %[[VAR_c1_i32:[0-9a-zA-Z_]+]] = arith.constant 1 : i32 + // CHECK-NEXT: return %[[VAR_c1_i32]] : i32 + %1 = arith.constant 1 : i32 + return %1 : i32 +} + +// ----- + +// CHECK-LABEL: func @up_propagate +func.func @up_propagate() -> i32 { + // CHECK-NEXT: %[[VAR_c0_i32:[0-9a-zA-Z_]+]] = arith.constant 0 : i32 + %0 = arith.constant 0 : i32 + + // CHECK-NEXT: %[[VAR_true:[0-9a-zA-Z_]+]] = arith.constant true + %cond = arith.constant true + + // CHECK-NEXT: cf.cond_br %[[VAR_true]], ^bb1, ^bb2(%[[VAR_c0_i32]] : i32) + cf.cond_br %cond, ^bb1, ^bb2(%0 : i32) + +^bb1: // CHECK: ^bb1: + // CHECK-NEXT: %[[VAR_c1_i32:[0-9a-zA-Z_]+]] = arith.constant 1 : i32 + %1 = arith.constant 1 : i32 + + // CHECK-NEXT: cf.br ^bb2(%[[VAR_c1_i32]] : i32) + cf.br ^bb2(%1 : i32) + +^bb2(%arg : i32): // CHECK: ^bb2 + // CHECK-NEXT: %[[VAR_c1_i32_0:[0-9a-zA-Z_]+]] = arith.constant 1 : i32 + %2 = arith.constant 1 : i32 + + // CHECK-NEXT: %[[VAR_1:[0-9a-zA-Z_]+]] = arith.addi %{{.*}}, %[[VAR_c1_i32_0]] : i32 + %add = arith.addi %arg, %2 : i32 + + // CHECK-NEXT: return %[[VAR_1]] : i32 + return %add : i32 +} + +// ----- + +/// The same test as above except that we are testing on a cfg embedded within +/// an operation region. +// CHECK-LABEL: func @up_propagate_region +func.func @up_propagate_region() -> i32 { + // CHECK-NEXT: {{.*}} "foo.region" + %0 = "foo.region"() ({ + // CHECK-NEXT: %[[VAR_c0_i32:[0-9a-zA-Z_]+]] = arith.constant 0 : i32 + // CHECK-NEXT: %[[VAR_true:[0-9a-zA-Z_]+]] = arith.constant true + // CHECK-NEXT: cf.cond_br + + %1 = arith.constant 0 : i32 + %true = arith.constant true + cf.cond_br %true, ^bb1, ^bb2(%1 : i32) + + ^bb1: // CHECK: ^bb1: + // CHECK-NEXT: %[[VAR_c1_i32:[0-9a-zA-Z_]+]] = arith.constant 1 : i32 + // CHECK-NEXT: cf.br + + %c1_i32 = arith.constant 1 : i32 + cf.br ^bb2(%c1_i32 : i32) + + ^bb2(%arg : i32): // CHECK: ^bb2(%[[VAR_1:.*]]: i32): + // CHECK-NEXT: %[[VAR_c1_i32_0:[0-9a-zA-Z_]+]] = arith.constant 1 : i32 + // CHECK-NEXT: %[[VAR_2:[0-9a-zA-Z_]+]] = arith.addi %[[VAR_1]], %[[VAR_c1_i32_0]] : i32 + // CHECK-NEXT: "foo.yield"(%[[VAR_2]]) : (i32) -> () + + %c1_i32_0 = arith.constant 1 : i32 + %2 = arith.addi %arg, %c1_i32_0 : i32 + "foo.yield" (%2) : (i32) -> () + }) : () -> (i32) + return %0 : i32 +} + +// ----- + +/// This test checks that nested regions that are isolated from above are +/// properly handled. +// CHECK-LABEL: @nested_isolated +func.func @nested_isolated() -> i32 { + // CHECK-NEXT: arith.constant 1 + %0 = arith.constant 1 : i32 + + // CHECK-NEXT: builtin.module + // CHECK-NEXT: @nested_func + builtin.module { + func.func @nested_func() { + // CHECK-NEXT: arith.constant 1 + %foo = arith.constant 1 : i32 + "foo.yield"(%foo) : (i32) -> () + } + } + + // CHECK: "foo.region" + "foo.region"() ({ + // CHECK-NEXT: arith.constant 1 + %foo = arith.constant 1 : i32 + "foo.yield"(%foo) : (i32) -> () + }) : () -> () + + return %0 : i32 +} + +// ----- + +/// This test is checking that CSE gracefully handles values in graph regions +/// where the use occurs before the def, and one of the defs could be CSE'd with +/// the other. +// CHECK-LABEL: @use_before_def +func.func @use_before_def() { + // CHECK-NEXT: test.graph_region + test.graph_region { + // CHECK-NEXT: arith.addi + %0 = arith.addi %1, %2 : i32 + + // CHECK-NEXT: arith.constant 1 + // CHECK-NEXT: arith.constant 1 + %1 = arith.constant 1 : i32 + %2 = arith.constant 1 : i32 + + // CHECK-NEXT: "foo.yield"(%{{.*}}) : (i32) -> () + "foo.yield"(%0) : (i32) -> () + } + return +} + +// ----- + +/// This test is checking that CSE is removing duplicated read op that follow +/// other. +// CHECK-LABEL: @remove_direct_duplicated_read_op +func.func @remove_direct_duplicated_read_op() -> i32 { + // CHECK-NEXT: %[[READ_VALUE:.*]] = "test.op_with_memread"() : () -> i32 + %0 = "test.op_with_memread"() : () -> (i32) + %1 = "test.op_with_memread"() : () -> (i32) + // CHECK-NEXT: %{{.*}} = arith.addi %[[READ_VALUE]], %[[READ_VALUE]] : i32 + %2 = arith.addi %0, %1 : i32 + return %2 : i32 +} + +// ----- + +/// This test is checking that CSE is removing duplicated read op that follow +/// other. +// CHECK-LABEL: @remove_multiple_duplicated_read_op +func.func @remove_multiple_duplicated_read_op() -> i64 { + // CHECK: %[[READ_VALUE:.*]] = "test.op_with_memread"() : () -> i64 + %0 = "test.op_with_memread"() : () -> (i64) + %1 = "test.op_with_memread"() : () -> (i64) + // CHECK-NEXT: %{{.*}} = arith.addi %{{.*}}, %[[READ_VALUE]] : i64 + %2 = arith.addi %0, %1 : i64 + %3 = "test.op_with_memread"() : () -> (i64) + // CHECK-NEXT: %{{.*}} = arith.addi %{{.*}}, %{{.*}} : i64 + %4 = arith.addi %2, %3 : i64 + %5 = "test.op_with_memread"() : () -> (i64) + // CHECK-NEXT: %{{.*}} = arith.addi %{{.*}}, %{{.*}} : i64 + %6 = arith.addi %4, %5 : i64 + // CHECK-NEXT: return %{{.*}} : i64 + return %6 : i64 +} + +// ----- + +/// This test is checking that CSE is not removing duplicated read op that +/// have write op in between. +// CHECK-LABEL: @dont_remove_duplicated_read_op_with_sideeffecting +func.func @dont_remove_duplicated_read_op_with_sideeffecting() -> i32 { + // CHECK-NEXT: %[[READ_VALUE0:.*]] = "test.op_with_memread"() : () -> i32 + %0 = "test.op_with_memread"() : () -> (i32) + "test.op_with_memwrite"() : () -> () + // CHECK: %[[READ_VALUE1:.*]] = "test.op_with_memread"() : () -> i32 + %1 = "test.op_with_memread"() : () -> (i32) + // CHECK-NEXT: %{{.*}} = arith.addi %[[READ_VALUE0]], %[[READ_VALUE1]] : i32 + %2 = arith.addi %0, %1 : i32 + return %2 : i32 +} + +// ----- + +// Check that an operation with a single region can CSE. +func.func @cse_single_block_ops(%a : tensor, %b : tensor) + -> (tensor, tensor) { + %0 = test.cse_of_single_block_op inputs(%a, %b) { + ^bb0(%arg0 : f32): + test.region_yield %arg0 : f32 + } : tensor, tensor -> tensor + %1 = test.cse_of_single_block_op inputs(%a, %b) { + ^bb0(%arg0 : f32): + test.region_yield %arg0 : f32 + } : tensor, tensor -> tensor + return %0, %1 : tensor, tensor +} +// CHECK-LABEL: func @cse_single_block_ops +// CHECK: %[[OP:.+]] = test.cse_of_single_block_op +// CHECK-NOT: test.cse_of_single_block_op +// CHECK: return %[[OP]], %[[OP]] + +// ----- + +// Operations with different number of bbArgs dont CSE. +func.func @no_cse_varied_bbargs(%a : tensor, %b : tensor) + -> (tensor, tensor) { + %0 = test.cse_of_single_block_op inputs(%a, %b) { + ^bb0(%arg0 : f32, %arg1 : f32): + test.region_yield %arg0 : f32 + } : tensor, tensor -> tensor + %1 = test.cse_of_single_block_op inputs(%a, %b) { + ^bb0(%arg0 : f32): + test.region_yield %arg0 : f32 + } : tensor, tensor -> tensor + return %0, %1 : tensor, tensor +} +// CHECK-LABEL: func @no_cse_varied_bbargs +// CHECK: %[[OP0:.+]] = test.cse_of_single_block_op +// CHECK: %[[OP1:.+]] = test.cse_of_single_block_op +// CHECK: return %[[OP0]], %[[OP1]] + +// ----- + +// Operations with different regions dont CSE +func.func @no_cse_region_difference_simple(%a : tensor, %b : tensor) + -> (tensor, tensor) { + %0 = test.cse_of_single_block_op inputs(%a, %b) { + ^bb0(%arg0 : f32, %arg1 : f32): + test.region_yield %arg0 : f32 + } : tensor, tensor -> tensor + %1 = test.cse_of_single_block_op inputs(%a, %b) { + ^bb0(%arg0 : f32, %arg1 : f32): + test.region_yield %arg1 : f32 + } : tensor, tensor -> tensor + return %0, %1 : tensor, tensor +} +// CHECK-LABEL: func @no_cse_region_difference_simple +// CHECK: %[[OP0:.+]] = test.cse_of_single_block_op +// CHECK: %[[OP1:.+]] = test.cse_of_single_block_op +// CHECK: return %[[OP0]], %[[OP1]] + +// ----- + +// Operation with identical region with multiple statements CSE. +func.func @cse_single_block_ops_identical_bodies(%a : tensor, %b : tensor, %c : f32, %d : i1) + -> (tensor, tensor) { + %0 = test.cse_of_single_block_op inputs(%a, %b) { + ^bb0(%arg0 : f32, %arg1 : f32): + %1 = arith.divf %arg0, %arg1 : f32 + %2 = arith.remf %arg0, %c : f32 + %3 = arith.select %d, %1, %2 : f32 + test.region_yield %3 : f32 + } : tensor, tensor -> tensor + %1 = test.cse_of_single_block_op inputs(%a, %b) { + ^bb0(%arg0 : f32, %arg1 : f32): + %1 = arith.divf %arg0, %arg1 : f32 + %2 = arith.remf %arg0, %c : f32 + %3 = arith.select %d, %1, %2 : f32 + test.region_yield %3 : f32 + } : tensor, tensor -> tensor + return %0, %1 : tensor, tensor +} +// CHECK-LABEL: func @cse_single_block_ops_identical_bodies +// CHECK: %[[OP:.+]] = test.cse_of_single_block_op +// CHECK-NOT: test.cse_of_single_block_op +// CHECK: return %[[OP]], %[[OP]] + +// ----- + +// Operation with non-identical regions dont CSE. +func.func @no_cse_single_block_ops_different_bodies(%a : tensor, %b : tensor, %c : f32, %d : i1) + -> (tensor, tensor) { + %0 = test.cse_of_single_block_op inputs(%a, %b) { + ^bb0(%arg0 : f32, %arg1 : f32): + %1 = arith.divf %arg0, %arg1 : f32 + %2 = arith.remf %arg0, %c : f32 + %3 = arith.select %d, %1, %2 : f32 + test.region_yield %3 : f32 + } : tensor, tensor -> tensor + %1 = test.cse_of_single_block_op inputs(%a, %b) { + ^bb0(%arg0 : f32, %arg1 : f32): + %1 = arith.divf %arg0, %arg1 : f32 + %2 = arith.remf %arg0, %c : f32 + %3 = arith.select %d, %2, %1 : f32 + test.region_yield %3 : f32 + } : tensor, tensor -> tensor + return %0, %1 : tensor, tensor +} +// CHECK-LABEL: func @no_cse_single_block_ops_different_bodies +// CHECK: %[[OP0:.+]] = test.cse_of_single_block_op +// CHECK: %[[OP1:.+]] = test.cse_of_single_block_op +// CHECK: return %[[OP0]], %[[OP1]] + +// ----- + +func.func @failing_issue_59135(%arg0: tensor<2x2xi1>, %arg1: f32, %arg2 : tensor<2xi1>) -> (tensor<2xi1>, tensor<2xi1>) { + %false_2 = arith.constant false + %true_5 = arith.constant true + %9 = test.cse_of_single_block_op inputs(%arg2) { + ^bb0(%out: i1): + %true_144 = arith.constant true + test.region_yield %true_144 : i1 + } : tensor<2xi1> -> tensor<2xi1> + %15 = test.cse_of_single_block_op inputs(%arg2) { + ^bb0(%out: i1): + %true_144 = arith.constant true + test.region_yield %true_144 : i1 + } : tensor<2xi1> -> tensor<2xi1> + %93 = arith.maxsi %false_2, %true_5 : i1 + return %9, %15 : tensor<2xi1>, tensor<2xi1> +} +// CHECK-LABEL: func @failing_issue_59135 +// CHECK: %[[TRUE:.+]] = arith.constant true +// CHECK: %[[OP:.+]] = test.cse_of_single_block_op +// CHECK: test.region_yield %[[TRUE]] +// CHECK: return %[[OP]], %[[OP]] + +// ----- + +func.func @cse_multiple_regions(%c: i1, %t: tensor<5xf32>) -> (tensor<5xf32>, tensor<5xf32>) { + %r1 = scf.if %c -> (tensor<5xf32>) { + %0 = tensor.empty() : tensor<5xf32> + scf.yield %0 : tensor<5xf32> + } else { + scf.yield %t : tensor<5xf32> + } + %r2 = scf.if %c -> (tensor<5xf32>) { + %0 = tensor.empty() : tensor<5xf32> + scf.yield %0 : tensor<5xf32> + } else { + scf.yield %t : tensor<5xf32> + } + return %r1, %r2 : tensor<5xf32>, tensor<5xf32> +} +// CHECK-LABEL: func @cse_multiple_regions +// CHECK: %[[if:.*]] = scf.if {{.*}} { +// CHECK: tensor.empty +// CHECK: scf.yield +// CHECK: } else { +// CHECK: scf.yield +// CHECK: } +// CHECK-NOT: scf.if +// CHECK: return %[[if]], %[[if]] + +// ----- + +// CHECK-LABEL: @cse_recursive_effects_success +func.func @cse_recursive_effects_success() -> (i32, i32, i32) { + // CHECK-NEXT: %[[READ_VALUE:.*]] = "test.op_with_memread"() : () -> i32 + %0 = "test.op_with_memread"() : () -> (i32) + + // do something with recursive effects, containing no side effects + %true = arith.constant true + // CHECK-NEXT: %[[TRUE:.+]] = arith.constant true + // CHECK-NEXT: %[[IF:.+]] = scf.if %[[TRUE]] -> (i32) { + %1 = scf.if %true -> (i32) { + %c42 = arith.constant 42 : i32 + scf.yield %c42 : i32 + // CHECK-NEXT: %[[C42:.+]] = arith.constant 42 : i32 + // CHECK-NEXT: scf.yield %[[C42]] + // CHECK-NEXT: } else { + } else { + %c24 = arith.constant 24 : i32 + scf.yield %c24 : i32 + // CHECK-NEXT: %[[C24:.+]] = arith.constant 24 : i32 + // CHECK-NEXT: scf.yield %[[C24]] + // CHECK-NEXT: } + } + + // %2 can be removed + // CHECK-NEXT: return %[[READ_VALUE]], %[[READ_VALUE]], %[[IF]] : i32, i32, i32 + %2 = "test.op_with_memread"() : () -> (i32) + return %0, %2, %1 : i32, i32, i32 +} + +// ----- + +// CHECK-LABEL: @cse_recursive_effects_failure +func.func @cse_recursive_effects_failure() -> (i32, i32, i32) { + // CHECK-NEXT: %[[READ_VALUE:.*]] = "test.op_with_memread"() : () -> i32 + %0 = "test.op_with_memread"() : () -> (i32) + + // do something with recursive effects, containing a write effect + %true = arith.constant true + // CHECK-NEXT: %[[TRUE:.+]] = arith.constant true + // CHECK-NEXT: %[[IF:.+]] = scf.if %[[TRUE]] -> (i32) { + %1 = scf.if %true -> (i32) { + "test.op_with_memwrite"() : () -> () + // CHECK-NEXT: "test.op_with_memwrite"() : () -> () + %c42 = arith.constant 42 : i32 + scf.yield %c42 : i32 + // CHECK-NEXT: %[[C42:.+]] = arith.constant 42 : i32 + // CHECK-NEXT: scf.yield %[[C42]] + // CHECK-NEXT: } else { + } else { + %c24 = arith.constant 24 : i32 + scf.yield %c24 : i32 + // CHECK-NEXT: %[[C24:.+]] = arith.constant 24 : i32 + // CHECK-NEXT: scf.yield %[[C24]] + // CHECK-NEXT: } + } + + // %2 can not be be removed because of the write + // CHECK-NEXT: %[[READ_VALUE2:.*]] = "test.op_with_memread"() : () -> i32 + // CHECK-NEXT: return %[[READ_VALUE]], %[[READ_VALUE2]], %[[IF]] : i32, i32, i32 + %2 = "test.op_with_memread"() : () -> (i32) + return %0, %2, %1 : i32, i32, i32 +} +*/ diff --git a/hir-transform/src/lib.rs b/hir-transform/src/lib.rs index e869c2578..c9c520ad5 100644 --- a/hir-transform/src/lib.rs +++ b/hir-transform/src/lib.rs @@ -8,19 +8,19 @@ extern crate std; mod canonicalization; mod cfg_to_scf; -//mod cse; //mod dce; +mod cse; //mod inliner; mod sccp; mod sink; mod spill; -//pub use self::cse::CommonSubexpressionElimination; //pub use self::dce::{DeadSymbolElmination, DeadValueElimination}; //pub use self::inliner::Inliner; pub use self::{ canonicalization::Canonicalizer, cfg_to_scf::{CFGToSCFInterface, transform_cfg_to_scf}, + cse::CommonSubexpressionElimination, sccp::SparseConditionalConstantPropagation, sink::{ControlFlowSink, SinkOperandDefs}, spill::{ReloadLike, SpillLike, TransformSpillsInterface, transform_spills}, diff --git a/hir-transform/src/sccp.rs b/hir-transform/src/sccp.rs index c779183cb..3b59efc18 100644 --- a/hir-transform/src/sccp.rs +++ b/hir-transform/src/sccp.rs @@ -1,8 +1,10 @@ +use alloc::rc::Rc; + use midenc_hir::{ - BlockRef, Builder, EntityMut, OpBuilder, Operation, OperationFolder, OperationName, RegionList, - Report, SmallVec, ValueRef, + BlockRef, Builder, Context, EntityMut, OpBuilder, Operation, OperationFolder, OperationName, + OperationRef, RegionList, Report, SmallVec, ValueRef, pass::{Pass, PassExecutionState}, - patterns::NoopRewriterListener, + patterns::TracingRewriterListener, }; use midenc_hir_analysis::{ DataFlowSolver, Lattice, @@ -36,17 +38,24 @@ impl Pass for SparseConditionalConstantPropagation { fn run_on_operation( &mut self, - mut op: EntityMut<'_, Self::Target>, + op: EntityMut<'_, Self::Target>, state: &mut PassExecutionState, ) -> Result<(), Report> { // Run sparse constant propagation + dead code analysis + let op = op.into_entity_ref(); let mut solver = DataFlowSolver::default(); solver.load::(); solver.load::(); solver.initialize_and_run(&op, state.analysis_manager().clone())?; // Rewrite based on results of analysis - self.rewrite(&mut op, state, &solver) + let context = op.context_rc(); + let op = { + let op_ref = op.as_operation_ref(); + drop(op); + op_ref + }; + self.rewrite(op, context, state, &solver) } } @@ -55,7 +64,8 @@ impl SparseConditionalConstantPropagation { /// that have been computed to be constant, and erases as many newly dead operations. fn rewrite( &mut self, - op: &mut Operation, + op: OperationRef, + context: Rc, state: &mut PassExecutionState, solver: &DataFlowSolver, ) -> Result<(), Report> { @@ -70,20 +80,20 @@ impl SparseConditionalConstantPropagation { }; // An operation folder used to create and unique constants. - let context = op.context_rc(); - let mut folder = OperationFolder::new(context.clone(), None::); + let mut folder = OperationFolder::new(context.clone(), TracingRewriterListener); let mut builder = OpBuilder::new(context.clone()); - add_to_worklist(op.regions(), &mut worklist); + { + let op = op.borrow(); + add_to_worklist(op.regions(), &mut worklist); + } let mut replaced_any = false; - while let Some(mut block) = worklist.pop() { - let mut block = block.borrow_mut(); - let body = block.body_mut(); - let mut ops = body.front(); + while let Some(block) = worklist.pop() { + let mut current_op = { block.borrow().body().front().as_pointer() }; - while let Some(mut op) = ops.as_pointer() { - ops.move_next(); + while let Some(op) = current_op.take() { + current_op = op.next(); builder.set_insertion_point_after(op); @@ -100,9 +110,10 @@ impl SparseConditionalConstantPropagation { // If all of the results of the operation were replaced, try to erase the operation // completely. - let mut op = op.borrow_mut(); + let op = op.borrow(); if replaced_all && op.would_be_trivially_dead() { assert!(!op.is_used(), "expected all uses to be replaced"); + let mut op = op.into_entity_mut().unwrap(); op.erase(); continue; } @@ -112,15 +123,11 @@ impl SparseConditionalConstantPropagation { } // Replace any block arguments with constants - builder.set_insertion_point_to_start(block.as_block_ref()); - - for arg in block.arguments() { - replaced_any |= replace_with_constant( - solver, - &mut builder, - &mut folder, - arg.borrow().as_value_ref(), - ); + builder.set_insertion_point_to_start(block); + + let block_arguments = SmallVec::<[_; 4]>::from_iter(block.borrow().argument_values()); + for arg in block_arguments { + replaced_any |= replace_with_constant(solver, &mut builder, &mut folder, arg); } } diff --git a/hir-transform/src/sink.rs b/hir-transform/src/sink.rs index d931786ff..3148d85a1 100644 --- a/hir-transform/src/sink.rs +++ b/hir-transform/src/sink.rs @@ -156,15 +156,19 @@ impl Pass for ControlFlowSink { /// ranges of values that are trivial to materialize on-demand. pub struct SinkOperandDefs; +impl SinkOperandDefs { + const NAME: &str = "sink-operand-defs"; +} + impl Pass for SinkOperandDefs { type Target = Operation; fn name(&self) -> &'static str { - "sink-operand-defs" + Self::NAME } fn argument(&self) -> &'static str { - "sink-operand-defs" + Self::NAME } fn can_schedule_on(&self, _name: &OperationName) -> bool { @@ -179,7 +183,7 @@ impl Pass for SinkOperandDefs { let operation = op.as_operation_ref(); drop(op); - log::debug!(target: "sink-operand-defs", "sinking operand defs for regions of {}", operation.borrow()); + log::debug!(target: Self::NAME, "sinking operand defs for regions of {}", operation.borrow()); // For each operation, we enqueue it in this worklist, we then recurse on each of it's // dependency operations until all dependencies have been visited. We move up blocks from @@ -206,7 +210,7 @@ impl Pass for SinkOperandDefs { // result will reduce the amount of unnecessary stack movement. let op = operation.borrow(); - log::trace!(target: "sink-operand-defs", "visiting {op}"); + log::trace!(target: Self::NAME, "visiting {op}"); for operand in op.operands().iter().rev() { let value = operand.borrow(); @@ -219,15 +223,15 @@ impl Pass for SinkOperandDefs { // NOTE: In theory, we could move effect-free operations _up_ the block to place // them closer to the block arguments they use, but that's unlikely to be all // that profitable of a rewrite in practice. - log::trace!(target: "sink-operand-defs", " ignoring block argument operand '{value}'"); + log::trace!(target: Self::NAME, " ignoring block argument operand '{value}'"); continue; }; - log::trace!(target: "sink-operand-defs", " evaluating operand '{value}'"); + log::trace!(target: Self::NAME, " evaluating operand '{value}'"); let def = defining_op.borrow(); if def.implements::() { - log::trace!(target: "sink-operand-defs", " defining '{}' is constant-like", def.name()); + log::trace!(target: Self::NAME, " defining '{}' is constant-like", def.name()); worklist.push_back(OpOperandSink::new(operation)); break; } @@ -240,16 +244,16 @@ impl Pass for SinkOperandDefs { // NOTE: For now we do not move ops that produce more than a single result, but // if the other results are unused, or the users would still be dominated by // the new location, then we could still move those ops. - log::trace!(target: "sink-operand-defs", " defining '{}' cannot be moved:", def.name()); - log::trace!(target: "sink-operand-defs", " * op has multiple uses"); + log::trace!(target: Self::NAME, " defining '{}' cannot be moved:", def.name()); + log::trace!(target: Self::NAME, " * op has multiple uses"); if incorrect_result_count { - log::trace!(target: "sink-operand-defs", " * op has incorrect number of results ({})", def.num_results()); + log::trace!(target: Self::NAME, " * op has incorrect number of results ({})", def.num_results()); } if has_effects { - log::trace!(target: "sink-operand-defs", " * op has memory effects"); + log::trace!(target: Self::NAME, " * op has memory effects"); } } else { - log::trace!(target: "sink-operand-defs", " defining '{}' is moveable, but is non-constant", def.name()); + log::trace!(target: Self::NAME, " defining '{}' is moveable, but is non-constant", def.name()); worklist.push_back(OpOperandSink::new(operation)); break; } @@ -257,7 +261,7 @@ impl Pass for SinkOperandDefs { }); for sinker in worklist.iter() { - log::debug!(target: "sink-operand-defs", "sink scheduled for {}", sinker.operation.borrow()); + log::debug!(target: Self::NAME, "sink scheduled for {}", sinker.operation.borrow()); } let mut visited = FxHashSet::default(); @@ -275,7 +279,7 @@ impl Pass for SinkOperandDefs { && !op.implements::() && erased.insert(operation) { - log::debug!(target: "sink-operand-defs", "erasing unused, effect-free, non-terminator op {op}"); + log::debug!(target: Self::NAME, "erasing unused, effect-free, non-terminator op {op}"); drop(op); operation.borrow_mut().erase(); continue; @@ -283,10 +287,10 @@ impl Pass for SinkOperandDefs { // If we've already worked this operation, skip it if !visited.insert(operation) && sink_state.next_operand_index == op.num_operands() { - log::trace!(target: "sink-operand-defs", "already visited {}", operation.borrow()); + log::trace!(target: Self::NAME, "already visited {}", operation.borrow()); continue; } else { - log::trace!(target: "sink-operand-defs", "visiting {}", operation.borrow()); + log::trace!(target: Self::NAME, "visiting {}", operation.borrow()); } let mut builder = OpBuilder::new(op.context_rc()); @@ -299,24 +303,24 @@ impl Pass for SinkOperandDefs { break; }; - log::debug!(target: "sink-operand-defs", " sinking next operand def for {op} at index {next_operand_index}"); + log::debug!(target: Self::NAME, " sinking next operand def for {op} at index {next_operand_index}"); let mut operand = op.operands()[next_operand_index]; sink_state.next_operand_index = next_operand_index; let operand_value = operand.borrow().as_value_ref(); - log::trace!(target: "sink-operand-defs", " visiting operand {operand_value}"); + log::trace!(target: Self::NAME, " visiting operand {operand_value}"); // Reuse moved/materialized replacements when the same operand is used multiple times if let Some(replacement) = sink_state.replacements.get(&operand_value).copied() { if replacement != operand_value { - log::trace!(target: "sink-operand-defs", " rewriting operand {operand_value} as {replacement}"); + log::trace!(target: Self::NAME, " rewriting operand {operand_value} as {replacement}"); operand.borrow_mut().set(replacement); changed = PostPassStatus::Changed; // If no other uses of this value remain, then remove the original // operation, as it is now dead. if !operand_value.borrow().is_used() { - log::trace!(target: "sink-operand-defs", " {operand_value} is no longer used, erasing definition"); + log::trace!(target: Self::NAME, " {operand_value} is no longer used, erasing definition"); // Replacements are only ever for op results let mut defining_op = operand_value.borrow().get_defining_op().unwrap(); defining_op.borrow_mut().erase(); @@ -334,34 +338,34 @@ impl Pass for SinkOperandDefs { // NOTE: In theory, we could move effect-free operations _up_ the block to place // them closer to the block arguments they use, but that's unlikely to be all // that profitable of a rewrite in practice. - log::trace!(target: "sink-operand-defs", " {value} is a block argument, ignoring.."); + log::trace!(target: Self::NAME, " {value} is a block argument, ignoring.."); continue 'next_operand; }; - log::trace!(target: "sink-operand-defs", " is sole user of {value}? {is_sole_user}"); + log::trace!(target: Self::NAME, " is sole user of {value}? {is_sole_user}"); let def = defining_op.borrow(); if let Some(attr) = matchers::constant().matches(&*def) { if !is_sole_user { - log::trace!(target: "sink-operand-defs", " defining op is a constant with multiple uses, materializing fresh copy"); + log::trace!(target: Self::NAME, " defining op is a constant with multiple uses, materializing fresh copy"); // Materialize a fresh copy of the original constant let span = value.span(); let ty = value.ty(); let Some(new_def) = def.dialect().materialize_constant(&mut builder, attr, ty, span) else { - log::trace!(target: "sink-operand-defs", " unable to materialize copy, skipping rewrite of this operand"); + log::trace!(target: Self::NAME, " unable to materialize copy, skipping rewrite of this operand"); continue 'next_operand; }; drop(def); drop(value); let replacement = new_def.borrow().results()[0] as ValueRef; - log::trace!(target: "sink-operand-defs", " rewriting operand {operand_value} as {replacement}"); + log::trace!(target: Self::NAME, " rewriting operand {operand_value} as {replacement}"); sink_state.replacements.insert(operand_value, replacement); operand.borrow_mut().set(replacement); changed = PostPassStatus::Changed; } else { - log::trace!(target: "sink-operand-defs", " defining op is a constant with no other uses, moving into place"); + log::trace!(target: Self::NAME, " defining op is a constant with no other uses, moving into place"); // The original op can be moved drop(def); drop(value); @@ -374,7 +378,7 @@ impl Pass for SinkOperandDefs { // NOTE: For now we do not move ops that produce more than a single result, but // if the other results are unused, or the users would still be dominated by // the new location, then we could still move those ops. - log::trace!(target: "sink-operand-defs", " defining op is unsuitable for sinking, ignoring this operand"); + log::trace!(target: Self::NAME, " defining op is unsuitable for sinking, ignoring this operand"); } else { // The original op can be moved // @@ -388,12 +392,12 @@ impl Pass for SinkOperandDefs { // 2. drop(def); drop(value); - log::trace!(target: "sink-operand-defs", " defining op can be moved and has no other uses, moving into place"); + log::trace!(target: Self::NAME, " defining op can be moved and has no other uses, moving into place"); defining_op.borrow_mut().move_to(*builder.insertion_point()); sink_state.replacements.insert(operand_value, operand_value); // Enqueue the defining op to be visited before continuing with this op's operands - log::trace!(target: "sink-operand-defs", " enqueing defining op for immediate processing"); + log::trace!(target: Self::NAME, " enqueing defining op for immediate processing"); //sink_state.ip = *builder.insertion_point(); sink_state.ip = ProgramPoint::before(operation); worklist.push_front(sink_state); diff --git a/hir-transform/src/spill.rs b/hir-transform/src/spill.rs index 309e60c9a..74cad1ab0 100644 --- a/hir-transform/src/spill.rs +++ b/hir-transform/src/spill.rs @@ -3,12 +3,12 @@ use alloc::{collections::VecDeque, rc::Rc}; use midenc_hir::{ BlockRef, Builder, Context, FxHashMap, OpBuilder, OpOperand, Operation, OperationRef, ProgramPoint, Region, RegionBranchOpInterface, RegionBranchPoint, RegionRef, Report, Rewriter, - SmallVec, SourceSpan, Spanned, StorableEntity, Usable, ValueRange, ValueRef, + SmallVec, SourceSpan, Spanned, StorableEntity, TraceTarget, Usable, ValueRange, ValueRef, adt::{SmallDenseMap, SmallSet}, cfg::Graph, dominance::{DomTreeNode, DominanceFrontier, DominanceInfo}, pass::{AnalysisManager, PostPassStatus}, - traits::SingleRegion, + traits::{IsolatedFromAbove, SingleRegion}, }; use midenc_hir_analysis::analyses::{ SpillAnalysis, @@ -121,17 +121,37 @@ pub fn transform_spills( let mut builder = OpBuilder::new(op.borrow().context_rc()); - log::debug!(target: "insert-spills", "analysis determined that some spills were required"); - log::debug!(target: "insert-spills", " edges to split = {}", analysis.splits().len()); - log::debug!(target: "insert-spills", " values spilled = {}", analysis.spills().len()); - log::debug!(target: "insert-spills", " reloads issued = {}", analysis.reloads().len()); + let trace_target = TraceTarget::category("pass").with_topic("spills"); + let trace_target = if let Some(sym) = op.borrow().as_symbol() { + trace_target.with_relevant_symbol(sym.name()) + } else { + trace_target + }; + + log::debug!( + target: &trace_target, + symbol = trace_target.relevant_symbol(); + "analysis determined that some spills were required + edges to split = {} + values spilled = {} + reloads issued = {}\n", + analysis.splits().len(), + analysis.spills().len(), + analysis.reloads().len(), + ); // Split all edges along which spills/reloads are required for split_info in analysis.splits_mut() { - log::trace!(target: "insert-spills", "splitting control flow edge {} -> {}", match split_info.predecessor { - Predecessor::Parent => ProgramPoint::before(split_info.predecessor.operation(split_info.point)), - Predecessor::Block { op, .. } | Predecessor::Region(op) => ProgramPoint::at_end_of(op.parent().unwrap()), - }, split_info.point); + log::trace!( + target: &trace_target, + symbol = trace_target.relevant_symbol(); + "splitting control flow edge {} -> {}", + match split_info.predecessor { + Predecessor::Parent => ProgramPoint::before(split_info.predecessor.operation(split_info.point)), + Predecessor::Block { op, .. } | Predecessor::Region(op) => ProgramPoint::at_end_of(op.parent().unwrap()), + }, + split_info.point, + ); let predecessor_block = split_info .predecessor @@ -141,7 +161,11 @@ pub fn transform_spills( // Create the split and switch the insertion point to the end of it let split = builder.create_block(predecessor_region, Some(predecessor_block), &[]); - log::trace!(target: "insert-spills", "created {split} to hold contents of split edge"); + log::trace!( + target: &trace_target, + symbol = trace_target.relevant_symbol(); + "created {split} to hold contents of split edge" + ); // Record the block we created for this split split_info.split = Some(split); @@ -151,12 +175,20 @@ pub fn transform_spills( // branch that terminates `split`. match split_info.predecessor { Predecessor::Block { mut op, index } => { - log::trace!(target: "insert-spills", "redirecting {predecessor_block} to {split}"); + log::trace!( + target: &trace_target, + symbol = trace_target.relevant_symbol(); + "redirecting {predecessor_block} to {split}" + ); let mut op = op.borrow_mut(); let mut succ = op.successor_mut(index as usize); let prev_dest = succ.dest.parent().unwrap(); succ.dest.borrow_mut().set(split); - log::trace!(target: "insert-spills", "creating edge from {split} to {prev_dest}"); + log::trace!( + target: &trace_target, + symbol = trace_target.relevant_symbol(); + "creating edge from {split} to {prev_dest}" + ); let arguments = succ .arguments .take() @@ -189,7 +221,12 @@ pub fn transform_spills( } } Predecessor::Region(predecessor) => { - log::trace!(target: "insert-spills", "splitting region control flow edge to {} from {predecessor}", split_info.point); + log::trace!( + target: &trace_target, + symbol = trace_target.relevant_symbol(); + "splitting region control flow edge to {} from {predecessor}", + split_info.point + ); todo!() } Predecessor::Parent => unimplemented!( @@ -210,7 +247,12 @@ pub fn transform_spills( } Placement::At(ip) => ip, }; - log::trace!(target: "insert-spills", "inserting spill of {} at {ip}", spill.value); + log::trace!( + target: &trace_target, + symbol = trace_target.relevant_symbol(); + "inserting spill of {} at {ip}", + spill.value + ); builder.set_insertion_point(ip); let inst = interface.create_spill(&mut builder, spill.value, spill.span)?; spill.inst = Some(inst); @@ -228,21 +270,44 @@ pub fn transform_spills( } Placement::At(ip) => ip, }; - log::trace!(target: "insert-spills", "inserting reload of {} at {ip}", reload.value); + log::trace!( + target: &trace_target, + symbol = trace_target.relevant_symbol(); + "inserting reload of {} at {ip}", + reload.value + ); builder.set_insertion_point(ip); let inst = interface.create_reload(&mut builder, reload.value, reload.span)?; reload.inst = Some(inst); } - log::trace!(target: "insert-spills", "all spills and reloads inserted successfully"); + log::trace!( + target: &trace_target, + symbol = trace_target.relevant_symbol(); + "all spills and reloads inserted successfully" + ); - log::trace!(target: "insert-spills", "op {} after inserting spills: {}", op.name(), op.borrow()); + log::trace!( + target: &trace_target, + symbol = trace_target.relevant_symbol(), + dialect = op.name().dialect().as_str(), + op = op.name().name().as_str(); + "op after inserting spills: {}", + op.borrow() + ); let dominfo = analysis_manager.get_analysis::()?; let region = op.borrow().regions().front().as_pointer().unwrap(); if region.borrow().has_one_block() { - rewrite_single_block_spills(op, region, analysis, interface, analysis_manager)?; + rewrite_single_block_spills( + op, + region, + analysis, + interface, + analysis_manager, + &trace_target, + )?; } else { rewrite_cfg_spills( builder.context_rc(), @@ -251,10 +316,17 @@ pub fn transform_spills( interface, &dominfo, analysis_manager, + &trace_target, )?; } - log::trace!(target: "insert-spills", "op {} after rewriting spills: {}", op.name(), op.borrow()); + log::trace!( + symbol = trace_target.relevant_symbol(), + dialect = op.name().dialect().as_str(), + op = op.name().name().as_str(); + "op after rewriting spills: {}", + op.borrow() + ); Ok(PostPassStatus::Changed) } @@ -264,6 +336,7 @@ fn rewrite_single_block_spills( analysis: &mut SpillAnalysis, interface: &mut dyn TransformSpillsInterface, _analysis_manager: AnalysisManager, + trace_target: &TraceTarget, ) -> Result<(), Report> { // In a flattened CFG with only structured control flow, no dominance tree is required. // @@ -309,7 +382,7 @@ fn rewrite_single_block_spills( } let mut block_states = - FxHashMap::, 4>>::default(); + FxHashMap::, 8>>::default(); let entry_block = region.borrow().entry_block_ref().unwrap(); let mut block_q = VecDeque::from([Node::new(entry_block)]); @@ -373,54 +446,15 @@ fn rewrite_single_block_spills( } let used = block_states.entry(node.block).or_default(); - - let reload_like = op.as_trait::(); - let is_reload_like = reload_like.is_some(); - if let Some(reload_like) = reload_like { - // We've found a reload of a spilled value, rewrite all uses of the spilled value - // found so far to use the reload instead. - let spilled = reload_like.spilled_value(); - let reloaded = reload_like.reloaded(); - - if let Some(to_rewrite) = used.remove(&spilled) { - debug_assert!(!to_rewrite.is_empty(), "expected empty use sets to be removed"); - - for mut user in to_rewrite { - user.borrow_mut().set(reloaded); - } - } else { - // This reload is unused, so remove it entirely, and move to the next op - node.move_next(); - block_q.push_back(node); - continue; - } - } + find_inst_uses(&op, used, analysis, trace_target); // Advance the cursor in this block node.move_next(); block_q.push_back(node); - - // Remove any use tracking for spilled values defined by this op - for result in ValueRange::<2>::from(op.results().all()) { - if analysis.is_spilled(&result) { - used.remove(&result); - continue; - } - } - - // Record any uses of spilled values by this op, so long as the op is not reload-like - if !is_reload_like { - for operand in op.operands().iter().copied() { - let value = operand.borrow().as_value_ref(); - if analysis.is_spilled(&value) { - used.entry(value).or_default().insert(operand); - } - } - } } let context = { op.borrow().context_rc() }; - rewrite_spill_pseudo_instructions(context, analysis, interface, None) + rewrite_spill_pseudo_instructions(context, analysis, interface, None, trace_target) } fn rewrite_cfg_spills( @@ -430,6 +464,7 @@ fn rewrite_cfg_spills( interface: &mut dyn TransformSpillsInterface, dominfo: &DominanceInfo, _analysis_manager: AnalysisManager, + trace_target: &TraceTarget, ) -> Result<(), Report> { // At this point, we've potentially emitted spills/reloads, but these are not yet being // used to split the live ranges of the SSA values to which they apply. Our job now, is @@ -462,7 +497,7 @@ fn rewrite_cfg_spills( // Make sure that any block in the iterated dominance frontier of a spilled value, has // a new phi (block argument) inserted, if one is not already present. These must be in // the CFG before we search for dominating definitions. - let inserted_phis = insert_required_phis(&context, analysis, &domf); + let inserted_phis = insert_required_phis(&context, analysis, &domf, trace_target); // Traverse the CFG bottom-up, doing the following along the way: // @@ -518,7 +553,7 @@ fn rewrite_cfg_spills( // definitions let block = block_ref.borrow(); for op in block.body().iter().rev() { - find_inst_uses(&op, &mut used, analysis); + find_inst_uses(&op, &mut used, analysis, trace_target); } // At the top of the block, if any of the block parameters are in the "used" set, remove @@ -528,14 +563,128 @@ fn rewrite_cfg_spills( used.remove(&arg); } - rewrite_inserted_phi_uses(&inserted_phis, block_ref, &mut used); + rewrite_inserted_phi_uses(&inserted_phis, block_ref, &mut used, trace_target); // What remains are the unsatisfied uses of spilled values for this block and its // successors used_sets.insert(block_ref, used); } - rewrite_spill_pseudo_instructions(context, analysis, interface, Some(dominfo)) + rewrite_spill_pseudo_instructions(context, analysis, interface, Some(dominfo), trace_target) +} + +/// Rewrite uses of spilled values in `op` and any nested regions of `op`. +/// +/// This is required for correctness when spills/reloads are inserted into regions nested under a +/// CFG block (e.g. structured control flow like `scf.if`), as those uses are otherwise ignored by +/// the CFG rewrite pass. +fn find_inst_uses( + op: &Operation, + used: &mut SmallDenseMap, 8>, + analysis: &SpillAnalysis, + trace_target: &TraceTarget, +) { + merge_op_nested_region_uses(op, used, analysis, trace_target); + + find_inst_uses_in_op(op, used, analysis); +} + +/// Merge into `used` the set of unsatisfied uses of spilled values from regions nested under `op` +/// that are reachable from the parent. +/// +/// NOTE: We process each nested region independently so that reloads in one region do not +/// incorrectly rewrite uses from another (e.g. `then` vs `else` branches). +fn merge_op_nested_region_uses( + op: &Operation, + used: &mut SmallDenseMap, 8>, + analysis: &SpillAnalysis, + trace_target: &TraceTarget, +) { + if op.implements::() { + return; + } + + // If this op participates in the region-branch interface, use the successor relation to only + // consider regions reachable from the parent. + if let Some(branch) = op.as_trait::() { + merge_nested_region_uses(branch, used, analysis, trace_target); + return; + } + + // Fallback for ops that contain regions but do not implement RegionBranchOpInterface. + // + // We conservatively treat each region as reachable from the parent, and only attempt to + // collect uses from single-block regions (multi-block nested regions require SSA reconstruction + // within the nested CFG). + for region in op.regions().iter() { + let region = region.as_region_ref(); + let region_borrowed = region.borrow(); + + if region_borrowed.is_empty() { + continue; + } + if !region_borrowed.has_one_block() { + log::trace!( + target: "insert-spills", + "skipping multi-block nested region {region} when collecting spill uses" + ); + continue; + } + + let entry = region_borrowed + .entry_block_ref() + .expect("expected non-empty region to have an entry block"); + drop(region_borrowed); + + let region_used = collect_block_uses(entry, analysis, trace_target); + for (value, users) in region_used { + used.entry(value).or_default().extend(users.iter().copied()); + } + } +} + +/// Merge into `used` the set of unsatisfied uses of spilled values from regions nested under +/// `branch` that are reachable from the parent. +/// +/// For region-branch ops, this includes *transitively* reachable regions. For example, `scf.while` +/// has an `after` region which is not an immediate successor of the parent, but is still reachable +/// from the parent through the region graph (via the `before` region). +fn merge_nested_region_uses( + branch: &dyn RegionBranchOpInterface, + used: &mut SmallDenseMap, 8>, + analysis: &SpillAnalysis, + trace_target: &TraceTarget, +) { + for region in Region::postorder_region_graph_for(branch) { + let region = region.borrow(); + assert!(region.has_one_block(), "multi-block regions are not currently supported"); + let entry = region.entry_block_ref().expect("expected region to have an entry block"); + drop(region); + + let region_used = collect_block_uses(entry, analysis, trace_target); + for (value, users) in region_used { + used.entry(value).or_default().extend(users.iter().copied()); + } + } +} + +/// Collect the set of unsatisfied uses of spilled values at the entry of `block_ref`. +fn collect_block_uses( + block_ref: BlockRef, + analysis: &SpillAnalysis, + trace_target: &TraceTarget, +) -> SmallDenseMap, 8> { + let mut used = SmallDenseMap::, 8>::default(); + let block = block_ref.borrow(); + for op in block.body().iter().rev() { + find_inst_uses(&op, &mut used, analysis, trace_target); + } + + for arg in ValueRange::<2>::from(block.arguments()) { + used.remove(&arg); + } + + used } /// Insert additional phi nodes as follows: @@ -551,13 +700,19 @@ fn insert_required_phis( context: &Context, analysis: &SpillAnalysis, domf: &DominanceFrontier, + trace_target: &TraceTarget, ) -> SmallDenseMap, 8> { use midenc_hir::adt::smallmap::Entry; let mut required_phis = SmallDenseMap::, 4>::default(); for reload in analysis.reloads() { let block = reload.inst.unwrap().parent().unwrap(); - log::trace!(target: "insert-spills", "add required_phis for {}", reload.value); + log::trace!( + target: trace_target, + symbol = trace_target.relevant_symbol(); + "add required_phis for {}", + reload.value + ); let r = required_phis.entry(reload.value).or_default(); r.insert(block); } @@ -599,7 +754,8 @@ fn insert_required_phis( inserted_phis } -fn find_inst_uses( +/// Find uses of spilled values in `op` itself (not including nested regions). +fn find_inst_uses_in_op( op: &Operation, used: &mut SmallDenseMap, 8>, analysis: &SpillAnalysis, @@ -647,6 +803,7 @@ fn rewrite_inserted_phi_uses( inserted_phis: &SmallDenseMap, 8>, block_ref: BlockRef, used: &mut SmallDenseMap, 8>, + trace_target: &TraceTarget, ) { // If we have inserted any phis in this block, rewrite uses of the spilled values they // represent. @@ -660,7 +817,11 @@ fn rewrite_inserted_phi_uses( } } else { // TODO(pauls): This phi is unused, we should be able to remove it - log::warn!(target: "insert-spills", "unused phi {phi} encountered during rewrite phase"); + log::warn!( + target: trace_target, + symbol = trace_target.relevant_symbol(); + "unused phi {phi} encountered during rewrite phase" + ); continue; } } @@ -684,13 +845,15 @@ fn rewrite_spill_pseudo_instructions( analysis: &mut SpillAnalysis, interface: &mut dyn TransformSpillsInterface, dominfo: Option<&DominanceInfo>, + trace_target: &TraceTarget, ) -> Result<(), Report> { use midenc_hir::{ dominance::Dominates, - patterns::{NoopRewriterListener, RewriterImpl}, + patterns::{RewriterImpl, TracingRewriterListener}, }; - let mut builder = RewriterImpl::::new(context); + let mut builder = RewriterImpl::::new(context) + .with_listener(TracingRewriterListener); for spill in analysis.spills() { let operation = spill.inst.expect("expected spill to have been materialized"); let spilled = { @@ -751,11 +914,21 @@ fn rewrite_spill_pseudo_instructions( // Avoid emitting loads for unused reloads if is_used { - log::trace!(target: "insert-spills", "convert reload to load {:?}", reload.place); + log::trace!( + target: trace_target, + symbol = trace_target.relevant_symbol(); + "convert reload to load {}", + reload.place + ); builder.set_insertion_point_after(operation); interface.convert_reload_to_load(&mut builder, operation)?; } else { - log::trace!(target: "insert-spills", "erase unused reload {:?}", reload.value); + log::trace!( + target: trace_target, + symbol = trace_target.relevant_symbol(); + "erase unused reload {}", + reload.value + ); builder.erase_op(operation); } } diff --git a/hir/Cargo.toml b/hir/Cargo.toml index ba81a4967..96299bf6c 100644 --- a/hir/Cargo.toml +++ b/hir/Cargo.toml @@ -40,4 +40,4 @@ thiserror.workspace = true [dev-dependencies] # Use local paths for dev-only dependency to avoid relying on crates.io during packaging pretty_assertions = "1.0" -env_logger.workspace = true +midenc-log.workspace = true diff --git a/hir/src/adt/arena.rs b/hir/src/adt/arena.rs index ebcdc1343..b21d1f34b 100644 --- a/hir/src/adt/arena.rs +++ b/hir/src/adt/arena.rs @@ -126,7 +126,8 @@ impl Arena { I: IntoIterator, { if T::IS_ZST { - return NonNull::slice_from_raw_parts(NonNull::dangling(), 0); + let len = items.into_iter().count(); + return NonNull::slice_from_raw_parts(NonNull::dangling(), len); } let mut chunks = self.chunks.borrow_mut(); @@ -479,3 +480,22 @@ impl SpecArenaExtend for [T; N] { ptr } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn extend_zst_returns_correct_length() { + let arena: Arena<()> = Arena::new(); + let slice = arena.extend([(), (), ()]); + assert_eq!(slice.len(), 3); + } + + #[test] + fn extend_zst_empty_returns_zero_length() { + let arena: Arena<()> = Arena::new(); + let slice = arena.extend(core::iter::empty::<()>()); + assert_eq!(slice.len(), 0); + } +} diff --git a/hir/src/dialects/builtin/builders/function.rs b/hir/src/dialects/builtin/builders/function.rs index 531f556bb..e58ae20f2 100644 --- a/hir/src/dialects/builtin/builders/function.rs +++ b/hir/src/dialects/builtin/builders/function.rs @@ -1,4 +1,7 @@ -use crate::{dialects::builtin::FunctionRef, *}; +use crate::{ + dialects::builtin::{FunctionRef, LocalVariable}, + *, +}; pub struct FunctionBuilder<'f, B: ?Sized> { pub func: FunctionRef, @@ -86,6 +89,10 @@ impl<'f, B: ?Sized + Builder> FunctionBuilder<'f, B> { self.builder.context().append_block_argument(block, ty, span) } + pub fn alloc_local(&mut self, ty: Type) -> LocalVariable { + self.func.borrow_mut().alloc_local(ty) + } + pub fn builder(&self) -> &B { self.builder } diff --git a/hir/src/dialects/builtin/ops/component/interface.rs b/hir/src/dialects/builtin/ops/component/interface.rs index 65b0e9bb7..fa0334ab2 100644 --- a/hir/src/dialects/builtin/ops/component/interface.rs +++ b/hir/src/dialects/builtin/ops/component/interface.rs @@ -39,13 +39,23 @@ impl ComponentId { && self.version.cmp_precedence(&other.version).is_eq() } - /// Get the Miden Assembly [LibraryPath] that uniquely identifies this interface. + /// Returns true if this is the synthetic wrapper component used for pure-Rust compilation. + pub fn is_synthetic_wrapper(&self) -> bool { + self.namespace.as_str() == "root_ns" + && self.name.as_str() == "root" + && self.version == Version::new(1, 0, 0) + } + + /// Get the Miden Assembly [`LibraryPath`] that uniquely identifies this interface. + /// + /// The returned path is a single quoted component so that `:` and `@` are preserved. pub fn to_library_path(&self) -> midenc_session::LibraryPath { - use midenc_session::{LibraryNamespace, LibraryPath}; + use midenc_session::LibraryPath; let ns = format!("{}:{}@{}", &self.namespace, &self.name, &self.version); - let namespace = LibraryNamespace::User(ns.into_boxed_str().into()); - LibraryPath::new_from_components(namespace, []) + let mut path = LibraryPath::default(); + path.push_component(&ns); + path } } diff --git a/hir/src/dialects/builtin/ops/function.rs b/hir/src/dialects/builtin/ops/function.rs index 2c4d15cf8..4d25b2a32 100644 --- a/hir/src/dialects/builtin/ops/function.rs +++ b/hir/src/dialects/builtin/ops/function.rs @@ -62,6 +62,12 @@ impl core::fmt::Debug for LocalVariable { } } +impl core::fmt::Display for LocalVariable { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "lv{}", self.as_usize()) + } +} + define_attr_type!(LocalVariable); impl AttrPrinter for LocalVariable { @@ -249,6 +255,14 @@ impl Function { LocalVariable::new(self.as_function_ref(), id) } + pub fn iter_locals(&self) -> impl Iterator { + let func = self.as_function_ref(); + self.locals + .iter() + .enumerate() + .map(move |(i, t)| (LocalVariable::new(func, i), t)) + } + #[inline(always)] pub fn as_function_ref(&self) -> FunctionRef { unsafe { FunctionRef::from_raw(self) } diff --git a/hir/src/dialects/builtin/ops/interface.rs b/hir/src/dialects/builtin/ops/interface.rs index a58e931fa..bbed48f5c 100644 --- a/hir/src/dialects/builtin/ops/interface.rs +++ b/hir/src/dialects/builtin/ops/interface.rs @@ -147,7 +147,10 @@ impl Interface { .downcast_ref::() .expect("invalid parent for interface operation: expected component"); let component_id = component.id(); - let path = component_id.to_library_path(); - Some(path.append_unchecked(self.name().as_str())) + let mut path = component_id.to_library_path(); + let name = self.name().as_str(); + let suffix = LibraryPath::new(&name).expect("invalid interface module name"); + path.push(suffix.as_path()); + Some(path) } } diff --git a/hir/src/folder.rs b/hir/src/folder.rs index 1a3eefe16..d3c2c394e 100644 --- a/hir/src/folder.rs +++ b/hir/src/folder.rs @@ -20,20 +20,9 @@ struct UniquedConstant { impl Eq for UniquedConstant {} impl PartialEq for UniquedConstant { fn eq(&self, other: &Self) -> bool { - use core::hash::{Hash, Hasher}; - - let v1_hash = { - let mut hasher = rustc_hash::FxHasher::default(); - self.value.hash(&mut hasher); - hasher.finish() - }; - let v2_hash = { - let mut hasher = rustc_hash::FxHasher::default(); - other.value.hash(&mut hasher); - hasher.finish() - }; - - self.dialect.name() == other.dialect.name() && v1_hash == v2_hash && self.ty == other.ty + self.dialect.name() == other.dialect.name() + && self.value.eq(&other.value) + && self.ty == other.ty } } impl UniquedConstant { @@ -391,6 +380,7 @@ impl OperationFolder { let new_dialect = const_op.borrow().dialect(); if new_dialect.name() == dialect.name() { self.referenced_dialects.entry(const_op).or_default().push(new_dialect); + uniqued_constants.insert(uniqued_constant, const_op); return Some(const_op); } diff --git a/hir/src/ir/builder.rs b/hir/src/ir/builder.rs index e8c69ac7a..2616166c4 100644 --- a/hir/src/ir/builder.rs +++ b/hir/src/ir/builder.rs @@ -317,8 +317,11 @@ pub trait Listener { fn notify_operation_inserted(&self, op: OperationRef, prev: ProgramPoint) {} /// Notify the listener that the specified block was inserted. /// - /// * If the block was moved, then `prev` and `ip` represent the previous location of the block. - /// * If the block was unlinked before it was inserted, then `prev` and `ip` are `None` + /// * If the block was created, but not inserted, then `prev` and `ip` are `None` + /// * If the block was unlinked before it was inserted, then `prev` is `None` and `ip` is the + /// location where it was inserted. + /// * If the block was moved, then `prev` is the previous region it was inserted into, and `ip` + /// is the location where it was inserted fn notify_block_inserted( &self, block: BlockRef, diff --git a/hir/src/ir/context.rs b/hir/src/ir/context.rs index 26ae1c5af..c617cab94 100644 --- a/hir/src/ir/context.rs +++ b/hir/src/ir/context.rs @@ -313,21 +313,21 @@ impl Context { UnsafeIntrusiveEntityRef::::new_uninit_with_metadata(Default::default(), &self.allocator) } - /// Allocate a new `EntityHandle`. + /// Allocate a new `UnsafeEntityRef`. /// - /// [EntityHandle] is a smart-pointer type for IR entities, which behaves like a ref-counted + /// [UnsafeEntityRef] is a smart-pointer type for IR entities, which behaves like a ref-counted /// pointer with dynamically-checked borrow checking rules. It is designed to play well with /// entities allocated from a [Context], and with the somewhat cyclical nature of the IR. pub fn alloc(&self, value: T) -> UnsafeEntityRef { UnsafeEntityRef::new(value, &self.allocator) } - /// Allocate a new `TrackedEntityHandle`. + /// Allocate a new `UnsafeIntrusiveEntityRef`. /// - /// [TrackedEntityHandle] is like [EntityHandle], except that it is specially designed for - /// entities which are meant to be tracked in intrusive linked lists. For example, the blocks - /// in a region, or the ops in a block. It does this without requiring the entity to know about - /// the link at all, while still making it possible to access the link from the entity. + /// [UnsafeIntrusiveEntityRef] is like [UnsafeEntityRef], except that it is specially designed + /// for entities which are meant to be tracked in intrusive linked lists. For example, the + /// blocks in a region, or the ops in a block. It does this without requiring the entity to know + /// about the link at all, while still making it possible to access the link from the entity. pub fn alloc_tracked(&self, value: T) -> UnsafeIntrusiveEntityRef { UnsafeIntrusiveEntityRef::new_with_metadata(value, Default::default(), &self.allocator) } diff --git a/hir/src/ir/dominance/info.rs b/hir/src/ir/dominance/info.rs index a40e913bb..544707a31 100644 --- a/hir/src/ir/dominance/info.rs +++ b/hir/src/ir/dominance/info.rs @@ -82,6 +82,11 @@ impl DominanceInfo { self.info.node(block) } + /// Returns true if blocks in `region` are known to follow SSA dominance rules + pub fn has_ssa_dominance(&self, region: RegionRef) -> bool { + self.info.region_has_ssa_dominance(region) + } + /// Get the dominance tree for `region` pub fn dominance(&self, region: RegionRef) -> Rc> { self.info.dominance(region) diff --git a/hir/src/ir/dominance/tree.rs b/hir/src/ir/dominance/tree.rs index 77f44c094..6649c25dd 100644 --- a/hir/src/ir/dominance/tree.rs +++ b/hir/src/ir/dominance/tree.rs @@ -423,6 +423,10 @@ impl DomTreeBase { this.compute(); + if !region.borrow().has_one_block() { + this.update_dfs_numbers(); + } + Ok(this) } diff --git a/hir/src/ir/effects/interface.rs b/hir/src/ir/effects/interface.rs index 37ab0ca15..2f735abfe 100644 --- a/hir/src/ir/effects/interface.rs +++ b/hir/src/ir/effects/interface.rs @@ -1,7 +1,17 @@ use smallvec::SmallVec; use super::*; -use crate::{SymbolRef, ValueRef}; +use crate::{OperationRef, SymbolRef, ValueRef}; + +/// Marker trait for ops with recursive effects of a given [Effect] type. +/// +/// Ops with recursive effects are considered to have any of the effects of operations nested within +/// its regions, in addition to any effects it declares on itself. Only when the operation and none +/// of its nested operations carry effects of the given type, can it be assumed that the operation +/// is free of that effect. +pub trait HasRecursiveEffects {} + +impl HasRecursiveEffects for T {} pub trait EffectOpInterface { /// Return the set all of the operation's effects @@ -176,3 +186,73 @@ impl Iterator for ResourceEffectIterator<'_, T> { None } } + +/// An iterator over the recursive effects of an [crate::Operation]. +/// +/// The value produced by the iterator is `(OperationRef, Option>)`, where the +/// operation reference is the effecting op, and the second element is the identified effect: +/// +/// * `Some` represents an effect on the operation or one of its nested operations +/// * `None` indicates that we have identified that the given operation has unknown effects, and +/// thus the entire operation could have unknown effects. +/// +/// Note that in the case of discovering that an operation has unknown effects, the iterator can +/// continue to visit all effects recursively - it is up to the caller to stop iteration if the +/// presence of unknown effects makes further search wasteful. +pub struct RecursiveEffectIterator { + buffer: crate::adt::SmallDeque<(OperationRef, Option>), 2>, + effecting_ops: SmallVec<[OperationRef; 4]>, +} + +impl RecursiveEffectIterator { + /// Iterate over the recursive effects of `op` + pub fn new(op: OperationRef) -> Self { + Self { + buffer: Default::default(), + effecting_ops: SmallVec::from_iter([op]), + } + } +} + +impl core::iter::FusedIterator for RecursiveEffectIterator {} + +impl Iterator for RecursiveEffectIterator { + type Item = (OperationRef, Option>); + + fn next(&mut self) -> Option { + loop { + if let Some(next) = self.buffer.pop_front() { + return Some(next); + } + + if let Some(op) = self.effecting_ops.pop() { + let operation = op.borrow(); + + let has_recursive_effects = operation.implements::>(); + if has_recursive_effects { + for region in operation.regions() { + for block in region.body() { + let mut next = block.body().front().as_pointer(); + while let Some(nested) = next.take() { + next = nested.next(); + self.effecting_ops.push(nested); + } + } + } + } + + if let Some(effect_interface) = operation.as_trait::>() { + self.buffer.extend(effect_interface.effects().map(|eff| (op, Some(eff)))); + } else if !has_recursive_effects { + // The operation does not have recursive memory effects or implement + // EffectOpInterface, so its effects are unknown. + self.buffer.push_back((op, None)); + } + } else { + break; + } + } + + None + } +} diff --git a/hir/src/ir/effects/memory.rs b/hir/src/ir/effects/memory.rs index 27be9c759..ac3b579fe 100644 --- a/hir/src/ir/effects/memory.rs +++ b/hir/src/ir/effects/memory.rs @@ -1,8 +1,8 @@ use super::*; -/// Marker trait for ops with recursive memory effects, i.e. the effects of the operation includes -/// the effects of operations nested within its regions. If the operation does not implement any -/// effect markers, e.g. `MemoryWrite`, then it can be assumed to have no memory effects itself. +/// Marker trait for ops with recursive memory effects. +/// +/// See [HasRecursiveEffects] for more details on the semantics of recursive effects. pub trait HasRecursiveMemoryEffects {} #[derive(Debug, Copy, Clone, PartialEq, Eq)] @@ -28,6 +28,13 @@ pub enum MemoryEffect { Free, } +impl PartialEq for &MemoryEffect { + #[inline] + fn eq(&self, other: &MemoryEffect) -> bool { + (**self).eq(other) + } +} + impl Effect for MemoryEffect {} pub trait MemoryEffectOpInterface = EffectOpInterface; diff --git a/hir/src/ir/entity.rs b/hir/src/ir/entity.rs index 54a627c19..484882a55 100644 --- a/hir/src/ir/entity.rs +++ b/hir/src/ir/entity.rs @@ -121,7 +121,7 @@ pub trait EntityId: Copy + Clone + PartialEq + Eq + PartialOrd + Ord + Hash + fm fn as_usize(&self) -> usize; } -/// An error raised when an aliasing violation is detected in the use of [EntityHandle] +/// An error raised when an aliasing violation is detected in the use of [UnsafeEntityRef] #[non_exhaustive] pub struct AliasingViolationError { #[cfg(debug_assertions)] @@ -266,21 +266,21 @@ impl Clone for RawEntityRef { } } impl RawEntityRef { - /// Create a new [EntityHandle] from a raw pointer to the underlying [EntityObj]. + /// Create a new [UnsafeEntityRef] from a raw pointer to the underlying [EntityObj]. /// /// # SAFETY /// - /// [EntityHandle] is designed to operate like an owned smart-pointer type, ala `Rc`. As a + /// [UnsafeEntityRef] is designed to operate like an owned smart-pointer type, ala `Rc`. As a /// result, it expects that the underlying data _never moves_ after it is allocated, for as - /// long as any outstanding [EntityHandle]s exist that might be used to access that data. + /// long as any outstanding [UnsafeEntityRef]s exist that might be used to access that data. /// /// Additionally, it is expected that all accesses to the underlying data flow through an - /// [EntityHandle], as it is the foundation on which the soundness of [EntityHandle] is built. - /// You must ensure that there no other references to the underlying data exist, or can be - /// created, _except_ via [EntityHandle]. + /// [UnsafeEntityRef], as it is the foundation on which the soundness of [UnsafeEntityRef] is + /// built. You must ensure that there no other references to the underlying data exist, or can + /// be created, _except_ via [UnsafeEntityRef]. /// /// You should generally not be using this API, as it is meant solely for constructing an - /// [EntityHandle] immediately after allocating the underlying [EntityObj]. + /// [UnsafeEntityRef] immediately after allocating the underlying [EntityObj]. #[inline] unsafe fn from_inner(inner: NonNull>) -> Self { Self { inner } diff --git a/hir/src/ir/entity/list.rs b/hir/src/ir/entity/list.rs index 6f2582248..ab3a6eec5 100644 --- a/hir/src/ir/entity/list.rs +++ b/hir/src/ir/entity/list.rs @@ -203,12 +203,12 @@ trait EntityListTraits: Sized { /// are moved. fn split_before(cursor: &mut EntityCursorMut<'_, T>) -> EntityList; - /// Remove the entity at the front of the list, returning its [TrackedEntityHandle] + /// Remove the entity at the front of the list, returning its [UnsafeIntrusiveEntityRef] /// /// Returns `None` if the list is empty. fn pop_front(&mut self) -> Option>; - /// Remove the entity at the back of the list, returning its [TrackedEntityHandle] + /// Remove the entity at the back of the list, returning its [UnsafeIntrusiveEntityRef] /// /// Returns `None` if the list is empty. fn pop_back(&mut self) -> Option>; @@ -569,14 +569,14 @@ impl EntityList { >::push_back(self, entity) } - /// Remove the entity at the front of the list, returning its [TrackedEntityHandle] + /// Remove the entity at the front of the list, returning its [UnsafeIntrusiveEntityRef] /// /// Returns `None` if the list is empty. pub fn pop_front(&mut self) -> Option> { >::pop_front(self) } - /// Remove the entity at the back of the list, returning its [TrackedEntityHandle] + /// Remove the entity at the back of the list, returning its [UnsafeIntrusiveEntityRef] /// /// Returns `None` if the list is empty. pub fn pop_back(&mut self) -> Option> { @@ -673,7 +673,7 @@ impl<'a, T> EntityCursor<'a, T> { Some(self.cursor.get()?.entity.borrow()) } - /// Get the [TrackedEntityHandle] corresponding to the entity under the cursor. + /// Get the [UnsafeIntrusiveEntityRef] corresponding to the entity under the cursor. /// /// Returns `None` if the cursor is pointing to the null object. #[inline] @@ -793,7 +793,7 @@ impl<'a, T: EntityListItem> EntityCursorMut<'a, T> { } } - /// Get the [TrackedEntityHandle] corresponding to the entity under the cursor. + /// Get the [UnsafeIntrusiveEntityRef] corresponding to the entity under the cursor. /// /// Returns `None` if the cursor is pointing to the null object. #[inline] diff --git a/hir/src/ir/operation.rs b/hir/src/ir/operation.rs index febb39bef..2e160b157 100644 --- a/hir/src/ir/operation.rs +++ b/hir/src/ir/operation.rs @@ -13,12 +13,12 @@ use smallvec::SmallVec; pub use self::{builder::OperationBuilder, name::OperationName}; use super::{ - effects::{HasRecursiveMemoryEffects, MemoryEffect, MemoryEffectOpInterface}, + effects::{ + Effect, EffectInstance, HasRecursiveMemoryEffects, MemoryEffect, MemoryEffectOpInterface, + }, *, }; -use crate::{ - AttributeSet, AttributeValue, Forward, ProgramPoint, adt::SmallSet, patterns::RewritePatternSet, -}; +use crate::{AttributeSet, AttributeValue, Forward, ProgramPoint, patterns::RewritePatternSet}; pub type OperationRef = UnsafeIntrusiveEntityRef; pub type OpList = EntityList; @@ -1038,68 +1038,37 @@ impl Operation { /// dead if they have no side effects. This allows for marking region operations as trivially /// dead without always being conservative about terminators. pub fn would_be_trivially_dead_even_if_terminator(&self) -> bool { - // The set of operations to consider when checking for side effects - let mut effecting_ops = SmallVec::<[OperationRef; 4]>::from_iter([self.as_operation_ref()]); - while let Some(op) = effecting_ops.pop() { - let op = op.borrow(); + use crate::effects::RecursiveEffectIterator; + + let this_op = self.as_operation_ref(); + let effects = RecursiveEffectIterator::::new(this_op); + for (effecting_op, effect) in effects { + // The presence of an unknown effect, then we must treat this op as conservatively + // having effects + let Some(effect) = effect else { + return false; + }; - // If the operation has recursive effects, push all of the nested operations on to the - // stack to consider - let has_recursive_effects = op.implements::(); - if has_recursive_effects { - for region in op.regions() { - for block in region.body() { - for op in block.body() { - effecting_ops.push(op.as_operation_ref()); + // We can drop effects if: + // + // * the effect is an allocation and the effect is a result of the effecting op. + // * the effect is a read + match effect.effect() { + MemoryEffect::Read => (), + MemoryEffect::Allocate => match effect.value() { + Some(value) => { + let is_defined_by_op = + value.borrow().get_defining_op().is_some_and(|op| op == effecting_op); + let is_droppable = + matches!(effect.effect(), MemoryEffect::Allocate) && is_defined_by_op; + if !is_droppable { + return false; } } - } + None => return false, + }, + _ => return false, } - - // If the op has memory effects, try to characterize them to see if the op is trivially - // dead here. - if let Some(effect_interface) = op.as_trait::() { - let mut effects = effect_interface.effects(); - - // Gather all results of this op that are allocated - let mut alloc_results = SmallSet::::default(); - for effect in effects.as_slice() { - let allocates = matches!(effect.effect(), MemoryEffect::Allocate); - if let Some(value) = effect.value() { - let is_defined_by_op = value - .borrow() - .get_defining_op() - .is_some_and(|op| self.as_operation_ref() == op); - if allocates && is_defined_by_op { - alloc_results.insert(value); - } - } - } - - if !effects.all(|effect| { - // We can drop effects if the value is an allocation and is a result of - // the operation - if effect.value().is_some_and(|v| alloc_results.contains(&v)) { - true - } else { - // Otherwise, the effect must be a read - matches!(effect.effect(), MemoryEffect::Read) - } - }) { - return false; - } - continue; - } - - // Otherwise, if the op has recursive side effects we can treat the operation itself - // as having no effects - if has_recursive_effects { - continue; - } - - // If there were no effect interfaces, we treat this op as conservatively having - // effects - return false; } // If we get here, none of the operations had effects that prevented marking this operation @@ -1148,6 +1117,48 @@ impl Operation { true } + + pub fn get_effects_recursively(&self) -> Option; 2]>> { + use crate::effects::RecursiveEffectIterator; + + let mut effects = SmallVec::<[_; 2]>::default(); + + for (_, effect) in RecursiveEffectIterator::new(self.as_operation_ref()) { + effects.push(effect?); + } + + Some(effects) + } + + /// Returns true if this operation is known to have `expected_effect`. + /// + /// Returns false if the op has unknown effects, no effects, or does not have `expected_effect` + /// amongst its effects. + pub fn has_memory_effect(&self, expected_effect: MemoryEffect) -> bool { + let Some(mem_interface) = self.as_trait::() else { + return false; + }; + + mem_interface.effects().any(|effect| effect.effect() == expected_effect) + } + + /// Returns true if this operation has `expected_effect` and _only_ `expected_effect`. + /// + /// Returns false if the op has no effects, or has any effect other than `expected_effect`. + pub fn has_single_memory_effect(&self, expected_effect: MemoryEffect) -> bool { + let Some(mem_interface) = self.as_trait::() else { + return false; + }; + if mem_interface.has_no_effect() { + return false; + } + for effect in mem_interface.effects() { + if effect.effect() != expected_effect { + return false; + } + } + true + } } /// Movement diff --git a/hir/src/ir/operation/builder.rs b/hir/src/ir/operation/builder.rs index 3207325ad..27724abd7 100644 --- a/hir/src/ir/operation/builder.rs +++ b/hir/src/ir/operation/builder.rs @@ -1,10 +1,10 @@ -use alloc::{boxed::Box, vec, vec::Vec}; +use alloc::{vec, vec::Vec}; use midenc_session::diagnostics::Severity; use crate::{ AsCallableSymbolRef, AsSymbolRef, AttributeValue, BlockRef, Builder, KeyedSuccessor, Op, - OpBuilder, OperationRef, Region, Report, Spanned, SuccessorInfo, Type, + OpBuilder, OperationRef, Region, Report, Spanned, SuccessorInfo, Type, UnsafeEntityRef, UnsafeIntrusiveEntityRef, ValueRef, traits::Terminator, }; @@ -168,8 +168,10 @@ where .into_iter() .map(|value_ref| self.builder.context().make_operand(value_ref, owner, 0)); let operand_group = op.operands.push_group(operands); - let key = Box::new(key); - let key = unsafe { core::ptr::NonNull::new_unchecked(Box::into_raw(key)) }; + let key_ref = self.builder.context().alloc(key); + let key = unsafe { + core::ptr::NonNull::new_unchecked(UnsafeEntityRef::as_ptr(&key_ref).cast_mut()) + }; group.push(SuccessorInfo { block, key: Some(key.cast()), diff --git a/hir/src/ir/region.rs b/hir/src/ir/region.rs index 8947f4dde..aef77f8a6 100644 --- a/hir/src/ir/region.rs +++ b/hir/src/ir/region.rs @@ -246,14 +246,18 @@ impl Region { /// Returns true if this region may be a graph region without SSA dominance pub fn may_be_graph_region(&self) -> bool { - if let Some(owner) = self.parent() { - owner - .borrow() - .as_trait::() - .is_some_and(|rki| rki.has_graph_regions()) - } else { - true - } + let op = self.parent().expect("orphaned region"); + op.borrow() + .as_trait::() + .is_some_and(|rki| rki.has_graph_regions()) + } + + /// Returns true if this region is known or assumed to have SSA dominance + pub fn has_ssa_dominance(&self) -> bool { + let op = self.parent().expect("orphaned region"); + op.borrow() + .as_trait::() + .is_none_or(|rki| rki.has_ssa_dominance()) } /// Returns true if this region has only one block diff --git a/hir/src/ir/symbols/path.rs b/hir/src/ir/symbols/path.rs index dcdd3cc4d..a041d7321 100644 --- a/hir/src/ir/symbols/path.rs +++ b/hir/src/ir/symbols/path.rs @@ -267,34 +267,20 @@ impl SymbolPath { /// Derive a Miden Assembly `LibraryPath` from this symbol path pub fn to_library_path(&self) -> midenc_session::LibraryPath { - use midenc_session::{ - LibraryNamespace, LibraryPath, - miden_assembly::{SourceSpan, Span, ast::Ident}, - }; - - let mut components = self.path.iter(); - let mut parts = SmallVec::<[_; 3]>::default(); - if self.is_absolute() { - let _ = components.next(); - } - let ns = match components.next() { - None => { - return LibraryPath::new_from_components(LibraryNamespace::Anon, parts); - } - Some(component) => LibraryNamespace::from_ident_unchecked(Ident::from_raw_parts( - Span::new(SourceSpan::default(), component.as_symbol_name().as_str().into()), - )), - }; + use midenc_session::LibraryPath; + let components = self.path.iter(); + let mut path = LibraryPath::default(); for component in components { - let id = Ident::from_raw_parts(Span::new( - SourceSpan::default(), - component.as_symbol_name().as_str().into(), - )); - parts.push(id); + if component.is_root() { + path.push_component("::"); + continue; + } else { + path.push_component(component.as_symbol_name().as_str()); + } } - LibraryPath::new_from_components(ns, parts) + path } /// Returns true if this symbol name is fully-qualified @@ -777,12 +763,61 @@ impl Iterator for SymbolNameComponents { } impl ExactSizeIterator for SymbolNameComponents { fn len(&self) -> usize { - let is_empty = self.name == interner::symbols::Empty; - if is_empty { - assert_eq!(self.parts.len(), 0, "malformed symbol name components"); + if self.done || self.name == interner::symbols::Empty { 0 } else { - self.parts.len() + 1 + self.parts.len() + 1 + usize::from(self.absolute) } } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn symbol_name_components_len_matches_iteration_count() { + // Test case: absolute path with parts + let iter = SymbolNameComponents { + parts: alloc::collections::VecDeque::from(["foo", "bar"]), + name: SymbolName::intern("baz"), + absolute: true, + done: false, + }; + assert_eq!(iter.len(), 4); // Root + foo + bar + baz + + // Test case: relative path (no Root) + let iter = SymbolNameComponents { + parts: alloc::collections::VecDeque::from(["foo"]), + name: SymbolName::intern("bar"), + absolute: false, + done: false, + }; + assert_eq!(iter.len(), 2); // foo + bar + + // Test case: done iterator returns 0 + let iter = SymbolNameComponents { + parts: alloc::collections::VecDeque::new(), + name: SymbolName::intern("x"), + absolute: false, + done: true, + }; + assert_eq!(iter.len(), 0); + + // Test case: len decreases correctly during iteration + let mut iter = SymbolNameComponents { + parts: alloc::collections::VecDeque::from(["a"]), + name: SymbolName::intern("b"), + absolute: true, + done: false, + }; + assert_eq!(iter.len(), 3); // Root + a + b + iter.next(); + assert_eq!(iter.len(), 2); // a + b + iter.next(); + assert_eq!(iter.len(), 1); // b + iter.next(); + assert_eq!(iter.len(), 0); // done + assert!(iter.next().is_none()); + } +} diff --git a/hir/src/lib.rs b/hir/src/lib.rs index 451846177..c4062955f 100644 --- a/hir/src/lib.rs +++ b/hir/src/lib.rs @@ -95,3 +95,124 @@ pub use self::{ patterns::{Rewriter, RewriterExt}, program_point::{Position, ProgramPoint}, }; + +/// Represents the target of a `log::trace!`/`log::debug!`/etc trace message. +#[derive(Clone)] +pub struct TraceTarget { + category: interner::Symbol, + topic: Option, + relevant_symbol: Option, + _cached: core::cell::Cell>, +} + +impl Default for TraceTarget { + fn default() -> Self { + Self { + category: interner::symbols::Empty, + topic: None, + relevant_symbol: None, + _cached: core::cell::Cell::new(None), + } + } +} + +impl TraceTarget { + pub fn category(category: impl Into) -> Self { + Self { + category: category.into(), + ..Default::default() + } + } + + pub fn with_topic(mut self, topic: impl Into) -> Self { + self.topic = Some(topic.into()); + self._cached.set(None); + self + } + + pub fn with_relevant_symbol(mut self, symbol: impl Into) -> Self { + self.relevant_symbol = Some(symbol.into()); + self._cached.set(None); + self + } + + pub fn relevant_symbol(&self) -> Option<&'static str> { + self.relevant_symbol.map(|sym| sym.as_str()) + } +} + +impl core::ops::Deref for TraceTarget { + type Target = str; + + #[inline] + fn deref(&self) -> &Self::Target { + self.as_ref() + } +} + +impl AsRef for TraceTarget { + fn as_ref(&self) -> &str { + match self._cached.get() { + Some(cached) => cached.as_str(), + None => { + let cached = interner::Symbol::intern(self); + self._cached.set(Some(cached)); + cached.as_str() + } + } + } +} + +impl core::fmt::Debug for TraceTarget { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + Self { + category, + topic: None, + relevant_symbol: None, + _cached: _, + } => f.write_str(category.as_str()), + Self { + category, + topic: None, + relevant_symbol: Some(sym), + _cached: _, + } => write!(f, "{category}:{sym}"), + Self { + category, + topic: Some(topic), + relevant_symbol: None, + _cached: _, + } => write!(f, "{category}:{topic}"), + Self { + category, + topic: Some(topic), + relevant_symbol: Some(sym), + _cached: _, + } => write!(f, "{category}:{topic}:{sym}"), + } + } +} + +impl core::fmt::Display for TraceTarget { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + if let Some(cached) = self._cached.get() { + return f.write_str(cached.as_str()); + } + + match self { + Self { + category, + topic: None, + relevant_symbol: _, + _cached: _, + } => f.write_str(category.as_str()), + Self { + category, + topic: Some(topic), + relevant_symbol: _, + _cached: _, + } => write!(f, "{category}:{topic}"), + } + } +} diff --git a/hir/src/pass.rs b/hir/src/pass.rs index 0f2b9f0bb..b8a1a9e3b 100644 --- a/hir/src/pass.rs +++ b/hir/src/pass.rs @@ -7,7 +7,7 @@ pub mod registry; mod specialization; pub mod statistics; -use alloc::string::String; +use alloc::{borrow::Cow, string::String}; pub use self::{ analysis::{Analysis, AnalysisManager, OperationAnalysis, PreservedAnalyses}, @@ -18,7 +18,7 @@ pub use self::{ specialization::PassTarget, statistics::{PassStatistic, Statistic, StatisticValue}, }; -use crate::{EntityRef, Operation, OperationName, OperationRef, SmallVec}; +use crate::{EntityRef, Operation, OperationName, OperationRef, SmallVec, TraceTarget}; /// Handles IR printing, based on the [`IRPrintingConfig`] passed in /// [Print::new]. Currently, this struct is managed by the [`PassManager`]'s [`PassInstrumentor`], @@ -40,11 +40,8 @@ use crate::{EntityRef, Operation, OperationName, OperationRef, SmallVec}; #[derive(Default)] pub struct Print { selected_passes: Option, - + filters: SmallVec<[OpFilter; 1]>, only_when_modified: bool, - op_filter: Option, - - target: Option, } /// Which passes are enabled for IR printing. @@ -56,65 +53,62 @@ enum SelectedPasses { Just(SmallVec<[String; 1]>), } -#[derive(Default, Debug)] -enum OpFilter { +#[derive(Default, Debug, Clone)] +pub enum OpFilter { /// Print all operations #[default] All, /// Print any `Symbol` operation, optionally filtering by symbols whose name contains a given /// string. - /// NOTE: Currently marked as `dead_code` since it is not configured via the CLI. See - /// [`Print::with_symbol_filter`] for more details. - #[allow(dead_code)] - Symbol(Option<&'static str>), + /// + /// See [`Print::with_symbol_filter`] for more details. + Symbol(Option>), /// Print only operations of the given type - /// NOTE: Currently marked as `dead_code` since it is not configured via the CLI. See - /// [`Print::with_symbol_filter`] for more details. - #[allow(dead_code)] + /// + /// NOTE: Currently marked as `dead_code` since it is not configured via the CLI. + /// + /// See [`Print::with_symbol_filter`] for more details. Type { dialect: crate::interner::Symbol, op: crate::interner::Symbol, }, } +impl From for OpFilter { + fn from(value: midenc_session::IrFilter) -> Self { + use midenc_session::IrFilter; + + match value { + IrFilter::Any => OpFilter::All, + IrFilter::Symbol(pattern) => OpFilter::Symbol(pattern), + IrFilter::Op { dialect, op } => OpFilter::Type { dialect, op }, + } + } +} + impl Print { pub fn new(config: &IRPrintingConfig) -> Option { - let print = if config.print_ir_after_all + if config.print_ir_after_all || !config.print_ir_after_pass.is_empty() || config.print_ir_after_modified { - Some(Self::default()) + Some(Self::default().with_pass_filter(config).with_symbol_filter(config)) } else { None - }; - print.map(|p| p.with_pass_filter(config)).map(|p| p.with_symbol_filter(config)) + } } pub fn with_type_filter(mut self) -> Self { let dialect = ::dialect_name(); let op = ::name(); - self.op_filter = Some(OpFilter::Type { dialect, op }); - self - } - - #[allow(dead_code)] - /// Create a printer that only prints `Symbol` operations containing `name` - fn with_symbol_matching(mut self, name: &'static str) -> Self { - self.op_filter = Some(OpFilter::Symbol(Some(name))); + self.filters.push(OpFilter::Type { dialect, op }); self } /// Configure which operations are printed. This is set via the different variants present in /// [`OpFilter`]. - /// - /// NOTE: At the moment, all operations are shown because symbol filtering is not processed by - /// the CLI. If added, this function could be expanded to process it. - fn with_symbol_filter(self, _config: &IRPrintingConfig) -> Self { - self.with_all_symbols() - } - - fn with_all_symbols(mut self) -> Self { - self.op_filter = Some(OpFilter::All); + fn with_symbol_filter(mut self, config: &IRPrintingConfig) -> Self { + self.filters.extend(config.print_ir_filters.iter().cloned()); self } @@ -142,47 +136,57 @@ impl Print { self } - /// Specify the `log` target to write the IR output to. - /// - /// By default, the target is `printer`, unless the op is a `Symbol`, in which case it is the - /// `Symbol` name. - pub fn with_target(mut self, target: impl AsRef) -> Self { - let target = compact_str::CompactString::new(target.as_ref()); - self.target = Some(target); - self - } - - fn print_ir(&self, op: EntityRef<'_, Operation>) { - match self.op_filter { - Some(OpFilter::All) => { - let target = self.target.as_deref().unwrap_or("printer"); - log::trace!(target: target, "{op}"); + pub fn print_ir(&self, op: EntityRef<'_, Operation>, topic: &'static str, phase: &str) { + let target = TraceTarget::category("pass").with_topic(topic); + // Determine if any filter applies to `op`, and print accordingly + if self.filters.is_empty() { + let name = op.name(); + if let Some(sym) = op.as_symbol() { + log::trace!(target: &target, symbol = sym.name().as_str(), dialect = name.dialect().as_str(), op = name.name().as_str(); "{phase}: {op}"); + } else { + log::trace!(target: &target, dialect = name.dialect().as_str(), op = name.name().as_str(); "{phase}: {op}"); } - Some(OpFilter::Type { - dialect, - op: op_name, - }) => { - let name = op.name(); - if name.dialect() == dialect && name.name() == op_name { - let target = self.target.as_deref().unwrap_or("printer"); - log::trace!(target: target, "{op}"); + return; + } + + for filter in self.filters.iter() { + match filter { + OpFilter::All => { + let name = op.name(); + if let Some(sym) = op.as_symbol() { + log::trace!(target: &target, symbol = sym.name().as_str(), dialect = name.dialect().as_str(), op = name.name().as_str(); "{phase}: {op}"); + } else { + log::trace!(target: &target, dialect = name.dialect().as_str(), op = name.name().as_str(); "{phase}: {op}"); + } + break; } - } - Some(OpFilter::Symbol(None)) => { - if let Some(sym) = op.as_symbol() { - let name = sym.name().as_str(); - let target = self.target.as_deref().unwrap_or(name); - log::trace!(target: target, "{}", sym.as_symbol_operation()); + OpFilter::Type { + dialect, + op: op_name, + } => { + let name = op.name(); + if name.dialect() == *dialect && name.name() == *op_name { + log::trace!(target: &target, dialect = dialect.as_str(), op = op_name.as_str(); "{phase}: {op}"); + break; + } } - } - Some(OpFilter::Symbol(Some(filter))) => { - if let Some(sym) = op.as_symbol().filter(|sym| sym.name().as_str().contains(filter)) - { - let target = self.target.as_deref().unwrap_or(filter); - log::trace!(target: target, "{}", sym.as_symbol_operation()); + OpFilter::Symbol(None) => { + if let Some(sym) = op.as_symbol() { + let name = op.name(); + log::trace!(target: &target, symbol = sym.name().as_str(), dialect = name.dialect().as_str(), op = name.name().as_str(); "{phase}: {}", sym.as_symbol_operation()); + break; + } + } + OpFilter::Symbol(Some(filter)) => { + if let Some(sym) = + op.as_symbol().filter(|sym| sym.name().as_str().contains(filter.as_ref())) + { + let name = op.name(); + log::trace!(target: &target, symbol = sym.name().as_str(), dialect = name.dialect().as_str(), op = name.name().as_str(); "{phase}: {}", sym.as_symbol_operation()); + break; + } } } - None => (), } } @@ -216,9 +220,8 @@ impl PassInstrumentation for Print { return; } - log::trace!("IR before the pass pipeline"); let op = op.borrow(); - self.print_ir(op); + self.print_ir(op, "pipeline", "before"); } fn run_before_pass(&mut self, pass: &dyn OperationPass, op: &OperationRef) { @@ -226,9 +229,8 @@ impl PassInstrumentation for Print { return; } if self.pass_filter(pass) { - log::trace!("Before the {} pass", pass.name()); let op = op.borrow(); - self.print_ir(op); + self.print_ir(op, pass.name(), "before"); } } @@ -241,9 +243,8 @@ impl PassInstrumentation for Print { let changed = post_execution_state.post_pass_status(); if self.should_print(pass, changed) { - log::trace!("After the {} pass", pass.name()); let op = op.borrow(); - self.print_ir(op); + self.print_ir(op, pass.name(), "after"); } } } diff --git a/hir/src/pass/analysis.rs b/hir/src/pass/analysis.rs index f70d1b255..cadae8128 100644 --- a/hir/src/pass/analysis.rs +++ b/hir/src/pass/analysis.rs @@ -237,8 +237,12 @@ impl PreservedAnalyses { fn insert(&mut self, id: TypeId) { match self.preserved.binary_search_by_key(&id, |probe| *probe) { - Ok(index) => self.preserved.insert(index, id), - Err(index) => self.preserved.insert(index, id), + Ok(index) => { + self.preserved[index] = id; + } + Err(index) => { + self.preserved.insert(index, id); + } } } @@ -704,3 +708,29 @@ impl AnalysisMap { self.analyses.retain(|_, a| !a.invalidate(preserved_analyses)); } } + +#[cfg(test)] +mod tests { + use super::*; + + struct DummyAnalysis; + + #[test] + fn preserved_analyses_no_duplicates() { + let mut preserved = PreservedAnalyses::default(); + + // Insert the same type multiple times + preserved.preserve::(); + preserved.preserve::(); + preserved.preserve::(); + + // Should only have one entry, not three + assert_eq!(preserved.preserved.len(), 1); + assert!(preserved.is_preserved::()); + + // After removal, it should be completely gone + preserved.unpreserve::(); + assert!(!preserved.is_preserved::()); + assert!(preserved.preserved.is_empty()); + } +} diff --git a/hir/src/pass/manager.rs b/hir/src/pass/manager.rs index afdd0b78b..9fdf390c9 100644 --- a/hir/src/pass/manager.rs +++ b/hir/src/pass/manager.rs @@ -11,7 +11,7 @@ use midenc_session::{Options, diagnostics::Severity}; use smallvec::{SmallVec, smallvec}; use super::{ - AnalysisManager, OperationPass, Pass, PassExecutionState, PassInstrumentation, + AnalysisManager, OpFilter, OperationPass, Pass, PassExecutionState, PassInstrumentation, PassInstrumentor, PipelineParentInfo, Statistic, }; use crate::{ @@ -35,8 +35,6 @@ pub enum PassDisplayMode { Pipeline, } -// TODO(pauls) -#[allow(unused)] #[derive(Default, Debug)] pub struct IRPrintingConfig { pub print_module_scope: bool, @@ -45,6 +43,7 @@ pub struct IRPrintingConfig { pub print_ir_after_all: bool, pub print_ir_after_pass: SmallVec<[String; 1]>, pub print_ir_after_modified: bool, + pub print_ir_filters: SmallVec<[OpFilter; 1]>, pub flags: OpPrintingFlags, } @@ -62,10 +61,19 @@ impl TryFrom<&Options> for IRPrintingConfig { )); }; - Ok(IRPrintingConfig { + let print_ir_filters = options + .print_ir_filters + .iter() + .cloned() + .map(OpFilter::from) + .filter(|filter| !matches!(filter, OpFilter::All)) + .collect(); + + Ok(Self { print_ir_after_all: options.print_ir_after_all, print_ir_after_pass: pass_filters.into(), print_ir_after_modified: options.print_ir_after_modified, + print_ir_filters, ..Default::default() }) } diff --git a/hir/src/pass/pass.rs b/hir/src/pass/pass.rs index 224ee31c6..de4556dbe 100644 --- a/hir/src/pass/pass.rs +++ b/hir/src/pass/pass.rs @@ -143,6 +143,12 @@ pub enum PostPassStatus { Changed, } +impl PostPassStatus { + pub const fn ir_changed(&self) -> bool { + matches!(self, Self::Changed) + } +} + impl From for PostPassStatus { fn from(ir_was_changed: bool) -> Self { if ir_was_changed { @@ -153,6 +159,14 @@ impl From for PostPassStatus { } } +impl core::ops::BitOrAssign for PostPassStatus { + fn bitor_assign(&mut self, rhs: Self) { + if rhs.ir_changed() { + *self = PostPassStatus::Changed; + } + } +} + /// A compiler pass which operates on an [Operation] of some kind. #[allow(unused_variables)] pub trait Pass: Sized + Any { diff --git a/hir/src/patterns/applicator.rs b/hir/src/patterns/applicator.rs index f11114ed7..40014ed5d 100644 --- a/hir/src/patterns/applicator.rs +++ b/hir/src/patterns/applicator.rs @@ -102,16 +102,29 @@ impl PatternApplicator { let op_specific_patterns = self.patterns.get(&op_name).map(|p| p.as_slice()).unwrap_or(&[]); if op_specific_patterns.is_empty() { - log::trace!(target: "pattern-rewrite-driver", "no op-specific patterns found for '{op_name}'"); + log::trace!( + target: "pattern-rewrite-driver", + dialect = op_name.dialect().as_str(), + op = op_name.name().as_str(); + "no op-specific patterns found for '{op_name}'" + ); } else { log::trace!( target: "pattern-rewrite-driver", + dialect = op_name.dialect().as_str(), + op = op_name.name().as_str(); "found {} op-specific patterns for '{op_name}'", op_specific_patterns.len() ); } - log::trace!(target: "pattern-rewrite-driver", "{} op-agnostic patterns available", self.match_any_patterns.len()); + log::trace!( + target: "pattern-rewrite-driver", + dialect = op_name.dialect().as_str(), + op = op_name.name().as_str(); + "{} op-agnostic patterns available", + self.match_any_patterns.len() + ); // Process the op-specific patterns and op-agnostic patterns in an interleaved fashion let mut op_patterns = op_specific_patterns.iter().peekable(); @@ -131,6 +144,8 @@ impl PatternApplicator { if let Some(best_pattern) = best_pattern { log::trace!( target: "pattern-rewrite-driver", + dialect = op_name.dialect().as_str(), + op = op_name.name().as_str(); "selected op-agnostic pattern '{}' because its benefit is higher than the \ next best op-specific pattern '{}'", next_any_pattern.name(), @@ -139,6 +154,8 @@ impl PatternApplicator { } else { log::trace!( target: "pattern-rewrite-driver", + dialect = op_name.dialect().as_str(), + op = op_name.name().as_str(); "selected op-agnostic pattern '{}' because no op-specific pattern is \ available", next_any_pattern.name() @@ -148,21 +165,37 @@ impl PatternApplicator { } else { // The op-specific pattern is best, if available, so actually consume it from the iterator if let Some(best_pattern) = best_pattern { - log::trace!(target: "pattern-rewrite-driver", "selected op-specific pattern '{}'", best_pattern.name()); + log::trace!( + target: "pattern-rewrite-driver", + dialect = op_name.dialect().as_str(), + op = op_name.name().as_str(); + "selected op-specific pattern '{}'", + best_pattern.name() + ); } best_pattern = op_patterns.next(); } // Break if we have exhausted all patterns let Some(best_pattern) = best_pattern else { - log::trace!(target: "pattern-rewrite-driver", "all patterns have been exhausted"); + log::trace!( + target: "pattern-rewrite-driver", + dialect = op_name.dialect().as_str(), + op = op_name.name().as_str(); + "all patterns have been exhausted" + ); break; }; // Can we apply this pattern? let applicable = can_apply(&**best_pattern); if !applicable { - log::trace!(target: "pattern-rewrite-driver", "skipping pattern: can_apply returned false"); + log::trace!( + target: "pattern-rewrite-driver", + dialect = op_name.dialect().as_str(), + op = op_name.name().as_str(); + "skipping pattern: can_apply returned false" + ); continue; } @@ -173,22 +206,43 @@ impl PatternApplicator { // TODO: Save the nearest parent IsolatedFromAbove op of this op for use in debug // messages/rendering, as the rewrite may invalidate `op` - log::debug!(target: "pattern-rewrite-driver", "trying to match '{}'", best_pattern.name()); + log::debug!( + target: "pattern-rewrite-driver", + dialect = op_name.dialect().as_str(), + op = op_name.name().as_str(); + "trying to match '{}'", + best_pattern.name() + ); match best_pattern.match_and_rewrite(op, rewriter) { Ok(matched) => { if matched { - log::trace!(target: "pattern-rewrite-driver", "pattern matched successfully"); + log::trace!( + target: "pattern-rewrite-driver", + dialect = op_name.dialect().as_str(), + op = op_name.name().as_str(); + "pattern matched successfully" + ); result = on_success(&**best_pattern).map_err(PatternApplicationError::Report); break; } else { - log::trace!(target: "pattern-rewrite-driver", "failed to match pattern"); + log::trace!( + target: "pattern-rewrite-driver", + dialect = op_name.dialect().as_str(), + op = op_name.name().as_str(); + "failed to match pattern" + ); on_failure(&**best_pattern); } } Err(err) => { - log::error!(target: "pattern-rewrite-driver", "error occurred during match_and_rewrite: {err}"); + log::error!( + target: "pattern-rewrite-driver", + dialect = op_name.dialect().as_str(), + op = op_name.name().as_str(); + "error occurred during match_and_rewrite: {err}" + ); result = Err(PatternApplicationError::Report(err)); on_failure(&**best_pattern); } diff --git a/hir/src/patterns/driver.rs b/hir/src/patterns/driver.rs index d0444ecf3..05ac24135 100644 --- a/hir/src/patterns/driver.rs +++ b/hir/src/patterns/driver.rs @@ -12,7 +12,7 @@ use crate::{ OperationFolder, OperationRef, ProgramPoint, RawWalk, Region, RegionRef, Report, SourceSpan, Spanned, Value, ValueRef, WalkResult, adt::SmallSet, - patterns::{PatternApplicationError, RewritePattern}, + patterns::{PatternApplicationError, RewritePattern, TracingRewriterListener}, traits::{ConstantLike, Foldable, IsolatedFromAbove}, }; @@ -266,7 +266,11 @@ pub struct GreedyRewriteConfig { impl Default for GreedyRewriteConfig { fn default() -> Self { Self { - listener: None, + listener: if log::log_enabled!(target: "rewriter", log::Level::Trace) { + Some(Rc::new(TracingRewriterListener)) + } else { + None + }, scope: None, max_iterations: core::num::NonZeroU32::new(10), max_rewrites: None, @@ -475,11 +479,11 @@ impl GreedyPatternRewriteDriver { fn process_worklist_item( &self, rewriter: &mut PatternRewriter>, - mut op_ref: OperationRef, + op_ref: OperationRef, ) -> bool { - let op = op_ref.borrow(); + log::trace!(target: "pattern-rewrite-driver", "processing operation '{op_ref}'"); - log::trace!(target: "pattern-rewrite-driver", "processing operation '{op}'"); + let op = op_ref.borrow(); // If the operation is trivially dead - remove it. if op.is_trivially_dead() { @@ -493,10 +497,6 @@ impl GreedyPatternRewriteDriver { // folding loop, since the folded result would be immediately materialized as a constant // op, and then revisited. if !op.implements::() { - // Re-borrow mutably since we're going to try and rewrite `op` now - drop(op); - let op = op_ref.borrow_mut(); - let mut results = SmallVec::<[OpFoldResult; 1]>::default(); log::trace!(target: "pattern-rewrite-driver", "attempting to fold operation.."); if op.fold(&mut results).is_ok() { @@ -634,6 +634,9 @@ impl GreedyPatternRewriteDriver { log::trace!(target: "pattern-rewrite-driver", "operation could not be folded"); } + // Drop this reference before we begin rewriting + drop(op); + // Try to match one of the patterns. // // The rewriter is automatically notified of any necessary changes, so there is nothing @@ -647,7 +650,7 @@ impl GreedyPatternRewriteDriver { // This is another aspect of the listener infra that needs to be handled log::trace!(target: "pattern-rewrite-driver", "attempting to match and rewrite one of the input patterns.."); let result = if let Some(listener) = self.config.listener.as_deref() { - let op_name = op_ref.borrow().name(); + let op_name = op_ref.name(); let can_apply = |pattern: &dyn RewritePattern| { log::trace!(target: "pattern-rewrite-driver", "applying pattern {} to op {}", pattern.name(), &op_name); listener.notify_pattern_begin(pattern, op_ref); diff --git a/hir/src/patterns/pattern.rs b/hir/src/patterns/pattern.rs index 50eb3ae56..a62a323f5 100644 --- a/hir/src/patterns/pattern.rs +++ b/hir/src/patterns/pattern.rs @@ -320,7 +320,7 @@ mod tests { #[test] fn rewrite_pattern_api_test() { - let mut builder = env_logger::Builder::from_env("MIDENC_TRACE"); + let mut builder = midenc_log::Builder::from_env("MIDENC_TRACE"); builder.init(); let context = Rc::new(Context::default()); diff --git a/hir/src/patterns/rewriter.rs b/hir/src/patterns/rewriter.rs index 97c9f9e46..e3dc0780a 100644 --- a/hir/src/patterns/rewriter.rs +++ b/hir/src/patterns/rewriter.rs @@ -1,12 +1,15 @@ use alloc::{boxed::Box, format, rc::Rc}; use core::ops::{Deref, DerefMut}; +use midenc_session::diagnostics::PrintDiagnostic; use smallvec::SmallVec; use crate::{ BlockRef, Builder, Context, InsertionGuard, Listener, ListenerType, OpBuilder, OpOperandImpl, OperationRef, PostOrderBlockIter, ProgramPoint, RegionRef, Report, SourceSpan, Usable, - ValueRef, patterns::Pattern, + ValueRef, + formatter::{DisplayOptional, DisplayValues}, + patterns::Pattern, }; /// A [Rewriter] is a [Builder] extended with additional functionality that is of primary use when @@ -127,7 +130,7 @@ pub trait Rewriter: Builder + RewriterListener { } /// This method erases all operations in a block. - fn erase_block(&mut self, block: BlockRef) { + fn erase_block(&mut self, mut block: BlockRef) { assert!(!block.borrow().is_used(), "expected 'block' to be unused"); let mut next_op = block.borrow().body().back().as_pointer(); @@ -141,10 +144,7 @@ pub trait Rewriter: Builder + RewriterListener { self.notify_block_erased(block); // Remove block from parent region - let mut region = block.parent().expect("expected 'block' to have a parent region"); - let mut region_mut = region.borrow_mut(); - let mut cursor = unsafe { region_mut.body_mut().cursor_mut_from_ptr(block) }; - cursor.remove(); + block.borrow_mut().erase(); } /// Move the blocks that belong to `region` before the given insertion point in another region, @@ -153,6 +153,7 @@ pub trait Rewriter: Builder + RewriterListener { /// correct block arguments. fn inline_region_before(&mut self, mut region: RegionRef, mut ip: RegionRef) { assert!(!RegionRef::ptr_eq(®ion, &ip), "cannot inline a region into itself"); + log::trace!(target: "rewriter", "inlining blocks of {region} into {ip}"); let region_body = region.borrow_mut().body_mut().take(); if !self.has_listener() { let mut parent_region = ip.borrow_mut(); @@ -258,6 +259,11 @@ pub trait Rewriter: Builder + RewriterListener { /// The dest block must have no successors. Otherwise, the resulting IR will have unreachable /// operations. fn merge_blocks(&mut self, src: BlockRef, dest: BlockRef, args: &[Option]) { + log::trace!( + target: "rewriter", + "merging {src} into {dest} replacing uses of its block arguments with {}", + DisplayValues::new(args.iter().map(|v| DisplayOptional(v.as_ref()))) + ); let ip = dest.borrow().body().back().as_pointer(); self.inline_block_before(src, dest, ip, args); } @@ -816,9 +822,218 @@ impl Listener for NoopRewriterListener { } } impl RewriterListener for NoopRewriterListener { + #[inline(always)] fn notify_operation_replaced(&self, _op: OperationRef, _replacement: OperationRef) {} } +/// A listener of kind `Rewriter` that emits trace logging for events +pub struct TracingRewriterListener; +impl Listener for TracingRewriterListener { + #[inline] + fn kind(&self) -> ListenerType { + ListenerType::Rewriter + } + + #[inline] + fn notify_operation_inserted(&self, _op: OperationRef, _prev: ProgramPoint) { + if log::log_enabled!(target: "rewriter", log::Level::Trace) { + let name = _op.name(); + let (event, direction) = if _prev.is_valid() { + ("moved", "from") + } else { + ("inserted", "at") + }; + if let Some(symbol) = _op.borrow().as_symbol() { + log::trace!( + target: "rewriter", + symbol = symbol.name().as_str(), + dialect = name.dialect().as_str(), + op = name.name().as_str(), + rewrite_event = event; + "{event} '{name}' {direction} {_prev}" + ); + } else { + log::trace!( + target: "rewriter", + dialect = name.dialect().as_str(), + op = name.name().as_str(), + rewrite_event = event; + "{event} '{name}' {direction} {_prev}", + ); + } + } + } + + #[inline] + fn notify_block_inserted( + &self, + _block: BlockRef, + _prev: Option, + _ip: Option, + ) { + if log::log_enabled!(target: "rewriter", log::Level::Trace) { + match (_prev, _ip) { + (None, None) => { + log::trace!( + target: "rewriter", + rewrite_event = "created"; + "created {_block}" + ); + } + (None, Some(ip)) => { + log::trace!( + target: "rewriter", + rewrite_event = "inserted"; + "inserted {_block} at {ip}" + ); + } + (Some(prev), Some(ip)) => { + log::trace!( + target: "rewriter", + rewrite_event = "moved"; + "moved {_block} from {prev} to {ip}" + ); + } + _ => unreachable!(), + } + } + } +} +impl RewriterListener for TracingRewriterListener { + fn notify_operation_replaced(&self, _op: OperationRef, _replacement: OperationRef) { + if log::log_enabled!(target: "rewriter", log::Level::Trace) { + log::trace!( + target: "rewriter", + rewrite_event = "replaced"; + "replaced {_op} with {_replacement}" + ); + } + } + + fn notify_block_erased(&self, _block: BlockRef) { + if log::log_enabled!(target: "rewriter", log::Level::Trace) { + log::trace!( + target: "rewriter", + rewrite_event = "erased"; + "erased {_block}" + ); + } + } + + fn notify_operation_modification_started(&self, _op: &OperationRef) { + if log::log_enabled!(target: "rewriter", log::Level::Trace) { + let name = _op.name(); + log::trace!( + target: "rewriter", + dialect = name.dialect().as_str(), + op = name.name().as_str(), + rewrite_event = "modification-started"; + "starting modification of {_op}" + ); + } + } + + fn notify_operation_modification_canceled(&self, _op: &OperationRef) { + if log::log_enabled!(target: "rewriter", log::Level::Trace) { + let name = _op.name(); + log::trace!( + target: "rewriter", + dialect = name.dialect().as_str(), + op = name.name().as_str(), + rewrite_event = "modification-canceled"; + "canceled modification" + ); + } + } + + fn notify_operation_modified(&self, _op: OperationRef) { + if log::log_enabled!(target: "rewriter", log::Level::Trace) { + let name = _op.name(); + log::trace!( + target: "rewriter", + dialect = name.dialect().as_str(), + op = name.name().as_str(), + rewrite_event = "modified"; + "completed modification of {_op}" + ); + } + } + + fn notify_operation_replaced_with_values( + &self, + _op: OperationRef, + _replacement: &[Option], + ) { + if log::log_enabled!(target: "rewriter", log::Level::Trace) { + let name = _op.name(); + log::trace!( + target: "rewriter", + dialect = name.dialect().as_str(), + op = name.name().as_str(), + rewrite_event = "replaced"; + "replaced op with {}: {_op}", + DisplayValues::new(_replacement.iter().map(|v| { + DisplayOptional(v.as_ref()) + })) + ); + } + } + + fn notify_operation_erased(&self, _op: OperationRef) { + if log::log_enabled!(target: "rewriter", log::Level::Trace) { + let name = _op.name(); + log::trace!( + target: "rewriter", + dialect = name.dialect().as_str(), + op = name.name().as_str(), + rewrite_event = "erased"; + "erased op {_op}" + ); + } + } + + fn notify_pattern_begin(&self, _pattern: &dyn Pattern, _op: OperationRef) { + if log::log_enabled!(target: "rewriter", log::Level::Trace) { + let name = _op.name(); + log::trace!( + target: "rewriter", + dialect = name.dialect().as_str(), + op = name.name().as_str(), + pattern = _pattern.name(), + rewrite_event = "pattern-begin"; + "attempting pattern against {_op}" + ); + } + } + + fn notify_pattern_end(&self, _pattern: &dyn Pattern, _success: bool) { + if log::log_enabled!(target: "rewriter", log::Level::Trace) { + let outcome = if _success { + "matched successfully" + } else { + "failed" + }; + log::trace!( + target: "rewriter", + pattern = _pattern.name(), + rewrite_event = "pattern-end"; + "pattern {outcome}" + ); + } + } + + fn notify_match_failure(&self, _span: SourceSpan, _reason: Report) { + if log::log_enabled!(target: "rewriter", log::Level::Error) { + let diag = PrintDiagnostic::new(_reason); + log::error!( + target: "rewriter", + rewrite_event = "match-failure"; + "match failed with: {diag}", + ); + } + } +} + pub struct ForwardingListener { base: Base, derived: Derived, @@ -901,6 +1116,7 @@ impl RewriterListener } fn notify_match_failure(&self, span: SourceSpan, reason: Report) { + // This is necessary for now, as we cannot clone Report let err = Report::msg(format!("{reason}")); self.base.notify_match_failure(span, reason); self.derived.notify_match_failure(span, err); diff --git a/midenc-compile/Cargo.toml b/midenc-compile/Cargo.toml index 5ee330626..470c0bd0f 100644 --- a/midenc-compile/Cargo.toml +++ b/midenc-compile/Cargo.toml @@ -26,6 +26,7 @@ std = [ ] [dependencies] +anyhow.workspace = true clap = { workspace = true, optional = true } log.workspace = true inventory.workspace = true diff --git a/midenc-compile/src/compiler.rs b/midenc-compile/src/compiler.rs index 413182e07..00887d7c9 100644 --- a/midenc-compile/src/compiler.rs +++ b/midenc-compile/src/compiler.rs @@ -7,9 +7,9 @@ use std::ffi::OsString; #[cfg(feature = "std")] use clap::{Parser, builder::ArgPredicate}; use midenc_session::{ - ColorChoice, DebugInfo, InputFile, LinkLibrary, OptLevel, Options, OutputFile, OutputType, - OutputTypeSpec, OutputTypes, Path, PathBuf, ProjectType, Session, TargetEnv, Verbosity, - Warnings, add_target_link_libraries, + ColorChoice, DebugInfo, InputFile, IrFilter, LinkLibrary, OptLevel, Options, OutputFile, + OutputType, OutputTypeSpec, OutputTypes, Path, PathBuf, ProjectType, Session, TargetEnv, + Verbosity, Warnings, add_target_link_libraries, diagnostics::{DefaultSourceManager, Emitter}, }; @@ -338,6 +338,28 @@ pub struct UnstableOptions { ) )] pub print_cfg_after_pass: Vec, + /// Print the IR before each compiler stage. + /// + /// The available stages are: + /// + /// * `link` - performs initial translation to HIR, and links dependencies into the graph + /// + /// * `rewrite` - performs rewrites/optimizations on the initial unmodified HIR + /// + /// * `codegen` - performs lowering from HIR to Miden Assembly + /// + /// * `assemble` - performs assembly of a program or library package + #[cfg_attr( + feature = "std", + arg( + long, + value_name = "STAGE", + value_delimiter = ',', + next_line_help(true), + help_heading = "Passes" + ) + )] + pub print_ir_before_stage: Vec, /// Print the IR after each pass is applied #[cfg_attr( feature = "std", @@ -362,6 +384,29 @@ pub struct UnstableOptions { arg(long, default_value_t = false, help_heading = "Passes") )] pub print_ir_after_modified: bool, + /// Only print IR that matches the given filter. + /// + /// The syntax for filters are as follows: + /// + /// * `any` (default) - matches any operation + /// + /// * `symbol:*` - matches any symbol + /// + /// * `symbol:` - matches any symbol whose name contains + /// + /// * `op:.` - matches any instance of the given operation name + #[cfg_attr( + feature = "std", + arg( + long, + action = clap::ArgAction::Append, + value_name = "FILTER", + value_delimiter = ',', + next_line_help(true), + help_heading = "Passes" + ) + )] + pub print_ir_filter: Vec, /// Print source location information in HIR output /// /// When enabled, HIR output will include #loc() annotations showing the source file, @@ -397,7 +442,7 @@ impl CodegenOptions { "\ Available codegen options: -Usage: midenc compile -C +Usage: midenc -C {all-args}{after-help} @@ -439,7 +484,7 @@ impl UnstableOptions { "\ Available unstable options: -Usage: midenc compile -Z +Usage: midenc -Z {all-args}{after-help} @@ -537,7 +582,10 @@ impl Compiler { // Initialize output types let mut output_types = OutputTypes::new(self.output_types).unwrap_or_else(|err| err.exit()); - if output_types.is_empty() { + let has_final_output = + output_types.keys().any(|ty| matches!(ty, OutputType::Mast | OutputType::Masp)); + if !has_final_output { + // By default, we always produce a final artifact; `--emit` selects additional outputs. output_types.insert(OutputType::Masp, output_file.clone()); } else if output_file.is_some() && output_types.get(&OutputType::Masp).is_some() { // The -o flag overrides --emit @@ -575,6 +623,7 @@ impl Compiler { options.print_ir_after_all = unstable.print_ir_after_all; options.print_ir_after_pass = unstable.print_ir_after_pass; options.print_ir_after_modified = unstable.print_ir_after_modified; + options.print_ir_filters = unstable.print_ir_filter; options.print_hir_source_locations = unstable.print_hir_source_locations; options.trim_path_prefixes = unstable.trim_path_prefixes; @@ -586,6 +635,18 @@ impl Compiler { }; create_target_dir(target_dir.as_path()); + // Raise an error if no inputs were provided + if inputs.is_empty() { + let cmd = ::command(); + let mut err = + clap::Error::new(clap::error::ErrorKind::MissingRequiredArgument).with_cmd(&cmd); + err.insert( + clap::error::ContextKind::InvalidArg, + clap::error::ContextValue::String("INPUT".to_string()), + ); + err.exit(); + } + let source_manager = Arc::new(DefaultSourceManager::default()); Session::new( inputs, diff --git a/midenc-compile/src/stages/assemble.rs b/midenc-compile/src/stages/assemble.rs index f82aa48ca..e6142255e 100644 --- a/midenc-compile/src/stages/assemble.rs +++ b/midenc-compile/src/stages/assemble.rs @@ -1,8 +1,10 @@ use alloc::{string::ToString, vec, vec::Vec}; use miden_assembly::ast::QualifiedProcedureName; -use miden_mast_package::{Dependency, MastArtifact, Package, PackageExport}; -use midenc_session::{Session, diagnostics::IntoDiagnostic}; +use miden_mast_package::{ + Dependency, MastArtifact, Package, PackageExport, PackageKind, ProcedureExport, +}; +use midenc_session::Session; use super::*; @@ -43,8 +45,6 @@ impl Stage for AssembleStage { "successfully assembled mast artifact with digest {}", DisplayHex::new(&mast.digest().as_bytes()) ); - session.emit(OutputMode::Text, &mast).into_diagnostic()?; - session.emit(OutputMode::Binary, &mast).into_diagnostic()?; Ok(Artifact::Assembled(build_package(mast, &input, session))) } else { log::debug!( @@ -74,16 +74,15 @@ fn build_package(mast: MastArtifact, outputs: &CodegenOutput, session: &Session) assert!(outputs.component.entrypoint.is_none(), "expect masm component to be a library"); for module_info in lib.module_infos() { for (_, proc_info) in module_info.procedures() { - let name = - QualifiedProcedureName::new(module_info.path().clone(), proc_info.name.clone()); + let name = QualifiedProcedureName::new(module_info.path(), proc_info.name.clone()); let digest = proc_info.digest; let signature = proc_info.signature.as_deref().cloned(); - exports.push(miden_mast_package::PackageExport { - name, + exports.push(PackageExport::Procedure(ProcedureExport { + path: name.into_inner(), digest, signature, attributes: Default::default(), - }); + })); } } } @@ -103,10 +102,15 @@ fn build_package(mast: MastArtifact, outputs: &CodegenOutput, session: &Session) None => vec![], }; + let kind = match mast { + MastArtifact::Executable(_) => PackageKind::Executable, + MastArtifact::Library(_) => PackageKind::Library, + }; miden_mast_package::Package { name, version: None, description: None, + kind, mast, manifest, sections, diff --git a/midenc-compile/src/stages/codegen.rs b/midenc-compile/src/stages/codegen.rs index ec5490311..ebe1a265e 100644 --- a/midenc-compile/src/stages/codegen.rs +++ b/midenc-compile/src/stages/codegen.rs @@ -53,11 +53,6 @@ impl Stage for CodegenStage { component.borrow().to_masm_component(analysis_manager).map(Box::new)?; let session = context.session(); - if session.should_emit(OutputType::Masm) { - for module in masm_component.modules.iter() { - session.emit(OutputMode::Text, module).into_diagnostic()?; - } - } // Ensure intrinsics modules are linked for intrinsics_module in required_intrinsics_modules(session) { @@ -74,6 +69,10 @@ impl Stage for CodegenStage { masm_component.modules.push(module); } + if session.should_emit(OutputType::Masm) { + session.emit(OutputMode::Text, masm_component.as_ref()).into_diagnostic()?; + } + Ok(CodegenOutput { component: Arc::from(masm_component), link_libraries, @@ -85,22 +84,22 @@ impl Stage for CodegenStage { fn required_intrinsics_modules(session: &Session) -> impl IntoIterator> { [ - masm::intrinsics::load(MEM_INTRINSICS_MODULE_NAME, &session.source_manager) + masm::intrinsics::load(MEM_INTRINSICS_MODULE_NAME, session.source_manager.clone()) .map(Arc::from) .expect("undefined intrinsics module"), - masm::intrinsics::load(I32_INTRINSICS_MODULE_NAME, &session.source_manager) + masm::intrinsics::load(I32_INTRINSICS_MODULE_NAME, session.source_manager.clone()) .map(Arc::from) .expect("undefined intrinsics module"), - masm::intrinsics::load(I64_INTRINSICS_MODULE_NAME, &session.source_manager) + masm::intrinsics::load(I64_INTRINSICS_MODULE_NAME, session.source_manager.clone()) .map(Arc::from) .expect("undefined intrinsics module"), - masm::intrinsics::load(I128_INTRINSICS_MODULE_NAME, &session.source_manager) + masm::intrinsics::load(I128_INTRINSICS_MODULE_NAME, session.source_manager.clone()) .map(Arc::from) .expect("undefined intrinsics module"), - masm::intrinsics::load(CRYPTO_INTRINSICS_MODULE_NAME, &session.source_manager) + masm::intrinsics::load(CRYPTO_INTRINSICS_MODULE_NAME, session.source_manager.clone()) .map(Arc::from) .expect("undefined intrinsics module"), - masm::intrinsics::load(ADVICE_INTRINSICS_MODULE_NAME, &session.source_manager) + masm::intrinsics::load(ADVICE_INTRINSICS_MODULE_NAME, session.source_manager.clone()) .map(Arc::from) .expect("undefined intrinsics module"), ] diff --git a/midenc-compile/src/stages/parse.rs b/midenc-compile/src/stages/parse.rs index d19e8203d..6f65018b2 100644 --- a/midenc-compile/src/stages/parse.rs +++ b/midenc-compile/src/stages/parse.rs @@ -1,11 +1,14 @@ #[cfg(feature = "std")] -use alloc::string::ToString; +use alloc::borrow::Cow; +#[cfg(feature = "std")] use alloc::{format, rc::Rc, sync::Arc}; use miden_assembly::utils::Deserializable; #[cfg(feature = "std")] use miden_assembly::utils::ReadAdapter; #[cfg(feature = "std")] +use midenc_frontend_wasm::{WatEmit, wasm_to_wat}; +#[cfg(feature = "std")] use midenc_session::{FileName, Path}; use midenc_session::{ InputFile, InputType, @@ -122,13 +125,45 @@ impl Stage for ParseStage { ParseOutput::Module(ref module) => { context.session().emit(OutputMode::Text, module).into_diagnostic()?; } - ParseOutput::Wasm(_) | ParseOutput::Library(_) | ParseOutput::Package(_) => (), + #[cfg(feature = "std")] + ParseOutput::Wasm(ref wasm_input) => { + self.emit_wat_for_wasm_input(wasm_input, context.session())?; + } + #[cfg(not(feature = "std"))] + ParseOutput::Wasm(_) => (), + ParseOutput::Library(_) | ParseOutput::Package(_) => (), } Ok(parsed) } } impl ParseStage { + #[cfg(feature = "std")] + fn emit_wat_for_wasm_input(&self, input: &InputType, session: &Session) -> CompilerResult<()> { + if !session.should_emit(midenc_session::OutputType::Wat) { + return Ok(()); + } + + let wasm_bytes: Cow<'_, [u8]> = match input { + InputType::Real(path) => { + Cow::Owned(std::fs::read(path).into_diagnostic().wrap_err_with(|| { + format!("failed to read wasm input from '{}'", path.display()) + })?) + } + InputType::Stdin { input, .. } => Cow::Borrowed(input), + }; + + let wat = wasm_to_wat(wasm_bytes.as_ref()) + .into_diagnostic() + .wrap_err("failed to convert wasm to wat")?; + let artifact = WatEmit(&wat); + session + .emit(OutputMode::Text, &artifact) + .into_diagnostic() + .wrap_err("failed to emit wat output")?; + Ok(()) + } + #[cfg(feature = "std")] fn parse_wasm_from_wat_file(&self, path: &Path) -> CompilerResult { let wasm = wat::parse_file(path).into_diagnostic().wrap_err("failed to parse wat")?; @@ -145,7 +180,7 @@ impl ParseStage { context: Rc, ) -> CompilerResult { use miden_assembly::{ - LibraryNamespace, LibraryPath, + PathBuf as LibraryPath, ast::{self, Ident, ModuleKind}, }; @@ -158,17 +193,16 @@ impl ParseStage { path.display() ) })?; - let namespace = path - .parent() - .map(|dir| { - LibraryNamespace::User(dir.to_str().unwrap().to_string().into_boxed_str().into()) - }) - .unwrap_or(LibraryNamespace::Anon); - let name = LibraryPath::new_from_components(namespace, [module_name]); + let mut name = match path.parent().and_then(|dir| dir.to_str()) { + Some(dir) => LibraryPath::new(&dir).into_diagnostic()?, + None => LibraryPath::new("$anon").into_diagnostic()?, + }; + name.push(&module_name); // Parse AST let mut parser = ast::Module::parser(ModuleKind::Library); - let ast = parser.parse_file(name, path, &context.session().source_manager)?; + let ast = + parser.parse_file(name.as_path(), path, context.session().source_manager.clone())?; Ok(ParseOutput::Module(Arc::from(ast))) } @@ -180,7 +214,7 @@ impl ParseStage { context: Rc, ) -> CompilerResult { use miden_assembly::{ - LibraryPath, + PathBuf as LibraryPath, ast::{self, ModuleKind}, }; @@ -193,7 +227,8 @@ impl ParseStage { // Parse AST let mut parser = ast::Module::parser(ModuleKind::Library); - let ast = parser.parse_str(name, source, &context.session().source_manager)?; + let ast = + parser.parse_str(name.as_path(), source, context.session().source_manager.clone())?; Ok(ParseOutput::Module(Arc::from(ast))) } diff --git a/midenc-compile/src/stages/rewrite.rs b/midenc-compile/src/stages/rewrite.rs index 2456f1ee7..637d3529e 100644 --- a/midenc-compile/src/stages/rewrite.rs +++ b/midenc-compile/src/stages/rewrite.rs @@ -1,13 +1,16 @@ use alloc::boxed::Box; -use midenc_dialect_hir::transforms::TransformSpills; +use midenc_dialect_hir::transforms::{Local2Reg, TransformSpills}; use midenc_dialect_scf::transforms::LiftControlFlowToSCF; use midenc_hir::{ Op, pass::{IRPrintingConfig, Nesting, PassManager}, patterns::{GreedyRewriteConfig, RegionSimplificationLevel}, }; -use midenc_hir_transform::{Canonicalizer, ControlFlowSink, SinkOperandDefs}; +use midenc_hir_transform::{ + Canonicalizer, CommonSubexpressionElimination, SinkOperandDefs, + SparseConditionalConstantPropagation, +}; use super::*; @@ -22,7 +25,6 @@ impl Stage for ApplyRewritesStage { } fn run(&mut self, input: Self::Input, context: Rc) -> CompilerResult { - let ir_print_config: IRPrintingConfig = (&context.as_ref().session().options).try_into()?; log::debug!(target: "driver", "applying rewrite passes"); // TODO(pauls): Set up pass registration for new pass infra /* @@ -49,6 +51,7 @@ impl Stage for ApplyRewritesStage { */ // Construct a pass manager with the default pass pipeline + let ir_print_config = IRPrintingConfig::try_from(&context.session().options)?; let mut pm = PassManager::on::(context.clone(), Nesting::Implicit) .enable_ir_printing(ir_print_config); @@ -63,23 +66,37 @@ impl Stage for ApplyRewritesStage { let mut module_pm = component_pm.nest::(); let mut func_pm = module_pm.nest::(); func_pm.add_pass(Canonicalizer::create_with_config(&rewrite_config)); + func_pm.add_pass(Box::new(CommonSubexpressionElimination)); + func_pm.add_pass(Box::new(SparseConditionalConstantPropagation)); + func_pm.add_pass(Box::new(SinkOperandDefs)); + //func_pm.add_pass(Box::new(ControlFlowSink)); + func_pm.add_pass(Box::new(Local2Reg)); + func_pm.add_pass(Box::new(TransformSpills)); func_pm.add_pass(Box::new(LiftControlFlowToSCF)); // Re-run canonicalization to clean up generated structured control flow func_pm.add_pass(Canonicalizer::create_with_config(&rewrite_config)); func_pm.add_pass(Box::new(SinkOperandDefs)); - func_pm.add_pass(Box::new(ControlFlowSink)); func_pm.add_pass(Box::new(TransformSpills)); + //func_pm.add_pass(Box::new(ControlFlowSink)); + //func_pm.add_pass(Box::new(DeadCodeElimination)); } // Function passes for component-level functions { let mut func_pm = component_pm.nest::(); func_pm.add_pass(Canonicalizer::create_with_config(&rewrite_config)); + func_pm.add_pass(Box::new(CommonSubexpressionElimination)); + func_pm.add_pass(Box::new(SparseConditionalConstantPropagation)); + func_pm.add_pass(Box::new(SinkOperandDefs)); + //func_pm.add_pass(Box::new(ControlFlowSink)); + func_pm.add_pass(Box::new(Local2Reg)); + func_pm.add_pass(Box::new(TransformSpills)); func_pm.add_pass(Box::new(LiftControlFlowToSCF)); // Re-run canonicalization to clean up generated structured control flow func_pm.add_pass(Canonicalizer::create_with_config(&rewrite_config)); func_pm.add_pass(Box::new(SinkOperandDefs)); - func_pm.add_pass(Box::new(ControlFlowSink)); func_pm.add_pass(Box::new(TransformSpills)); + //func_pm.add_pass(Box::new(ControlFlowSink)); + //func_pm.add_pass(Box::new(DeadCodeElimination)); } } diff --git a/midenc-driver/src/midenc.rs b/midenc-driver/src/midenc.rs index 6bb2bffd6..fefa0b262 100644 --- a/midenc-driver/src/midenc.rs +++ b/midenc-driver/src/midenc.rs @@ -19,8 +19,8 @@ pub struct Midenc { /// The input file to compile /// /// You may specify `-` to read from stdin, otherwise you must provide a path - #[arg(required(true), value_name = "FILE")] - input: InputFile, + #[arg(value_name = "FILE")] + input: Option, #[command(flatten)] options: compile::Compiler, } @@ -65,8 +65,11 @@ impl Midenc { if options.working_dir.is_none() { options.working_dir = Some(cwd.into()); } - let session = - Rc::new(options.into_session(vec![input], emitter).with_extra_flags(matches.into())); + let session = Rc::new( + options + .into_session(Vec::from_iter(input), emitter) + .with_extra_flags(matches.into()), + ); let context = Rc::new(Context::new(session)); compile::compile(context) } diff --git a/midenc-log/Cargo.toml b/midenc-log/Cargo.toml new file mode 100644 index 000000000..6d072a61a --- /dev/null +++ b/midenc-log/Cargo.toml @@ -0,0 +1,31 @@ +[package] +name = "midenc-log" +description = "Provides flexible trace logging for midenc" +version.workspace = true +rust-version.workspace = true +repository.workspace = true +homepage.workspace = true +documentation.workspace = true +categories.workspace = true +keywords.workspace = true +license = "MIT OR Apache-2.0" +readme.workspace = true +edition.workspace = true + +[features] +default = ["auto-color", "humantime", "regex"] +color = ["dep:anstream", "dep:anstyle"] +auto-color = ["color", "anstream/auto"] +humantime = ["dep:jiff"] +regex = ["dep:regex"] +kv = ["log/kv"] + +[dependencies] +anstream = { version = "0.6", default-features = false, features = ["wincon"], optional = true } +anstyle = { version = "1.0", optional = true } +log = { workspace = true, features = ["std"] } +jiff = { version = "0.2.3", default-features = false, features = ["std"], optional = true } +regex = { version = "1.0", default-features = false, features = ["std", "perf"], optional = true } + +[dev-dependencies] +snapbox = "0.6" diff --git a/tests/lit/.gitkeep b/midenc-log/README.md similarity index 100% rename from tests/lit/.gitkeep rename to midenc-log/README.md diff --git a/midenc-log/src/filter/directive.rs b/midenc-log/src/filter/directive.rs new file mode 100644 index 000000000..71f4173b2 --- /dev/null +++ b/midenc-log/src/filter/directive.rs @@ -0,0 +1,103 @@ +use log::{Level, LevelFilter}; + +use super::FilterOp; + +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] +pub struct Directive { + pub kind: DirectiveKind, + pub level: LevelFilter, + pub negated: bool, +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum DirectiveKind { + Any, + Module { module: String }, + Component { component: String }, + Topic { component: String, topic: FilterOp }, +} + +impl PartialOrd for DirectiveKind { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +impl Ord for DirectiveKind { + fn cmp(&self, other: &Self) -> core::cmp::Ordering { + use core::cmp::Ordering; + + match (self, other) { + (Self::Any, Self::Any) => Ordering::Equal, + (Self::Any, _) => Ordering::Less, + (_, Self::Any) => Ordering::Greater, + (Self::Module { module: l }, Self::Module { module: r }) => { + l.len().cmp(&r.len()).then_with(|| l.cmp(r)) + } + // Checking modules has greater complexity than components + (Self::Module { module: _ }, Self::Component { component: _ }) => Ordering::Greater, + (Self::Component { component: _ }, Self::Module { module: _ }) => Ordering::Less, + // Checking modules has lesser complexity than the remaining kinds + (Self::Module { module: _ }, _) => Ordering::Less, + (_, Self::Module { module: _ }) => Ordering::Greater, + (Self::Component { component: l }, Self::Component { component: r }) => { + l.len().cmp(&r.len()).then_with(|| l.cmp(r)) + } + (Self::Component { component: _ }, _) => Ordering::Less, + (_, Self::Component { component: _ }) => Ordering::Greater, + ( + Self::Topic { + component: lc, + topic: lt, + }, + Self::Topic { + component: rc, + topic: rt, + }, + ) => lc.len().cmp(&rc.len()).then_with(|| lc.cmp(rc)).then(lt.cmp(rt)), + } + } +} + +impl DirectiveKind { + pub fn matches(&self, target: &str) -> bool { + match self { + Self::Any => true, + Self::Module { module } => target.contains(module), + Self::Component { component } => { + let (target_component, _) = target.split_once(':').unwrap_or((target, "")); + component == target_component + } + Self::Topic { component, topic } => { + let (target_component, target_topic) = + target.split_once(':').unwrap_or((target, "")); + component == target_component && topic.is_match(target_topic) + } + } + } +} + +// Check whether a level and target are enabled by the set of directives. +pub fn enabled(directives: &[Directive], level: Level, target: &str) -> bool { + // Search for the longest match, the vector is assumed to be pre-sorted. + let mut was_matched = false; + for directive in directives.iter().rev() { + // Don't bother applying further positive matches once we've had one positive match + if was_matched && !directive.negated { + continue; + } + + // Setting level to `off` is equivalent to negation and takes precedence over it + let (matches, negated) = match directive.level { + LevelFilter::Off => (directive.kind.matches(target), true), + filter if level <= filter => (directive.kind.matches(target), directive.negated), + _ => continue, + }; + // If we find a negative match, we don't need to do any more checking + if matches && negated { + return false; + } + was_matched |= matches; + } + was_matched +} diff --git a/midenc-log/src/filter/filter.rs b/midenc-log/src/filter/filter.rs new file mode 100644 index 000000000..098f4ae6a --- /dev/null +++ b/midenc-log/src/filter/filter.rs @@ -0,0 +1,725 @@ +use std::{env, fmt, mem}; + +use log::{LevelFilter, Metadata, Record}; + +use crate::filter::{ + Directive, DirectiveKind, FilterOp, KvFilter, ParseError, enabled, kv_filter::KvFilterOp, + parse_spec, parser::ParseResult, +}; + +/// A builder for a log filter. +/// +/// It can be used to parse a set of directives from a string before building +/// a [`Filter`] instance. +/// +/// ## Example +/// +/// ``` +/// # use std::env; +/// use env_filter::Builder; +/// +/// let mut builder = Builder::new(); +/// +/// // Parse a logging filter from an environment variable. +/// if let Ok(rust_log) = env::var("RUST_LOG") { +/// builder.parse(&rust_log); +/// } +/// +/// let filter = builder.build(); +/// ``` +pub struct Builder { + directives: Vec, + kv_filters: Vec, + filter: Option, + built: bool, +} + +impl Builder { + /// Initializes the filter builder with defaults. + pub fn new() -> Builder { + Builder { + directives: Vec::new(), + kv_filters: Vec::new(), + filter: None, + built: false, + } + } + + /// Initializes the filter builder from an environment. + pub fn from_env(env: &str) -> Builder { + let mut builder = Builder::new(); + + if let Ok(s) = env::var(env) { + builder.parse(&s); + } + + builder + } + + /// Insert the directive but ignore duplicates + fn insert_directive(&mut self, directive: Directive) { + for d in self.directives.iter_mut() { + if d.negated != directive.negated { + continue; + } + match &d.kind { + DirectiveKind::Any if matches!(&directive.kind, DirectiveKind::Any) => { + d.level = directive.level; + return; + } + DirectiveKind::Module { module } if matches!(&directive.kind, DirectiveKind::Module { module: m } if m == module) => + { + d.level = directive.level; + return; + } + DirectiveKind::Component { component } if matches!(&directive.kind, DirectiveKind::Component { component: c } if c == component) => + { + d.level = directive.level; + return; + } + DirectiveKind::Topic { component, topic } if matches!(&directive.kind, DirectiveKind::Topic { component: c, topic: t } if c == component && t == topic) => + { + d.level = directive.level; + return; + } + _ => continue, + } + } + self.directives.push(directive); + } + + /// Adds a directive to the filter for a specific module. + pub fn filter_module(&mut self, module: &str, level: LevelFilter) -> &mut Self { + self.insert_directive(Directive { + kind: DirectiveKind::Module { + module: module.to_string(), + }, + level, + negated: false, + }); + self + } + + /// Adds a directive to the filter for all modules. + pub fn filter_level(&mut self, level: LevelFilter) -> &mut Self { + self.insert_directive(Directive { + kind: DirectiveKind::Any, + level, + negated: false, + }); + self + } + + /// Adds a component directive to the filter. + pub fn filter_component( + &mut self, + component: &str, + level: LevelFilter, + negated: bool, + ) -> &mut Self { + self.insert_directive(Directive { + kind: DirectiveKind::Component { + component: component.to_string(), + }, + level, + negated, + }); + self + } + + /// Adds a component + topic directive to the filter. + pub fn filter_topic( + &mut self, + component: &str, + topic: &str, + level: LevelFilter, + negated: bool, + ) -> &mut Self { + self.insert_directive(Directive { + kind: DirectiveKind::Topic { + component: component.to_string(), + topic: FilterOp::new(topic).expect("invalid topic filter"), + }, + level, + negated, + }); + self + } + + /// Adds a key/value filter to the overall filter. + pub fn filter_key_value(&mut self, key: &str, value: &str, negated: bool) -> &mut Self { + for kv_filter in self.kv_filters.iter_mut() { + if kv_filter.key != key { + continue; + } + + kv_filter.insert_value_filter(value, negated); + return self; + } + + self.kv_filters.push(KvFilter { + key: key.to_owned(), + patterns: vec![KvFilterOp { + value: FilterOp::new(value).expect("invalid value filter"), + negated, + }], + }); + self + } + + /// Parses the directives string. + /// + /// See the [Enabling Logging] section for more details. + /// + /// [Enabling Logging]: ../index.html#enabling-logging + pub fn parse(&mut self, filters: &str) -> &mut Self { + #![allow(clippy::print_stderr)] // compatibility + + let ParseResult { + directives, + filter, + errors, + } = parse_spec(filters); + + for error in errors { + eprintln!("warning: {error}, ignoring it"); + } + + self.filter = filter; + + for directive in directives { + self.insert_directive(directive); + } + self + } + + /// Parses the directive string, returning an error if the given directive string is invalid. + /// + /// See the [Enabling Logging] section for more details. + /// + /// [Enabling Logging]: ../index.html#enabling-logging + pub fn try_parse(&mut self, filters: &str) -> Result<&mut Self, ParseError> { + let (directives, filter) = parse_spec(filters).ok()?; + + self.filter = filter; + + for directive in directives { + self.insert_directive(directive); + } + Ok(self) + } + + /// Build a log filter. + pub fn build(&mut self) -> Filter { + assert!(!self.built, "attempt to re-use consumed builder"); + self.built = true; + + let mut directives = Vec::new(); + if self.directives.is_empty() { + // Adds the default filter if none exist + directives.push(Directive { + kind: DirectiveKind::Any, + level: LevelFilter::Error, + negated: false, + }); + } else { + // Consume directives. + directives = mem::take(&mut self.directives); + // Sort the directives to place more efficient matches at the start + directives.sort(); + } + + Filter { + directives, + kv_filters: mem::take(&mut self.kv_filters), + filter: mem::take(&mut self.filter), + } + } +} + +impl Default for Builder { + fn default() -> Self { + Builder::new() + } +} + +impl fmt::Debug for Builder { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + if self.built { + f.debug_struct("Filter").field("built", &true).finish() + } else { + f.debug_struct("Filter") + .field("filter", &self.filter) + .field("kv_filters", &self.kv_filters) + .field("directives", &self.directives) + .finish() + } + } +} + +/// A log filter. +/// +/// This struct can be used to determine whether or not a log record +/// should be written to the output. +/// Use the [`Builder`] type to parse and construct a `Filter`. +/// +/// [`Builder`]: struct.Builder.html +#[derive(Clone)] +pub struct Filter { + directives: Vec, + kv_filters: Vec, + filter: Option, +} + +impl Filter { + /// Returns the maximum `LevelFilter` that this filter instance is + /// configured to output. + /// + /// # Example + /// + /// ```rust + /// use log::LevelFilter; + /// use env_filter::Builder; + /// + /// let mut builder = Builder::new(); + /// builder.filter(Some("module1"), LevelFilter::Info); + /// builder.filter(Some("module2"), LevelFilter::Error); + /// + /// let filter = builder.build(); + /// assert_eq!(filter.filter(), LevelFilter::Info); + /// ``` + pub fn filter(&self) -> LevelFilter { + self.directives.iter().map(|d| d.level).max().unwrap_or(LevelFilter::Off) + } + + /// Checks if this record matches the configured filter. + pub fn matches(&self, record: &Record<'_>) -> bool { + let level = record.metadata().level(); + let target = record.metadata().target(); + + let is_enabled = enabled(&self.directives, level, target); + if !is_enabled { + return false; + } + + // We treat the lack of kv filters as a match by default - if there are any filters, and + // any of those filters applied to the key/value data of the record, then the record is + // matched so long as none of the matches were negated + let mut was_matched = None; + let kv = record.key_values(); + for kv_filter in self.kv_filters.iter() { + match kv_filter.matches(kv) { + None => continue, + Some(false) => return false, + Some(true) => { + was_matched = Some(true); + } + } + } + + if was_matched.is_some_and(|matched| !matched) { + return false; + } + + if let Some(filter) = self.filter.as_ref() + && !filter.is_match(&record.args().to_string()) + { + return false; + } + + true + } + + /// Determines if a log message with the specified metadata would be logged. + pub fn enabled(&self, metadata: &Metadata<'_>) -> bool { + let level = metadata.level(); + let target = metadata.target(); + + enabled(&self.directives, level, target) + } +} + +impl fmt::Debug for Filter { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Filter") + .field("filter", &self.filter) + .field("directives", &self.directives) + .finish() + } +} + +#[cfg(test)] +mod tests { + use log::{Level, LevelFilter}; + use snapbox::{assert_data_eq, str}; + + use super::{Builder, Directive, DirectiveKind, Filter, enabled}; + + fn make_logger_filter(dirs: Vec) -> Filter { + let mut logger = Builder::new().build(); + logger.directives = dirs; + logger + } + + #[test] + fn filter_info() { + let logger = Builder::new().filter_level(LevelFilter::Info).build(); + assert!(enabled(&logger.directives, Level::Info, "crate1")); + assert!(!enabled(&logger.directives, Level::Debug, "crate1")); + } + + #[test] + fn filter_beginning_longest_match() { + let logger = Builder::new() + .filter_module("crate2", LevelFilter::Info) + .filter_module("crate2::mod", LevelFilter::Debug) + .filter_module("crate1::mod1", LevelFilter::Warn) + .build(); + assert!(enabled(&logger.directives, Level::Debug, "crate2::mod1")); + assert!(!enabled(&logger.directives, Level::Debug, "crate2")); + } + + // Some of our tests are only correct or complete when they cover the full + // universe of variants for log::Level. In the unlikely event that a new + // variant is added in the future, this test will detect the scenario and + // alert us to the need to review and update the tests. In such a + // situation, this test will fail to compile, and the error message will + // look something like this: + // + // error[E0004]: non-exhaustive patterns: `NewVariant` not covered + // --> src/filter/mod.rs:413:15 + // | + // 413 | match level_universe { + // | ^^^^^^^^^^^^^^ pattern `NewVariant` not covered + #[test] + fn ensure_tests_cover_level_universe() { + let level_universe: Level = Level::Trace; // use of trace variant is arbitrary + match level_universe { + Level::Error | Level::Warn | Level::Info | Level::Debug | Level::Trace => (), + } + } + + #[test] + fn parse_default() { + let logger = Builder::new().parse("info,crate1::mod1=warn").build(); + assert!(enabled(&logger.directives, Level::Warn, "crate1::mod1")); + assert!(enabled(&logger.directives, Level::Info, "crate2::mod2")); + } + + #[test] + fn parse_default_bare_level_off_lc() { + let logger = Builder::new().parse("off").build(); + assert!(!enabled(&logger.directives, Level::Error, "")); + assert!(!enabled(&logger.directives, Level::Warn, "")); + assert!(!enabled(&logger.directives, Level::Info, "")); + assert!(!enabled(&logger.directives, Level::Debug, "")); + assert!(!enabled(&logger.directives, Level::Trace, "")); + } + + #[test] + fn parse_default_bare_level_off_uc() { + let logger = Builder::new().parse("OFF").build(); + assert!(!enabled(&logger.directives, Level::Error, "")); + assert!(!enabled(&logger.directives, Level::Warn, "")); + assert!(!enabled(&logger.directives, Level::Info, "")); + assert!(!enabled(&logger.directives, Level::Debug, "")); + assert!(!enabled(&logger.directives, Level::Trace, "")); + } + + #[test] + fn parse_default_bare_level_error_lc() { + let logger = Builder::new().parse("error").build(); + assert!(enabled(&logger.directives, Level::Error, "")); + assert!(!enabled(&logger.directives, Level::Warn, "")); + assert!(!enabled(&logger.directives, Level::Info, "")); + assert!(!enabled(&logger.directives, Level::Debug, "")); + assert!(!enabled(&logger.directives, Level::Trace, "")); + } + + #[test] + fn parse_default_bare_level_error_uc() { + let logger = Builder::new().parse("ERROR").build(); + assert!(enabled(&logger.directives, Level::Error, "")); + assert!(!enabled(&logger.directives, Level::Warn, "")); + assert!(!enabled(&logger.directives, Level::Info, "")); + assert!(!enabled(&logger.directives, Level::Debug, "")); + assert!(!enabled(&logger.directives, Level::Trace, "")); + } + + #[test] + fn parse_default_bare_level_warn_lc() { + let logger = Builder::new().parse("warn").build(); + assert!(enabled(&logger.directives, Level::Error, "")); + assert!(enabled(&logger.directives, Level::Warn, "")); + assert!(!enabled(&logger.directives, Level::Info, "")); + assert!(!enabled(&logger.directives, Level::Debug, "")); + assert!(!enabled(&logger.directives, Level::Trace, "")); + } + + #[test] + fn parse_default_bare_level_warn_uc() { + let logger = Builder::new().parse("WARN").build(); + assert!(enabled(&logger.directives, Level::Error, "")); + assert!(enabled(&logger.directives, Level::Warn, "")); + assert!(!enabled(&logger.directives, Level::Info, "")); + assert!(!enabled(&logger.directives, Level::Debug, "")); + assert!(!enabled(&logger.directives, Level::Trace, "")); + } + + #[test] + fn parse_default_bare_level_info_lc() { + let logger = Builder::new().parse("info").build(); + assert!(enabled(&logger.directives, Level::Error, "")); + assert!(enabled(&logger.directives, Level::Warn, "")); + assert!(enabled(&logger.directives, Level::Info, "")); + assert!(!enabled(&logger.directives, Level::Debug, "")); + assert!(!enabled(&logger.directives, Level::Trace, "")); + } + + #[test] + fn parse_default_bare_level_info_uc() { + let logger = Builder::new().parse("INFO").build(); + assert!(enabled(&logger.directives, Level::Error, "")); + assert!(enabled(&logger.directives, Level::Warn, "")); + assert!(enabled(&logger.directives, Level::Info, "")); + assert!(!enabled(&logger.directives, Level::Debug, "")); + assert!(!enabled(&logger.directives, Level::Trace, "")); + } + + #[test] + fn parse_default_bare_level_debug_lc() { + let logger = Builder::new().parse("debug").build(); + assert!(enabled(&logger.directives, Level::Error, "")); + assert!(enabled(&logger.directives, Level::Warn, "")); + assert!(enabled(&logger.directives, Level::Info, "")); + assert!(enabled(&logger.directives, Level::Debug, "")); + assert!(!enabled(&logger.directives, Level::Trace, "")); + } + + #[test] + fn parse_default_bare_level_debug_uc() { + let logger = Builder::new().parse("DEBUG").build(); + assert!(enabled(&logger.directives, Level::Error, "")); + assert!(enabled(&logger.directives, Level::Warn, "")); + assert!(enabled(&logger.directives, Level::Info, "")); + assert!(enabled(&logger.directives, Level::Debug, "")); + assert!(!enabled(&logger.directives, Level::Trace, "")); + } + + #[test] + fn parse_default_bare_level_trace_lc() { + let logger = Builder::new().parse("trace").build(); + assert!(enabled(&logger.directives, Level::Error, "")); + assert!(enabled(&logger.directives, Level::Warn, "")); + assert!(enabled(&logger.directives, Level::Info, "")); + assert!(enabled(&logger.directives, Level::Debug, "")); + assert!(enabled(&logger.directives, Level::Trace, "")); + } + + #[test] + fn parse_default_bare_level_trace_uc() { + let logger = Builder::new().parse("TRACE").build(); + assert!(enabled(&logger.directives, Level::Error, "")); + assert!(enabled(&logger.directives, Level::Warn, "")); + assert!(enabled(&logger.directives, Level::Info, "")); + assert!(enabled(&logger.directives, Level::Debug, "")); + assert!(enabled(&logger.directives, Level::Trace, "")); + } + + // In practice, the desired log level is typically specified by a token + // that is either all lowercase (e.g., 'trace') or all uppercase (.e.g, + // 'TRACE'), but this tests serves as a reminder that + // log::Level::from_str() ignores all case variants. + #[test] + fn parse_default_bare_level_debug_mixed() { + { + let logger = Builder::new().parse("Debug").build(); + assert!(enabled(&logger.directives, Level::Error, "")); + assert!(enabled(&logger.directives, Level::Warn, "")); + assert!(enabled(&logger.directives, Level::Info, "")); + assert!(enabled(&logger.directives, Level::Debug, "")); + assert!(!enabled(&logger.directives, Level::Trace, "")); + } + { + let logger = Builder::new().parse("debuG").build(); + assert!(enabled(&logger.directives, Level::Error, "")); + assert!(enabled(&logger.directives, Level::Warn, "")); + assert!(enabled(&logger.directives, Level::Info, "")); + assert!(enabled(&logger.directives, Level::Debug, "")); + assert!(!enabled(&logger.directives, Level::Trace, "")); + } + { + let logger = Builder::new().parse("deBug").build(); + assert!(enabled(&logger.directives, Level::Error, "")); + assert!(enabled(&logger.directives, Level::Warn, "")); + assert!(enabled(&logger.directives, Level::Info, "")); + assert!(enabled(&logger.directives, Level::Debug, "")); + assert!(!enabled(&logger.directives, Level::Trace, "")); + } + { + let logger = Builder::new().parse("DeBuG").build(); // LaTeX flavor! + assert!(enabled(&logger.directives, Level::Error, "")); + assert!(enabled(&logger.directives, Level::Warn, "")); + assert!(enabled(&logger.directives, Level::Info, "")); + assert!(enabled(&logger.directives, Level::Debug, "")); + assert!(!enabled(&logger.directives, Level::Trace, "")); + } + } + + #[test] + fn try_parse_valid_filter() { + let logger = Builder::new() + .try_parse("info,crate1::mod1=warn") + .expect("valid filter returned error") + .build(); + assert!(enabled(&logger.directives, Level::Warn, "crate1::mod1")); + assert!(enabled(&logger.directives, Level::Info, "crate2::mod2")); + } + + #[test] + fn try_parse_invalid_filter() { + let error = Builder::new().try_parse("info,crate1=invalid").unwrap_err(); + assert_data_eq!( + error, + str![ + "error parsing logger filter: invalid logging spec 'crate1=invalid': attempted to \ + convert a string that doesn't match an existing log level" + ] + ); + } + + #[test] + fn match_full_path() { + let logger = make_logger_filter(vec![ + Directive { + kind: DirectiveKind::Module { + module: "crate2".to_owned(), + }, + level: LevelFilter::Info, + negated: false, + }, + Directive { + kind: DirectiveKind::Module { + module: "crate1::mod1".to_owned(), + }, + level: LevelFilter::Warn, + negated: false, + }, + ]); + assert!(enabled(&logger.directives, Level::Warn, "crate1::mod1")); + assert!(!enabled(&logger.directives, Level::Info, "crate1::mod1")); + assert!(enabled(&logger.directives, Level::Info, "crate2")); + assert!(!enabled(&logger.directives, Level::Debug, "crate2")); + } + + #[test] + fn no_match() { + let logger = make_logger_filter(vec![ + Directive { + kind: DirectiveKind::Module { + module: "crate2".to_owned(), + }, + level: LevelFilter::Info, + negated: false, + }, + Directive { + kind: DirectiveKind::Module { + module: "crate1::mod1".to_owned(), + }, + level: LevelFilter::Warn, + negated: false, + }, + ]); + assert!(!enabled(&logger.directives, Level::Warn, "crate3")); + } + + #[test] + fn match_beginning() { + let logger = make_logger_filter(vec![ + Directive { + kind: DirectiveKind::Module { + module: "crate2".to_owned(), + }, + level: LevelFilter::Info, + negated: false, + }, + Directive { + kind: DirectiveKind::Module { + module: "crate1::mod1".to_owned(), + }, + level: LevelFilter::Warn, + negated: false, + }, + ]); + assert!(enabled(&logger.directives, Level::Info, "crate2::mod1")); + } + + #[test] + fn match_beginning_longest_match() { + let logger = make_logger_filter(vec![ + Directive { + kind: DirectiveKind::Module { + module: "crate2".to_owned(), + }, + level: LevelFilter::Info, + negated: false, + }, + Directive { + kind: DirectiveKind::Module { + module: "crate2::mod".to_owned(), + }, + level: LevelFilter::Debug, + negated: false, + }, + Directive { + kind: DirectiveKind::Module { + module: "crate1::mod1".to_owned(), + }, + level: LevelFilter::Warn, + negated: false, + }, + ]); + assert!(enabled(&logger.directives, Level::Debug, "crate2::mod1")); + assert!(!enabled(&logger.directives, Level::Debug, "crate2")); + } + + #[test] + fn match_default() { + let logger = make_logger_filter(vec![ + Directive { + kind: DirectiveKind::Any, + level: LevelFilter::Info, + negated: false, + }, + Directive { + kind: DirectiveKind::Module { + module: "crate1::mod1".to_owned(), + }, + level: LevelFilter::Warn, + negated: false, + }, + ]); + assert!(enabled(&logger.directives, Level::Warn, "crate1::mod1")); + assert!(enabled(&logger.directives, Level::Info, "crate2::mod2")); + } + + #[test] + fn zero_level() { + let logger = make_logger_filter(vec![ + Directive { + kind: DirectiveKind::Any, + level: LevelFilter::Info, + negated: false, + }, + Directive { + kind: DirectiveKind::Module { + module: "crate1::mod1".to_owned(), + }, + level: LevelFilter::Off, + negated: false, + }, + ]); + assert!(!enabled(&logger.directives, Level::Error, "crate1::mod1")); + assert!(enabled(&logger.directives, Level::Info, "crate2::mod2")); + } +} diff --git a/midenc-log/src/filter/filtered_log.rs b/midenc-log/src/filter/filtered_log.rs new file mode 100644 index 000000000..699c7bad7 --- /dev/null +++ b/midenc-log/src/filter/filtered_log.rs @@ -0,0 +1,45 @@ +use log::Log; + +use crate::filter::Filter; + +/// Decorate a [`log::Log`] with record [`Filter`]ing. +/// +/// Records that match the filter will be forwarded to the wrapped log. +/// Other records will be ignored. +#[derive(Debug)] +pub struct FilteredLog { + log: T, + filter: Filter, +} + +impl FilteredLog { + /// Create a new filtered log. + pub fn new(log: T, filter: Filter) -> Self { + Self { log, filter } + } +} + +impl Log for FilteredLog { + /// Determines if a log message with the specified metadata would be logged. + /// + /// For the wrapped log, this returns `true` only if both the filter and the wrapped log return `true`. + fn enabled(&self, metadata: &log::Metadata<'_>) -> bool { + self.filter.enabled(metadata) && self.log.enabled(metadata) + } + + /// Logs the record. + /// + /// Forwards the record to the wrapped log, but only if the record matches the filter. + fn log(&self, record: &log::Record<'_>) { + if self.filter.matches(record) { + self.log.log(record); + } + } + + /// Flushes any buffered records. + /// + /// Forwards directly to the wrapped log. + fn flush(&self) { + self.log.flush(); + } +} diff --git a/midenc-log/src/filter/kv_filter.rs b/midenc-log/src/filter/kv_filter.rs new file mode 100644 index 000000000..11b3daee9 --- /dev/null +++ b/midenc-log/src/filter/kv_filter.rs @@ -0,0 +1,45 @@ +use super::FilterOp; + +#[derive(Debug, Clone)] +pub struct KvFilter { + pub key: String, + pub patterns: Vec, +} + +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] +pub struct KvFilterOp { + pub value: FilterOp, + pub negated: bool, +} + +impl KvFilter { + pub fn matches(&self, kv: &dyn log::kv::Source) -> Option { + let value = kv.get(log::kv::Key::from_str(&self.key))?; + let value = value.to_borrowed_str()?; + + let mut was_matched = false; + for pattern in self.patterns.iter() { + if pattern.value.is_match(value) { + if pattern.negated { + return Some(false); + } + was_matched = true; + } + } + Some(was_matched) + } + + pub fn insert_value_filter(&mut self, pattern: &str, negated: bool) { + if self + .patterns + .iter() + .any(|p| p.value.as_str() == pattern && p.negated == negated) + { + return; + } + self.patterns.push(KvFilterOp { + value: FilterOp::new(pattern).expect("invalid value filter"), + negated, + }); + } +} diff --git a/midenc-log/src/filter/mod.rs b/midenc-log/src/filter/mod.rs new file mode 100644 index 000000000..d17a5bbbf --- /dev/null +++ b/midenc-log/src/filter/mod.rs @@ -0,0 +1,54 @@ +//! Filtering for log records. +//! +//! You can use the [`Filter`] type in your own logger implementation to use the same +//! filter parsing and matching as `midenc_log`. +//! +//! ## Using `env_filter` in your own logger +//! +//! You can use `env_filter`'s filtering functionality with your own logger. +//! Call [`Builder::parse`] to parse directives from a string when constructing +//! your logger. Call [`Filter::matches`] to check whether a record should be +//! logged based on the parsed filters when log records are received. +//! +//! ``` +//! use env_filter::Filter; +//! use log::{Log, Metadata, Record}; +//! +//! struct PrintLogger; +//! +//! impl Log for PrintLogger { +//! fn enabled(&self, metadata: &Metadata) -> bool { +//! true +//! } +//! +//! fn log(&self, record: &Record) { +//! println!("{:?}", record); +//! } +//! +//! fn flush(&self) {} +//! } +//! +//! let mut builder = env_filter::Builder::new(); +//! // Parse a directives string from an environment variable +//! if let Ok(ref filter) = std::env::var("MY_LOG_LEVEL") { +//! builder.parse(filter); +//! } +//! +//! let logger = env_filter::FilteredLog::new(PrintLogger, builder.build()); +//! ``` + +mod directive; +#[allow(clippy::module_inception)] +mod filter; +mod filtered_log; +mod kv_filter; +mod op; +mod parser; + +use directive::{Directive, DirectiveKind, enabled}; +pub use filter::{Builder, Filter}; +pub use filtered_log::FilteredLog; +use kv_filter::KvFilter; +use op::FilterOp; +pub use parser::ParseError; +use parser::parse_spec; diff --git a/midenc-log/src/filter/op.rs b/midenc-log/src/filter/op.rs new file mode 100644 index 000000000..995ff0376 --- /dev/null +++ b/midenc-log/src/filter/op.rs @@ -0,0 +1,88 @@ +use std::fmt; + +#[derive(Debug, Clone)] +pub(crate) struct FilterOp { + #[cfg(feature = "regex")] + inner: regex::Regex, + #[cfg(not(feature = "regex"))] + inner: String, +} + +impl Eq for FilterOp {} +impl PartialEq for FilterOp { + #[cfg(feature = "regex")] + fn eq(&self, other: &Self) -> bool { + self.inner.as_str() == other.inner.as_str() + } + + #[cfg(not(feature = "regex"))] + fn eq(&self, other: &Self) -> bool { + self.inner == other.inner + } +} + +impl PartialOrd for FilterOp { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +impl Ord for FilterOp { + #[cfg(feature = "regex")] + fn cmp(&self, other: &Self) -> core::cmp::Ordering { + self.inner + .as_str() + .len() + .cmp(&other.inner.as_str().len()) + .then_with(|| self.inner.as_str().cmp(other.inner.as_str())) + } + + #[cfg(not(feature = "regex"))] + fn cmp(&self, other: &Self) -> core::cmp::Ordering { + self.inner + .len() + .cmp(&other.inner.len()) + .then_with(|| self.inner.cmp(&other.inner)) + } +} + +#[cfg(feature = "regex")] +impl FilterOp { + pub(crate) fn new(spec: &str) -> Result { + match regex::Regex::new(spec) { + Ok(r) => Ok(Self { inner: r }), + Err(e) => Err(e.to_string()), + } + } + + pub(crate) fn is_match(&self, s: &str) -> bool { + self.inner.is_match(s) + } + + pub(crate) fn as_str(&self) -> &str { + self.inner.as_str() + } +} + +#[cfg(not(feature = "regex"))] +impl FilterOp { + pub fn new(spec: &str) -> Result { + Ok(Self { + inner: spec.to_string(), + }) + } + + pub fn is_match(&self, s: &str) -> bool { + s.contains(&self.inner) + } + + pub(crate) fn as_str(&self) -> &str { + &self.inner + } +} + +impl fmt::Display for FilterOp { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + self.inner.fmt(f) + } +} diff --git a/midenc-log/src/filter/parser.rs b/midenc-log/src/filter/parser.rs new file mode 100644 index 000000000..45c8886b8 --- /dev/null +++ b/midenc-log/src/filter/parser.rs @@ -0,0 +1,746 @@ +use std::{ + error::Error, + fmt::{Display, Formatter}, +}; + +use log::LevelFilter; + +use super::directive::DirectiveKind; +use crate::filter::{Directive, FilterOp}; + +#[derive(Default, Debug)] +pub(crate) struct ParseResult { + pub(crate) directives: Vec, + pub(crate) filter: Option, + pub(crate) errors: Vec, +} + +impl ParseResult { + fn add_directive(&mut self, directive: Directive) { + self.directives.push(directive); + } + + fn set_filter(&mut self, filter: FilterOp) { + self.filter = Some(filter); + } + + fn add_error(&mut self, message: String) { + self.errors.push(message); + } + + pub(crate) fn ok(self) -> Result<(Vec, Option), ParseError> { + let Self { + directives, + filter, + errors, + } = self; + if let Some(error) = errors.into_iter().next() { + Err(ParseError { details: error }) + } else { + Ok((directives, filter)) + } + } +} + +/// Error during logger directive parsing process. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct ParseError { + details: String, +} + +impl Display for ParseError { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + write!(f, "error parsing logger filter: {}", self.details) + } +} + +impl Error for ParseError {} + +/// Parse a logging specification string (e.g: `crate1,crate2::mod3,crate3::x=error/foo`) +/// and return a vector with log directives. +pub(crate) fn parse_spec(s: &str) -> ParseResult { + let mut result = ParseResult::default(); + + let (spec, filter) = s.rsplit_once('/').unwrap_or((s, "")); + if spec.contains('/') { + result.add_error(format!("invalid logging spec '{s}': too many '/'")); + return result; + } + let filter = if filter.is_empty() { + None + } else { + Some(filter) + }; + let directives = spec.split(',').map(|s| s.trim()); + for directive in directives { + if directive.is_empty() { + continue; + } + + let (matcher_spec, level, negated) = match directive.rsplit_once('=') { + Some((ms, "")) => { + let ms = ms.trim(); + if ms.contains('=') { + result.add_error(format!( + "invalid logging spec '{directive}': '=' is not allowed in paths" + )); + continue; + } + if let Some(ms) = ms.strip_prefix('-') { + (Some(ms), LevelFilter::max(), true) + } else { + (Some(ms), LevelFilter::max(), false) + } + } + Some((ms, level)) => { + let ms = ms.trim(); + if ms.contains('=') { + result.add_error(format!( + "invalid logging spec '{directive}': '=' is not allowed in paths" + )); + continue; + } + let level = level + .trim() + .parse::() + .map_err(|err| format!("invalid logging spec '{directive}': {err}")); + match level { + Ok(level) => { + if let Some(ms) = ms.strip_prefix('-') { + (Some(ms), level, true) + } else { + (Some(ms), level, false) + } + } + Err(err) => { + result.add_error(err); + continue; + } + } + } + None => { + let (level, negated) = if let Some(level) = directive.strip_prefix('-') { + (level.trim(), true) + } else { + (directive, false) + }; + match level.parse::() { + Ok(level) => (None, level, negated), + Err(_) => (Some(directive), LevelFilter::max(), negated), + } + } + }; + + if let Some(matcher_spec) = matcher_spec { + match matcher_spec.split_once(':') { + Some((component, "*" | "")) => { + result.add_directive(Directive { + kind: DirectiveKind::Component { + component: component.to_owned(), + }, + level, + negated, + }); + } + // If `topic` starts with a ':', we've attempted to parse a module path as a filter + // spec, e.g. `core::option` + Some((_, topic)) if topic.starts_with(':') => { + result.add_directive(Directive { + kind: DirectiveKind::Module { + module: matcher_spec.to_owned(), + }, + level, + negated, + }); + continue; + } + Some((component, topic)) => { + let topic = match FilterOp::new(topic) { + Ok(topic) => topic, + Err(err) => { + result.add_error(format!("invalid logging spec '{directive}': {err}")); + continue; + } + }; + result.add_directive(Directive { + kind: DirectiveKind::Topic { + component: component.to_owned(), + topic, + }, + level, + negated, + }); + } + None => { + result.add_directive(Directive { + kind: DirectiveKind::Component { + component: matcher_spec.to_owned(), + }, + level, + negated, + }); + } + } + } else { + result.add_directive(Directive { + kind: DirectiveKind::Any, + level, + negated, + }); + } + } + + if let Some(filter) = filter { + match FilterOp::new(filter) { + Ok(filter_op) => result.set_filter(filter_op), + Err(err) => result.add_error(format!("invalid regex filter - {err}")), + } + } + + result +} + +#[cfg(test)] +mod tests { + use log::LevelFilter; + use snapbox::{Data, IntoData, assert_data_eq, str}; + + use super::{ParseResult, parse_spec}; + use crate::filter::{ParseError, directive::DirectiveKind, op::FilterOp}; + + impl IntoData for ParseError { + fn into_data(self) -> Data { + self.to_string().into_data() + } + } + + #[test] + fn parse_spec_valid() { + let ParseResult { + directives: dirs, + filter, + errors, + } = parse_spec( + "crate1::mod1=error,crate1::mod2,crate2=debug,component:topic=trace,component2=trace", + ); + + assert_eq!(dirs.len(), 5); + assert_eq!( + dirs[0].kind, + DirectiveKind::Module { + module: "crate1::mod1".to_owned() + } + ); + assert_eq!(dirs[0].level, LevelFilter::Error); + + assert_eq!( + dirs[1].kind, + DirectiveKind::Module { + module: "crate1::mod2".to_owned() + } + ); + assert_eq!(dirs[1].level, LevelFilter::max()); + + assert_eq!( + dirs[2].kind, + DirectiveKind::Component { + component: "crate2".to_owned() + } + ); + assert_eq!(dirs[2].level, LevelFilter::Debug); + assert!(filter.is_none()); + + assert_eq!( + dirs[3].kind, + DirectiveKind::Topic { + component: "component".to_owned(), + topic: FilterOp::new("topic").unwrap() + } + ); + assert_eq!(dirs[3].level, LevelFilter::Trace); + assert!(filter.is_none()); + + assert_eq!( + dirs[4].kind, + DirectiveKind::Component { + component: "component2".to_owned() + } + ); + assert_eq!(dirs[4].level, LevelFilter::Trace); + assert!(filter.is_none()); + + assert!(errors.is_empty()); + } + + #[test] + fn parse_spec_invalid_crate() { + // test parse_spec with multiple = in specification + let ParseResult { + directives: dirs, + filter, + errors, + } = parse_spec("crate1::mod1=warn=info,crate2=debug"); + + assert_eq!(dirs.len(), 1); + assert_eq!( + dirs[0].kind, + DirectiveKind::Component { + component: "crate2".to_owned() + } + ); + assert_eq!(dirs[0].level, LevelFilter::Debug); + assert!(filter.is_none()); + + assert_eq!(errors.len(), 1); + assert_data_eq!( + &errors[0], + str!["invalid logging spec 'crate1::mod1=warn=info': '=' is not allowed in paths"] + ); + } + + #[test] + fn parse_spec_invalid_level() { + // test parse_spec with 'noNumber' as log level + let ParseResult { + directives: dirs, + filter, + errors, + } = parse_spec("crate1::mod1=noNumber,crate2=debug"); + + assert_eq!(dirs.len(), 1); + assert_eq!( + dirs[0].kind, + DirectiveKind::Component { + component: "crate2".to_owned() + } + ); + assert_eq!(dirs[0].level, LevelFilter::Debug); + assert!(filter.is_none()); + + assert_eq!(errors.len(), 1); + assert_data_eq!( + &errors[0], + str![ + "invalid logging spec 'crate1::mod1=noNumber': attempted to convert a string that \ + doesn't match an existing log level" + ] + ); + } + + #[test] + fn parse_spec_string_level() { + // test parse_spec with 'warn' as log level + let ParseResult { + directives: dirs, + filter, + errors, + } = parse_spec("crate1::mod1=wrong,crate2=warn"); + + assert_eq!(dirs.len(), 1); + assert_eq!( + dirs[0].kind, + DirectiveKind::Component { + component: "crate2".to_owned() + } + ); + assert_eq!(dirs[0].level, LevelFilter::Warn); + assert!(filter.is_none()); + + assert_eq!(errors.len(), 1); + assert_data_eq!( + &errors[0], + str![ + "invalid logging spec 'crate1::mod1=wrong': attempted to convert a string that \ + doesn't match an existing log level" + ] + ); + } + + #[test] + fn parse_spec_empty_level() { + // test parse_spec with '' as log level + let ParseResult { + directives: dirs, + filter, + errors, + } = parse_spec("crate1::mod1=wrong,crate2="); + + assert_eq!(dirs.len(), 1); + assert_eq!( + dirs[0].kind, + DirectiveKind::Component { + component: "crate2".to_owned() + } + ); + assert_eq!(dirs[0].level, LevelFilter::max()); + assert!(filter.is_none()); + + assert_eq!(errors.len(), 1); + assert_data_eq!( + &errors[0], + str![ + "invalid logging spec 'crate1::mod1=wrong': attempted to convert a string that \ + doesn't match an existing log level" + ] + ); + } + + #[test] + fn parse_spec_empty_level_isolated() { + // test parse_spec with "" as log level (and the entire spec str) + let ParseResult { + directives: dirs, + filter, + errors, + } = parse_spec(""); // should be ignored + assert_eq!(dirs.len(), 0); + assert!(filter.is_none()); + assert!(errors.is_empty()); + } + + #[test] + fn parse_spec_blank_level_isolated() { + // test parse_spec with a white-space-only string specified as the log + // level (and the entire spec str) + let ParseResult { + directives: dirs, + filter, + errors, + } = parse_spec(" "); // should be ignored + assert_eq!(dirs.len(), 0); + assert!(filter.is_none()); + assert!(errors.is_empty()); + } + + #[test] + fn parse_spec_blank_level_isolated_comma_only() { + // The spec should contain zero or more comma-separated string slices, + // so a comma-only string should be interpreted as two empty strings + // (which should both be treated as invalid, so ignored). + let ParseResult { + directives: dirs, + filter, + errors, + } = parse_spec(","); // should be ignored + assert_eq!(dirs.len(), 0); + assert!(filter.is_none()); + assert!(errors.is_empty()); + } + + #[test] + fn parse_spec_blank_level_isolated_comma_blank() { + // The spec should contain zero or more comma-separated string slices, + // so this bogus spec should be interpreted as containing one empty + // string and one blank string. Both should both be treated as + // invalid, so ignored. + let ParseResult { + directives: dirs, + filter, + errors, + } = parse_spec(", "); // should be ignored + assert_eq!(dirs.len(), 0); + assert!(filter.is_none()); + assert!(errors.is_empty()); + } + + #[test] + fn parse_spec_blank_level_isolated_blank_comma() { + // The spec should contain zero or more comma-separated string slices, + // so this bogus spec should be interpreted as containing one blank + // string and one empty string. Both should both be treated as + // invalid, so ignored. + let ParseResult { + directives: dirs, + filter, + errors, + } = parse_spec(" ,"); // should be ignored + assert_eq!(dirs.len(), 0); + assert!(filter.is_none()); + assert!(errors.is_empty()); + } + + #[test] + fn parse_spec_global() { + // test parse_spec with no crate + let ParseResult { + directives: dirs, + filter, + errors, + } = parse_spec("warn,crate2=debug"); + assert_eq!(dirs.len(), 2); + assert_eq!(dirs[0].kind, DirectiveKind::Any); + assert_eq!(dirs[0].level, LevelFilter::Warn); + assert_eq!( + dirs[1].kind, + DirectiveKind::Component { + component: "crate2".to_owned() + } + ); + assert_eq!(dirs[1].level, LevelFilter::Debug); + assert!(filter.is_none()); + assert!(errors.is_empty()); + } + + #[test] + fn parse_spec_global_bare_warn_lc() { + // test parse_spec with no crate, in isolation, all lowercase + let ParseResult { + directives: dirs, + filter, + errors, + } = parse_spec("warn"); + assert_eq!(dirs.len(), 1); + assert_eq!(dirs[0].kind, DirectiveKind::Any); + assert_eq!(dirs[0].level, LevelFilter::Warn); + assert!(filter.is_none()); + assert!(errors.is_empty()); + } + + #[test] + fn parse_spec_global_bare_warn_uc() { + // test parse_spec with no crate, in isolation, all uppercase + let ParseResult { + directives: dirs, + filter, + errors, + } = parse_spec("WARN"); + assert_eq!(dirs.len(), 1); + assert_eq!(dirs[0].kind, DirectiveKind::Any); + assert_eq!(dirs[0].level, LevelFilter::Warn); + assert!(filter.is_none()); + assert!(errors.is_empty()); + } + + #[test] + fn parse_spec_global_bare_warn_mixed() { + // test parse_spec with no crate, in isolation, mixed case + let ParseResult { + directives: dirs, + filter, + errors, + } = parse_spec("wArN"); + assert_eq!(dirs.len(), 1); + assert_eq!(dirs[0].kind, DirectiveKind::Any); + assert_eq!(dirs[0].level, LevelFilter::Warn); + assert!(filter.is_none()); + assert!(errors.is_empty()); + } + + #[test] + fn parse_spec_valid_filter() { + let ParseResult { + directives: dirs, + filter, + errors, + } = parse_spec("crate1::mod1=error,crate1::mod2,crate2=debug/abc"); + assert_eq!(dirs.len(), 3); + assert_eq!( + dirs[0].kind, + DirectiveKind::Module { + module: "crate1::mod1".to_owned() + } + ); + assert_eq!(dirs[0].level, LevelFilter::Error); + + assert_eq!( + dirs[1].kind, + DirectiveKind::Module { + module: "crate1::mod2".to_owned() + } + ); + assert_eq!(dirs[1].level, LevelFilter::max()); + + assert_eq!( + dirs[2].kind, + DirectiveKind::Component { + component: "crate2".to_owned() + } + ); + assert_eq!(dirs[2].level, LevelFilter::Debug); + assert!(filter.is_some() && filter.unwrap().to_string() == "abc"); + assert!(errors.is_empty()); + } + + #[test] + fn parse_spec_invalid_crate_filter() { + let ParseResult { + directives: dirs, + filter, + errors, + } = parse_spec("crate1::mod1=error=warn,crate2=debug/a.c"); + + assert_eq!(dirs.len(), 1); + assert_eq!( + dirs[0].kind, + DirectiveKind::Component { + component: "crate2".to_owned() + } + ); + assert_eq!(dirs[0].level, LevelFilter::Debug); + assert!(filter.is_some() && filter.unwrap().to_string() == "a.c"); + + assert_eq!(errors.len(), 1); + assert_data_eq!( + &errors[0], + str!["invalid logging spec 'crate1::mod1=error=warn': '=' is not allowed in paths"] + ); + } + + #[test] + fn parse_spec_empty_with_filter() { + let ParseResult { + directives: dirs, + filter, + errors, + } = parse_spec("crate1/a*c"); + assert_eq!(dirs.len(), 1); + assert_eq!( + dirs[0].kind, + DirectiveKind::Component { + component: "crate1".to_owned() + } + ); + assert_eq!(dirs[0].level, LevelFilter::max()); + assert!(filter.is_some() && filter.unwrap().to_string() == "a*c"); + assert!(errors.is_empty()); + } + + #[test] + fn parse_spec_with_multiple_filters() { + let ParseResult { + directives: dirs, + filter, + errors, + } = parse_spec("debug/abc/a.c"); + assert!(dirs.is_empty()); + assert!(filter.is_none()); + + assert_eq!(errors.len(), 1); + assert_data_eq!(&errors[0], str!["invalid logging spec 'debug/abc/a.c': too many '/'"]); + } + + #[test] + fn parse_spec_multiple_invalid_crates() { + // test parse_spec with multiple = in specification + let ParseResult { + directives: dirs, + filter, + errors, + } = parse_spec("crate1::mod1=warn=info,crate2=debug,crate3=error=error"); + + assert_eq!(dirs.len(), 1); + assert_eq!( + dirs[0].kind, + DirectiveKind::Component { + component: "crate2".to_owned() + } + ); + assert_eq!(dirs[0].level, LevelFilter::Debug); + assert!(filter.is_none()); + + assert_eq!(errors.len(), 2); + assert_data_eq!( + &errors[0], + str!["invalid logging spec 'crate1::mod1=warn=info': '=' is not allowed in paths"] + ); + assert_data_eq!( + &errors[1], + str!["invalid logging spec 'crate3=error=error': '=' is not allowed in paths"] + ); + } + + #[test] + fn parse_spec_multiple_invalid_levels() { + // test parse_spec with 'noNumber' as log level + let ParseResult { + directives: dirs, + filter, + errors, + } = parse_spec("crate1::mod1=noNumber,crate2=debug,crate3=invalid"); + + assert_eq!(dirs.len(), 1); + assert_eq!( + dirs[0].kind, + DirectiveKind::Component { + component: "crate2".to_owned() + } + ); + assert_eq!(dirs[0].level, LevelFilter::Debug); + assert!(filter.is_none()); + + assert_eq!(errors.len(), 2); + assert_data_eq!( + &errors[0], + str![ + "invalid logging spec 'crate1::mod1=noNumber': attempted to convert a string that \ + doesn't match an existing log level" + ] + ); + assert_data_eq!( + &errors[1], + str![ + "invalid logging spec 'crate3=invalid': attempted to convert a string that \ + doesn't match an existing log level" + ] + ); + } + + #[test] + fn parse_spec_invalid_crate_and_level() { + // test parse_spec with 'noNumber' as log level + let ParseResult { + directives: dirs, + filter, + errors, + } = parse_spec("crate1::mod1=debug=info,crate2=debug,crate3=invalid"); + + assert_eq!(dirs.len(), 1); + assert_eq!( + dirs[0].kind, + DirectiveKind::Component { + component: "crate2".to_owned() + } + ); + assert_eq!(dirs[0].level, LevelFilter::Debug); + assert!(filter.is_none()); + + assert_eq!(errors.len(), 2); + assert_data_eq!( + &errors[0], + str!["invalid logging spec 'crate1::mod1=debug=info': '=' is not allowed in paths"] + ); + assert_data_eq!( + &errors[1], + str![ + "invalid logging spec 'crate3=invalid': attempted to convert a string that \ + doesn't match an existing log level" + ] + ); + } + + #[test] + fn parse_error_message_single_error() { + let error = parse_spec("crate1::mod1=debug=info,crate2=debug").ok().unwrap_err(); + assert_data_eq!( + error, + str![ + "error parsing logger filter: invalid logging spec 'crate1::mod1=debug=info': '=' \ + is not allowed in paths" + ] + ); + } + + #[test] + fn parse_error_message_multiple_errors() { + let error = parse_spec("crate1::mod1=debug=info,crate2=debug,crate3=invalid") + .ok() + .unwrap_err(); + assert_data_eq!( + error, + str![ + "error parsing logger filter: invalid logging spec 'crate1::mod1=debug=info': '=' \ + is not allowed in paths" + ] + ); + } +} diff --git a/midenc-log/src/fmt/humantime.rs b/midenc-log/src/fmt/humantime.rs new file mode 100644 index 000000000..a694f6f5f --- /dev/null +++ b/midenc-log/src/fmt/humantime.rs @@ -0,0 +1,131 @@ +use std::{fmt, time::SystemTime}; + +use crate::fmt::{Formatter, TimestampPrecision}; + +impl Formatter { + /// Get a [`Timestamp`] for the current date and time in UTC. + /// + /// # Examples + /// + /// Include the current timestamp with the log record: + /// + /// ``` + /// use std::io::Write; + /// + /// let mut builder = midenc_log::Builder::new(); + /// + /// builder.format(|buf, record| { + /// let ts = buf.timestamp(); + /// + /// writeln!(buf, "{}: {}: {}", ts, record.level(), record.args()) + /// }); + /// ``` + pub fn timestamp(&self) -> Timestamp { + Timestamp { + time: SystemTime::now(), + precision: TimestampPrecision::Seconds, + } + } + + /// Get a [`Timestamp`] for the current date and time in UTC with full + /// second precision. + pub fn timestamp_seconds(&self) -> Timestamp { + Timestamp { + time: SystemTime::now(), + precision: TimestampPrecision::Seconds, + } + } + + /// Get a [`Timestamp`] for the current date and time in UTC with + /// millisecond precision. + pub fn timestamp_millis(&self) -> Timestamp { + Timestamp { + time: SystemTime::now(), + precision: TimestampPrecision::Millis, + } + } + + /// Get a [`Timestamp`] for the current date and time in UTC with + /// microsecond precision. + pub fn timestamp_micros(&self) -> Timestamp { + Timestamp { + time: SystemTime::now(), + precision: TimestampPrecision::Micros, + } + } + + /// Get a [`Timestamp`] for the current date and time in UTC with + /// nanosecond precision. + pub fn timestamp_nanos(&self) -> Timestamp { + Timestamp { + time: SystemTime::now(), + precision: TimestampPrecision::Nanos, + } + } +} + +/// An [RFC3339] formatted timestamp. +/// +/// The timestamp implements [`Display`] and can be written to a [`Formatter`]. +/// +/// [RFC3339]: https://www.ietf.org/rfc/rfc3339.txt +/// [`Display`]: std::fmt::Display +pub struct Timestamp { + time: SystemTime, + precision: TimestampPrecision, +} + +impl fmt::Debug for Timestamp { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + /// A `Debug` wrapper for `Timestamp` that uses the `Display` implementation. + struct TimestampValue<'a>(&'a Timestamp); + + impl fmt::Debug for TimestampValue<'_> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt::Display::fmt(&self.0, f) + } + } + + f.debug_tuple("Timestamp").field(&TimestampValue(self)).finish() + } +} + +impl fmt::Display for Timestamp { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let Ok(ts) = jiff::Timestamp::try_from(self.time) else { + return Err(fmt::Error); + }; + + match self.precision { + TimestampPrecision::Seconds => write!(f, "{ts:.0}"), + TimestampPrecision::Millis => write!(f, "{ts:.3}"), + TimestampPrecision::Micros => write!(f, "{ts:.6}"), + TimestampPrecision::Nanos => write!(f, "{ts:.9}"), + } + } +} + +#[cfg(test)] +mod tests { + use super::Timestamp; + use crate::TimestampPrecision; + + #[test] + fn test_display_timestamp() { + let mut ts = Timestamp { + time: std::time::SystemTime::UNIX_EPOCH, + precision: TimestampPrecision::Nanos, + }; + + assert_eq!("1970-01-01T00:00:00.000000000Z", format!("{ts}")); + + ts.precision = TimestampPrecision::Micros; + assert_eq!("1970-01-01T00:00:00.000000Z", format!("{ts}")); + + ts.precision = TimestampPrecision::Millis; + assert_eq!("1970-01-01T00:00:00.000Z", format!("{ts}")); + + ts.precision = TimestampPrecision::Seconds; + assert_eq!("1970-01-01T00:00:00Z", format!("{ts}")); + } +} diff --git a/midenc-log/src/fmt/kv.rs b/midenc-log/src/fmt/kv.rs new file mode 100644 index 000000000..0b419e49c --- /dev/null +++ b/midenc-log/src/fmt/kv.rs @@ -0,0 +1,68 @@ +use std::io::{self, Write}; + +#[cfg(feature = "color")] +use anstyle::Style; +use log::kv::{Error, Key, Source, Value, VisitSource}; + +#[cfg(feature = "color")] +use super::WriteStyle; +use super::{Formatter, StyledValue}; + +/// Format function for serializing key/value pairs +/// +/// This function determines how key/value pairs for structured logs are serialized within the default +/// format. +pub(crate) type KvFormatFn = dyn Fn(&mut Formatter, &dyn Source) -> io::Result<()> + Sync + Send; + +/// Null Key Value Format +/// +/// This function is intended to be passed to +/// [`Builder::format_key_values`](crate::Builder::format_key_values). +/// +/// This key value format simply ignores any key/value fields and doesn't include them in the +/// output. +pub fn hidden_kv_format(_formatter: &mut Formatter, _fields: &dyn Source) -> io::Result<()> { + Ok(()) +} + +/// Default Key Value Format +/// +/// This function is intended to be passed to +/// [`Builder::format_key_values`](crate::Builder::format_key_values). +/// +/// This is the default key/value format. Which uses an "=" as the separator between the key and +/// value and a " " between each pair. +/// +/// For example: `ip=127.0.0.1 port=123456 path=/example` +pub fn default_kv_format(formatter: &mut Formatter, fields: &dyn Source) -> io::Result<()> { + fields.visit(&mut DefaultVisitSource(formatter)).map_err(io::Error::other) +} + +struct DefaultVisitSource<'a>(&'a mut Formatter); + +impl<'kvs> VisitSource<'kvs> for DefaultVisitSource<'_> { + fn visit_pair(&mut self, key: Key<'_>, value: Value<'kvs>) -> Result<(), Error> { + write!(self.0, " {}={}", self.style_key(key), value)?; + Ok(()) + } +} + +impl DefaultVisitSource<'_> { + fn style_key<'k>(&self, text: Key<'k>) -> StyledValue> { + #[cfg(feature = "color")] + { + StyledValue { + style: if self.0.write_style == WriteStyle::Never { + Style::new() + } else { + Style::new().italic() + }, + value: text, + } + } + #[cfg(not(feature = "color"))] + { + text + } + } +} diff --git a/midenc-log/src/fmt/mod.rs b/midenc-log/src/fmt/mod.rs new file mode 100644 index 000000000..150b0efe1 --- /dev/null +++ b/midenc-log/src/fmt/mod.rs @@ -0,0 +1,981 @@ +//! Formatting for log records. +//! +//! This module contains a [`Formatter`] that can be used to format log records +//! into without needing temporary allocations. Usually you won't need to worry +//! about the contents of this module and can use the `Formatter` like an ordinary +//! [`Write`]. +//! +//! # Formatting log records +//! +//! The format used to print log records can be customised using the [`Builder::format`] +//! method. +//! +//! Terminal styling is done through ANSI escape codes and will be adapted to the capabilities of +//! the target stream.s +//! +//! For example, you could use one of: +//! - [anstyle](https://docs.rs/anstyle) is a minimal, runtime string styling API and is re-exported as [`style`] +//! - [owo-colors](https://docs.rs/owo-colors) is a feature rich runtime string styling API +//! - [color-print](https://docs.rs/color-print) for feature-rich compile-time styling API +//! +//! See also [`Formatter::default_level_style`] +//! +//! ``` +//! use std::io::Write; +//! +//! let mut builder = midenc_log::Builder::new(); +//! +//! builder.format(|buf, record| { +//! writeln!(buf, "{}: {}", +//! record.level(), +//! record.args()) +//! }); +//! ``` +//! +//! # Key Value arguments +//! +//! If the `kv` feature is enabled, then the default format will include key values from +//! the log by default, but this can be disabled by calling [`Builder::format_key_values`] +//! with [`hidden_kv_format`] as the format function. +//! +//! The way these keys and values are formatted can also be customized with a separate format +//! function that is called by the default format with [`Builder::format_key_values`]. +//! +//! ``` +//! # #[cfg(feature= "kv")] +//! # { +//! use log::info; +//! midenc_log::init(); +//! info!(x="45"; "Some message"); +//! info!(x="12"; "Another message {x}", x="12"); +//! # } +//! ``` +//! +//! See . +//! +//! [`Builder::format`]: crate::Builder::format +//! [`Write`]: std::io::Write +//! [`Builder::format_key_values`]: crate::Builder::format_key_values + +use std::{cell::RefCell, fmt, fmt::Display, io, io::prelude::Write, mem, rc::Rc}; + +#[cfg(feature = "color")] +use log::Level; +use log::Record; + +#[cfg(feature = "humantime")] +mod humantime; +#[cfg(feature = "kv")] +mod kv; + +#[cfg(feature = "color")] +pub use anstyle as style; + +#[cfg(feature = "humantime")] +pub use self::humantime::Timestamp; +#[cfg(feature = "kv")] +pub use self::kv::*; +use crate::writer::{Buffer, Writer}; +pub use crate::writer::{Target, WriteStyle}; + +/// Formatting precision of timestamps. +/// +/// Seconds give precision of full seconds, milliseconds give thousands of a +/// second (3 decimal digits), microseconds are millionth of a second (6 decimal +/// digits) and nanoseconds are billionth of a second (9 decimal digits). +#[allow(clippy::exhaustive_enums)] // compatibility +#[derive(Copy, Clone, Debug)] +pub enum TimestampPrecision { + /// Full second precision (0 decimal digits) + Seconds, + /// Millisecond precision (3 decimal digits) + Millis, + /// Microsecond precision (6 decimal digits) + Micros, + /// Nanosecond precision (9 decimal digits) + Nanos, +} + +/// The default timestamp precision is seconds. +impl Default for TimestampPrecision { + fn default() -> Self { + TimestampPrecision::Seconds + } +} + +/// A formatter to write logs into. +/// +/// `Formatter` implements the standard [`Write`] trait for writing log records. +/// It also supports terminal styling using ANSI escape codes. +/// +/// # Examples +/// +/// Use the [`writeln`] macro to format a log record. +/// An instance of a `Formatter` is passed to an `midenc_log` format as `buf`: +/// +/// ``` +/// use std::io::Write; +/// +/// let mut builder = midenc_log::Builder::new(); +/// +/// builder.format(|buf, record| writeln!(buf, "{}: {}", record.level(), record.args())); +/// ``` +/// +/// [`Write`]: std::io::Write +/// [`writeln`]: std::writeln +pub struct Formatter { + buf: Rc>, + write_style: WriteStyle, +} + +impl Formatter { + pub(crate) fn new(writer: &Writer) -> Self { + Formatter { + buf: Rc::new(RefCell::new(writer.buffer())), + write_style: writer.write_style(), + } + } + + pub(crate) fn write_style(&self) -> WriteStyle { + self.write_style + } + + pub(crate) fn print(&self, writer: &Writer) -> io::Result<()> { + writer.print(&self.buf.borrow()) + } + + pub(crate) fn clear(&mut self) { + self.buf.borrow_mut().clear(); + } +} + +#[cfg(feature = "color")] +impl Formatter { + /// Get the default [`style::Style`] for the given level. + /// + /// The style can be used to print other values besides the level. + /// + /// See [`style`] for how to adapt it to the styling crate of your choice + pub fn default_level_style(&self, level: Level) -> style::Style { + if self.write_style == WriteStyle::Never { + style::Style::new() + } else { + match level { + Level::Trace => style::AnsiColor::Cyan.on_default(), + Level::Debug => style::AnsiColor::Blue.on_default(), + Level::Info => style::AnsiColor::Green.on_default(), + Level::Warn => style::AnsiColor::Yellow.on_default(), + Level::Error => style::AnsiColor::Red.on_default().effects(style::Effects::BOLD), + } + } + } +} + +impl Write for Formatter { + fn write(&mut self, buf: &[u8]) -> io::Result { + self.buf.borrow_mut().write(buf) + } + + fn flush(&mut self) -> io::Result<()> { + self.buf.borrow_mut().flush() + } +} + +impl fmt::Debug for Formatter { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let buf = self.buf.borrow(); + f.debug_struct("Formatter") + .field("buf", &buf) + .field("write_style", &self.write_style) + .finish() + } +} + +pub(crate) trait RecordFormat { + fn format(&self, formatter: &mut Formatter, record: &Record<'_>) -> io::Result<()>; +} + +impl RecordFormat for F +where + F: Fn(&mut Formatter, &Record<'_>) -> io::Result<()>, +{ + fn format(&self, formatter: &mut Formatter, record: &Record<'_>) -> io::Result<()> { + (self)(formatter, record) + } +} + +pub(crate) type FormatFn = Box; + +#[derive(Default)] +pub(crate) struct Builder { + pub(crate) default_format: ConfigurableFormat, + pub(crate) custom_format: Option, + built: bool, +} + +impl Builder { + /// Convert the format into a callable function. + /// + /// If the `custom_format` is `Some`, then any `default_format` switches are ignored. + /// If the `custom_format` is `None`, then a default format is returned. + /// Any `default_format` switches set to `false` won't be written by the format. + pub(crate) fn build(&mut self) -> FormatFn { + assert!(!self.built, "attempt to re-use consumed builder"); + + let built = mem::replace( + self, + Builder { + built: true, + ..Default::default() + }, + ); + + if let Some(fmt) = built.custom_format { + fmt + } else { + Box::new(built.default_format) + } + } +} + +#[cfg(feature = "color")] +type SubtleStyle = StyledValue<&'static str>; +#[cfg(not(feature = "color"))] +type SubtleStyle = &'static str; + +/// A value that can be printed using the given styles. +#[cfg(feature = "color")] +struct StyledValue { + style: style::Style, + value: T, +} + +#[cfg(feature = "color")] +impl Display for StyledValue { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let style = self.style; + + // We need to make sure `f`s settings don't get passed onto the styling but do get passed + // to the value + write!(f, "{style}")?; + self.value.fmt(f)?; + write!(f, "{style:#}")?; + Ok(()) + } +} + +#[cfg(not(feature = "color"))] +type StyledValue = T; + +/// A [custom format][crate::Builder::format] with settings for which fields to show +pub struct ConfigurableFormat { + // This format needs to work with any combination of crate features. + pub(crate) timestamp: Option, + pub(crate) module_path: bool, + pub(crate) target: bool, + pub(crate) level: bool, + pub(crate) source_file: bool, + pub(crate) source_line_number: bool, + pub(crate) indent: Option, + pub(crate) suffix: &'static str, + #[cfg(feature = "kv")] + pub(crate) kv_format: Option>, +} + +impl ConfigurableFormat { + /// Format the [`Record`] as configured for outputting + pub fn format(&self, formatter: &mut Formatter, record: &Record<'_>) -> io::Result<()> { + let fmt = ConfigurableFormatWriter { + format: self, + buf: formatter, + written_header_value: false, + }; + + fmt.write(record) + } +} + +impl ConfigurableFormat { + /// Whether or not to write the level in the default format. + pub fn level(&mut self, write: bool) -> &mut Self { + self.level = write; + self + } + + /// Whether or not to write the source file path in the default format. + pub fn file(&mut self, write: bool) -> &mut Self { + self.source_file = write; + self + } + + /// Whether or not to write the source line number path in the default format. + /// + /// Only has effect if `format_file` is also enabled + pub fn line_number(&mut self, write: bool) -> &mut Self { + self.source_line_number = write; + self + } + + /// Whether or not to write the module path in the default format. + pub fn module_path(&mut self, write: bool) -> &mut Self { + self.module_path = write; + self + } + + /// Whether or not to write the target in the default format. + pub fn target(&mut self, write: bool) -> &mut Self { + self.target = write; + self + } + + /// Configures the amount of spaces to use to indent multiline log records. + /// A value of `None` disables any kind of indentation. + pub fn indent(&mut self, indent: Option) -> &mut Self { + self.indent = indent; + self + } + + /// Configures if timestamp should be included and in what precision. + pub fn timestamp(&mut self, timestamp: Option) -> &mut Self { + self.timestamp = timestamp; + self + } + + /// Configures the end of line suffix. + pub fn suffix(&mut self, suffix: &'static str) -> &mut Self { + self.suffix = suffix; + self + } + + /// Set the format for structured key/value pairs in the log record + /// + /// With the default format, this function is called for each record and should format + /// the structured key-value pairs as returned by [`log::Record::key_values`]. + /// + /// The format function is expected to output the string directly to the `Formatter` so that + /// implementations can use the [`std::fmt`] macros, similar to the main format function. + /// + /// The default format uses a space to separate each key-value pair, with an "=" between + /// the key and value. + #[cfg(feature = "kv")] + pub fn key_values(&mut self, format: F) -> &mut Self + where + F: Fn(&mut Formatter, &dyn log::kv::Source) -> io::Result<()> + Sync + Send + 'static, + { + self.kv_format = Some(Box::new(format)); + self + } +} + +impl Default for ConfigurableFormat { + fn default() -> Self { + Self { + timestamp: Some(Default::default()), + module_path: false, + target: true, + level: true, + source_file: false, + source_line_number: false, + indent: Some(4), + suffix: "\n", + #[cfg(feature = "kv")] + kv_format: None, + } + } +} + +impl RecordFormat for ConfigurableFormat { + fn format(&self, formatter: &mut Formatter, record: &Record<'_>) -> io::Result<()> { + self.format(formatter, record) + } +} + +/// The default format. +/// +/// This format needs to work with any combination of crate features. +struct ConfigurableFormatWriter<'a> { + format: &'a ConfigurableFormat, + buf: &'a mut Formatter, + written_header_value: bool, +} + +impl ConfigurableFormatWriter<'_> { + fn write(mut self, record: &Record<'_>) -> io::Result<()> { + self.write_timestamp()?; + self.write_level(record)?; + self.write_module_path(record)?; + self.write_source_location(record)?; + self.write_target(record)?; + self.finish_header()?; + + self.write_args(record)?; + #[cfg(feature = "kv")] + self.write_kv(record)?; + write!(self.buf, "{}", self.format.suffix) + } + + fn subtle_style(&self, text: &'static str) -> SubtleStyle { + #[cfg(feature = "color")] + { + StyledValue { + style: if self.buf.write_style == WriteStyle::Never { + style::Style::new() + } else { + style::AnsiColor::BrightBlack.on_default() + }, + value: text, + } + } + #[cfg(not(feature = "color"))] + { + text + } + } + + fn write_header_value(&mut self, value: T) -> io::Result<()> + where + T: Display, + { + if !self.written_header_value { + self.written_header_value = true; + + let open_brace = self.subtle_style("["); + write!(self.buf, "{open_brace}{value}") + } else { + write!(self.buf, " {value}") + } + } + + fn write_level(&mut self, record: &Record<'_>) -> io::Result<()> { + if !self.format.level { + return Ok(()); + } + + let level = { + let level = record.level(); + #[cfg(feature = "color")] + { + StyledValue { + style: self.buf.default_level_style(level), + value: level, + } + } + #[cfg(not(feature = "color"))] + { + level + } + }; + + self.write_header_value(format_args!("{level:<5}")) + } + + fn write_timestamp(&mut self) -> io::Result<()> { + #[cfg(feature = "humantime")] + { + use self::TimestampPrecision::{Micros, Millis, Nanos, Seconds}; + let ts = match self.format.timestamp { + None => return Ok(()), + Some(Seconds) => self.buf.timestamp_seconds(), + Some(Millis) => self.buf.timestamp_millis(), + Some(Micros) => self.buf.timestamp_micros(), + Some(Nanos) => self.buf.timestamp_nanos(), + }; + + self.write_header_value(ts) + } + #[cfg(not(feature = "humantime"))] + { + // Trick the compiler to think we have used self.timestamp + // Workaround for "field is never used: `timestamp`" compiler nag. + let _ = self.format.timestamp; + Ok(()) + } + } + + fn write_module_path(&mut self, record: &Record<'_>) -> io::Result<()> { + if !self.format.module_path { + return Ok(()); + } + + if let Some(module_path) = record.module_path() { + self.write_header_value(module_path) + } else { + Ok(()) + } + } + + fn write_source_location(&mut self, record: &Record<'_>) -> io::Result<()> { + if !self.format.source_file { + return Ok(()); + } + + if let Some(file_path) = record.file() { + let line = self.format.source_line_number.then(|| record.line()).flatten(); + match line { + Some(line) => self.write_header_value(format_args!("{file_path}:{line}")), + None => self.write_header_value(file_path), + } + } else { + Ok(()) + } + } + + fn write_target(&mut self, record: &Record<'_>) -> io::Result<()> { + if !self.format.target { + return Ok(()); + } + + match record.target() { + "" => Ok(()), + target => self.write_header_value(target), + } + } + + fn finish_header(&mut self) -> io::Result<()> { + if self.written_header_value { + let close_brace = self.subtle_style("]"); + write!(self.buf, "{close_brace} ") + } else { + Ok(()) + } + } + + fn write_args(&mut self, record: &Record<'_>) -> io::Result<()> { + match self.format.indent { + // Fast path for no indentation + None => write!(self.buf, "{}", record.args()), + + Some(indent_count) => { + // Create a wrapper around the buffer only if we have to actually indent the message + + struct IndentWrapper<'a, 'b> { + fmt: &'a mut ConfigurableFormatWriter<'b>, + indent_count: usize, + } + + impl Write for IndentWrapper<'_, '_> { + fn write(&mut self, buf: &[u8]) -> io::Result { + let mut first = true; + for chunk in buf.split(|&x| x == b'\n') { + if !first { + write!( + self.fmt.buf, + "{}{:width$}", + self.fmt.format.suffix, + "", + width = self.indent_count + )?; + } + self.fmt.buf.write_all(chunk)?; + first = false; + } + + Ok(buf.len()) + } + + fn flush(&mut self) -> io::Result<()> { + self.fmt.buf.flush() + } + } + + // The explicit scope here is just to make older versions of Rust happy + { + let mut wrapper = IndentWrapper { + fmt: self, + indent_count, + }; + write!(wrapper, "{}", record.args())?; + } + + Ok(()) + } + } + } + + #[cfg(feature = "kv")] + fn write_kv(&mut self, record: &Record<'_>) -> io::Result<()> { + let format = self.format.kv_format.as_deref().unwrap_or(&default_kv_format); + format(self.buf, record.key_values()) + } +} + +#[cfg(test)] +mod tests { + use log::{Level, Record}; + + use super::*; + + fn write_record(record: Record<'_>, fmt: ConfigurableFormatWriter<'_>) -> String { + let buf = fmt.buf.buf.clone(); + + fmt.write(&record).expect("failed to write record"); + + let buf = buf.borrow(); + String::from_utf8(buf.as_bytes().to_vec()).expect("failed to read record") + } + + fn write_target(target: &str, fmt: ConfigurableFormatWriter<'_>) -> String { + write_record( + Record::builder() + .args(format_args!("log\nmessage")) + .level(Level::Info) + .file(Some("test.rs")) + .line(Some(144)) + .module_path(Some("test::path")) + .target(target) + .build(), + fmt, + ) + } + + fn write(fmt: ConfigurableFormatWriter<'_>) -> String { + write_target("", fmt) + } + + fn formatter() -> Formatter { + let writer = crate::writer::Builder::new().write_style(WriteStyle::Never).build(); + + Formatter::new(&writer) + } + + #[test] + fn format_with_header() { + let mut f = formatter(); + + let written = write(ConfigurableFormatWriter { + format: &ConfigurableFormat { + timestamp: None, + module_path: true, + target: false, + level: true, + source_file: false, + source_line_number: false, + #[cfg(feature = "kv")] + kv_format: Some(Box::new(hidden_kv_format)), + indent: None, + suffix: "\n", + }, + written_header_value: false, + buf: &mut f, + }); + + assert_eq!("[INFO test::path] log\nmessage\n", written); + } + + #[test] + fn format_no_header() { + let mut f = formatter(); + + let written = write(ConfigurableFormatWriter { + format: &ConfigurableFormat { + timestamp: None, + module_path: false, + target: false, + level: false, + source_file: false, + source_line_number: false, + #[cfg(feature = "kv")] + kv_format: Some(Box::new(hidden_kv_format)), + indent: None, + suffix: "\n", + }, + written_header_value: false, + buf: &mut f, + }); + + assert_eq!("log\nmessage\n", written); + } + + #[test] + fn format_indent_spaces() { + let mut f = formatter(); + + let written = write(ConfigurableFormatWriter { + format: &ConfigurableFormat { + timestamp: None, + module_path: true, + target: false, + level: true, + source_file: false, + source_line_number: false, + #[cfg(feature = "kv")] + kv_format: Some(Box::new(hidden_kv_format)), + indent: Some(4), + suffix: "\n", + }, + written_header_value: false, + buf: &mut f, + }); + + assert_eq!("[INFO test::path] log\n message\n", written); + } + + #[test] + fn format_indent_zero_spaces() { + let mut f = formatter(); + + let written = write(ConfigurableFormatWriter { + format: &ConfigurableFormat { + timestamp: None, + module_path: true, + target: false, + level: true, + source_file: false, + source_line_number: false, + #[cfg(feature = "kv")] + kv_format: Some(Box::new(hidden_kv_format)), + indent: Some(0), + suffix: "\n", + }, + written_header_value: false, + buf: &mut f, + }); + + assert_eq!("[INFO test::path] log\nmessage\n", written); + } + + #[test] + fn format_indent_spaces_no_header() { + let mut f = formatter(); + + let written = write(ConfigurableFormatWriter { + format: &ConfigurableFormat { + timestamp: None, + module_path: false, + target: false, + level: false, + source_file: false, + source_line_number: false, + #[cfg(feature = "kv")] + kv_format: Some(Box::new(hidden_kv_format)), + indent: Some(4), + suffix: "\n", + }, + written_header_value: false, + buf: &mut f, + }); + + assert_eq!("log\n message\n", written); + } + + #[test] + fn format_suffix() { + let mut f = formatter(); + + let written = write(ConfigurableFormatWriter { + format: &ConfigurableFormat { + timestamp: None, + module_path: false, + target: false, + level: false, + source_file: false, + source_line_number: false, + #[cfg(feature = "kv")] + kv_format: Some(Box::new(hidden_kv_format)), + indent: None, + suffix: "\n\n", + }, + written_header_value: false, + buf: &mut f, + }); + + assert_eq!("log\nmessage\n\n", written); + } + + #[test] + fn format_suffix_with_indent() { + let mut f = formatter(); + + let written = write(ConfigurableFormatWriter { + format: &ConfigurableFormat { + timestamp: None, + module_path: false, + target: false, + level: false, + source_file: false, + source_line_number: false, + #[cfg(feature = "kv")] + kv_format: Some(Box::new(hidden_kv_format)), + indent: Some(4), + suffix: "\n\n", + }, + written_header_value: false, + buf: &mut f, + }); + + assert_eq!("log\n\n message\n\n", written); + } + + #[test] + fn format_target() { + let mut f = formatter(); + + let written = write_target( + "target", + ConfigurableFormatWriter { + format: &ConfigurableFormat { + timestamp: None, + module_path: true, + target: true, + level: true, + source_file: false, + source_line_number: false, + #[cfg(feature = "kv")] + kv_format: Some(Box::new(hidden_kv_format)), + indent: None, + suffix: "\n", + }, + written_header_value: false, + buf: &mut f, + }, + ); + + assert_eq!("[INFO test::path target] log\nmessage\n", written); + } + + #[test] + fn format_empty_target() { + let mut f = formatter(); + + let written = write(ConfigurableFormatWriter { + format: &ConfigurableFormat { + timestamp: None, + module_path: true, + target: true, + level: true, + source_file: false, + source_line_number: false, + #[cfg(feature = "kv")] + kv_format: Some(Box::new(hidden_kv_format)), + indent: None, + suffix: "\n", + }, + written_header_value: false, + buf: &mut f, + }); + + assert_eq!("[INFO test::path] log\nmessage\n", written); + } + + #[test] + fn format_no_target() { + let mut f = formatter(); + + let written = write_target( + "target", + ConfigurableFormatWriter { + format: &ConfigurableFormat { + timestamp: None, + module_path: true, + target: false, + level: true, + source_file: false, + source_line_number: false, + #[cfg(feature = "kv")] + kv_format: Some(Box::new(hidden_kv_format)), + indent: None, + suffix: "\n", + }, + written_header_value: false, + buf: &mut f, + }, + ); + + assert_eq!("[INFO test::path] log\nmessage\n", written); + } + + #[test] + fn format_with_source_file_and_line_number() { + let mut f = formatter(); + + let written = write(ConfigurableFormatWriter { + format: &ConfigurableFormat { + timestamp: None, + module_path: false, + target: false, + level: true, + source_file: true, + source_line_number: true, + #[cfg(feature = "kv")] + kv_format: Some(Box::new(hidden_kv_format)), + indent: None, + suffix: "\n", + }, + written_header_value: false, + buf: &mut f, + }); + + assert_eq!("[INFO test.rs:144] log\nmessage\n", written); + } + + #[cfg(feature = "kv")] + #[test] + fn format_kv_default() { + let kvs = &[("a", 1u32), ("b", 2u32)][..]; + let mut f = formatter(); + let record = Record::builder() + .args(format_args!("log message")) + .level(Level::Info) + .module_path(Some("test::path")) + .key_values(&kvs) + .build(); + + let written = write_record( + record, + ConfigurableFormatWriter { + format: &ConfigurableFormat { + timestamp: None, + module_path: false, + target: false, + level: true, + source_file: false, + source_line_number: false, + kv_format: Some(Box::new(default_kv_format)), + indent: None, + suffix: "\n", + }, + written_header_value: false, + buf: &mut f, + }, + ); + + assert_eq!("[INFO ] log message a=1 b=2\n", written); + } + + #[cfg(feature = "kv")] + #[test] + fn format_kv_default_full() { + let kvs = &[("a", 1u32), ("b", 2u32)][..]; + let mut f = formatter(); + let record = Record::builder() + .args(format_args!("log\nmessage")) + .level(Level::Info) + .module_path(Some("test::path")) + .target("target") + .file(Some("test.rs")) + .line(Some(42)) + .key_values(&kvs) + .build(); + + let written = write_record( + record, + ConfigurableFormatWriter { + format: &ConfigurableFormat { + timestamp: None, + module_path: true, + target: true, + level: true, + source_file: true, + source_line_number: true, + kv_format: Some(Box::new(default_kv_format)), + indent: None, + suffix: "\n", + }, + written_header_value: false, + buf: &mut f, + }, + ); + + assert_eq!("[INFO test::path test.rs:42 target] log\nmessage a=1 b=2\n", written); + } +} diff --git a/midenc-log/src/lib.rs b/midenc-log/src/lib.rs new file mode 100644 index 000000000..18ac37396 --- /dev/null +++ b/midenc-log/src/lib.rs @@ -0,0 +1,329 @@ +//! A configurable logger that can be configured both directly and via environment variables. +//! +//! Designed for use with [`log`](log-crate-url). +//! +//! This crate is inspired by [`midenc_log`](https://crates.io/crates/midenc_log), but provides +//! additional features specific to the Miden compiler that make it more useful when diagnosing +//! issues in a pipeline that has an enormous quantity of verbose trace logs that are emitted for +//! a large number of different entities in the compilation graph. Typically, we're interested in +//! output related to a specific function, possibly refined to specific components of the compiler, +//! or even specific areas of those components. +//! +//! There are a few primary use cases we're interested in supporting with this crate: +//! +//! 1. Emit all logs at a given log level, e.g. `MIDENC_TRACE=trace cargo miden build` +//! 2. Same as 1, but for a specific component of the compiler, e.g. `MIDENC_TRACE=codegen=trace` +//! 3. Same as 2, but for a specific topic within that component, e.g. +//! `MIDENC_TRACE=pass:cse=trace` +//! 4. Same as 2, but for any topic in that component which matches a regular expression, e.g. +//! `MIDENC_TRACE=pass:.*=trace` +//! 5. Any of the above, but only for an operation which matches a given filter: +//! a. Match any op that implements Symbol, e.g. `MIDENC_TRACE=trace MIDENC_TRACE_FILTER=symbol:*` +//! b. Match a symbol whose name matches a regular expression, e.g. `MIDENC_TRACE=trace MIDENC_TRACE_FILTER=symbol:foo` +//! c. Match a specific operation type, e.g. `MIDENC_TRACE=trace MIDENC_TRACE_FILTER=op:hir.function` +//! 6. Negated filters, e.g. emit all logs which match any positive filters and are not also matched +//! by the negative filter, e.g.: +//! a. Emit everything except logs for the "dataflow" component: `MIDENC_TRACE=trace,-dataflow` +//! b. Emit everything except trace-level logs for the "dataflow" component: `MIDENC_TRACE=trace,-dataflow=trace` +//! c. Emit logs for the "dataflow" component, except trace-level logs for the "solver" topic: `MIDENC_TRACE=dataflow=trace,-dataflow:solver=trace` +//! +//! By default, logs are written to `stderr`, but this is configurable. +//! +//! NOTE: The functionality here relies on `log` targets using a structured format that we can +//! parse and extract the relevant pieces from. Any `log` targets which are not in this format +//! will be treated as a single component and emitted according to the default logging rules, +//! while still supporting filtering those components. The format is as follows: +//! +//! ```ignore +//! scope := component (":" topic)* +//! +//! component := [A-Za-z0-9_-]+ +//! topic := [^:,=]+ +//! ``` +//! +//! When there are nested topics, the last topic is considered to contain the relevant symbol for +//! that log message, and so will be filtered by `MIDENC_TRACE_FILTER`, not any topic patterns in +//! `MIDENC_TRACE`. +//! +//! ## Example +//! +//! ``` +//! use log::{debug, error, log_enabled, info, Level}; +//! +//! midenc_log::init(); +//! +//! debug!("this is a debug {}", "message"); +//! error!("this is printed by default"); +//! +//! if log_enabled!(Level::Info) { +//! let x = 3 * 4; // expensive computation +//! info!("the answer was: {}", x); +//! } +//! ``` +//! +//! Assumes the binary is `main`: +//! +//! ```console +//! $ RUST_LOG=error ./main +//! [2017-11-09T02:12:24Z ERROR main] this is printed by default +//! ``` +//! +//! ```console +//! $ RUST_LOG=info ./main +//! [2017-11-09T02:12:24Z ERROR main] this is printed by default +//! [2017-11-09T02:12:24Z INFO main] the answer was: 12 +//! ``` +//! +//! ```console +//! $ RUST_LOG=debug ./main +//! [2017-11-09T02:12:24Z DEBUG main] this is a debug message +//! [2017-11-09T02:12:24Z ERROR main] this is printed by default +//! [2017-11-09T02:12:24Z INFO main] the answer was: 12 +//! ``` +//! +//! You can also set the log level on a per module basis: +//! +//! ```console +//! $ RUST_LOG=main=info ./main +//! [2017-11-09T02:12:24Z ERROR main] this is printed by default +//! [2017-11-09T02:12:24Z INFO main] the answer was: 12 +//! ``` +//! +//! And enable all logging: +//! +//! ```console +//! $ RUST_LOG=main ./main +//! [2017-11-09T02:12:24Z DEBUG main] this is a debug message +//! [2017-11-09T02:12:24Z ERROR main] this is printed by default +//! [2017-11-09T02:12:24Z INFO main] the answer was: 12 +//! ``` +//! +//! If the binary name contains hyphens, you will need to replace +//! them with underscores: +//! +//! ```console +//! $ RUST_LOG=my_app ./my-app +//! [2017-11-09T02:12:24Z DEBUG my_app] this is a debug message +//! [2017-11-09T02:12:24Z ERROR my_app] this is printed by default +//! [2017-11-09T02:12:24Z INFO my_app] the answer was: 12 +//! ``` +//! +//! This is because Rust modules and crates cannot contain hyphens +//! in their name, although `cargo` continues to accept them. +//! +//! See the documentation for the [`log` crate][log-crate-url] for more +//! information about its API. +//! +//! ## Enabling logging +//! +//! **By default all logging is disabled except for the `error` level** +//! +//! The **`RUST_LOG`** environment variable controls logging with the syntax: +//! ```console +//! RUST_LOG=[target][=][level][,...] +//! ``` +//! Or in other words, its a comma-separated list of directives. +//! Directives can filter by **target**, by **level**, or both (using `=`). +//! +//! For example, +//! ```console +//! RUST_LOG=data=debug,hardware=debug +//! ``` +//! +//! **target** is typically the path of the module the message +//! in question originated from, though it can be overridden. +//! The path is rooted in the name of the crate it was compiled for, so if +//! your program is in a file called, for example, `hello.rs`, the path would +//! simply be `hello`. +//! +//! Furthermore, the log can be filtered using prefix-search based on the +//! specified log target. +//! +//! For example, `RUST_LOG=example` would match the following targets: +//! - `example` +//! - `example::test` +//! - `example::test::module::submodule` +//! - `examples::and_more_examples` +//! +//! When providing the crate name or a module path, explicitly specifying the +//! log level is optional. If omitted, all logging for the item will be +//! enabled. +//! +//! **level** is the maximum [`log::Level`][level-enum] to be shown and includes: +//! - `error` +//! - `warn` +//! - `info` +//! - `debug` +//! - `trace` +//! - `off` (pseudo level to disable all logging for the target) +//! +//! Logging level names are case-insensitive; e.g., +//! `debug`, `DEBUG`, and `dEbuG` all represent the same logging level. For +//! consistency, our convention is to use the lower case names. Where our docs +//! do use other forms, they do so in the context of specific examples, so you +//! won't be surprised if you see similar usage in the wild. +//! +//! Some examples of valid values of `RUST_LOG` are: +//! +//! - `RUST_LOG=hello` turns on all logging for the `hello` module +//! - `RUST_LOG=trace` turns on all logging for the application, regardless of its name +//! - `RUST_LOG=TRACE` turns on all logging for the application, regardless of its name (same as previous) +//! - `RUST_LOG=info` turns on all info logging +//! - `RUST_LOG=INFO` turns on all info logging (same as previous) +//! - `RUST_LOG=hello=debug` turns on debug logging for `hello` +//! - `RUST_LOG=hello=DEBUG` turns on debug logging for `hello` (same as previous) +//! - `RUST_LOG=hello,std::option` turns on `hello`, and std's option logging +//! - `RUST_LOG=error,hello=warn` turn on global error logging and also warn for `hello` +//! - `RUST_LOG=error,hello=off` turn on global error logging, but turn off logging for `hello` +//! - `RUST_LOG=off` turns off all logging for the application +//! - `RUST_LOG=OFF` turns off all logging for the application (same as previous) +//! +//! ## Filtering results +//! +//! A `RUST_LOG` directive may include a regex filter. The syntax is to append `/` +//! followed by a regex. Each message is checked against the regex, and is only +//! logged if it matches. Note that the matching is done after formatting the +//! log string but before adding any logging meta-data. There is a single filter +//! for all modules. +//! +//! Some examples: +//! +//! * `hello/foo` turns on all logging for the 'hello' module where the log +//! message includes 'foo'. +//! * `info/f.o` turns on all info logging where the log message includes 'foo', +//! 'f1o', 'fao', etc. +//! * `hello=debug/foo*foo` turns on debug logging for 'hello' where the log +//! message includes 'foofoo' or 'fofoo' or 'fooooooofoo', etc. +//! * `error,hello=warn/[0-9]scopes` turn on global error logging and also +//! warn for hello. In both cases the log message must include a single digit +//! number followed by 'scopes'. +//! +//! ## Capturing logs in tests +//! +//! Records logged during `cargo test` will not be captured by the test harness by default. +//! The [`Builder::is_test`] method can be used in unit tests to ensure logs will be captured: +//! +//! ```test_harness +//! #[cfg(test)] +//! mod tests { +//! use log::info; +//! +//! fn init() { +//! let _ = midenc_log::builder().is_test(true).try_init(); +//! } +//! +//! #[test] +//! fn it_works() { +//! init(); +//! +//! info!("This record will be captured by `cargo test`"); +//! +//! assert_eq!(2, 1 + 1); +//! } +//! } +//! ``` +//! +//! Enabling test capturing comes at the expense of color and other style support +//! and may have performance implications. +//! +//! ## Colors +//! +//! Outputting of colors and other styles can be controlled by the `RUST_LOG_STYLE` +//! environment variable. It accepts the following [values][fmt::WriteStyle]: +//! +//! * `auto` (default) will attempt to print style characters, but don't force the issue. +//! If the console isn't available on Windows, or if TERM=dumb, for example, then don't print colors. +//! * `always` will always print style characters even if they aren't supported by the terminal. +//! This includes emitting ANSI colors on Windows if the console API is unavailable. +//! * `never` will never print style characters. +//! +//! Color may be applied in the logged message or a [custom formatter][fmt]. +//! +//!
+//! +//! Logging of untrusted inputs can cause unexpected behavior as they may include ANSI escape codes which +//! will be forwarded to the users terminal as part of "Weaponizing ANSI Escape Sequences". +//! +//! Mitigations include: +//! - Setting `RUST_LOG_STYLE=never` to have all ANSI escape codes stripped +//! - In the application, calling [`Builder::write_style(Never)`][Builder::write_style] to have all ANSI escape codes stripped +//! - In the application, [stripping ANSI escape codes](https://docs.rs/anstream/latest/anstream/adapter/fn.strip_str.html) +//! from user inputs +//! +//! Note: deactivating the build-time feature `color` is not a mitigation as that removes all ANSI escape code +//! stripping from `midenc_log`. +//! +//!
+//! +//! ## Tweaking the default format +//! +//! Parts of the default format can be excluded from the log output using the [`Builder`]. +//! The following example excludes the timestamp from the log output: +//! +//! ``` +//! midenc_log::builder() +//! .format_timestamp(None) +//! .init(); +//! ``` +//! +//! ### Stability of the default format +//! +//! The default format won't optimise for long-term stability, and explicitly makes no +//! guarantees about the stability of its output across major, minor or patch version +//! bumps during `0.x`. +//! +//! If you want to capture or interpret the output of `midenc_log` programmatically +//! then you should use a custom format. +//! +//! ### Using a custom format +//! +//! Custom formats can be provided as closures to the [`Builder`]. +//! These closures take a [`Formatter`][crate::fmt::Formatter] and `log::Record` as arguments: +//! +//! ``` +//! use std::io::Write; +//! +//! midenc_log::builder() +//! .format(|buf, record| { +//! writeln!(buf, "{}: {}", record.level(), record.args()) +//! }) +//! .init(); +//! ``` +//! +//! See the [`fmt`] module for more details about custom formats. +//! +//! ## Specifying defaults for environment variables +//! +//! `midenc_log` can read configuration from environment variables. +//! If these variables aren't present, the default value to use can be tweaked with the [`Env`] type. +//! The following example defaults to log `warn` and above if the `RUST_LOG` environment variable +//! isn't set: +//! +//! ``` +//! use midenc_log::Env; +//! +//! midenc_log::Builder::from_env(Env::default().default_filter_or("warn")).init(); +//! ``` +//! +//! [level-enum]: https://docs.rs/log/latest/log/enum.Level.html +//! [log-crate-url]: https://docs.rs/log + +#![cfg_attr(docsrs, feature(doc_cfg))] +#![warn(clippy::print_stderr)] +#![warn(clippy::print_stdout)] +#![allow(clippy::test_attr_in_doctest)] + +pub mod filter; +mod logger; +mod writer; + +pub mod fmt; + +pub use self::{ + fmt::{Target, TimestampPrecision, WriteStyle}, + logger::*, +}; + +#[doc = include_str!("../README.md")] +#[cfg(doctest)] +pub struct ReadmeDoctests; diff --git a/midenc-log/src/logger.rs b/midenc-log/src/logger.rs new file mode 100644 index 000000000..386011adc --- /dev/null +++ b/midenc-log/src/logger.rs @@ -0,0 +1,1056 @@ +use std::{borrow::Cow, cell::RefCell, env, io}; + +use log::{LevelFilter, Log, Metadata, Record, SetLoggerError}; + +use crate::{ + fmt, + fmt::{FormatFn, Formatter}, + writer::{self, Writer}, +}; + +/// The default name for the environment variable to read filters from. +pub const DEFAULT_FILTER_ENV: &str = "MIDENC_TRACE"; + +/// The default name for the environment variable to read kv filters from. +pub const DEFAULT_KV_FILTER_ENV: &str = "MIDENC_TRACE_FILTER"; + +/// The default name for the environment variable to read style preferences from. +pub const DEFAULT_WRITE_STYLE_ENV: &str = "MIDENC_TRACE_STYLE"; + +/// `Builder` acts as builder for initializing a `Logger`. +/// +/// It can be used to customize the log format, change the environment variable used +/// to provide the logging directives and also set the default log level filter. +/// +/// # Examples +/// +/// ``` +/// # use std::io::Write; +/// use midenc_log::Builder; +/// use log::{LevelFilter, error, info}; +/// +/// let mut builder = Builder::from_default_env(); +/// +/// builder +/// .format(|buf, record| writeln!(buf, "{} - {}", record.level(), record.args())) +/// .filter(None, LevelFilter::Info) +/// .init(); +/// +/// error!("error message"); +/// info!("info message"); +/// ``` +#[derive(Default)] +pub struct Builder { + filter: crate::filter::Builder, + writer: writer::Builder, + format: fmt::Builder, + built: bool, +} + +impl Builder { + /// Initializes the log builder with defaults. + /// + /// **NOTE:** This method won't read from any environment variables. + /// Use the [`filter`] and [`write_style`] methods to configure the builder + /// or use [`from_env`] or [`from_default_env`] instead. + /// + /// # Examples + /// + /// Create a new builder and configure filters and style: + /// + /// ``` + /// use log::LevelFilter; + /// use midenc_log::{Builder, WriteStyle}; + /// + /// let mut builder = Builder::new(); + /// + /// builder + /// .filter(None, LevelFilter::Info) + /// .write_style(WriteStyle::Always) + /// .init(); + /// ``` + /// + /// [`filter`]: #method.filter + /// [`write_style`]: #method.write_style + /// [`from_env`]: #method.from_env + /// [`from_default_env`]: #method.from_default_env + pub fn new() -> Builder { + Default::default() + } + + /// Initializes the log builder from the environment. + /// + /// The variables used to read configuration from can be tweaked before + /// passing in. + /// + /// # Examples + /// + /// Initialise a logger reading the log filter from an environment variable + /// called `MY_LOG`: + /// + /// ``` + /// use midenc_log::Builder; + /// + /// let mut builder = Builder::from_env("MY_LOG"); + /// builder.init(); + /// ``` + /// + /// Initialise a logger using the `MY_LOG` variable for filtering and + /// `MY_LOG_STYLE` for whether or not to write styles: + /// + /// ``` + /// use midenc_log::{Builder, Env}; + /// + /// let env = Env::new().filter("MY_LOG").write_style("MY_LOG_STYLE"); + /// + /// let mut builder = Builder::from_env(env); + /// builder.init(); + /// ``` + pub fn from_env<'a, E>(env: E) -> Self + where + E: Into>, + { + let mut builder = Builder::new(); + builder.parse_env(env); + builder + } + + /// Applies the configuration from the environment. + /// + /// This function allows a builder to be configured with default parameters, + /// to be then overridden by the environment. + /// + /// # Examples + /// + /// Initialise a logger with filter level `Off`, then override the log + /// filter from an environment variable called `MY_LOG`: + /// + /// ``` + /// use log::LevelFilter; + /// use midenc_log::Builder; + /// + /// let mut builder = Builder::new(); + /// + /// builder.filter_level(LevelFilter::Off); + /// builder.parse_env("MY_LOG"); + /// builder.init(); + /// ``` + /// + /// Initialise a logger with filter level `Off`, then use the `MY_LOG` + /// variable to override filtering and `MY_LOG_STYLE` to override whether + /// or not to write styles: + /// + /// ``` + /// use log::LevelFilter; + /// use midenc_log::{Builder, Env}; + /// + /// let env = Env::new().filter("MY_LOG").write_style("MY_LOG_STYLE"); + /// + /// let mut builder = Builder::new(); + /// builder.filter_level(LevelFilter::Off); + /// builder.parse_env(env); + /// builder.init(); + /// ``` + pub fn parse_env<'a, E>(&mut self, env: E) -> &mut Self + where + E: Into>, + { + let env = env.into(); + + if let Some(s) = env.get_filter() { + self.parse_filters(&s); + } + + if let Some(s) = env.get_kv_filter() { + self.parse_kv_filters(&s); + } + + if let Some(s) = env.get_write_style() { + self.parse_write_style(&s); + } + + self + } + + /// Initializes the log builder from the environment using default variable names. + /// + /// This method is a convenient way to call `from_env(Env::default())` without + /// having to use the `Env` type explicitly. The builder will use the + /// [default environment variables]. + /// + /// # Examples + /// + /// Initialise a logger using the default environment variables: + /// + /// ``` + /// use midenc_log::Builder; + /// + /// let mut builder = Builder::from_default_env(); + /// builder.init(); + /// ``` + /// + /// [default environment variables]: struct.Env.html#default-environment-variables + pub fn from_default_env() -> Self { + Self::from_env(Env::default()) + } + + /// Applies the configuration from the environment using default variable names. + /// + /// This method is a convenient way to call `parse_env(Env::default())` without + /// having to use the `Env` type explicitly. The builder will use the + /// [default environment variables]. + /// + /// # Examples + /// + /// Initialise a logger with filter level `Off`, then configure it using the + /// default environment variables: + /// + /// ``` + /// use log::LevelFilter; + /// use midenc_log::Builder; + /// + /// let mut builder = Builder::new(); + /// builder.filter_level(LevelFilter::Off); + /// builder.parse_default_env(); + /// builder.init(); + /// ``` + /// + /// [default environment variables]: struct.Env.html#default-environment-variables + pub fn parse_default_env(&mut self) -> &mut Self { + self.parse_env(Env::default()) + } + + /// Sets the format function for formatting the log output. + /// + /// This function is called on each record logged and should format the + /// log record and output it to the given [`Formatter`]. + /// + /// The format function is expected to output the string directly to the + /// `Formatter` so that implementations can use the [`std::fmt`] macros + /// to format and output without intermediate heap allocations. The default + /// `midenc_log` formatter takes advantage of this. + /// + /// When the `color` feature is enabled, styling via ANSI escape codes is supported and the + /// output will automatically respect [`Builder::write_style`]. + /// + /// # Examples + /// + /// Use a custom format to write only the log message: + /// + /// ``` + /// use std::io::Write; + /// use midenc_log::Builder; + /// + /// let mut builder = Builder::new(); + /// + /// builder.format(|buf, record| writeln!(buf, "{}", record.args())); + /// ``` + /// + /// [`Formatter`]: fmt/struct.Formatter.html + /// [`String`]: https://doc.rust-lang.org/stable/std/string/struct.String.html + /// [`std::fmt`]: https://doc.rust-lang.org/std/fmt/index.html + pub fn format(&mut self, format: F) -> &mut Self + where + F: Fn(&mut Formatter, &Record<'_>) -> io::Result<()> + Sync + Send + 'static, + { + self.format.custom_format = Some(Box::new(format)); + self + } + + /// Use the default format. + /// + /// This method will clear any custom format set on the builder. + pub fn default_format(&mut self) -> &mut Self { + self.format = Default::default(); + self + } + + /// Whether or not to write the level in the default format. + pub fn format_level(&mut self, write: bool) -> &mut Self { + self.format.default_format.level(write); + self + } + + /// Whether or not to write the source file path in the default format. + pub fn format_file(&mut self, write: bool) -> &mut Self { + self.format.default_format.file(write); + self + } + + /// Whether or not to write the source line number path in the default format. + /// + /// Only has effect if `format_file` is also enabled + pub fn format_line_number(&mut self, write: bool) -> &mut Self { + self.format.default_format.line_number(write); + self + } + + /// Whether or not to write the source path and line number + /// + /// Equivalent to calling both `format_file` and `format_line_number` + /// with `true` + pub fn format_source_path(&mut self, write: bool) -> &mut Self { + self.format_file(write).format_line_number(write); + self + } + + /// Whether or not to write the module path in the default format. + pub fn format_module_path(&mut self, write: bool) -> &mut Self { + self.format.default_format.module_path(write); + self + } + + /// Whether or not to write the target in the default format. + pub fn format_target(&mut self, write: bool) -> &mut Self { + self.format.default_format.target(write); + self + } + + /// Configures the amount of spaces to use to indent multiline log records. + /// A value of `None` disables any kind of indentation. + pub fn format_indent(&mut self, indent: Option) -> &mut Self { + self.format.default_format.indent(indent); + self + } + + /// Configures if timestamp should be included and in what precision. + pub fn format_timestamp(&mut self, timestamp: Option) -> &mut Self { + self.format.default_format.timestamp(timestamp); + self + } + + /// Configures the timestamp to use second precision. + pub fn format_timestamp_secs(&mut self) -> &mut Self { + self.format_timestamp(Some(fmt::TimestampPrecision::Seconds)) + } + + /// Configures the timestamp to use millisecond precision. + pub fn format_timestamp_millis(&mut self) -> &mut Self { + self.format_timestamp(Some(fmt::TimestampPrecision::Millis)) + } + + /// Configures the timestamp to use microsecond precision. + pub fn format_timestamp_micros(&mut self) -> &mut Self { + self.format_timestamp(Some(fmt::TimestampPrecision::Micros)) + } + + /// Configures the timestamp to use nanosecond precision. + pub fn format_timestamp_nanos(&mut self) -> &mut Self { + self.format_timestamp(Some(fmt::TimestampPrecision::Nanos)) + } + + /// Configures the end of line suffix. + pub fn format_suffix(&mut self, suffix: &'static str) -> &mut Self { + self.format.default_format.suffix(suffix); + self + } + + /// Set the format for structured key/value pairs in the log record + /// + /// With the default format, this function is called for each record and should format + /// the structured key-value pairs as returned by [`log::Record::key_values`]. + /// + /// The format function is expected to output the string directly to the `Formatter` so that + /// implementations can use the [`std::fmt`] macros, similar to the main format function. + /// + /// The default format uses a space to separate each key-value pair, with an "=" between + /// the key and value. + #[cfg(feature = "kv")] + pub fn format_key_values(&mut self, format: F) -> &mut Self + where + F: Fn(&mut Formatter, &dyn log::kv::Source) -> io::Result<()> + Sync + Send + 'static, + { + self.format.default_format.key_values(format); + self + } + + /// Adds a directive to the filter for a specific module. + /// + /// # Examples + /// + /// Only include messages for info and above for logs in `path::to::module`: + /// + /// ``` + /// use midenc_log::Builder; + /// use log::LevelFilter; + /// + /// let mut builder = Builder::new(); + /// + /// builder.filter_module("path::to::module", LevelFilter::Info); + /// ``` + pub fn filter_module(&mut self, module: &str, level: LevelFilter) -> &mut Self { + self.filter.filter_module(module, level); + self + } + + /// Adds a directive to the filter for all modules. + /// + /// # Examples + /// + /// Only include messages for info and above for logs globally: + /// + /// ``` + /// use midenc_log::Builder; + /// use log::LevelFilter; + /// + /// let mut builder = Builder::new(); + /// + /// builder.filter_level(LevelFilter::Info); + /// ``` + pub fn filter_level(&mut self, level: LevelFilter) -> &mut Self { + self.filter.filter_level(level); + self + } + + /// Parses the directives string in the same form as the `MIDENC_TRACE` + /// environment variable. + /// + /// See the module documentation for more details. + pub fn parse_filters(&mut self, filters: &str) -> &mut Self { + self.filter.parse(filters); + self + } + + /// Parses a kv filter string from the `MIDENC_TRACE_FILTER` environment variable. + /// + /// See the module documentation for more details. + pub fn parse_kv_filters(&mut self, filters: &str) -> &mut Self { + for filter in filters.split(',').map(|f| f.trim()) { + let (filter, negated) = + filter.strip_prefix('-').map(|f| (f, true)).unwrap_or((filter, false)); + let (key, value) = filter + .split_once(':') + .expect("invalid kv filter spec: expected format is `key:value[,key2:value2,..]`"); + self.filter.filter_key_value(key, value, negated); + } + self + } + + /// Sets the target for the log output. + /// + /// Env logger can log to either stdout, stderr or a custom pipe. The default is stderr. + /// + /// The custom pipe can be used to send the log messages to a custom sink (for example a file). + /// Do note that direct writes to a file can become a bottleneck due to IO operation times. + /// + /// # Examples + /// + /// Write log message to `stdout`: + /// + /// ``` + /// use midenc_log::{Builder, Target}; + /// + /// let mut builder = Builder::new(); + /// + /// builder.target(Target::Stdout); + /// ``` + pub fn target(&mut self, target: fmt::Target) -> &mut Self { + self.writer.target(target); + self + } + + /// Sets whether or not styles will be written. + /// + /// This can be useful in environments that don't support control characters + /// for setting colors. + /// + /// # Examples + /// + /// Never attempt to write styles: + /// + /// ``` + /// use midenc_log::{Builder, WriteStyle}; + /// + /// let mut builder = Builder::new(); + /// + /// builder.write_style(WriteStyle::Never); + /// ``` + pub fn write_style(&mut self, write_style: fmt::WriteStyle) -> &mut Self { + self.writer.write_style(write_style); + self + } + + /// Parses whether or not to write styles in the same form as the `MIDENC_LOG_STYLE` + /// environment variable. + /// + /// See the module documentation for more details. + pub fn parse_write_style(&mut self, write_style: &str) -> &mut Self { + self.writer.parse_write_style(write_style); + self + } + + /// Sets whether or not the logger will be used in unit tests. + /// + /// If `is_test` is `true` then the logger will allow the testing framework to + /// capture log records rather than printing them to the terminal directly. + pub fn is_test(&mut self, is_test: bool) -> &mut Self { + self.writer.is_test(is_test); + self + } + + /// Initializes the global logger with the built env logger. + /// + /// This should be called early in the execution of a Rust program. Any log + /// events that occur before initialization will be ignored. + /// + /// # Errors + /// + /// This function will fail if it is called more than once, or if another + /// library has already initialized a global logger. + pub fn try_init(&mut self) -> Result<(), SetLoggerError> { + let logger = self.build(); + + let max_level = logger.filter(); + let r = log::set_boxed_logger(Box::new(logger)); + + if r.is_ok() { + log::set_max_level(max_level); + } + + r + } + + /// Initializes the global logger with the built env logger. + /// + /// This should be called early in the execution of a Rust program. Any log + /// events that occur before initialization will be ignored. + /// + /// # Panics + /// + /// This function will panic if it is called more than once, or if another + /// library has already initialized a global logger. + pub fn init(&mut self) { + self.try_init() + .expect("Builder::init should not be called after logger initialized"); + } + + /// Build an env logger. + /// + /// The returned logger implements the `Log` trait and can be installed manually + /// or nested within another logger. + pub fn build(&mut self) -> Logger { + assert!(!self.built, "attempt to re-use consumed builder"); + self.built = true; + + Logger { + writer: self.writer.build(), + filter: self.filter.build(), + format: self.format.build(), + } + } +} + +impl std::fmt::Debug for Builder { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + if self.built { + f.debug_struct("Logger").field("built", &true).finish() + } else { + f.debug_struct("Logger") + .field("filter", &self.filter) + .field("writer", &self.writer) + .finish() + } + } +} + +/// The env logger. +/// +/// This struct implements the `Log` trait from the [`log` crate][log-crate-url], +/// which allows it to act as a logger. +/// +/// The [`init()`], [`try_init()`], [`Builder::init()`] and [`Builder::try_init()`] +/// methods will each construct a `Logger` and immediately initialize it as the +/// default global logger. +/// +/// If you'd instead need access to the constructed `Logger`, you can use +/// the associated [`Builder`] and install it with the +/// [`log` crate][log-crate-url] directly. +/// +/// [log-crate-url]: https://docs.rs/log +/// [`init()`]: fn.init.html +/// [`try_init()`]: fn.try_init.html +/// [`Builder::init()`]: struct.Builder.html#method.init +/// [`Builder::try_init()`]: struct.Builder.html#method.try_init +/// [`Builder`]: struct.Builder.html +pub struct Logger { + writer: Writer, + filter: crate::filter::Filter, + format: FormatFn, +} + +impl Logger { + /// Creates the logger from the environment. + /// + /// The variables used to read configuration from can be tweaked before + /// passing in. + /// + /// # Examples + /// + /// Create a logger reading the log filter from an environment variable + /// called `MY_LOG`: + /// + /// ``` + /// use midenc_log::Logger; + /// + /// let logger = Logger::from_env("MY_LOG"); + /// ``` + /// + /// Create a logger using the `MY_LOG` variable for filtering and + /// `MY_LOG_STYLE` for whether or not to write styles: + /// + /// ``` + /// use midenc_log::{Logger, Env}; + /// + /// let env = Env::new().filter_or("MY_LOG", "info").write_style_or("MY_LOG_STYLE", "always"); + /// + /// let logger = Logger::from_env(env); + /// ``` + pub fn from_env<'a, E>(env: E) -> Self + where + E: Into>, + { + Builder::from_env(env).build() + } + + /// Creates the logger from the environment using default variable names. + /// + /// This method is a convenient way to call `from_env(Env::default())` without + /// having to use the `Env` type explicitly. The logger will use the + /// [default environment variables]. + /// + /// # Examples + /// + /// Creates a logger using the default environment variables: + /// + /// ``` + /// use midenc_log::Logger; + /// + /// let logger = Logger::from_default_env(); + /// ``` + /// + /// [default environment variables]: struct.Env.html#default-environment-variables + pub fn from_default_env() -> Self { + Builder::from_default_env().build() + } + + /// Returns the maximum `LevelFilter` that this env logger instance is + /// configured to output. + pub fn filter(&self) -> LevelFilter { + self.filter.filter() + } + + /// Checks if this record matches the configured filter. + pub fn matches(&self, record: &Record<'_>) -> bool { + self.filter.matches(record) + } +} + +impl Log for Logger { + fn enabled(&self, metadata: &Metadata<'_>) -> bool { + self.filter.enabled(metadata) + } + + fn log(&self, record: &Record<'_>) { + if self.matches(record) { + // Log records are written to a thread-local buffer before being printed + // to the terminal. We clear these buffers afterwards, but they aren't shrunk + // so will always at least have capacity for the largest log record formatted + // on that thread. + // + // If multiple `Logger`s are used by the same threads then the thread-local + // formatter might have different color support. If this is the case the + // formatter and its buffer are discarded and recreated. + + thread_local! { + static FORMATTER: RefCell> = const { RefCell::new(None) }; + } + + let print = |formatter: &mut Formatter, record: &Record<'_>| { + let _ = self + .format + .format(formatter, record) + .and_then(|_| formatter.print(&self.writer)); + + // Always clear the buffer afterwards + formatter.clear(); + }; + + let printed = FORMATTER + .try_with(|tl_buf| { + if let Ok(mut tl_buf) = tl_buf.try_borrow_mut() { + // There are no active borrows of the buffer + if let Some(ref mut formatter) = *tl_buf { + // We have a previously set formatter + + // Check the buffer style. If it's different from the logger's + // style then drop the buffer and recreate it. + if formatter.write_style() != self.writer.write_style() { + *formatter = Formatter::new(&self.writer); + } + + print(formatter, record); + } else { + // We don't have a previously set formatter + let mut formatter = Formatter::new(&self.writer); + print(&mut formatter, record); + + *tl_buf = Some(formatter); + } + } else { + // There's already an active borrow of the buffer (due to re-entrancy) + print(&mut Formatter::new(&self.writer), record); + } + }) + .is_ok(); + + if !printed { + // The thread-local storage was not available (because its + // destructor has already run). Create a new single-use + // Formatter on the stack for this call. + print(&mut Formatter::new(&self.writer), record); + } + } + } + + fn flush(&self) {} +} + +impl std::fmt::Debug for Logger { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Logger").field("filter", &self.filter).finish() + } +} + +/// Set of environment variables to configure from. +/// +/// # Default environment variables +/// +/// By default, the `Env` will read the following environment variables: +/// +/// - `MIDENC_TRACE`: the level filter +/// - `MIDENC_TRACE_FILTER`: a key-value filter to apply +/// - `MIDENC_TRACE_STYLE`: whether or not to print styles with records. +/// +/// These sources can be configured using the builder methods on `Env`. +#[derive(Debug)] +pub struct Env<'a> { + filter: Var<'a>, + kv_filter: Var<'a>, + write_style: Var<'a>, +} + +impl<'a> Env<'a> { + /// Get a default set of environment variables. + pub fn new() -> Self { + Self::default() + } + + /// Specify an environment variable to read the filter from. + pub fn filter(mut self, filter_env: E) -> Self + where + E: Into>, + { + self.filter = Var::new(filter_env); + + self + } + + /// Specify an environment variable to read the filter from. + /// + /// If the variable is not set, the default value will be used. + pub fn filter_or(mut self, filter_env: E, default: V) -> Self + where + E: Into>, + V: Into>, + { + self.filter = Var::new_with_default(filter_env, default); + + self + } + + /// Use the default environment variable to read the filter from. + /// + /// If the variable is not set, the default value will be used. + pub fn default_filter_or(mut self, default: V) -> Self + where + V: Into>, + { + self.filter = Var::new_with_default(DEFAULT_FILTER_ENV, default); + + self + } + + fn get_filter(&self) -> Option { + self.filter.get() + } + + fn get_kv_filter(&self) -> Option { + self.kv_filter.get() + } + + /// Specify an environment variable to read the style from. + pub fn write_style(mut self, write_style_env: E) -> Self + where + E: Into>, + { + self.write_style = Var::new(write_style_env); + + self + } + + /// Specify an environment variable to read the style from. + /// + /// If the variable is not set, the default value will be used. + pub fn write_style_or(mut self, write_style_env: E, default: V) -> Self + where + E: Into>, + V: Into>, + { + self.write_style = Var::new_with_default(write_style_env, default); + + self + } + + /// Use the default environment variable to read the style from. + /// + /// If the variable is not set, the default value will be used. + pub fn default_write_style_or(mut self, default: V) -> Self + where + V: Into>, + { + self.write_style = Var::new_with_default(DEFAULT_WRITE_STYLE_ENV, default); + + self + } + + fn get_write_style(&self) -> Option { + self.write_style.get() + } +} + +impl<'a, T> From for Env<'a> +where + T: Into>, +{ + fn from(filter_env: T) -> Self { + Env::default().filter(filter_env.into()) + } +} + +impl Default for Env<'_> { + fn default() -> Self { + Env { + filter: Var::new(DEFAULT_FILTER_ENV), + kv_filter: Var::new(DEFAULT_KV_FILTER_ENV), + write_style: Var::new(DEFAULT_WRITE_STYLE_ENV), + } + } +} + +#[derive(Debug)] +struct Var<'a> { + name: Cow<'a, str>, + default: Option>, +} + +impl<'a> Var<'a> { + fn new(name: E) -> Self + where + E: Into>, + { + Var { + name: name.into(), + default: None, + } + } + + fn new_with_default(name: E, default: V) -> Self + where + E: Into>, + V: Into>, + { + Var { + name: name.into(), + default: Some(default.into()), + } + } + + fn get(&self) -> Option { + env::var(&*self.name) + .ok() + .or_else(|| self.default.clone().map(|v| v.into_owned())) + } +} + +/// Attempts to initialize the global logger with an env logger. +/// +/// This should be called early in the execution of a Rust program. Any log +/// events that occur before initialization will be ignored. +/// +/// # Errors +/// +/// This function will fail if it is called more than once, or if another +/// library has already initialized a global logger. +pub fn try_init() -> Result<(), SetLoggerError> { + try_init_from_env(Env::default()) +} + +/// Initializes the global logger with an env logger. +/// +/// This should be called early in the execution of a Rust program. Any log +/// events that occur before initialization will be ignored. +/// +/// # Panics +/// +/// This function will panic if it is called more than once, or if another +/// library has already initialized a global logger. +pub fn init() { + try_init().expect("midenc_log::init should not be called after logger initialized"); +} + +/// Attempts to initialize the global logger with an env logger from the given +/// environment variables. +/// +/// This should be called early in the execution of a Rust program. Any log +/// events that occur before initialization will be ignored. +/// +/// # Examples +/// +/// Initialise a logger using the `MY_LOG` environment variable for filters +/// and `MY_LOG_STYLE` for writing colors: +/// +/// ``` +/// use midenc_log::{Builder, Env}; +/// +/// # fn run() -> Result<(), Box> { +/// let env = Env::new().filter("MY_LOG").write_style("MY_LOG_STYLE"); +/// +/// midenc_log::try_init_from_env(env)?; +/// +/// Ok(()) +/// # } +/// # run().unwrap(); +/// ``` +/// +/// # Errors +/// +/// This function will fail if it is called more than once, or if another +/// library has already initialized a global logger. +pub fn try_init_from_env<'a, E>(env: E) -> Result<(), SetLoggerError> +where + E: Into>, +{ + let mut builder = Builder::from_env(env); + + builder.try_init() +} + +/// Initializes the global logger with an env logger from the given environment +/// variables. +/// +/// This should be called early in the execution of a Rust program. Any log +/// events that occur before initialization will be ignored. +/// +/// # Examples +/// +/// Initialise a logger using the `MY_LOG` environment variable for filters +/// and `MY_LOG_STYLE` for writing colors: +/// +/// ``` +/// use midenc_log::{Builder, Env}; +/// +/// let env = Env::new().filter("MY_LOG").write_style("MY_LOG_STYLE"); +/// +/// midenc_log::init_from_env(env); +/// ``` +/// +/// # Panics +/// +/// This function will panic if it is called more than once, or if another +/// library has already initialized a global logger. +pub fn init_from_env<'a, E>(env: E) +where + E: Into>, +{ + try_init_from_env(env) + .expect("midenc_log::init_from_env should not be called after logger initialized"); +} + +/// Create a new builder with the default environment variables. +/// +/// The builder can be configured before being initialized. +/// This is a convenient way of calling [`Builder::from_default_env`]. +/// +/// [`Builder::from_default_env`]: struct.Builder.html#method.from_default_env +pub fn builder() -> Builder { + Builder::from_default_env() +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn env_get_filter_reads_from_var_if_set() { + unsafe { + env::set_var("env_get_filter_reads_from_var_if_set", "from var"); + } + + let env = Env::new().filter_or("env_get_filter_reads_from_var_if_set", "from default"); + + assert_eq!(Some("from var".to_owned()), env.get_filter()); + } + + #[test] + fn env_get_filter_reads_from_default_if_var_not_set() { + unsafe { + env::remove_var("env_get_filter_reads_from_default_if_var_not_set"); + } + + let env = Env::new() + .filter_or("env_get_filter_reads_from_default_if_var_not_set", "from default"); + + assert_eq!(Some("from default".to_owned()), env.get_filter()); + } + + #[test] + fn env_get_write_style_reads_from_var_if_set() { + unsafe { + env::set_var("env_get_write_style_reads_from_var_if_set", "from var"); + } + + let env = + Env::new().write_style_or("env_get_write_style_reads_from_var_if_set", "from default"); + + assert_eq!(Some("from var".to_owned()), env.get_write_style()); + } + + #[test] + fn env_get_write_style_reads_from_default_if_var_not_set() { + unsafe { + env::remove_var("env_get_write_style_reads_from_default_if_var_not_set"); + } + + let env = Env::new().write_style_or( + "env_get_write_style_reads_from_default_if_var_not_set", + "from default", + ); + + assert_eq!(Some("from default".to_owned()), env.get_write_style()); + } + + #[test] + fn builder_parse_env_overrides_existing_filters() { + unsafe { + env::set_var("builder_parse_default_env_overrides_existing_filters", "debug"); + } + let env = Env::new().filter("builder_parse_default_env_overrides_existing_filters"); + + let mut builder = Builder::new(); + builder.filter_level(LevelFilter::Trace); + // Overrides global level to debug + builder.parse_env(env); + + assert_eq!(builder.filter.build().filter(), LevelFilter::Debug); + } +} diff --git a/midenc-log/src/writer/buffer.rs b/midenc-log/src/writer/buffer.rs new file mode 100644 index 000000000..f2661eea9 --- /dev/null +++ b/midenc-log/src/writer/buffer.rs @@ -0,0 +1,175 @@ +use std::{io, sync::Mutex}; + +use crate::writer::WriteStyle; + +#[derive(Debug)] +pub(crate) struct BufferWriter { + target: WritableTarget, + write_style: WriteStyle, +} + +impl BufferWriter { + pub(crate) fn stderr(is_test: bool, write_style: WriteStyle) -> Self { + BufferWriter { + target: if is_test { + WritableTarget::PrintStderr + } else { + WritableTarget::WriteStderr + }, + write_style, + } + } + + pub(crate) fn stdout(is_test: bool, write_style: WriteStyle) -> Self { + BufferWriter { + target: if is_test { + WritableTarget::PrintStdout + } else { + WritableTarget::WriteStdout + }, + write_style, + } + } + + pub(crate) fn pipe( + pipe: Box>, + write_style: WriteStyle, + ) -> Self { + BufferWriter { + target: WritableTarget::Pipe(pipe), + write_style, + } + } + + pub(crate) fn write_style(&self) -> WriteStyle { + self.write_style + } + + pub(crate) fn buffer(&self) -> Buffer { + Buffer(Vec::new()) + } + + pub(crate) fn print(&self, buf: &Buffer) -> io::Result<()> { + #![allow(clippy::print_stdout)] // enabled for tests only + #![allow(clippy::print_stderr)] // enabled for tests only + + use std::io::Write as _; + + let buf = buf.as_bytes(); + match &self.target { + WritableTarget::WriteStdout => { + let stream = io::stdout(); + #[cfg(feature = "color")] + let stream = anstream::AutoStream::new(stream, self.write_style.into()); + let mut stream = stream.lock(); + stream.write_all(buf)?; + stream.flush()?; + } + WritableTarget::PrintStdout => { + #[cfg(feature = "color")] + let buf = adapt(buf, self.write_style)?; + #[cfg(feature = "color")] + let buf = &buf; + let buf = String::from_utf8_lossy(buf); + print!("{buf}"); + } + WritableTarget::WriteStderr => { + let stream = io::stderr(); + #[cfg(feature = "color")] + let stream = anstream::AutoStream::new(stream, self.write_style.into()); + let mut stream = stream.lock(); + stream.write_all(buf)?; + stream.flush()?; + } + WritableTarget::PrintStderr => { + #[cfg(feature = "color")] + let buf = adapt(buf, self.write_style)?; + #[cfg(feature = "color")] + let buf = &buf; + let buf = String::from_utf8_lossy(buf); + eprint!("{buf}"); + } + WritableTarget::Pipe(pipe) => { + #[cfg(feature = "color")] + let buf = adapt(buf, self.write_style)?; + #[cfg(feature = "color")] + let buf = &buf; + let mut stream = pipe.lock().expect("no panics while held"); + stream.write_all(buf)?; + stream.flush()?; + } + } + + Ok(()) + } +} + +#[cfg(feature = "color")] +fn adapt(buf: &[u8], write_style: WriteStyle) -> io::Result> { + use std::io::Write as _; + + let adapted = Vec::with_capacity(buf.len()); + let mut stream = anstream::AutoStream::new(adapted, write_style.into()); + stream.write_all(buf)?; + let adapted = stream.into_inner(); + Ok(adapted) +} + +pub(crate) struct Buffer(Vec); + +impl Buffer { + pub(crate) fn clear(&mut self) { + self.0.clear(); + } + + pub(crate) fn write(&mut self, buf: &[u8]) -> io::Result { + self.0.extend(buf); + Ok(buf.len()) + } + + pub(crate) fn flush(&mut self) -> io::Result<()> { + Ok(()) + } + + pub(crate) fn as_bytes(&self) -> &[u8] { + &self.0 + } +} + +impl std::fmt::Debug for Buffer { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + String::from_utf8_lossy(self.as_bytes()).fmt(f) + } +} + +/// Log target, either `stdout`, `stderr` or a custom pipe. +/// +/// Same as `Target`, except the pipe is wrapped in a mutex for interior mutability. +pub(crate) enum WritableTarget { + /// Logs will be written to standard output. + WriteStdout, + /// Logs will be printed to standard output. + PrintStdout, + /// Logs will be written to standard error. + WriteStderr, + /// Logs will be printed to standard error. + PrintStderr, + /// Logs will be sent to a custom pipe. + Pipe(Box>), +} + +impl std::fmt::Debug for WritableTarget { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + f, + "{}", + match self { + Self::WriteStdout => "stdout", + Self::PrintStdout => "stdout", + Self::WriteStderr => "stderr", + Self::PrintStderr => "stderr", + Self::Pipe(_) => "pipe", + } + ) + } +} diff --git a/midenc-log/src/writer/mod.rs b/midenc-log/src/writer/mod.rs new file mode 100644 index 000000000..86325fff6 --- /dev/null +++ b/midenc-log/src/writer/mod.rs @@ -0,0 +1,188 @@ +mod buffer; +mod target; + +use std::{io, mem, sync::Mutex}; + +pub(crate) use buffer::Buffer; +use buffer::BufferWriter; +pub use target::Target; + +/// Whether or not to print styles to the target. +#[allow(clippy::exhaustive_enums)] // By definition don't need more +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Default)] +pub enum WriteStyle { + /// Try to print styles, but don't force the issue. + #[default] + Auto, + /// Try very hard to print styles. + Always, + /// Never print styles. + Never, +} + +#[cfg(feature = "color")] +impl From for WriteStyle { + fn from(choice: anstream::ColorChoice) -> Self { + match choice { + anstream::ColorChoice::Auto => Self::Auto, + anstream::ColorChoice::Always => Self::Always, + anstream::ColorChoice::AlwaysAnsi => Self::Always, + anstream::ColorChoice::Never => Self::Never, + } + } +} + +#[cfg(feature = "color")] +impl From for anstream::ColorChoice { + fn from(choice: WriteStyle) -> Self { + match choice { + WriteStyle::Auto => anstream::ColorChoice::Auto, + WriteStyle::Always => anstream::ColorChoice::Always, + WriteStyle::Never => anstream::ColorChoice::Never, + } + } +} + +/// A terminal target with color awareness. +#[derive(Debug)] +pub(crate) struct Writer { + inner: BufferWriter, +} + +impl Writer { + pub(crate) fn write_style(&self) -> WriteStyle { + self.inner.write_style() + } + + pub(crate) fn buffer(&self) -> Buffer { + self.inner.buffer() + } + + pub(crate) fn print(&self, buf: &Buffer) -> io::Result<()> { + self.inner.print(buf) + } +} + +/// A builder for a terminal writer. +/// +/// The target and style choice can be configured before building. +#[derive(Debug)] +pub(crate) struct Builder { + target: Target, + write_style: WriteStyle, + is_test: bool, + built: bool, +} + +impl Builder { + /// Initialize the writer builder with defaults. + pub(crate) fn new() -> Self { + Builder { + target: Default::default(), + write_style: Default::default(), + is_test: false, + built: false, + } + } + + /// Set the target to write to. + pub(crate) fn target(&mut self, target: Target) -> &mut Self { + self.target = target; + self + } + + /// Parses a style choice string. + /// + /// See the [Disabling colors] section for more details. + /// + /// [Disabling colors]: ../index.html#disabling-colors + pub(crate) fn parse_write_style(&mut self, write_style: &str) -> &mut Self { + self.write_style(parse_write_style(write_style)) + } + + /// Whether or not to print style characters when writing. + pub(crate) fn write_style(&mut self, write_style: WriteStyle) -> &mut Self { + self.write_style = write_style; + self + } + + /// Whether or not to capture logs for `cargo test`. + #[allow(clippy::wrong_self_convention)] + pub(crate) fn is_test(&mut self, is_test: bool) -> &mut Self { + self.is_test = is_test; + self + } + + /// Build a terminal writer. + pub(crate) fn build(&mut self) -> Writer { + assert!(!self.built, "attempt to re-use consumed builder"); + self.built = true; + + let color_choice = self.write_style; + #[cfg(feature = "auto-color")] + let color_choice = if color_choice == WriteStyle::Auto { + match &self.target { + Target::Stdout => anstream::AutoStream::choice(&io::stdout()).into(), + Target::Stderr => anstream::AutoStream::choice(&io::stderr()).into(), + Target::Pipe(_) => color_choice, + } + } else { + color_choice + }; + let color_choice = if color_choice == WriteStyle::Auto { + WriteStyle::Never + } else { + color_choice + }; + + let writer = match mem::take(&mut self.target) { + Target::Stdout => BufferWriter::stdout(self.is_test, color_choice), + Target::Stderr => BufferWriter::stderr(self.is_test, color_choice), + Target::Pipe(pipe) => BufferWriter::pipe(Box::new(Mutex::new(pipe)), color_choice), + }; + + Writer { inner: writer } + } +} + +impl Default for Builder { + fn default() -> Self { + Builder::new() + } +} + +fn parse_write_style(spec: &str) -> WriteStyle { + match spec { + "auto" => WriteStyle::Auto, + "always" => WriteStyle::Always, + "never" => WriteStyle::Never, + _ => Default::default(), + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn parse_write_style_valid() { + let inputs = vec![ + ("auto", WriteStyle::Auto), + ("always", WriteStyle::Always), + ("never", WriteStyle::Never), + ]; + + for (input, expected) in inputs { + assert_eq!(expected, parse_write_style(input)); + } + } + + #[test] + fn parse_write_style_invalid() { + let inputs = vec!["", "true", "false", "NEVER!!"]; + + for input in inputs { + assert_eq!(WriteStyle::Auto, parse_write_style(input)); + } + } +} diff --git a/midenc-log/src/writer/target.rs b/midenc-log/src/writer/target.rs new file mode 100644 index 000000000..a1220ffee --- /dev/null +++ b/midenc-log/src/writer/target.rs @@ -0,0 +1,26 @@ +/// Log target, either `stdout`, `stderr` or a custom pipe. +#[non_exhaustive] +#[derive(Default)] +pub enum Target { + /// Logs will be sent to standard output. + Stdout, + /// Logs will be sent to standard error. + #[default] + Stderr, + /// Logs will be sent to a custom pipe. + Pipe(Box), +} + +impl std::fmt::Debug for Target { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + f, + "{}", + match self { + Self::Stdout => "stdout", + Self::Stderr => "stderr", + Self::Pipe(_) => "pipe", + } + ) + } +} diff --git a/midenc-session/Cargo.toml b/midenc-session/Cargo.toml index b867f2874..f75011b91 100644 --- a/midenc-session/Cargo.toml +++ b/midenc-session/Cargo.toml @@ -21,7 +21,7 @@ std = [ "dep:clap", "anyhow/std", "miden-assembly/std", - "miden-lib/std", + "miden-protocol/std", ] [dependencies] @@ -31,13 +31,14 @@ inventory.workspace = true log.workspace = true miden-assembly.workspace = true miden-assembly-syntax.workspace = true +miden-core-lib.workspace = true miden-core.workspace = true miden-debug-types.workspace = true miden-mast-package.workspace = true -miden-stdlib.workspace = true midenc-hir-symbol.workspace = true midenc-hir-macros.workspace = true -miden-lib.workspace = true +miden-protocol.workspace = true +smallvec.workspace = true parking_lot = { workspace = true, optional = true } termcolor = { version = "1.4.1", optional = true } thiserror.workspace = true diff --git a/midenc-session/src/emit.rs b/midenc-session/src/emit.rs index c13b23681..27f395eb5 100644 --- a/midenc-session/src/emit.rs +++ b/midenc-session/src/emit.rs @@ -283,10 +283,8 @@ impl Emit for miden_assembly::Library { } fn output_type(&self, mode: OutputMode) -> OutputType { - match mode { - OutputMode::Text => OutputType::Mast, - OutputMode::Binary => OutputType::Masl, - } + let _ = mode; + OutputType::Mast } fn write_to( @@ -364,10 +362,8 @@ impl Emit for miden_core::Program { } fn output_type(&self, mode: OutputMode) -> OutputType { - match mode { - OutputMode::Text => OutputType::Mast, - OutputMode::Binary => OutputType::Masl, - } + let _ = mode; + OutputType::Mast } fn write_to( @@ -462,20 +458,26 @@ impl Emit for MastArtifact { } fn output_type(&self, mode: OutputMode) -> OutputType { - match mode { - OutputMode::Text => OutputType::Mast, - OutputMode::Binary => OutputType::Masl, - } + let _ = mode; + OutputType::Mast } fn write_to( &self, mut writer: W, - _mode: OutputMode, - _session: &Session, + mode: OutputMode, + session: &Session, ) -> anyhow::Result<()> { - let mut writer = ByteWriterAdapter(&mut writer); - self.write_into(&mut writer); - Ok(()) + match mode { + OutputMode::Text => match self { + MastArtifact::Executable(program) => program.write_to(writer, mode, session), + MastArtifact::Library(lib) => lib.write_to(writer, mode, session), + }, + OutputMode::Binary => { + let mut writer = ByteWriterAdapter(&mut writer); + self.write_into(&mut writer); + Ok(()) + } + } } } diff --git a/midenc-session/src/lib.rs b/midenc-session/src/lib.rs index 0015f0579..5d0b7dfba 100644 --- a/midenc-session/src/lib.rs +++ b/midenc-session/src/lib.rs @@ -51,7 +51,7 @@ pub use self::{ flags::{ArgMatches, CompileFlag, CompileFlags, FlagAction}, inputs::{FileName, FileType, InputFile, InputType, InvalidInputError}, libs::{ - LibraryKind, LibraryNamespace, LibraryPath, LibraryPathComponent, LinkLibrary, STDLIB, + LibraryKind, LibraryPath, LibraryPathComponent, LinkLibrary, STDLIB, add_target_link_libraries, }, options::*, @@ -304,7 +304,7 @@ impl Session { /// Get the [OutputFile] to write the assembled MAST output to pub fn out_file(&self) -> OutputFile { - let out_file = self.output_files.output_file(OutputType::Masl, None); + let out_file = self.output_files.output_file(OutputType::Masp, None); if let OutputFile::Real(ref path) = out_file { self.check_file_is_writeable(path); @@ -373,6 +373,11 @@ impl Session { || self.options.print_ir_after_pass.iter().any(|p| p == pass) } + /// Returns true if IR should be printed to stdout, at the start of `stage` + pub fn should_print_ir_before_stage(&self, stage: &str) -> bool { + self.options.print_ir_before_stage.iter().any(|s| s == stage) + } + /// Returns true if CFG should be printed to stdout, after executing a pass named `pass` pub fn should_print_cfg(&self, pass: &str) -> bool { self.options.print_cfg_after_all @@ -393,6 +398,9 @@ impl Session { if self.should_emit(ty) { match self.output_files.output_file(ty, name.map(|n| n.as_str())) { OutputFile::Real(path) => Some(path), + OutputFile::Directory(_) => { + unreachable!("OutputFiles::output_file never returns OutputFile::Directory") + } OutputFile::Stdout => None, } } else { @@ -410,6 +418,9 @@ impl Session { OutputFile::Real(path) => { item.write_to_file(&path, mode, self)?; } + OutputFile::Directory(_) => { + unreachable!("OutputFiles::output_file never returns OutputFile::Directory") + } OutputFile::Stdout => { let stdout = std::io::stdout().lock(); item.write_to(stdout, mode, self)?; diff --git a/midenc-session/src/libs.rs b/midenc-session/src/libs.rs index 3d9011ce8..803b08ea5 100644 --- a/midenc-session/src/libs.rs +++ b/midenc-session/src/libs.rs @@ -6,22 +6,19 @@ use alloc::{boxed::Box, string::ToString}; use core::fmt; pub use miden_assembly_syntax::{ - Library as CompiledLibrary, LibraryNamespace, LibraryPath, LibraryPathComponent, + Library as CompiledLibrary, PathBuf as LibraryPath, PathComponent as LibraryPathComponent, }; #[cfg(feature = "std")] use miden_core::utils::Deserializable; -use miden_stdlib::StdLibrary; +use miden_core_lib::CoreLibrary; use midenc_hir_symbol::sync::LazyLock; #[cfg(feature = "std")] -use crate::{ - Path, - diagnostics::{IntoDiagnostic, WrapErr}, -}; +use crate::{Path, diagnostics::IntoDiagnostic}; use crate::{PathBuf, Session, TargetEnv, diagnostics::Report}; pub static STDLIB: LazyLock> = - LazyLock::new(|| Arc::new(StdLibrary::default().into())); + LazyLock::new(|| Arc::new(CoreLibrary::default().into())); /// The types of libraries that can be linked against during compilation #[derive(Default, Debug, Copy, Clone, PartialEq, Eq, Hash)] @@ -98,7 +95,7 @@ impl LinkLibrary { // Handle libraries shipped with the compiler, or via Miden crates match self.name.as_ref() { "std" => Ok((*STDLIB).as_ref().clone()), - "base" => Ok(miden_lib::MidenLib::default().as_ref().clone()), + "base" => Ok(miden_protocol::ProtocolLib::default().as_ref().clone()), name => Err(Report::msg(format!( "link library '{name}' cannot be loaded: compiler was built without standard \ library" @@ -115,7 +112,7 @@ impl LinkLibrary { // Handle libraries shipped with the compiler, or via Miden crates match self.name.as_ref() { "std" => return Ok((*STDLIB).as_ref().clone()), - "base" => return Ok(miden_lib::MidenLib::default().as_ref().clone()), + "base" => return Ok(miden_protocol::ProtocolLib::default().as_ref().clone()), _ => (), } @@ -129,12 +126,14 @@ impl LinkLibrary { fn load_from_path(&self, path: &Path, session: &Session) -> Result { match self.kind { LibraryKind::Masm => { - let ns = LibraryNamespace::new(&self.name) - .into_diagnostic() - .wrap_err_with(|| format!("invalid library namespace '{}'", &self.name))?; + let ns = miden_assembly_syntax::Path::validate(&self.name).map_err(|err| { + Report::msg(format!( + "invalid library namespace '{}': {err}", + self.name.as_ref() + )) + })?; miden_assembly::Assembler::new(session.source_manager.clone()) - .with_debug_mode(true) .assemble_library_from_dir(path, ns) } LibraryKind::Mast => CompiledLibrary::deserialize_from_file(path).map_err(|err| { diff --git a/midenc-session/src/options/mod.rs b/midenc-session/src/options/mod.rs index 62c915aab..5ae428547 100644 --- a/midenc-session/src/options/mod.rs +++ b/midenc-session/src/options/mod.rs @@ -1,5 +1,8 @@ +mod printing; + use alloc::{fmt, str::FromStr, string::String, sync::Arc, vec, vec::Vec}; +pub use self::printing::IrFilter; #[cfg(feature = "std")] use crate::Path; use crate::{ @@ -52,12 +55,16 @@ pub struct Options { pub print_cfg_after_all: bool, /// Print CFG to stdout each time the named passes are applied pub print_cfg_after_pass: Vec, + /// Print IR to stdout at the start of each stage + pub print_ir_before_stage: Vec, /// Print IR to stdout after each pass pub print_ir_after_all: bool, /// Print IR to stdout each time the named passes are applied pub print_ir_after_pass: Vec, /// Only print the IR if the pass modified the IR structure. pub print_ir_after_modified: bool, + /// Apply filters to what IR is printed, when printing is enabled + pub print_ir_filters: Vec, /// Save intermediate artifacts in memory during compilation pub save_temps: bool, /// We store any leftover argument matches in the session options for use @@ -132,9 +139,11 @@ impl Options { save_temps: false, print_cfg_after_all: false, print_cfg_after_pass: vec![], + print_ir_before_stage: vec![], print_ir_after_all: false, print_ir_after_pass: vec![], print_ir_after_modified: false, + print_ir_filters: vec![], flags: CompileFlags::default(), } } diff --git a/midenc-session/src/options/printing.rs b/midenc-session/src/options/printing.rs new file mode 100644 index 000000000..eedbbdde5 --- /dev/null +++ b/midenc-session/src/options/printing.rs @@ -0,0 +1,58 @@ +use alloc::{ + borrow::Cow, + format, + string::{String, ToString}, +}; +use core::str::FromStr; + +/// ColorChoice represents the color preferences of an end user. +/// +/// The `Default` implementation for this type will select `Auto`, which tries +/// to do the right thing based on the current environment. +/// +/// The `FromStr` implementation for this type converts a lowercase kebab-case +/// string of the variant name to the corresponding variant. Any other string +/// results in an error. +#[derive(Default, Debug, Clone, PartialEq, Eq)] +pub enum IrFilter { + /// Apply to any IR + #[default] + Any, + /// Apply to any operation that implements `Symbol`, optionally restricted with a specific + /// string that the name of the symbol must contain + Symbol(Option>), + /// Apply to a specific operation, given by its dialect and opcode + Op { + dialect: midenc_hir_symbol::Symbol, + op: midenc_hir_symbol::Symbol, + }, +} + +impl FromStr for IrFilter { + type Err = String; + + fn from_str(s: &str) -> Result { + match s.split_once(':') { + Some(("symbol", "" | "*")) => Ok(Self::Symbol(None)), + Some(("symbol", pattern)) => Ok(Self::Symbol(Some(pattern.to_string().into()))), + Some(("op", name)) => match name.split_once(".") { + Some((dialect, op)) => Ok(Self::Op { + dialect: midenc_hir_symbol::Symbol::intern(dialect), + op: midenc_hir_symbol::Symbol::intern(op), + }), + None => Err(format!( + "invalid operation name '{name}': must be dialect-qualified, e.g. \ + `dialect.{name}`" + )), + }, + Some((ty, _)) => { + Err(format!("unrecognized filter type '{ty}': expected `symbol` or `op`")) + } + None if s == "any" => Ok(Self::Any), + None => Err(format!( + "unrecognized filter '{s}': expected `symbol:`, \ + `op:.`, or `any`" + )), + } + } +} diff --git a/midenc-session/src/outputs.rs b/midenc-session/src/outputs.rs index b9e45138b..5744ebdae 100644 --- a/midenc-session/src/outputs.rs +++ b/midenc-session/src/outputs.rs @@ -6,8 +6,42 @@ use alloc::{ string::String, }; +use smallvec::SmallVec; + use crate::{Path, PathBuf}; +/// Escape `name` for use as a single filesystem path component (e.g. a file stem). +/// +/// This is used when emitting artifacts whose names may contain characters that are legal in +/// compiler/session identifiers, but are problematic (or even invalid) as filenames on common +/// filesystems. +fn escape_path_component(name: &str) -> Cow<'_, str> { + if name.is_empty() { + return Cow::Borrowed("_"); + } + + let is_safe = name != "." + && name != ".." + && name.chars().all(|ch| ch.is_ascii_alphanumeric() || matches!(ch, '_' | '-')); + if is_safe { + return Cow::Borrowed(name); + } + + let mut escaped = String::with_capacity(name.len()); + for ch in name.chars() { + if ch.is_ascii_alphanumeric() || matches!(ch, '_' | '-') { + escaped.push(ch); + } else { + escaped.push('_'); + } + } + + match escaped.as_str() { + "" | "." | ".." => Cow::Borrowed("_"), + _ => Cow::Owned(escaped), + } +} + /// The type of output to produce for a given [OutputType], when multiple options are available #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum OutputMode { @@ -23,14 +57,14 @@ pub enum OutputMode { pub enum OutputType { /// The compiler will emit the parse tree of the input, if applicable Ast, + /// The compiler will emit WebAssembly text format (WAT), if applicable + Wat, /// The compiler will emit Miden IR Hir, /// The compiler will emit Miden Assembly text Masm, /// The compiler will emit a Merkalized Abstract Syntax Tree in text form Mast, - /// The compiler will emit a MAST library in binary form - Masl, /// The compiler will emit a MAST package in binary form #[default] Masp, @@ -38,16 +72,16 @@ pub enum OutputType { impl OutputType { /// Returns true if this output type is an intermediate artifact produced during compilation pub fn is_intermediate(&self) -> bool { - !matches!(self, Self::Mast | Self::Masl | Self::Masp) + !matches!(self, Self::Mast | Self::Masp) } pub fn extension(&self) -> &'static str { match self { Self::Ast => "ast", + Self::Wat => "wat", Self::Hir => "hir", Self::Masm => "masm", Self::Mast => "mast", - Self::Masl => "masl", Self::Masp => "masp", } } @@ -56,33 +90,39 @@ impl OutputType { format!( "`{}`, `{}`, `{}`, `{}`, `{}`, `{}`", Self::Ast, + Self::Wat, Self::Hir, Self::Masm, Self::Mast, - Self::Masl, Self::Masp, ) } - pub fn all() -> [OutputType; 6] { - [ + pub const fn all() -> &'static [OutputType] { + &[ OutputType::Ast, + OutputType::Wat, OutputType::Hir, OutputType::Masm, OutputType::Mast, - OutputType::Masl, OutputType::Masp, ] } + + /// Returns the subset of [OutputType] values considered "intermediate" for convenience + /// emission (WAT, HIR, MASM). + pub const fn ir() -> &'static [OutputType] { + &[OutputType::Wat, OutputType::Hir, OutputType::Masm] + } } impl fmt::Display for OutputType { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { Self::Ast => f.write_str("ast"), + Self::Wat => f.write_str("wat"), Self::Hir => f.write_str("hir"), Self::Masm => f.write_str("masm"), Self::Mast => f.write_str("mast"), - Self::Masl => f.write_str("masl"), Self::Masp => f.write_str("masp"), } } @@ -93,10 +133,10 @@ impl FromStr for OutputType { fn from_str(s: &str) -> Result { match s { "ast" => Ok(Self::Ast), + "wat" => Ok(Self::Wat), "hir" => Ok(Self::Hir), "masm" => Ok(Self::Masm), "mast" => Ok(Self::Mast), - "masl" => Ok(Self::Masl), "masp" => Ok(Self::Masp), _ => Err(()), } @@ -106,12 +146,18 @@ impl FromStr for OutputType { #[derive(Debug, Clone)] pub enum OutputFile { Real(PathBuf), + /// A directory in which to place outputs. + /// + /// This is distinct from [OutputFile::Real] because callers may want a path to be treated as a + /// directory even if it does not exist yet. + Directory(PathBuf), Stdout, } impl OutputFile { pub fn parent(&self) -> Option<&Path> { match self { Self::Real(path) => path.parent(), + Self::Directory(path) => Some(path.as_ref()), Self::Stdout => None, } } @@ -119,6 +165,7 @@ impl OutputFile { pub fn filestem(&self) -> Option> { match self { Self::Real(path) => path.file_stem().map(|stem| stem.to_string_lossy()), + Self::Directory(_) => None, Self::Stdout => None, } } @@ -132,6 +179,7 @@ impl OutputFile { use std::io::IsTerminal; match self { Self::Real(_) => false, + Self::Directory(_) => false, Self::Stdout => std::io::stdout().is_terminal(), } } @@ -144,6 +192,7 @@ impl OutputFile { pub fn as_path(&self) -> Option<&Path> { match self { Self::Real(path) => Some(path.as_ref()), + Self::Directory(path) => Some(path.as_ref()), Self::Stdout => None, } } @@ -156,6 +205,15 @@ impl OutputFile { ) -> PathBuf { match self { Self::Real(path) => path.clone(), + Self::Directory(dir) => { + let dir = if dir.is_absolute() { + dir.clone() + } else { + outputs.cwd.join(dir) + }; + let stem = escape_path_component(name.unwrap_or(outputs.stem.as_str())); + dir.join(stem.as_ref()).with_extension(ty.extension()) + } Self::Stdout => outputs.temp_path(ty, name), } } @@ -164,6 +222,7 @@ impl fmt::Display for OutputFile { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::Real(path) => write!(f, "{}", path.display()), + Self::Directory(path) => write!(f, "{}", path.display()), Self::Stdout => write!(f, "stdout"), } } @@ -184,7 +243,7 @@ pub struct OutputFiles { pub out_dir: PathBuf, /// If specified, the specific path at which to write the compiler output. /// - /// This _only_ applies to the final output, i.e. the `.masl` library or executable. + /// This _only_ applies to the final output, e.g. the `.masp` package. pub out_file: Option, /// The raw output types requested by the user on the command line pub outputs: OutputTypes, @@ -211,41 +270,56 @@ impl OutputFiles { /// Return the [OutputFile] representing where an output of `ty` type should be written, /// with an optional `name`, which overrides the file stem of the resulting path. pub fn output_file(&self, ty: OutputType, name: Option<&str>) -> OutputFile { - let default_name = name.unwrap_or(self.stem.as_str()); - self.outputs - .get(&ty) - .and_then(|p| p.to_owned()) - .map(|of| match of { - OutputFile::Real(path) => OutputFile::Real({ - let path = if path.is_absolute() { - path - } else { - self.cwd.join(path) - }; - if path.is_dir() { - path.join(default_name).with_extension(ty.extension()) - } else if let Some(name) = name { - path.with_stem_and_extension(name, ty.extension()) + let requested = self.outputs.contains_key(&ty); + let default_name = escape_path_component(name.unwrap_or(self.stem.as_str())); + match self.outputs.get(&ty).and_then(|p| p.to_owned()) { + Some(OutputFile::Real(path)) => OutputFile::Real({ + let path = if path.is_absolute() { + path + } else { + self.cwd.join(path) + }; + if path.is_dir() { + path.join(default_name.as_ref()).with_extension(ty.extension()) + } else if let Some(name) = name { + let name = escape_path_component(name); + path.with_stem_and_extension(name.as_ref(), ty.extension()) + } else { + path + } + }), + Some(OutputFile::Directory(dir)) => OutputFile::Real({ + let dir = if dir.is_absolute() { + dir + } else { + self.cwd.join(dir) + }; + dir.join(default_name.as_ref()).with_extension(ty.extension()) + }), + Some(OutputFile::Stdout) => OutputFile::Stdout, + None => { + // If the user requested an output type without specifying a destination, default to + // the session output directory (i.e. the working directory by default). Only + // compiler-internal temporaries use `tmp_dir`. + let out = if ty.is_intermediate() { + if requested { + self.with_directory_and_extension(&self.out_dir, ty.extension()) } else { - path + self.with_directory_and_extension(&self.tmp_dir, ty.extension()) } - }), - out @ OutputFile::Stdout => out, - }) - .unwrap_or_else(|| { - let out = if ty.is_intermediate() { - self.with_directory_and_extension(&self.tmp_dir, ty.extension()) } else if let Some(output_file) = self.out_file.as_ref() { return output_file.clone(); } else { self.with_directory_and_extension(&self.out_dir, ty.extension()) }; OutputFile::Real(if let Some(name) = name { - out.with_stem(name) + let name = escape_path_component(name); + out.with_stem(name.as_ref()) } else { out }) - }) + } + } } /// Return the most appropriate file path for an output of `ty` type. @@ -256,6 +330,9 @@ impl OutputFiles { pub fn output_path(&self, ty: OutputType) -> PathBuf { match self.output_file(ty, None) { OutputFile::Real(path) => path, + OutputFile::Directory(_) => { + unreachable!("OutputFiles::output_file never returns OutputFile::Directory") + } OutputFile::Stdout => { if ty.is_intermediate() { self.with_directory_and_extension(&self.tmp_dir, ty.extension()) @@ -274,9 +351,8 @@ impl OutputFiles { /// /// The file path is always a child of `self.tmp_dir` pub fn temp_path(&self, ty: OutputType, name: Option<&str>) -> PathBuf { - self.tmp_dir - .join(name.unwrap_or(self.stem.as_str())) - .with_extension(ty.extension()) + let name = escape_path_component(name.unwrap_or(self.stem.as_str())); + self.tmp_dir.join(name.as_ref()).with_extension(ty.extension()) } /// Build a file path which is either: @@ -286,6 +362,14 @@ impl OutputFiles { pub fn with_extension(&self, extension: &str) -> PathBuf { match self.out_file.as_ref() { Some(OutputFile::Real(path)) => path.with_extension(extension), + Some(OutputFile::Directory(dir)) => { + let dir = if dir.is_absolute() { + dir.clone() + } else { + self.cwd.join(dir) + }; + self.with_directory_and_extension(&dir, extension) + } Some(OutputFile::Stdout) | None => { self.with_directory_and_extension(&self.out_dir, extension) } @@ -296,7 +380,8 @@ impl OutputFiles { /// `extension` #[inline] fn with_directory_and_extension(&self, directory: &Path, extension: &str) -> PathBuf { - directory.join(&self.stem).with_extension(extension) + let stem = escape_path_component(&self.stem); + directory.join(stem.as_ref()).with_extension(extension) } } @@ -316,21 +401,58 @@ impl OutputTypes { "--emit=all cannot be combined with other --emit types", )); } - if let Some(OutputFile::Real(path)) = &path - && path.extension().is_some() - { - return Err(clap::Error::raw( - clap::error::ErrorKind::ValueValidation, - "invalid path for --emit=all: must be a directory", - )); - } - for ty in OutputType::all() { + let path = match path { + None => None, + Some(OutputFile::Real(path)) => { + if path.extension().is_some() { + return Err(clap::Error::raw( + clap::error::ErrorKind::ValueValidation, + "invalid path for --emit=all: must be a directory", + )); + } + Some(OutputFile::Directory(path)) + } + Some(OutputFile::Directory(path)) => { + if path.extension().is_some() { + return Err(clap::Error::raw( + clap::error::ErrorKind::ValueValidation, + "invalid path for --emit=all: must be a directory", + )); + } + Some(OutputFile::Directory(path)) + } + Some(OutputFile::Stdout) => Some(OutputFile::Stdout), + }; + for &ty in OutputType::all() { map.insert(ty, path.clone()); } } + OutputTypeSpec::Subset { output_types, path } => { + // Emit a bundle of output types into the same destination. + for output_type in output_types { + match map.get(&output_type) { + // If the user already chose an explicit destination for this type, + // don't allow `ir`/`inter` to override it. + Some(Some(_)) => { + return Err(clap::Error::raw( + clap::error::ErrorKind::ValueValidation, + format!( + "conflicting --emit options given for output type \ + '{output_type}'" + ), + )); + } + _ => { + // If the user requested the type without a destination, or hasn't + // requested it at all yet, route it to the `ir` directory. + map.insert(output_type, path.clone()); + } + } + } + } OutputTypeSpec::Typed { output_type, path } => { if path.is_some() { - if matches!(map.get(&output_type), Some(Some(OutputFile::Real(_)))) { + if matches!(map.get(&output_type), Some(Some(_))) { return Err(clap::Error::raw( clap::error::ErrorKind::ValueValidation, format!( @@ -388,27 +510,18 @@ impl OutputTypes { pub fn should_link(&self) -> bool { self.0.keys().any(|k| { - matches!( - k, - OutputType::Hir - | OutputType::Masm - | OutputType::Mast - | OutputType::Masl - | OutputType::Masp - ) + matches!(k, OutputType::Hir | OutputType::Masm | OutputType::Mast | OutputType::Masp) }) } pub fn should_codegen(&self) -> bool { - self.0.keys().any(|k| { - matches!(k, OutputType::Masm | OutputType::Mast | OutputType::Masl | OutputType::Masp) - }) + self.0 + .keys() + .any(|k| matches!(k, OutputType::Masm | OutputType::Mast | OutputType::Masp)) } pub fn should_assemble(&self) -> bool { - self.0 - .keys() - .any(|k| matches!(k, OutputType::Mast | OutputType::Masl | OutputType::Masp)) + self.0.keys().any(|k| matches!(k, OutputType::Mast | OutputType::Masp)) } } @@ -418,6 +531,14 @@ pub enum OutputTypeSpec { All { path: Option, }, + /// Emit a set of output types to a common destination (typically a directory). + /// + /// This is primarily intended for shorthand specifications like `--emit=ir[=PATH]`, but can + /// represent any two-or-more output types with a shared destination. + Subset { + output_types: SmallVec<[OutputType; 3]>, + path: Option, + }, Typed { output_type: OutputType, path: Option, @@ -451,11 +572,12 @@ impl clap::builder::TypedValueParser for OutputTypeParser { Some(Box::new( [ PossibleValue::new("ast").help("Abstract Syntax Tree (text)"), + PossibleValue::new("wat").help("WebAssembly text format (text)"), PossibleValue::new("hir").help("High-level Intermediate Representation (text)"), PossibleValue::new("masm").help("Miden Assembly (text)"), PossibleValue::new("mast").help("Merkelized Abstract Syntax Tree (text)"), - PossibleValue::new("masl").help("Merkelized Abstract Syntax Tree (binary)"), PossibleValue::new("masp").help("Miden Assembly Package Format (binary)"), + PossibleValue::new("ir").help("WAT + HIR + MASM (text, optional directory)"), PossibleValue::new("all").help("All of the above"), ] .into_iter(), @@ -478,14 +600,36 @@ impl clap::builder::TypedValueParser for OutputTypeParser { Some((shorthand, path)) => (shorthand, Some(OutputFile::Real(PathBuf::from(path)))), }; if shorthand == "all" { + let path = match path { + None => None, + Some(OutputFile::Real(path)) => Some(OutputFile::Directory(path)), + Some(OutputFile::Stdout) => Some(OutputFile::Stdout), + Some(OutputFile::Directory(_)) => unreachable!("all path is parsed as real"), + }; return Ok(OutputTypeSpec::All { path }); } + if shorthand == "ir" { + let path = match path { + None => None, + Some(OutputFile::Real(path)) => Some(OutputFile::Directory(path)), + Some(OutputFile::Stdout) => { + return Err(Error::raw( + ErrorKind::InvalidValue, + format!("invalid output type: `{shorthand}=-` - expected `ir[=PATH]`"), + )); + } + Some(OutputFile::Directory(_)) => unreachable!("ir path is parsed as real"), + }; + let output_types = SmallVec::from_slice(OutputType::ir()); + return Ok(OutputTypeSpec::Subset { output_types, path }); + } let output_type = shorthand.parse::().map_err(|_| { Error::raw( ErrorKind::InvalidValue, format!( - "invalid output type: `{shorthand}` - expected one of: {display}", - display = OutputType::shorthand_display() + "invalid output type: `{shorthand}` - expected one of: {display}, `all`, \ + `ir[=PATH]`", + display = OutputType::shorthand_display(), ), ) })?; diff --git a/midenc/Cargo.toml b/midenc/Cargo.toml index 4bce0a691..a784338e1 100644 --- a/midenc/Cargo.toml +++ b/midenc/Cargo.toml @@ -14,6 +14,6 @@ readme.workspace = true edition.workspace = true [dependencies] -env_logger.workspace = true human-panic = "2.0" midenc-driver = { workspace = true, features = ["std"] } +midenc-log.workspace = true diff --git a/midenc/src/main.rs b/midenc/src/main.rs index 7797b72c1..e3ab365a1 100644 --- a/midenc/src/main.rs +++ b/midenc/src/main.rs @@ -11,7 +11,7 @@ pub fn main() -> Result<(), Report> { } // Initialize logger, but do not install it, leave that up to the command handler - let mut builder = env_logger::Builder::from_env("MIDENC_TRACE"); + let mut builder = midenc_log::Builder::from_env("MIDENC_TRACE"); builder.format_indent(Some(2)); if let Ok(precision) = env::var("MIDENC_TRACE_TIMING") { match precision.as_str() { diff --git a/sdk/.cargo/config.toml b/sdk/.cargo/config.toml index dc0be7321..6b509f5b7 100644 --- a/sdk/.cargo/config.toml +++ b/sdk/.cargo/config.toml @@ -1,2 +1,2 @@ [build] -target = "wasm32-wasip1" \ No newline at end of file +target = "wasm32-wasip1" diff --git a/sdk/README.md b/sdk/README.md index 134c0edfe..3e6cae2c3 100644 --- a/sdk/README.md +++ b/sdk/README.md @@ -6,7 +6,7 @@ The SDK is composed of the following crates: ## Miden Standard Library -The `miden-stdlib-sys` crate provides a `Felt` type that represents field element in the Miden VM and a standard library for developing Miden programs. +The `miden-stdlib-sys` crate provides low-level bindings for Miden standard library functionality, and re-exports the unified `Felt` type from the `miden-field` crate. See [README](stdlib-sys/README.md) diff --git a/sdk/alloc/Cargo.toml b/sdk/alloc/Cargo.toml index 5fd8fcd75..d39a450b7 100644 --- a/sdk/alloc/Cargo.toml +++ b/sdk/alloc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "miden-sdk-alloc" description = "A simple bump allocator for Miden SDK programs" -version = "0.8.0" +version = "0.10.0" rust-version.workspace = true authors.workspace = true repository.workspace = true diff --git a/sdk/base-macros/Cargo.toml b/sdk/base-macros/Cargo.toml index 186dbd5d1..f8b8f827a 100644 --- a/sdk/base-macros/Cargo.toml +++ b/sdk/base-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "miden-base-macros" description = "Provides proc macro support for Miden rollup SDK" -version = "0.8.0" +version = "0.10.0" rust-version.workspace = true authors.workspace = true repository.workspace = true @@ -17,7 +17,7 @@ proc-macro = true [dependencies] proc-macro2.workspace = true quote.workspace = true -miden-objects.workspace = true +miden-protocol.workspace = true semver.workspace = true toml.workspace = true syn.workspace = true @@ -27,4 +27,4 @@ wit-bindgen-rust = { version = "0.46", default-features = false } [dev-dependencies] # Use local paths for dev-only dependency to avoid relying on crates.io during packaging -miden-objects = { workspace = true, features = ["std"] } +miden-protocol = { workspace = true, features = ["std"] } diff --git a/sdk/base-macros/src/account_component_metadata.rs b/sdk/base-macros/src/account_component_metadata.rs index c81da9ead..7c5afe35d 100644 --- a/sdk/base-macros/src/account_component_metadata.rs +++ b/sdk/base-macros/src/account_component_metadata.rs @@ -1,11 +1,16 @@ use std::collections::BTreeSet; -use miden_objects::account::{ - AccountComponentMetadata, AccountType, MapRepresentation, StorageEntry, StorageValueName, - TemplateType, WordRepresentation, component::FieldIdentifier, +use miden_protocol::account::{ + AccountType, StorageSlotName, + component::{ + AccountComponentMetadata, MapSlotSchema, StorageSchema, StorageSlotSchema, ValueSlotSchema, + WordSchema, storage::SchemaTypeId, + }, }; use semver::Version; +use crate::{component_macro::typecheck_storage_field, types::StorageFieldType}; + pub struct AccountComponentMetadataBuilder { /// The human-readable name of the component. name: String, @@ -20,9 +25,8 @@ pub struct AccountComponentMetadataBuilder { /// A set of supported target account types for this component. supported_types: BTreeSet, - /// A list of storage entries defining the component's storage layout and initialization - /// values. - storage: Vec, + /// Storage schema entries defining the component's storage layout. + storage: Vec<(StorageSlotName, StorageSlotSchema)>, } impl AccountComponentMetadataBuilder { @@ -43,63 +47,61 @@ impl AccountComponentMetadataBuilder { pub fn add_storage_entry( &mut self, - name: &str, + slot_name: StorageSlotName, description: Option, - slot: u8, - field_type: &syn::Type, + field: &syn::Field, field_type_attr: Option, ) { - let type_path = if let syn::Type::Path(type_path) = field_type { - type_path - } else { - panic!("failed to get type path {field_type:?}") - }; - - if let Some(segment) = type_path.path.segments.last() { - let type_name = segment.ident.to_string(); - let storage_value_name = - StorageValueName::new(name).expect("well formed storage value name"); - match type_name.as_str() { - "StorageMap" => { - let mut map_repr = MapRepresentation::new_value(vec![], storage_value_name); - if let Some(description) = description { - map_repr = map_repr.with_description(description); - } - self.storage.push(StorageEntry::new_map(slot, map_repr)); - } - "Value" => { - let r#type = if let Some(field_type) = field_type_attr { - TemplateType::new(&field_type) - .unwrap_or_else(|_| panic!("well formed attribute type {field_type}")) - } else { - TemplateType::native_word() - }; - self.storage.push(StorageEntry::new_value( - slot, - WordRepresentation::Template { - r#type, - identifier: FieldIdentifier { - name: storage_value_name, - description, - }, - }, + match typecheck_storage_field(field) { + Ok(StorageFieldType::StorageMap) => { + if let Some(description) = description { + let key_schema = WordSchema::new_simple(SchemaTypeId::native_word()); + let value_schema = WordSchema::new_simple(SchemaTypeId::native_word()); + let slot_schema = StorageSlotSchema::Map(MapSlotSchema::new( + Some(description), + None, + key_schema, + value_schema, )); + self.storage.push((slot_name, slot_schema)); + } else { + let key_schema = WordSchema::new_simple(SchemaTypeId::native_word()); + let value_schema = WordSchema::new_simple(SchemaTypeId::native_word()); + let slot_schema = StorageSlotSchema::Map(MapSlotSchema::new( + None, + None, + key_schema, + value_schema, + )); + self.storage.push((slot_name, slot_schema)); } - _ => panic!("unexpected field type: {type_name}"), } - } else { - panic!("failed to get last segment of the type path {type_path:?}") + Ok(StorageFieldType::Value) => { + let r#type = if let Some(field_type) = field_type_attr.as_deref() { + SchemaTypeId::new(field_type) + .unwrap_or_else(|_| panic!("well formed attribute type {field_type}")) + } else { + SchemaTypeId::native_word() + }; + + let word_schema = WordSchema::new_simple(r#type); + let slot_schema = + StorageSlotSchema::Value(ValueSlotSchema::new(description, word_schema)); + self.storage.push((slot_name, slot_schema)); + } + Err(err) => panic!("invalid field type for storage: {err}"), } } pub fn build(self) -> AccountComponentMetadata { + let storage_schema = + StorageSchema::new(self.storage).expect("failed to build component storage schema"); AccountComponentMetadata::new( self.name, self.description, self.version, self.supported_types, - self.storage, + storage_schema, ) - .expect("failed to build AccountComponentMetadata") } } diff --git a/sdk/base-macros/src/component_macro/mod.rs b/sdk/base-macros/src/component_macro/mod.rs index f294d15b4..7cf9c22a7 100644 --- a/sdk/base-macros/src/component_macro/mod.rs +++ b/sdk/base-macros/src/component_macro/mod.rs @@ -5,7 +5,7 @@ use std::{ }; use heck::{ToKebabCase, ToSnakeCase}; -use miden_objects::{account::AccountType, utils::Serializable}; +use miden_protocol::{account::AccountType, utils::serde::Serializable}; use proc_macro::Span; use proc_macro2::{Ident, Literal, TokenStream as TokenStream2}; use quote::{format_ident, quote}; @@ -14,6 +14,7 @@ use syn::{ spanned::Spanned, }; +pub(crate) use crate::component_macro::storage::typecheck_storage_field; use crate::{ account_component_metadata::AccountComponentMetadataBuilder, boilerplate::runtime_boilerplate, @@ -142,7 +143,8 @@ fn expand_component_struct( let default_impl = match &mut input_struct.fields { syn::Fields::Named(fields) => { - let field_inits = process_storage_fields(fields, &mut acc_builder)?; + let storage_namespace = metadata.component_package.as_deref().unwrap_or(&metadata.name); + let field_inits = process_storage_fields(fields, &mut acc_builder, storage_namespace)?; generate_default_impl(struct_name, &field_inits) } syn::Fields::Unit => quote! { diff --git a/sdk/base-macros/src/component_macro/storage.rs b/sdk/base-macros/src/component_macro/storage.rs index bbb1eb484..b85d8a06a 100644 --- a/sdk/base-macros/src/component_macro/storage.rs +++ b/sdk/base-macros/src/component_macro/storage.rs @@ -1,11 +1,39 @@ +use std::collections::HashMap; + use quote::quote; -use syn::spanned::Spanned; +use syn::{Field, Type, spanned::Spanned}; + +use crate::{account_component_metadata::AccountComponentMetadataBuilder, types::StorageFieldType}; + +/// Normalizes a storage slot name component into a valid identifier-like segment. +/// +/// This is a lossy transformation: characters outside `[A-Za-z0-9_]` are replaced with `_`, and +/// empty/leading-underscore components are prefixed to avoid invalid identifiers. Callers should +/// ensure the resulting slot names remain unique. +fn sanitize_slot_name_component(component: &str) -> String { + let mut out: String = component + .chars() + .map(|c| { + if c.is_ascii_alphanumeric() || c == '_' { + c + } else { + '_' + } + }) + .collect(); -use crate::account_component_metadata::AccountComponentMetadataBuilder; + if out.is_empty() { + out.push('x'); + } + if out.starts_with('_') { + out.insert(0, 'x'); + } + + out +} /// Parsed arguments collected from a `#[storage(...)]` attribute. struct StorageAttributeArgs { - slot: u8, description: Option, type_attr: Option, } @@ -18,7 +46,6 @@ fn parse_storage_attribute( return Ok(None); } - let mut slot_value = None; let mut description_value = None; let mut type_value = None; @@ -29,11 +56,7 @@ fn parse_storage_attribute( let parser = syn::meta::parser(|meta| { if meta.path.is_ident("slot") { - let value_stream; - syn::parenthesized!(value_stream in meta.input); - let lit: syn::LitInt = value_stream.parse()?; - slot_value = Some(lit.base10_parse::()?); - Ok(()) + Err(meta.error("`slot(...)` is no longer supported; slots are derived from slot names")) } else if meta.path.is_ident("description") { let value = meta.value()?; let lit: syn::LitStr = value.parse()?; @@ -51,28 +74,43 @@ fn parse_storage_attribute( list.parse_args_with(parser)?; - let slot = slot_value.ok_or_else(|| { - syn::Error::new(attr.span(), "missing required `slot(N)` argument in `storage` attribute") - })?; - Ok(Some(StorageAttributeArgs { - slot, description: description_value, type_attr: type_value, })) } +/// Converts a [`miden_protocol::account::StorageSlotId`] into tokens that reconstruct it as a +/// constant expression. +fn slot_id_tokens(id: miden_protocol::account::StorageSlotId) -> proc_macro2::TokenStream { + let suffix = id.suffix().as_int(); + let prefix = id.prefix().as_int(); + quote! { + ::miden::StorageSlotId::new( + ::miden::Felt::from_u64_unchecked(#suffix), + ::miden::Felt::from_u64_unchecked(#prefix), + ) + } +} + /// Processes component struct fields, recording storage metadata and building default /// initializers. pub fn process_storage_fields( fields: &mut syn::FieldsNamed, builder: &mut AccountComponentMetadataBuilder, + storage_namespace: &str, ) -> Result, syn::Error> { - let mut field_inits = Vec::new(); + let mut field_infos = Vec::new(); let mut errors = Vec::new(); + let mut slot_names = HashMap::::new(); + let mut slot_ids = HashMap::<(u64, u64), String>::new(); for field in fields.named.iter_mut() { + if let Err(err) = typecheck_storage_field(field) { + errors.push(err); + } let field_name = field.ident.as_ref().expect("Named field must have an identifier"); + let field_name_str = field_name.to_string(); let field_type = &field.ty; let mut storage_args = None; let mut attr_indices_to_remove = Vec::new(); @@ -96,18 +134,47 @@ pub fn process_storage_fields( } if let Some(args) = storage_args { - let slot = args.slot; - field_inits.push(quote! { - #field_name: #field_type { slot: #slot } - }); - - builder.add_storage_entry( - &field_name.to_string(), - args.description, - args.slot, - field_type, - args.type_attr, - ); + // Slot names are part of the on-chain storage ABI: `StorageSlotId` values are derived + // from the slot name. Keep this format stable. + let namespace = sanitize_slot_name_component(storage_namespace); + let field_component = sanitize_slot_name_component(&field_name_str); + let slot_name_str = format!("miden::component::{namespace}::{field_component}"); + if let Some(existing_field) = slot_names.get(&slot_name_str) { + errors.push(syn::Error::new( + field.span(), + format!( + "storage slot name '{slot_name_str}' for field '{field_name_str}' \ + conflicts with field '{existing_field}'" + ), + )); + continue; + } + + let slot_name = miden_protocol::account::StorageSlotName::new(slot_name_str.clone()) + .map_err(|err| { + syn::Error::new( + field.span(), + format!("failed to construct storage slot name: {err}"), + ) + })?; + let slot_id = slot_name.id(); + let slot_id_key = (slot_id.suffix().as_int(), slot_id.prefix().as_int()); + if let Some(existing_field) = slot_ids.get(&slot_id_key) { + errors.push(syn::Error::new( + field.span(), + format!( + "storage slot id for field '{field_name_str}' conflicts with field \ + '{existing_field}'" + ), + )); + continue; + } + slot_names.insert(slot_name_str, field_name_str.clone()); + slot_ids.insert(slot_id_key, field_name_str); + + builder.add_storage_entry(slot_name.clone(), args.description, field, args.type_attr); + + field_infos.push((field_name.clone(), field_type.clone(), slot_id)); } else { errors .push(syn::Error::new(field.span(), "field is missing the `#[storage]` attribute")); @@ -115,8 +182,60 @@ pub fn process_storage_fields( } if let Some(first_error) = errors.into_iter().next() { - Err(first_error) - } else { - Ok(field_inits) + return Err(first_error); + } + + let mut field_inits = Vec::with_capacity(field_infos.len()); + for (field_name, field_type, slot_id) in field_infos.into_iter() { + let slot = slot_id_tokens(slot_id); + field_inits.push(quote! { + #field_name: #field_type { slot: #slot } + }); + } + + Ok(field_inits) +} + +/// Checks that the type of `field` is either `StorageMap` or `Value` from the `miden` crate. +/// +/// # Limitations +/// +/// Types are not resolved during macro expansion, so this check just verifies the identifier +/// written in the struct correspond to one of the expected values. Hence the following cannot +/// be detected: +/// +/// * A developer defines their own `StorageMap` or `Value` +/// * A developer uses a valid type from miden but aliases it +pub(crate) fn typecheck_storage_field(field: &Field) -> Result { + let type_path = match &field.ty { + Type::Path(type_path) => type_path, + _ => { + return Err(syn::Error::new(field.span(), "storage field type must be a path")); + } + }; + + let segments: Vec = type_path + .path + .segments + .iter() + .map(|segment| segment.ident.to_string()) + .collect(); + + const BASE_CRATE: &str = "miden"; + const TYPENAME_MAP: &str = "StorageMap"; + const TYPENAME_VALUE: &str = "Value"; + + match segments.as_slice() { + [a] if a == TYPENAME_MAP => Ok(StorageFieldType::StorageMap), + [a] if a == TYPENAME_VALUE => Ok(StorageFieldType::Value), + [a, b] if a == BASE_CRATE && b == TYPENAME_MAP => Ok(StorageFieldType::StorageMap), + [a, b] if a == BASE_CRATE && b == TYPENAME_VALUE => Ok(StorageFieldType::Value), + _ => Err(syn::Error::new( + field.span(), + format!( + "storage field type can only be `{TYPENAME_MAP}` or `{TYPENAME_VALUE}` from \ + `{BASE_CRATE}` crate" + ), + )), } } diff --git a/sdk/base-macros/src/lib.rs b/sdk/base-macros/src/lib.rs index c84b78118..ff14aaaee 100644 --- a/sdk/base-macros/src/lib.rs +++ b/sdk/base-macros/src/lib.rs @@ -7,7 +7,7 @@ //! signature. //! //! Example: -//! ```rust +//! ```rust,ignore //! //! #[export_type] //! pub struct StructA { @@ -26,7 +26,7 @@ //! //! #[component] //! impl MyAccount { -//! pub fn (&self, a: StructA) -> StructB { +//! pub fn foo(&self, a: StructA) -> StructB { //! ... //! } //! } @@ -56,6 +56,7 @@ mod component_macro; mod export_type; mod generate; mod manifest_paths; +mod note; mod script; mod types; mod util; @@ -91,20 +92,59 @@ pub fn export_type( export_type::expand(attr, item) } -/// Marks the function as a note script +/// Marks a type/impl as a note script definition. +/// +/// This attribute is intended to be used on: +/// - a note input type definition (`struct MyNote { ... }`) +/// - the associated inherent `impl` block that contains an entrypoint method annotated with +/// `#[note_script]` +/// +/// # Example +/// +/// ```rust,ignore +/// use miden::*; +/// use crate::bindings::Account; +/// +/// #[note] +/// struct MyNote { +/// recipient: AccountId, +/// } +/// +/// #[note] +/// impl MyNote { +/// #[note_script] +/// pub fn run(self, _arg: Word, account: &mut Account) { +/// assert_eq!(account.get_id(), self.recipient); +/// } +/// } +/// ``` +#[proc_macro_attribute] +pub fn note( + attr: proc_macro::TokenStream, + item: proc_macro::TokenStream, +) -> proc_macro::TokenStream { + note::expand_note(attr, item) +} + +/// Marks a method as the note script entrypoint (`#[note_script]`). +/// +/// The method must be contained within an inherent `impl` block annotated with `#[note]`. +/// +/// # Supported entrypoint signature +/// +/// - Receiver must be plain `self` (by value); `&self`, `&mut self`, `mut self`, and typed +/// receivers (e.g. `self: Box`) are not supported. +/// - The method must return `()`. +/// - Excluding `self`, the method must accept: +/// - exactly one `Word` argument, and +/// - optionally a single `&Account` or `&mut Account` argument (in either order). +/// - Generic methods and `async fn` are not supported. #[proc_macro_attribute] pub fn note_script( attr: proc_macro::TokenStream, item: proc_macro::TokenStream, ) -> proc_macro::TokenStream { - script::expand( - attr, - item, - ScriptConfig { - export_interface: "miden:base/note-script@1.0.0", - guest_trait_path: "self::bindings::exports::miden::base::note_script::Guest", - }, - ) + note::expand_note_script(attr, item) } /// Marks the function as a transaction script @@ -171,7 +211,7 @@ pub fn tx_script( /// The macro's first argument is the name of a type that implements the traits /// generated: /// -/// ``` +/// ```rust,ignore /// use miden::generate; /// /// generate!({ @@ -208,7 +248,7 @@ pub fn tx_script( /// values. /// /// -/// ``` +/// ```rust,ignore /// use miden::generate; /// # macro_rules! generate { ($($t:tt)*) => () } /// diff --git a/sdk/base-macros/src/note.rs b/sdk/base-macros/src/note.rs new file mode 100644 index 000000000..044f449a7 --- /dev/null +++ b/sdk/base-macros/src/note.rs @@ -0,0 +1,609 @@ +use proc_macro2::{Span, TokenStream as TokenStream2}; +use quote::quote; +use syn::{ + Attribute, FnArg, ImplItem, ImplItemFn, Item, ItemImpl, ItemStruct, PathArguments, Type, + parse_macro_input, spanned::Spanned, +}; + +use crate::script::{GuestWrapperConfig, expand_guest_wrapper}; + +const NOTE_SCRIPT_ATTR: &str = "note_script"; +const NOTE_SCRIPT_DOC_MARKER: &str = "__miden_note_script_marker"; + +/// Expands `#[note]` for either a note input `struct` or an inherent `impl` block. +pub(crate) fn expand_note( + attr: proc_macro::TokenStream, + item: proc_macro::TokenStream, +) -> proc_macro::TokenStream { + if !attr.is_empty() { + return syn::Error::new(Span::call_site(), "this attribute does not accept arguments") + .into_compile_error() + .into(); + } + + let item = parse_macro_input!(item as Item); + match item { + Item::Struct(item_struct) => expand_note_struct(item_struct).into(), + Item::Impl(item_impl) => expand_note_impl(item_impl).into(), + other => syn::Error::new( + other.span(), + "`#[note]` must be applied to a `struct` or an inherent `impl` block", + ) + .into_compile_error() + .into(), + } +} + +/// Expands `#[note_script]`. +/// +/// This attribute must be applied to a method inside an inherent `impl` block annotated with +/// `#[note]`. It acts as a marker for `#[note]` to locate the entrypoint method. +pub(crate) fn expand_note_script( + attr: proc_macro::TokenStream, + item: proc_macro::TokenStream, +) -> proc_macro::TokenStream { + if !attr.is_empty() { + return syn::Error::new(Span::call_site(), "this attribute does not accept arguments") + .into_compile_error() + .into(); + } + + let item_tokens: TokenStream2 = item.clone().into(); + let mut item_fn: ImplItemFn = match syn::parse2(item_tokens.clone()) { + Ok(item_fn) => item_fn, + Err(_) => { + if let Ok(item_fn) = syn::parse2::(item_tokens.clone()) { + return syn::Error::new( + item_fn.sig.span(), + "`#[note_script]` must be applied to a method inside a `#[note]` `impl` block", + ) + .into_compile_error() + .into(); + } + + if let Ok(item_fn) = syn::parse2::(item_tokens.clone()) { + return syn::Error::new( + item_fn.sig.span(), + "`#[note_script]` must be applied to a method inside a `#[note]` `impl` block", + ) + .into_compile_error() + .into(); + } + + return syn::Error::new( + Span::call_site(), + "`#[note_script]` must be applied to a method inside a `#[note]` `impl` block", + ) + .into_compile_error() + .into(); + } + }; + + // `#[note]` uses `#[note_script]` as a marker. Since proc-macro attributes are consumed during + // expansion, we also attach a stable marker attribute that `#[note]` can reliably detect. + let marker = syn::LitStr::new(NOTE_SCRIPT_DOC_MARKER, Span::call_site()); + item_fn.attrs.push(syn::parse_quote!(#[doc = #marker])); + quote!(#item_fn).into() +} + +fn expand_note_struct(item_struct: ItemStruct) -> TokenStream2 { + let struct_ident = &item_struct.ident; + + if !item_struct.generics.params.is_empty() { + return syn::Error::new( + item_struct.generics.span(), + "`#[note]` does not support generic note input structs", + ) + .into_compile_error(); + } + + let from_impl = match &item_struct.fields { + syn::Fields::Unit => { + quote! { + impl ::core::convert::From<&[::miden::Felt]> for #struct_ident { + #[inline(always)] + fn from(_felts: &[::miden::Felt]) -> Self { + Self + } + } + } + } + syn::Fields::Named(fields) => { + let field_inits = fields.named.iter().map(|field| { + let ident = field.ident.as_ref().expect("named fields must have identifiers"); + let ty = &field.ty; + quote! { + #ident: <#ty as ::miden::felt_repr::FromFeltRepr>::from_felt_repr(&mut reader) + } + }); + + quote! { + impl ::core::convert::From<&[::miden::Felt]> for #struct_ident { + #[inline(always)] + fn from(felts: &[::miden::Felt]) -> Self { + let mut reader = ::miden::felt_repr::FeltReader::new(felts); + Self { #(#field_inits),* } + } + } + } + } + syn::Fields::Unnamed(fields) => { + let field_inits = fields.unnamed.iter().map(|field| { + let ty = &field.ty; + quote! { + <#ty as ::miden::felt_repr::FromFeltRepr>::from_felt_repr(&mut reader) + } + }); + + quote! { + impl ::core::convert::From<&[::miden::Felt]> for #struct_ident { + #[inline(always)] + fn from(felts: &[::miden::Felt]) -> Self { + let mut reader = ::miden::felt_repr::FeltReader::new(felts); + Self(#(#field_inits),*) + } + } + } + } + }; + + quote! { + #item_struct + #from_impl + } +} + +fn expand_note_impl(item_impl: ItemImpl) -> TokenStream2 { + if item_impl.trait_.is_some() { + return syn::Error::new( + item_impl.span(), + "`#[note]` cannot be applied to trait impl blocks", + ) + .into_compile_error(); + } + + if !item_impl.generics.params.is_empty() { + return syn::Error::new( + item_impl.generics.span(), + "`#[note]` does not support generic impl blocks", + ) + .into_compile_error(); + } + + let note_ty = match item_impl.self_ty.as_ref() { + Type::Path(type_path) if type_path.qself.is_none() => type_path.clone(), + other => { + return syn::Error::new( + other.span(), + "`#[note]` requires an impl block for a concrete type (e.g. `impl MyNote { ... }`)", + ) + .into_compile_error(); + } + }; + + let (entrypoint_fn, item_impl) = match extract_entrypoint(item_impl) { + Ok(val) => val, + Err(err) => return err.into_compile_error(), + }; + + let (arg_idx, account_param) = match parse_entrypoint_signature(&entrypoint_fn) { + Ok(val) => val, + Err(err) => return err.into_compile_error(), + }; + + let entrypoint_ident = &entrypoint_fn.sig.ident; + let note_ident = note_ty + .path + .segments + .last() + .expect("type path must have at least one segment") + .ident + .clone(); + let guest_struct_ident = quote::format_ident!("__MidenNoteScript_{note_ident}"); + + let note_init = note_instantiation(¬e_ty); + let (account_instantiation, account_arg, account_trait_impl) = match account_param { + Some(AccountParam { ty, mut_ref }) => { + let account_ident = quote::format_ident!("__miden_account"); + ( + quote! { + let mut #account_ident = <#ty as ::core::default::Default>::default(); + }, + if mut_ref { + quote! { &mut #account_ident } + } else { + quote! { &#account_ident } + }, + quote! { + impl ::miden::active_account::ActiveAccount for #ty {} + }, + ) + } + None => (quote! {}, quote! {}, quote! {}), + }; + + let args = match build_entrypoint_call_args(entrypoint_fn.sig.span(), arg_idx, account_arg) { + Ok(args) => args, + Err(err) => return err.into_compile_error(), + }; + let call = quote! { __miden_note.#entrypoint_ident(#(#args),*); }; + + match expand_guest_wrapper( + Span::call_site(), + GuestWrapperConfig { + export_interface: "miden:base/note-script@1.0.0", + guest_trait_path: "self::bindings::exports::miden::base::note_script::Guest", + guest_struct_ident, + guest_struct_doc: "Guest entry point generated by the Miden note script macros.", + }, + quote! { #item_impl }, + account_trait_impl, + quote! { + #note_init + #account_instantiation + #call + }, + ) { + Ok(tokens) => tokens, + Err(err) => err.into_compile_error(), + } +} + +#[derive(Clone)] +struct AccountParam { + ty: Type, + mut_ref: bool, +} + +fn note_instantiation(note_ty: &syn::TypePath) -> TokenStream2 { + // NOTE: Avoid calling `active_note::get_inputs()` for zero-sized note types so that "no input" + // notes can execute without requiring a full active-note runtime context. + quote! { + let __miden_note: #note_ty = if ::core::mem::size_of::<#note_ty>() == 0 { + (&[] as &[::miden::Felt]).into() + } else { + let inputs = ::miden::active_note::get_inputs(); + inputs.as_slice().into() + }; + } +} + +fn extract_entrypoint(mut item_impl: ItemImpl) -> syn::Result<(ImplItemFn, ItemImpl)> { + let mut entrypoints = Vec::new(); + + for item in &mut item_impl.items { + let ImplItem::Fn(item_fn) = item else { + continue; + }; + + if has_entrypoint_marker_attr(&item_fn.attrs) { + entrypoints.push(item_fn.clone()); + // Remove entrypoint markers so they don't reach the output. + item_fn.attrs.retain(|attr| !is_entrypoint_marker_attr(attr)); + } + } + + match entrypoints.as_slice() { + [only] => Ok((only.clone(), item_impl)), + [] => Err(syn::Error::new( + item_impl.span(), + "`#[note]` requires an entrypoint method annotated with `#[note_script]`", + )), + _ => Err(syn::Error::new( + item_impl.span(), + "`#[note]` requires a single entrypoint method (only one `#[note_script]` method is \ + allowed)", + )), + } +} + +/// Parses the entrypoint signature. +/// +/// Returns: +/// - index of the Word argument among the non-receiver arguments (0 or 1) +/// - optional injected account parameter +fn parse_entrypoint_signature( + entrypoint: &ImplItemFn, +) -> syn::Result<(usize, Option)> { + let sig = &entrypoint.sig; + + if let Some(asyncness) = sig.asyncness { + return Err(syn::Error::new(asyncness.span(), "entrypoint method must not be `async`")); + } + + if !sig.generics.params.is_empty() || sig.generics.where_clause.is_some() { + return Err(syn::Error::new(sig.generics.span(), "entrypoint method must not be generic")); + } + + let receiver = sig + .receiver() + .ok_or_else(|| syn::Error::new(sig.span(), "entrypoint method must accept `self`"))?; + + if receiver.colon_token.is_some() { + return Err(syn::Error::new( + receiver.span(), + "entrypoint receiver must be `self` (by value); typed receivers (e.g. `self: \ + Box`) are not supported", + )); + } + + if receiver.reference.is_some() { + return Err(syn::Error::new( + receiver.span(), + "entrypoint receiver must be `self` (by value); `&self` / `&mut self` are not \ + supported", + )); + } + + if receiver.mutability.is_some() { + return Err(syn::Error::new( + receiver.span(), + "entrypoint receiver must be `self` (non-mutable); `mut self` is not supported", + )); + } + + if !is_unit_return_type(&sig.output) { + return Err(syn::Error::new(sig.output.span(), "entrypoint method must return `()`")); + } + + let non_receiver_args: Vec<_> = + sig.inputs.iter().filter(|arg| !matches!(arg, FnArg::Receiver(_))).collect(); + + if non_receiver_args.is_empty() || non_receiver_args.len() > 2 { + return Err(syn::Error::new( + sig.span(), + "entrypoint must accept 1 or 2 arguments (excluding `self`): `Word` and optional \ + `&Account`/`&mut Account`", + )); + } + + let mut word_positions = Vec::new(); + let mut account: Option = None; + + for (idx, arg) in non_receiver_args.iter().enumerate() { + let FnArg::Typed(pat_type) = arg else { + continue; + }; + if is_type_named(pat_type.ty.as_ref(), "Word") { + word_positions.push(idx); + continue; + } + + if let Some((ty, mut_ref)) = parse_account_ref_type(pat_type.ty.as_ref()) { + if account.is_some() { + return Err(syn::Error::new( + pat_type.ty.span(), + "entrypoint may only declare a single account parameter", + )); + } + account = Some(AccountParam { ty, mut_ref }); + continue; + } + + return Err(syn::Error::new( + pat_type.ty.span(), + "unsupported entrypoint parameter type; expected `Word` and optional `&Account`/`&mut \ + Account`", + )); + } + + let [word_idx] = word_positions.as_slice() else { + return Err(syn::Error::new( + sig.span(), + "entrypoint must declare exactly one `Word` parameter", + )); + }; + + if non_receiver_args.len() == 2 && account.is_none() { + return Err(syn::Error::new( + sig.span(), + "entrypoint with two parameters must include an account reference (`&Account` or \ + `&mut Account`)", + )); + } + + Ok((*word_idx, account)) +} + +/// Builds the arguments passed to the user's entrypoint method call. +fn build_entrypoint_call_args( + error_span: Span, + arg_word_idx: usize, + account_arg: TokenStream2, +) -> syn::Result> { + let arg = quote! { arg }; + + if account_arg.is_empty() { + return Ok(vec![arg]); + } + + match arg_word_idx { + 0 => Ok(vec![arg, account_arg]), + 1 => Ok(vec![account_arg, arg]), + _ => Err(syn::Error::new(error_span, "internal error: invalid entrypoint argument index")), + } +} + +fn parse_account_ref_type(ty: &Type) -> Option<(Type, bool)> { + let Type::Reference(type_ref) = ty else { + return None; + }; + if !is_type_named(type_ref.elem.as_ref(), "Account") { + return None; + } + Some(((*type_ref.elem).clone(), type_ref.mutability.is_some())) +} + +/// Returns true if the entrypoint return type is unit. +fn is_unit_return_type(output: &syn::ReturnType) -> bool { + match output { + syn::ReturnType::Default => true, + syn::ReturnType::Type(_, ty) => matches!(ty.as_ref(), Type::Tuple(t) if t.elems.is_empty()), + } +} + +fn is_type_named(ty: &Type, name: &str) -> bool { + let Type::Path(type_path) = ty else { + return false; + }; + if type_path.qself.is_some() { + return false; + } + type_path + .path + .segments + .last() + .is_some_and(|seg| seg.ident == name && matches!(seg.arguments, PathArguments::None)) +} + +/// Returns true if any entrypoint marker attribute is present. +fn has_entrypoint_marker_attr(attrs: &[Attribute]) -> bool { + attrs.iter().any(is_entrypoint_marker_attr) +} + +fn is_attr_named(attr: &Attribute, name: &str) -> bool { + attr.path() + .segments + .last() + .is_some_and(|seg| seg.ident == name && matches!(seg.arguments, PathArguments::None)) +} + +/// Returns true if an attribute marks a method as the note entrypoint. +fn is_entrypoint_marker_attr(attr: &Attribute) -> bool { + is_attr_named(attr, NOTE_SCRIPT_ATTR) || is_doc_marker_attr(attr, NOTE_SCRIPT_DOC_MARKER) +} + +/// Returns true if `attr` is `#[doc = "..."]` with `marker` as the string value. +fn is_doc_marker_attr(attr: &Attribute, marker: &str) -> bool { + if !attr.path().is_ident("doc") { + return false; + } + + let syn::Meta::NameValue(meta) = &attr.meta else { + return false; + }; + + let syn::Expr::Lit(expr) = &meta.value else { + return false; + }; + + let syn::Lit::Str(value) = &expr.lit else { + return false; + }; + + value.value() == marker +} + +#[cfg(test)] +mod tests { + use syn::parse_quote; + + use super::*; + + #[test] + fn entrypoint_signature_allows_non_run_name() { + let item_fn: ImplItemFn = parse_quote! { + pub fn execute(self, _arg: Word) {} + }; + + assert!(parse_entrypoint_signature(&item_fn).is_ok()); + } + + #[test] + fn entrypoint_signature_requires_unit_return() { + let item_fn: ImplItemFn = parse_quote! { + pub fn run(self, arg: Word) -> Word { arg } + }; + + let err = match parse_entrypoint_signature(&item_fn) { + Ok(_) => panic!("expected signature validation to fail"), + Err(err) => err, + }; + assert!(err.to_string().contains("must return `()`")); + } + + #[test] + fn entrypoint_signature_rejects_async() { + let item_fn: ImplItemFn = parse_quote! { + pub async fn execute(self, _arg: Word) {} + }; + + let err = match parse_entrypoint_signature(&item_fn) { + Ok(_) => panic!("expected signature validation to fail"), + Err(err) => err, + }; + assert!(err.to_string().contains("must not be `async`")); + } + + #[test] + fn entrypoint_signature_rejects_typed_receiver() { + let item_fn: ImplItemFn = parse_quote! { + pub fn execute(self: Box, _arg: Word) {} + }; + + let err = match parse_entrypoint_signature(&item_fn) { + Ok(_) => panic!("expected signature validation to fail"), + Err(err) => err, + }; + assert!(err.to_string().contains("typed receivers")); + } + + #[test] + fn entrypoint_signature_rejects_generics() { + let item_fn: ImplItemFn = parse_quote! { + pub fn execute(self, _arg: Word) {} + }; + + let err = match parse_entrypoint_signature(&item_fn) { + Ok(_) => panic!("expected signature validation to fail"), + Err(err) => err, + }; + assert!(err.to_string().contains("must not be generic")); + } + + #[test] + fn extract_entrypoint_accepts_doc_marker() { + let marker = syn::LitStr::new(NOTE_SCRIPT_DOC_MARKER, Span::call_site()); + let item_impl: ItemImpl = parse_quote! { + impl MyNote { + #[doc = #marker] + pub fn execute(self, _arg: Word) {} + } + }; + + let (entrypoint_fn, item_impl) = extract_entrypoint(item_impl).unwrap(); + assert_eq!(entrypoint_fn.sig.ident, "execute"); + + let ImplItem::Fn(method) = item_impl.items.first().expect("method must exist") else { + panic!("expected function method"); + }; + assert!( + method + .attrs + .iter() + .all(|attr| !is_doc_marker_attr(attr, NOTE_SCRIPT_DOC_MARKER)), + "entrypoint markers must be removed from output" + ); + } + + #[test] + fn extract_entrypoint_accepts_qualified_note_script_attr() { + let item_impl: ItemImpl = parse_quote! { + impl MyNote { + #[miden::note_script] + pub fn execute(self, _arg: Word) {} + } + }; + + let (entrypoint_fn, item_impl) = extract_entrypoint(item_impl).unwrap(); + assert_eq!(entrypoint_fn.sig.ident, "execute"); + + let ImplItem::Fn(method) = item_impl.items.first().expect("method must exist") else { + panic!("expected function method"); + }; + assert!( + method.attrs.iter().all(|attr| !is_entrypoint_marker_attr(attr)), + "entrypoint markers must be removed from output" + ); + } +} diff --git a/sdk/base-macros/src/script.rs b/sdk/base-macros/src/script.rs index 19197c565..cec9d6bff 100644 --- a/sdk/base-macros/src/script.rs +++ b/sdk/base-macros/src/script.rs @@ -1,6 +1,6 @@ use std::{env, fs, path::Path}; -use proc_macro2::{Literal, Span}; +use proc_macro2::{Literal, Span, TokenStream as TokenStream2}; use quote::quote; use syn::{FnArg, ItemFn, Pat, PatIdent, parse_macro_input, spanned::Spanned}; use toml::Value; @@ -20,7 +20,66 @@ pub(crate) struct ScriptConfig { pub guest_trait_path: &'static str, } -/// Shared expansion logic used by both `#[note_script]` and `#[tx_script]`. +/// Configuration for generating a script guest wrapper. +pub(crate) struct GuestWrapperConfig { + /// Fully-qualified export interface emitted by the generated WIT world. + pub export_interface: &'static str, + /// Fully-qualified path to the guest trait implemented by the generated struct. + pub guest_trait_path: &'static str, + /// The name of the generated guest struct. + pub guest_struct_ident: syn::Ident, + /// Doc string attached to the generated guest struct. + pub guest_struct_doc: &'static str, +} + +/// Generates the shared script wrapper boilerplate (WIT bindings + export glue + guest entrypoint). +pub(crate) fn expand_guest_wrapper( + error_span: Span, + config: GuestWrapperConfig, + user_items: TokenStream2, + trait_impls: TokenStream2, + run_body: TokenStream2, +) -> syn::Result { + let inline_wit = build_script_wit(error_span, config.export_interface)?; + let inline_literal = Literal::string(&inline_wit); + + let export_path: syn::Path = syn::parse_str(config.guest_trait_path).map_err(|err| { + syn::Error::new( + error_span, + format!("failed to parse guest trait path '{}': {err}", config.guest_trait_path), + ) + })?; + + let runtime_boilerplate = runtime_boilerplate(); + let guest_struct_ident = config.guest_struct_ident; + let doc = config.guest_struct_doc; + + Ok(quote! { + #runtime_boilerplate + + #user_items + + ::miden::generate!(inline = #inline_literal); + self::bindings::export!(#guest_struct_ident); + + #trait_impls + + // Bring ActiveAccount trait into scope so users can call account.get_id(), etc. + #[allow(unused_imports)] + use ::miden::active_account::ActiveAccount as _; + + #[doc = #doc] + pub struct #guest_struct_ident; + + impl #export_path for #guest_struct_ident { + fn run(arg: ::miden::Word) { + #run_body + } + } + }) +} + +/// Expansion logic used by `#[tx_script]`. pub(crate) fn expand( attr: proc_macro::TokenStream, item: proc_macro::TokenStream, @@ -55,27 +114,8 @@ pub(crate) fn expand( Err(err) => return err.into_compile_error().into(), }; - let inline_wit = match build_script_wit(Span::call_site(), config.export_interface) { - Ok(wit) => wit, - Err(err) => return err.into_compile_error().into(), - }; - let inline_literal = Literal::string(&inline_wit); let struct_ident = quote::format_ident!("Struct"); - let export_path: syn::Path = match syn::parse_str(config.guest_trait_path) { - Ok(path) => path, - Err(err) => { - return syn::Error::new( - Span::call_site(), - format!("failed to parse guest trait path '{}': {err}", config.guest_trait_path), - ) - .into_compile_error() - .into(); - } - }; - - let runtime_boilerplate = runtime_boilerplate(); - // Generate the call to the user's function, with optional injected parameter. // Note: `Account` generated from account components in scripts only implements `ActiveAccount`. // `NativeAccount` exposes functions that can be called only by account code. @@ -90,29 +130,23 @@ pub(crate) fn expand( None => (quote! {}, quote! { #fn_ident(arg) }, quote! {}), }; - let expanded = quote! { - #runtime_boilerplate - - #input_fn - - ::miden::generate!(inline = #inline_literal); - self::bindings::export!(#struct_ident); - - #trait_impl - - // Bring ActiveAccount trait into scope so users can call account.get_id(), etc. - #[allow(unused_imports)] - use ::miden::active_account::ActiveAccount as _; - - /// Guest entry point generated by the Miden script attribute. - pub struct #struct_ident; - - impl #export_path for #struct_ident { - fn run(arg: ::miden::Word) { - #instantiation - #call; - } - } + let expanded = match expand_guest_wrapper( + Span::call_site(), + GuestWrapperConfig { + export_interface: config.export_interface, + guest_trait_path: config.guest_trait_path, + guest_struct_ident: struct_ident.clone(), + guest_struct_doc: "Guest entry point generated by the Miden script attribute.", + }, + quote! { #input_fn }, + trait_impl, + quote! { + #instantiation + #call; + }, + ) { + Ok(tokens) => tokens, + Err(err) => err.into_compile_error(), }; expanded.into() @@ -231,7 +265,8 @@ fn is_type_named(ty: &syn::Type, name: &str) -> bool { .is_some_and(|seg| seg.ident == name && seg.arguments.is_empty()) } -fn build_script_wit( +/// Builds an inlined WIT world definition for a script crate. +pub(crate) fn build_script_wit( error_span: Span, export_interface: &'static str, ) -> Result { diff --git a/sdk/base-macros/src/types.rs b/sdk/base-macros/src/types.rs index 4522c4355..c7a3beda0 100644 --- a/sdk/base-macros/src/types.rs +++ b/sdk/base-macros/src/types.rs @@ -43,6 +43,16 @@ pub(crate) struct ExportedTypeDef { pub(crate) kind: ExportedTypeKind, } +/// Represents the types that can be used as storage fields. +/// +/// During macro expansion struct field types correspond to strings, as types haven't been +/// resolved yet. After validating a field type, use this enum instead of strings. +#[derive(Clone, Debug)] +pub(crate) enum StorageFieldType { + StorageMap, + Value, +} + pub(crate) fn register_export_type(def: ExportedTypeDef, _span: Span) -> Result<(), syn::Error> { let registry = EXPORTED_TYPES.get_or_init(|| Mutex::new(Vec::new())); let mut registry = registry.lock().expect("mutex poisoned"); diff --git a/sdk/base-macros/wit/miden.wit b/sdk/base-macros/wit/miden.wit index 11786d5e5..2820dc315 100644 --- a/sdk/base-macros/wit/miden.wit +++ b/sdk/base-macros/wit/miden.wit @@ -2,13 +2,12 @@ package miden:base@1.0.0; /// Types to be used in tx-kernel interface interface core-types { - /// Represents base field element in the field using Montgomery representation. - /// Internal values represent x * R mod M where R = 2^64 mod M and x in [0, M). - /// The backing type is `f64` but the internal values are always integer in the range [0, M). - /// Field modulus M = 2^64 - 2^32 + 1 + /// Represents an on-chain felt. + /// + /// Field modulus M = 2^64 - 2^32 + 1. record felt { - /// We plan to use f32 as the backing type for the field element. It has the size that we need and - /// we don't plan to support floating point arithmetic in programs for Miden VM. + /// The backing type is `f32` which will be treated as a felt by the compiler. + /// We're basically hijacking the Wasm `f32` type and treat as felt. inner: f32, } diff --git a/sdk/base-sys/Cargo.toml b/sdk/base-sys/Cargo.toml index a8e33240d..372be6ee9 100644 --- a/sdk/base-sys/Cargo.toml +++ b/sdk/base-sys/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "miden-base-sys" description = "Miden rollup Rust bingings and MASM library" -version = "0.8.1" +version = "0.10.0" rust-version.workspace = true authors.workspace = true repository.workspace = true @@ -16,7 +16,8 @@ build = "build.rs" links = "miden_base_sys_stubs" [dependencies] -miden-stdlib-sys = { version = "0.8.0", path = "../stdlib-sys" } +miden-stdlib-sys = { version = "0.10.0", path = "../stdlib-sys" } +miden-field-repr = { version = "0.10.0", path = "../field-repr/repr" } [features] default = [] diff --git a/sdk/base-sys/src/bindings/active_account.rs b/sdk/base-sys/src/bindings/active_account.rs index d567c8ed3..b335761e4 100644 --- a/sdk/base-sys/src/bindings/active_account.rs +++ b/sdk/base-sys/src/bindings/active_account.rs @@ -4,43 +4,43 @@ use super::types::{AccountId, Asset}; #[allow(improper_ctypes)] unsafe extern "C" { - #[link_name = "miden::active_account::get_id"] + #[link_name = "miden::protocol::active_account::get_id"] fn extern_active_account_get_id(ptr: *mut AccountId); - #[link_name = "miden::active_account::get_nonce"] + #[link_name = "miden::protocol::active_account::get_nonce"] fn extern_active_account_get_nonce() -> Felt; - #[link_name = "miden::active_account::get_initial_commitment"] + #[link_name = "miden::protocol::active_account::get_initial_commitment"] fn extern_active_account_get_initial_commitment(ptr: *mut Word); - #[link_name = "miden::active_account::compute_commitment"] + #[link_name = "miden::protocol::active_account::compute_commitment"] fn extern_active_account_compute_commitment(ptr: *mut Word); - #[link_name = "miden::active_account::get_code_commitment"] + #[link_name = "miden::protocol::active_account::get_code_commitment"] fn extern_active_account_get_code_commitment(ptr: *mut Word); - #[link_name = "miden::active_account::get_initial_storage_commitment"] + #[link_name = "miden::protocol::active_account::get_initial_storage_commitment"] fn extern_active_account_get_initial_storage_commitment(ptr: *mut Word); - #[link_name = "miden::active_account::compute_storage_commitment"] + #[link_name = "miden::protocol::active_account::compute_storage_commitment"] fn extern_active_account_compute_storage_commitment(ptr: *mut Word); - #[link_name = "miden::active_account::get_balance"] + #[link_name = "miden::protocol::active_account::get_balance"] fn extern_active_account_get_balance(faucet_id_prefix: Felt, faucet_id_suffix: Felt) -> Felt; - #[link_name = "miden::active_account::get_initial_balance"] + #[link_name = "miden::protocol::active_account::get_initial_balance"] fn extern_active_account_get_initial_balance( faucet_id_prefix: Felt, faucet_id_suffix: Felt, ) -> Felt; - #[link_name = "miden::active_account::has_non_fungible_asset"] + #[link_name = "miden::protocol::active_account::has_non_fungible_asset"] fn extern_active_account_has_non_fungible_asset( asset_3: Felt, asset_2: Felt, asset_1: Felt, asset_0: Felt, ) -> Felt; - #[link_name = "miden::active_account::get_initial_vault_root"] + #[link_name = "miden::protocol::active_account::get_initial_vault_root"] fn extern_active_account_get_initial_vault_root(ptr: *mut Word); - #[link_name = "miden::active_account::get_vault_root"] + #[link_name = "miden::protocol::active_account::get_vault_root"] fn extern_active_account_get_vault_root(ptr: *mut Word); - #[link_name = "miden::active_account::get_num_procedures"] + #[link_name = "miden::protocol::active_account::get_num_procedures"] fn extern_active_account_get_num_procedures() -> Felt; - #[link_name = "miden::active_account::get_procedure_root"] + #[link_name = "miden::protocol::active_account::get_procedure_root"] fn extern_active_account_get_procedure_root(index: Felt, ptr: *mut Word); - #[link_name = "miden::active_account::has_procedure"] + #[link_name = "miden::protocol::active_account::has_procedure"] fn extern_active_account_has_procedure( proc_root_3: Felt, proc_root_2: Felt, diff --git a/sdk/base-sys/src/bindings/active_note.rs b/sdk/base-sys/src/bindings/active_note.rs index 3e89b0325..66f250f11 100644 --- a/sdk/base-sys/src/bindings/active_note.rs +++ b/sdk/base-sys/src/bindings/active_note.rs @@ -3,31 +3,42 @@ use alloc::vec::Vec; use miden_stdlib_sys::{Felt, Word}; -use super::{AccountId, Asset, Recipient}; +use super::{AccountId, Asset, NoteMetadata, Recipient}; #[allow(improper_ctypes)] unsafe extern "C" { - #[link_name = "miden::active_note::get_inputs"] + #[link_name = "miden::protocol::active_note::get_inputs"] pub fn extern_note_get_inputs(ptr: *mut Felt) -> usize; - #[link_name = "miden::active_note::get_assets"] + #[link_name = "miden::protocol::active_note::get_assets"] pub fn extern_note_get_assets(ptr: *mut Felt) -> usize; - #[link_name = "miden::active_note::get_sender"] + #[link_name = "miden::protocol::active_note::get_sender"] pub fn extern_note_get_sender(ptr: *mut AccountId); - #[link_name = "miden::active_note::get_recipient"] + #[link_name = "miden::protocol::active_note::get_recipient"] pub fn extern_note_get_recipient(ptr: *mut Recipient); - #[link_name = "miden::active_note::get_script_root"] + #[link_name = "miden::protocol::active_note::get_script_root"] pub fn extern_note_get_script_root(ptr: *mut Word); - #[link_name = "miden::active_note::get_serial_number"] + #[link_name = "miden::protocol::active_note::get_serial_number"] pub fn extern_note_get_serial_number(ptr: *mut Word); - #[link_name = "miden::active_note::get_metadata"] - pub fn extern_note_get_metadata(ptr: *mut Word); - #[link_name = "miden::active_note::add_assets_to_account"] - pub fn extern_note_add_assets_to_account(); + #[link_name = "miden::protocol::active_note::get_metadata"] + pub fn extern_note_get_metadata(ptr: *mut NoteMetadata); } /// Get the inputs of the currently executing note. +/// +/// # Examples +/// +/// Parse a note input layout into domain types: +/// +/// ```rust,ignore +/// use miden::{active_note, AccountId, Asset}; +/// +/// let inputs = active_note::get_inputs(); +/// +/// // Example layout: first two inputs store a target `AccountId`. +/// let target = AccountId::from(inputs[0], inputs[1]); +/// ``` pub fn get_inputs() -> Vec { - const MAX_INPUTS: usize = 256; + const MAX_INPUTS: usize = 1024; let mut inputs: Vec = Vec::with_capacity(MAX_INPUTS); let num_inputs = unsafe { // Ensure the pointer is a valid Miden pointer @@ -107,17 +118,11 @@ pub fn get_serial_number() -> Word { } } -/// Returns the metadata of the note that is currently executing. -pub fn get_metadata() -> Word { +/// Returns the attachment and metadata header of the note that is currently executing. +pub fn get_metadata() -> NoteMetadata { unsafe { - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); extern_note_get_metadata(ret_area.as_mut_ptr()); ret_area.assume_init().reverse() } } - -/// Moves all assets from the active note into the active account vault. -#[inline] -pub fn add_assets_to_account() { - unsafe { extern_note_add_assets_to_account() } -} diff --git a/sdk/base-sys/src/bindings/asset.rs b/sdk/base-sys/src/bindings/asset.rs index 56954e992..4f1e58e99 100644 --- a/sdk/base-sys/src/bindings/asset.rs +++ b/sdk/base-sys/src/bindings/asset.rs @@ -4,7 +4,7 @@ use super::types::{AccountId, Asset}; #[allow(improper_ctypes)] unsafe extern "C" { - #[link_name = "miden::asset::build_fungible_asset"] + #[link_name = "miden::protocol::asset::build_fungible_asset"] pub fn extern_asset_build_fungible_asset( faucet_id_prefix: Felt, faucet_id_suffix: Felt, @@ -12,7 +12,7 @@ unsafe extern "C" { ptr: *mut Asset, ); - #[link_name = "miden::asset::build_non_fungible_asset"] + #[link_name = "miden::protocol::asset::build_non_fungible_asset"] pub fn extern_asset_build_non_fungible_asset( faucet_id_prefix: Felt, data_hash_3: Felt, diff --git a/sdk/base-sys/src/bindings/faucet.rs b/sdk/base-sys/src/bindings/faucet.rs index d42b2fee7..33ced3fd0 100644 --- a/sdk/base-sys/src/bindings/faucet.rs +++ b/sdk/base-sys/src/bindings/faucet.rs @@ -4,10 +4,10 @@ use super::types::Asset; #[allow(improper_ctypes)] unsafe extern "C" { - #[link_name = "miden::faucet::create_fungible_asset"] + #[link_name = "miden::protocol::faucet::create_fungible_asset"] pub fn extern_faucet_create_fungible_asset(amount: Felt, ptr: *mut Asset); - #[link_name = "miden::faucet::create_non_fungible_asset"] + #[link_name = "miden::protocol::faucet::create_non_fungible_asset"] pub fn extern_faucet_create_non_fungible_asset( data_hash_3: Felt, data_hash_2: Felt, @@ -16,7 +16,7 @@ unsafe extern "C" { ptr: *mut Asset, ); - #[link_name = "miden::faucet::mint"] + #[link_name = "miden::protocol::faucet::mint"] pub fn extern_faucet_mint( asset_3: Felt, asset_2: Felt, @@ -25,7 +25,7 @@ unsafe extern "C" { ptr: *mut Asset, ); - #[link_name = "miden::faucet::burn"] + #[link_name = "miden::protocol::faucet::burn"] pub fn extern_faucet_burn( asset_3: Felt, asset_2: Felt, @@ -34,10 +34,10 @@ unsafe extern "C" { ptr: *mut Asset, ); - #[link_name = "miden::faucet::get_total_issuance"] + #[link_name = "miden::protocol::faucet::get_total_issuance"] pub fn extern_faucet_get_total_issuance() -> Felt; - #[link_name = "miden::faucet::is_non_fungible_asset_issued"] + #[link_name = "miden::protocol::faucet::is_non_fungible_asset_issued"] pub fn extern_faucet_is_non_fungible_asset_issued( asset_3: Felt, asset_2: Felt, diff --git a/sdk/base-sys/src/bindings/input_note.rs b/sdk/base-sys/src/bindings/input_note.rs index 52d34e6db..4c2b7daf2 100644 --- a/sdk/base-sys/src/bindings/input_note.rs +++ b/sdk/base-sys/src/bindings/input_note.rs @@ -3,32 +3,32 @@ use alloc::vec::Vec; use miden_stdlib_sys::{Felt, Word}; -use super::types::{AccountId, Asset, NoteIdx, Recipient}; +use super::types::{AccountId, Asset, NoteIdx, NoteMetadata, Recipient}; #[allow(improper_ctypes)] unsafe extern "C" { - #[link_name = "miden::input_note::get_assets_info"] + #[link_name = "miden::protocol::input_note::get_assets_info"] pub fn extern_input_note_get_assets_info(note_index: Felt, ptr: *mut (Word, Felt)); - #[link_name = "miden::input_note::get_assets"] + #[link_name = "miden::protocol::input_note::get_assets"] pub fn extern_input_note_get_assets(dest_ptr: *mut Felt, note_index: Felt) -> usize; - #[link_name = "miden::input_note::get_recipient"] + #[link_name = "miden::protocol::input_note::get_recipient"] pub fn extern_input_note_get_recipient(note_index: Felt, ptr: *mut Recipient); - #[link_name = "miden::input_note::get_metadata"] - pub fn extern_input_note_get_metadata(note_index: Felt, ptr: *mut Word); + #[link_name = "miden::protocol::input_note::get_metadata"] + pub fn extern_input_note_get_metadata(note_index: Felt, ptr: *mut NoteMetadata); - #[link_name = "miden::input_note::get_sender"] + #[link_name = "miden::protocol::input_note::get_sender"] pub fn extern_input_note_get_sender(note_index: Felt, ptr: *mut AccountId); - #[link_name = "miden::input_note::get_inputs_info"] + #[link_name = "miden::protocol::input_note::get_inputs_info"] pub fn extern_input_note_get_inputs_info(note_index: Felt, ptr: *mut (Word, Felt)); - #[link_name = "miden::input_note::get_script_root"] + #[link_name = "miden::protocol::input_note::get_script_root"] pub fn extern_input_note_get_script_root(note_index: Felt, ptr: *mut Word); - #[link_name = "miden::input_note::get_serial_number"] + #[link_name = "miden::protocol::input_note::get_serial_number"] pub fn extern_input_note_get_serial_number(note_index: Felt, ptr: *mut Word); } @@ -82,10 +82,10 @@ pub fn get_recipient(note_index: NoteIdx) -> Recipient { } } -/// Returns the metadata of the input note at `note_index`. -pub fn get_metadata(note_index: NoteIdx) -> Word { +/// Returns the attachment and metadata header of the input note at `note_index`. +pub fn get_metadata(note_index: NoteIdx) -> NoteMetadata { unsafe { - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); extern_input_note_get_metadata(note_index.inner, ret_area.as_mut_ptr()); ret_area.assume_init().reverse() } diff --git a/sdk/base-sys/src/bindings/mod.rs b/sdk/base-sys/src/bindings/mod.rs index 45c257162..7878eeea5 100644 --- a/sdk/base-sys/src/bindings/mod.rs +++ b/sdk/base-sys/src/bindings/mod.rs @@ -19,4 +19,5 @@ pub mod storage; pub mod tx; mod types; +pub use miden_field_repr::{FromFeltRepr, ToFeltRepr}; pub use types::*; diff --git a/sdk/base-sys/src/bindings/native_account.rs b/sdk/base-sys/src/bindings/native_account.rs index c47df1e23..016436e8c 100644 --- a/sdk/base-sys/src/bindings/native_account.rs +++ b/sdk/base-sys/src/bindings/native_account.rs @@ -4,7 +4,7 @@ use super::types::Asset; #[allow(improper_ctypes)] unsafe extern "C" { - #[link_name = "miden::native_account::add_asset"] + #[link_name = "miden::protocol::native_account::add_asset"] fn extern_native_account_add_asset( asset_3: Felt, asset_2: Felt, @@ -12,7 +12,7 @@ unsafe extern "C" { asset_0: Felt, ptr: *mut Asset, ); - #[link_name = "miden::native_account::remove_asset"] + #[link_name = "miden::protocol::native_account::remove_asset"] fn extern_native_account_remove_asset( asset_3: Felt, asset_2: Felt, @@ -20,11 +20,11 @@ unsafe extern "C" { asset_0: Felt, ptr: *mut Asset, ); - #[link_name = "miden::native_account::incr_nonce"] + #[link_name = "miden::protocol::native_account::incr_nonce"] fn extern_native_account_incr_nonce() -> Felt; - #[link_name = "miden::native_account::compute_delta_commitment"] + #[link_name = "miden::protocol::native_account::compute_delta_commitment"] fn extern_native_account_compute_delta_commitment(ptr: *mut Word); - #[link_name = "miden::native_account::was_procedure_called"] + #[link_name = "miden::protocol::native_account::was_procedure_called"] fn extern_native_account_was_procedure_called( proc_root_3: Felt, proc_root_2: Felt, @@ -44,6 +44,24 @@ unsafe extern "C" { /// - If the asset is not valid. /// - If the total value of two fungible assets is greater than or equal to 2^63. /// - If the vault already contains the same non-fungible asset. +/// +/// # Examples +/// +/// Implement a basic-wallet style `receive_asset` method by adding the asset to the vault: +/// +/// ```rust,ignore +/// use miden::{component, native_account::NativeAccount, Asset}; +/// +/// #[component] +/// struct MyAccount; +/// +/// #[component] +/// impl MyAccount { +/// pub fn receive_asset(&mut self, asset: Asset) { +/// self.add_asset(asset); +/// } +/// } +/// ``` pub fn add_asset(asset: Asset) -> Asset { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); @@ -54,7 +72,7 @@ pub fn add_asset(asset: Asset) -> Asset { asset.inner[0], ret_area.as_mut_ptr(), ); - ret_area.assume_init() + ret_area.assume_init().reverse() } } @@ -123,6 +141,24 @@ pub trait NativeAccount { /// - If the asset is not valid. /// - If the total value of two fungible assets is greater than or equal to 2^63. /// - If the vault already contains the same non-fungible asset. + /// + /// # Examples + /// + /// Implement a basic-wallet style `receive_asset` method by adding the asset to the vault: + /// + /// ```rust,ignore + /// use miden::{component, native_account::NativeAccount, Asset}; + /// + /// #[component] + /// struct MyAccount; + /// + /// #[component] + /// impl MyAccount { + /// pub fn receive_asset(&mut self, asset: Asset) { + /// self.add_asset(asset); + /// } + /// } + /// ``` #[inline] fn add_asset(&mut self, asset: Asset) -> Asset { add_asset(asset) diff --git a/sdk/base-sys/src/bindings/output_note.rs b/sdk/base-sys/src/bindings/output_note.rs index 03cbbc81a..c2f868db1 100644 --- a/sdk/base-sys/src/bindings/output_note.rs +++ b/sdk/base-sys/src/bindings/output_note.rs @@ -3,23 +3,21 @@ use alloc::vec::Vec; use miden_stdlib_sys::{Felt, Word}; -use super::types::{Asset, NoteIdx, NoteType, Recipient, Tag}; +use super::types::{Asset, NoteIdx, NoteMetadata, NoteType, Recipient, Tag}; #[allow(improper_ctypes)] unsafe extern "C" { - #[link_name = "miden::output_note::create"] + #[link_name = "miden::protocol::output_note::create"] pub fn extern_output_note_create( tag: Tag, - aux: Felt, note_type: NoteType, - execution_hint: Felt, recipient_f0: Felt, recipient_f1: Felt, recipient_f2: Felt, recipient_f3: Felt, ) -> NoteIdx; - #[link_name = "miden::output_note::add_asset"] + #[link_name = "miden::protocol::output_note::add_asset"] pub fn extern_output_note_add_asset( asset_f0: Felt, asset_f1: Felt, @@ -28,33 +26,81 @@ unsafe extern "C" { note_idx: NoteIdx, ); - #[link_name = "miden::output_note::get_assets_info"] + #[link_name = "miden::protocol::output_note::get_assets_info"] pub fn extern_output_note_get_assets_info(note_index: Felt, ptr: *mut (Word, Felt)); - #[link_name = "miden::output_note::get_assets"] + #[link_name = "miden::protocol::output_note::get_assets"] pub fn extern_output_note_get_assets(dest_ptr: *mut Felt, note_index: Felt) -> usize; - #[link_name = "miden::output_note::get_recipient"] + #[link_name = "miden::protocol::output_note::get_recipient"] pub fn extern_output_note_get_recipient(note_index: Felt, ptr: *mut Recipient); - #[link_name = "miden::output_note::get_metadata"] - pub fn extern_output_note_get_metadata(note_index: Felt, ptr: *mut Word); + #[link_name = "miden::protocol::output_note::get_metadata"] + pub fn extern_output_note_get_metadata(note_index: Felt, ptr: *mut NoteMetadata); + + #[link_name = "miden::protocol::output_note::set_attachment"] + pub fn extern_output_note_set_attachment( + note_idx: NoteIdx, + attachment_scheme: Felt, + attachment_kind: Felt, + attachment_f0: Felt, + attachment_f1: Felt, + attachment_f2: Felt, + attachment_f3: Felt, + ); + + #[link_name = "miden::protocol::output_note::set_word_attachment"] + pub fn extern_output_note_set_word_attachment( + note_idx: NoteIdx, + attachment_scheme: Felt, + attachment_f0: Felt, + attachment_f1: Felt, + attachment_f2: Felt, + attachment_f3: Felt, + ); + + #[link_name = "miden::protocol::output_note::set_array_attachment"] + pub fn extern_output_note_set_array_attachment( + note_idx: NoteIdx, + attachment_scheme: Felt, + attachment_f0: Felt, + attachment_f1: Felt, + attachment_f2: Felt, + attachment_f3: Felt, + ); } /// Creates a new output note and returns its index. -pub fn create( - tag: Tag, - aux: Felt, - note_type: NoteType, - execution_hint: Felt, - recipient: Recipient, -) -> NoteIdx { +/// +/// # Examples +/// +/// Create a note and add a single asset to it: +/// +/// ```rust,ignore +/// // before using `Vec`/`vec!`. +/// extern crate alloc; +/// +/// use miden::{felt, output_note, Asset, Digest, NoteType, Recipient, Tag, Word}; +/// +/// // Values used to derive the note recipient. +/// let serial_num = Word::from_u64_unchecked(1, 2, 3, 4); +/// let note_script_root = Digest::from_word(Word::from_u64_unchecked(0, 0, 0, 0)); +/// +/// // Note inputs are hashed via `hash_elements`. +/// let inputs = alloc::vec![felt!(0); 2]; +/// let recipient = Recipient::compute(serial_num, note_script_root, inputs); +/// +/// let tag = Tag::from(felt!(0)); +/// let note_type = NoteType::from(felt!(1)); // public note type (0b01) +/// +/// let note_idx = output_note::create(tag, note_type, recipient); +/// output_note::add_asset(Asset::new([felt!(0), felt!(0), felt!(0), felt!(1)]), note_idx); +/// ``` +pub fn create(tag: Tag, note_type: NoteType, recipient: Recipient) -> NoteIdx { unsafe { extern_output_note_create( tag, - aux, note_type, - execution_hint, recipient.inner[3], recipient.inner[2], recipient.inner[1], @@ -63,7 +109,69 @@ pub fn create( } } +/// Sets the attachment of the output note specified by `note_idx`. +pub fn set_attachment( + note_idx: NoteIdx, + attachment_scheme: Felt, + attachment_kind: Felt, + attachment: Word, +) { + unsafe { + extern_output_note_set_attachment( + note_idx, + attachment_scheme, + attachment_kind, + attachment[3], + attachment[2], + attachment[1], + attachment[0], + ); + } +} + +/// Sets the attachment of the output note specified by `note_idx` to the provided word. +pub fn set_word_attachment(note_idx: NoteIdx, attachment_scheme: Felt, attachment: Word) { + unsafe { + extern_output_note_set_word_attachment( + note_idx, + attachment_scheme, + attachment[3], + attachment[2], + attachment[1], + attachment[0], + ); + } +} + +/// Sets the attachment of the output note specified by `note_idx` to the provided commitment. +/// +/// The advice map must contain an entry for the attachment elements committed to by `attachment`. +pub fn set_array_attachment(note_idx: NoteIdx, attachment_scheme: Felt, attachment: Word) { + unsafe { + extern_output_note_set_array_attachment( + note_idx, + attachment_scheme, + attachment[3], + attachment[2], + attachment[1], + attachment[0], + ); + } +} + /// Adds the asset to the output note specified by `note_idx`. +/// +/// # Examples +/// +/// ```rust,ignore +/// use miden::{felt, output_note, Asset, NoteIdx}; +/// +/// // `note_idx` is returned by `output_note::create(...)`. +/// let note_idx: NoteIdx = /* ... */ +/// +/// let asset = Asset::new([felt!(0), felt!(0), felt!(0), felt!(1)]); +/// output_note::add_asset(asset, note_idx); +/// ``` pub fn add_asset(asset: Asset, note_idx: NoteIdx) { unsafe { extern_output_note_add_asset( @@ -121,10 +229,10 @@ pub fn get_recipient(note_index: NoteIdx) -> Recipient { } } -/// Returns the metadata of the output note at `note_index`. -pub fn get_metadata(note_index: NoteIdx) -> Word { +/// Returns the attachment and metadata header of the output note at `note_index`. +pub fn get_metadata(note_index: NoteIdx) -> NoteMetadata { unsafe { - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); extern_output_note_get_metadata(note_index.inner, ret_area.as_mut_ptr()); ret_area.assume_init().reverse() } diff --git a/sdk/base-sys/src/bindings/storage.rs b/sdk/base-sys/src/bindings/storage.rs index 5269ab619..6f144935a 100644 --- a/sdk/base-sys/src/bindings/storage.rs +++ b/sdk/base-sys/src/bindings/storage.rs @@ -1,28 +1,30 @@ use miden_stdlib_sys::{Felt, Word}; -use super::StorageCommitmentRoot; +use super::StorageSlotId; #[allow(improper_ctypes)] unsafe extern "C" { - #[link_name = "miden::active_account::get_item"] - pub fn extern_get_storage_item(index: Felt, ptr: *mut Word); + #[link_name = "miden::protocol::active_account::get_item"] + pub fn extern_get_storage_item(index_prefix: Felt, index_suffix: Felt, ptr: *mut Word); - #[link_name = "miden::active_account::get_initial_item"] - pub fn extern_get_initial_storage_item(index: Felt, ptr: *mut Word); + #[link_name = "miden::protocol::active_account::get_initial_item"] + pub fn extern_get_initial_storage_item(index_prefix: Felt, index_suffix: Felt, ptr: *mut Word); - #[link_name = "miden::native_account::set_item"] + #[link_name = "miden::protocol::native_account::set_item"] pub fn extern_set_storage_item( - index: Felt, + index_prefix: Felt, + index_suffix: Felt, v0: Felt, v1: Felt, v2: Felt, v3: Felt, - ptr: *mut (StorageCommitmentRoot, Word), + ptr: *mut Word, ); - #[link_name = "miden::active_account::get_map_item"] + #[link_name = "miden::protocol::active_account::get_map_item"] pub fn extern_get_storage_map_item( - index: Felt, + index_prefix: Felt, + index_suffix: Felt, k0: Felt, k1: Felt, k2: Felt, @@ -30,9 +32,10 @@ unsafe extern "C" { ptr: *mut Word, ); - #[link_name = "miden::active_account::get_initial_map_item"] + #[link_name = "miden::protocol::active_account::get_initial_map_item"] pub fn extern_get_initial_storage_map_item( - index: Felt, + index_prefix: Felt, + index_suffix: Felt, k0: Felt, k1: Felt, k2: Felt, @@ -40,9 +43,10 @@ unsafe extern "C" { ptr: *mut Word, ); - #[link_name = "miden::native_account::set_map_item"] + #[link_name = "miden::protocol::native_account::set_map_item"] pub fn extern_set_storage_map_item( - index: Felt, + index_prefix: Felt, + index_suffix: Felt, k0: Felt, k1: Felt, k2: Felt, @@ -51,26 +55,27 @@ unsafe extern "C" { v1: Felt, v2: Felt, v3: Felt, - ptr: *mut (StorageCommitmentRoot, Word), + ptr: *mut Word, ); } /// Gets an item from the account storage. /// -/// Inputs: index +/// Inputs: slot_id /// Outputs: value /// /// Where: -/// - index is the index of the item to get. +/// - slot_id identifies the storage slot to access. /// - value is the value of the item. /// /// Panics if: -/// - the index of the requested item is out of bounds. +/// - the requested slot does not exist in the account storage. #[inline] -pub fn get_item(index: u8) -> Word { +pub fn get_item(slot_id: StorageSlotId) -> Word { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - extern_get_storage_item(index.into(), ret_area.as_mut_ptr()); + let (prefix, suffix) = slot_id.to_prefix_suffix(); + extern_get_storage_item(prefix, suffix, ret_area.as_mut_ptr()); let word = ret_area.assume_init(); word.reverse() } @@ -78,63 +83,66 @@ pub fn get_item(index: u8) -> Word { /// Gets the initial value of an item from the account storage. #[inline] -pub fn get_initial_item(index: u8) -> Word { +pub fn get_initial_item(slot_id: StorageSlotId) -> Word { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - extern_get_initial_storage_item(index.into(), ret_area.as_mut_ptr()); + let (prefix, suffix) = slot_id.to_prefix_suffix(); + extern_get_initial_storage_item(prefix, suffix, ret_area.as_mut_ptr()); ret_area.assume_init().reverse() } } /// Sets an item in the account storage. /// -/// Inputs: index, value -/// Outputs: (new_root, old_value) +/// Inputs: slot_id, value +/// Outputs: old_value /// /// Where: -/// - index is the index of the item to set. +/// - slot_id identifies the storage slot to update. /// - value is the value to set. -/// - new_root is the new storage commitment. /// - old_value is the previous value of the item. /// /// Panics if: -/// - the index of the item is out of bounds. +/// - the requested slot does not exist in the account storage. #[inline] -pub fn set_item(index: u8, value: Word) -> (StorageCommitmentRoot, Word) { +pub fn set_item(slot_id: StorageSlotId, value: Word) -> Word { unsafe { - let mut ret_area = ::core::mem::MaybeUninit::<(StorageCommitmentRoot, Word)>::uninit(); + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + let (prefix, suffix) = slot_id.to_prefix_suffix(); extern_set_storage_item( - index.into(), + prefix, + suffix, value[3], value[2], value[1], value[0], ret_area.as_mut_ptr(), ); - let (comm, value) = ret_area.assume_init(); - (comm.reverse(), value.reverse()) + ret_area.assume_init().reverse() } } /// Gets a map item from the account storage. /// -/// Inputs: index, key +/// Inputs: slot_id, key /// Outputs: value /// /// Where: -/// - index is the index of the map where the key value should be read. +/// - slot_id identifies the map slot where the key should be read. /// - key is the key of the item to get. /// - value is the value of the item. /// /// Panics if: -/// - the index for the map is out of bounds, meaning > 255. -/// - the slot item at index is not a map. +/// - the requested slot does not exist in the account storage. +/// - the slot content is not a map. #[inline] -pub fn get_map_item(index: u8, key: &Word) -> Word { +pub fn get_map_item(slot_id: StorageSlotId, key: &Word) -> Word { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + let (prefix, suffix) = slot_id.to_prefix_suffix(); extern_get_storage_map_item( - index.into(), + prefix, + suffix, key[3], key[2], key[1], @@ -147,11 +155,13 @@ pub fn get_map_item(index: u8, key: &Word) -> Word { /// Gets the initial value from a storage map. #[inline] -pub fn get_initial_map_item(index: u8, key: &Word) -> Word { +pub fn get_initial_map_item(slot_id: StorageSlotId, key: &Word) -> Word { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + let (prefix, suffix) = slot_id.to_prefix_suffix(); extern_get_initial_storage_map_item( - index.into(), + prefix, + suffix, key[3], key[2], key[1], @@ -164,25 +174,26 @@ pub fn get_initial_map_item(index: u8, key: &Word) -> Word { /// Sets a map item in the account storage. /// -/// Inputs: index, key, value -/// Outputs: (map_old_root, map_old_value) +/// Inputs: slot_id, key, value +/// Outputs: old_value /// /// Where: -/// - index is the index of the map where the key value should be set. +/// - slot_id identifies the map slot where the key should be set. /// - key is the key to set. /// - value is the value to set. -/// - map_old_root is the old map root. -/// - map_old_value is the old value at key. +/// - old_value is the old value at key. /// /// Panics if: -/// - the index for the map is out of bounds, meaning > 255. -/// - the slot item at index is not a map. +/// - the requested slot does not exist in the account storage. +/// - the slot content is not a map. #[inline] -pub fn set_map_item(index: u8, key: Word, value: Word) -> (StorageCommitmentRoot, Word) { +pub fn set_map_item(slot_id: StorageSlotId, key: Word, value: Word) -> Word { unsafe { - let mut ret_area = ::core::mem::MaybeUninit::<(StorageCommitmentRoot, Word)>::uninit(); + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + let (prefix, suffix) = slot_id.to_prefix_suffix(); extern_set_storage_map_item( - index.into(), + prefix, + suffix, key[3], key[2], key[1], @@ -193,7 +204,6 @@ pub fn set_map_item(index: u8, key: Word, value: Word) -> (StorageCommitmentRoot value[0], ret_area.as_mut_ptr(), ); - let (comm, value) = ret_area.assume_init(); - (comm.reverse(), value.reverse()) + ret_area.assume_init().reverse() } } diff --git a/sdk/base-sys/src/bindings/tx.rs b/sdk/base-sys/src/bindings/tx.rs index 153d84c68..0d7c212e4 100644 --- a/sdk/base-sys/src/bindings/tx.rs +++ b/sdk/base-sys/src/bindings/tx.rs @@ -2,31 +2,31 @@ use miden_stdlib_sys::{Felt, Word}; #[allow(improper_ctypes)] unsafe extern "C" { - #[link_name = "miden::tx::get_block_number"] + #[link_name = "miden::protocol::tx::get_block_number"] pub fn extern_tx_get_block_number() -> Felt; - #[link_name = "miden::tx::get_block_commitment"] + #[link_name = "miden::protocol::tx::get_block_commitment"] pub fn extern_tx_get_block_commitment(ptr: *mut Word); - #[link_name = "miden::tx::get_block_timestamp"] + #[link_name = "miden::protocol::tx::get_block_timestamp"] pub fn extern_tx_get_block_timestamp() -> Felt; - #[link_name = "miden::tx::get_input_notes_commitment"] + #[link_name = "miden::protocol::tx::get_input_notes_commitment"] pub fn extern_tx_get_input_notes_commitment(ptr: *mut Word); - #[link_name = "miden::tx::get_output_notes_commitment"] + #[link_name = "miden::protocol::tx::get_output_notes_commitment"] pub fn extern_tx_get_output_notes_commitment(ptr: *mut Word); - #[link_name = "miden::tx::get_num_input_notes"] + #[link_name = "miden::protocol::tx::get_num_input_notes"] pub fn extern_tx_get_num_input_notes() -> Felt; - #[link_name = "miden::tx::get_num_output_notes"] + #[link_name = "miden::protocol::tx::get_num_output_notes"] pub fn extern_tx_get_num_output_notes() -> Felt; - #[link_name = "miden::tx::get_expiration_block_delta"] + #[link_name = "miden::protocol::tx::get_expiration_block_delta"] pub fn extern_tx_get_expiration_block_delta() -> Felt; - #[link_name = "miden::tx::update_expiration_block_delta"] + #[link_name = "miden::protocol::tx::update_expiration_block_delta"] pub fn extern_tx_update_expiration_block_delta(delta: Felt); } diff --git a/sdk/base-sys/src/bindings/types.rs b/sdk/base-sys/src/bindings/types.rs index 739b24403..1128d7104 100644 --- a/sdk/base-sys/src/bindings/types.rs +++ b/sdk/base-sys/src/bindings/types.rs @@ -2,22 +2,51 @@ extern crate alloc; use alloc::vec::Vec; -use miden_stdlib_sys::{Digest, Felt, Word, felt, hash_elements, intrinsics::crypto::merge}; +use miden_field_repr::FromFeltRepr; +use miden_stdlib_sys::{Digest, Felt, Word, hash_elements, intrinsics::crypto::merge}; -#[allow(unused)] -#[derive(Copy, Clone, Debug, PartialEq, Eq)] +/// Unique identifier for a Miden account, composed of two field elements. +#[derive(Copy, Clone, Debug, PartialEq, Eq, FromFeltRepr)] pub struct AccountId { pub prefix: Felt, pub suffix: Felt, } impl AccountId { - /// Creates a new AccountId from prefix and suffix Felt values - pub fn from(prefix: Felt, suffix: Felt) -> Self { + /// Creates a new AccountId from prefix and suffix Felt values. + pub fn new(prefix: Felt, suffix: Felt) -> Self { Self { prefix, suffix } } } +/// A fungible or a non-fungible asset. +/// +/// All assets are encoded using a single word (4 elements) such that it is easy to determine the +/// type of an asset both inside and outside Miden VM. Specifically: +/// +/// Element 1 of the asset will be: +/// - ZERO for a fungible asset. +/// - non-ZERO for a non-fungible asset. +/// +/// Element 3 of both asset types is the prefix of an +/// [`AccountId`], which can be used to distinguish assets. +/// +/// The methodology for constructing fungible and non-fungible assets is described below. +/// +/// # Fungible assets +/// +/// - A fungible asset's data layout is: `[amount, 0, faucet_id_suffix, faucet_id_prefix]`. +/// +/// # Non-fungible assets +/// +/// - A non-fungible asset's data layout is: `[hash0, hash1, hash2, faucet_id_prefix]`. +/// +/// The 4 elements of non-fungible assets are computed as follows: +/// - First the asset data is hashed. This compresses an asset of an arbitrary length to 4 field +/// elements: `[hash0, hash1, hash2, hash3]`. +/// - `hash3` is then replaced with the prefix of the faucet ID (`faucet_id_prefix`) which issues +/// the asset: `[hash0, hash1, hash2, faucet_id_prefix]`. +/// #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(transparent)] pub struct Asset { @@ -74,28 +103,49 @@ pub struct Recipient { impl Recipient { /// Computes a recipient digest from the provided components. /// - /// The `padded_inputs` must be padded with ZEROs to the next multiple of 8 (i.e. 2-word - /// aligned). For example, to pass two inputs `a` and `b`, use: - /// `vec![a, b, felt!(0), felt!(0), felt!(0), felt!(0), felt!(0), felt!(0)]`. + /// This matches the Miden protocol note recipient digest: + /// `hash(hash(hash(serial_num, [0; 4]), script_root), inputs_commitment)`. /// - /// # Panics - /// Panics if `padded_inputs.len()` is not a multiple of 8. - pub fn compute(serial_num: Word, script_digest: Digest, padded_inputs: Vec) -> Self { - assert!( - padded_inputs.len().is_multiple_of(8), - "`padded_inputs` length must be a multiple of 8" - ); - - let empty_word = Word::new([felt!(0), felt!(0), felt!(0), felt!(0)]); + /// Where `inputs_commitment` is the RPO256 hash of the provided `inputs`. + pub fn compute(serial_num: Word, script_digest: Digest, inputs: Vec) -> Self { + let empty_word = Word::from_u64_unchecked(0, 0, 0, 0); let serial_num_hash = merge([Digest::from_word(serial_num), Digest::from_word(empty_word)]); let merge_script = merge([serial_num_hash, script_digest]); - let digest: Word = merge([merge_script, hash_elements(padded_inputs)]).into(); + let digest: Word = merge([merge_script, hash_elements(inputs)]).into(); Self { inner: digest } } } +/// The note metadata returned by `*_note::get_metadata` procedures. +/// +/// In the Miden protocol, metadata retrieval returns both the note attachment and the metadata +/// header as separate words. +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +#[repr(C)] +pub struct NoteMetadata { + /// The attachment of the note. + pub attachment: Word, + /// The metadata header of the note. + pub header: Word, +} + +impl NoteMetadata { + /// Creates a new [`NoteMetadata`] from attachment and header. + pub fn new(attachment: Word, header: Word) -> Self { + Self { attachment, header } + } + + #[inline] + pub(crate) fn reverse(self) -> Self { + Self { + attachment: self.attachment.reverse(), + header: self.header.reverse(), + } + } +} + impl From<[Felt; 4]> for Recipient { fn from(value: [Felt; 4]) -> Self { Recipient { @@ -140,13 +190,46 @@ impl From for NoteType { } } -#[derive(Clone, Debug, PartialEq, Eq)] -#[repr(transparent)] -pub struct StorageCommitmentRoot(Word); +/// The partial hash of a storage slot name. +/// +/// A slot id consists of two field elements: a `prefix` and a `suffix`. +/// +/// Slot ids uniquely identify slots in account storage and are used by the host functions exposed +/// via `miden::protocol::*`. +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] +pub struct StorageSlotId { + suffix: Felt, + prefix: Felt, +} -impl StorageCommitmentRoot { - #[inline] - pub(crate) fn reverse(&self) -> StorageCommitmentRoot { - Self(self.0.reverse()) +impl StorageSlotId { + /// Creates a new [`StorageSlotId`] from the provided felts. + /// + /// Note: this constructor takes `(suffix, prefix)` to match the values returned by + /// `miden_protocol::account::StorageSlotId::{suffix,prefix}`. + pub fn new(suffix: Felt, prefix: Felt) -> Self { + Self { suffix, prefix } + } + + /// Creates a new [`StorageSlotId`] from the provided felts in host-call order. + /// + /// Host functions take the `prefix` first and then the `suffix`. + pub fn from_prefix_suffix(prefix: Felt, suffix: Felt) -> Self { + Self { suffix, prefix } + } + + /// Returns the `(prefix, suffix)` pair in host-call order. + pub fn to_prefix_suffix(&self) -> (Felt, Felt) { + (self.prefix, self.suffix) + } + + /// Returns the suffix of the [`StorageSlotId`]. + pub fn suffix(&self) -> Felt { + self.suffix + } + + /// Returns the prefix of the [`StorageSlotId`]. + pub fn prefix(&self) -> Felt { + self.prefix } } diff --git a/sdk/base-sys/stubs/active_account.rs b/sdk/base-sys/stubs/active_account.rs index a1bd01157..932f0b9ca 100644 --- a/sdk/base-sys/stubs/active_account.rs +++ b/sdk/base-sys/stubs/active_account.rs @@ -1,53 +1,58 @@ use core::ffi::c_void; -#[unsafe(export_name = "miden::active_account::get_id")] +#[unsafe(export_name = "miden::protocol::active_account::get_id")] pub extern "C" fn active_account_get_id_plain(_out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::active_account::get_nonce")] +#[unsafe(export_name = "miden::protocol::active_account::get_nonce")] pub extern "C" fn active_account_get_nonce_plain() -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::active_account::get_initial_commitment")] +#[unsafe(export_name = "miden::protocol::active_account::get_initial_commitment")] pub extern "C" fn active_account_get_initial_commitment_plain(_out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::active_account::compute_commitment")] +#[unsafe(export_name = "miden::protocol::active_account::compute_commitment")] pub extern "C" fn active_account_compute_commitment_plain(_out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::active_account::get_code_commitment")] +#[unsafe(export_name = "miden::protocol::active_account::get_code_commitment")] pub extern "C" fn active_account_get_code_commitment_plain(_out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::active_account::get_initial_storage_commitment")] +#[unsafe(export_name = "miden::protocol::active_account::get_initial_storage_commitment")] pub extern "C" fn active_account_get_initial_storage_commitment_plain(_out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::active_account::compute_storage_commitment")] +#[unsafe(export_name = "miden::protocol::active_account::compute_storage_commitment")] pub extern "C" fn active_account_compute_storage_commitment_plain(_out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::active_account::get_item")] -pub extern "C" fn active_account_get_item_plain(_index: f32, _out: *mut c_void) { +#[unsafe(export_name = "miden::protocol::active_account::get_item")] +pub extern "C" fn active_account_get_item_plain(_index_prefix: f32, _index_suffix: f32, _out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::active_account::get_initial_item")] -pub extern "C" fn active_account_get_initial_item_plain(_index: f32, _out: *mut c_void) { +#[unsafe(export_name = "miden::protocol::active_account::get_initial_item")] +pub extern "C" fn active_account_get_initial_item_plain( + _index_prefix: f32, + _index_suffix: f32, + _out: *mut c_void, +) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::active_account::get_map_item")] +#[unsafe(export_name = "miden::protocol::active_account::get_map_item")] pub extern "C" fn active_account_get_map_item_plain( - _index: f32, + _index_prefix: f32, + _index_suffix: f32, _k0: f32, _k1: f32, _k2: f32, @@ -57,9 +62,10 @@ pub extern "C" fn active_account_get_map_item_plain( unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::active_account::get_initial_map_item")] +#[unsafe(export_name = "miden::protocol::active_account::get_initial_map_item")] pub extern "C" fn active_account_get_initial_map_item_plain( - _index: f32, + _index_prefix: f32, + _index_suffix: f32, _k0: f32, _k1: f32, _k2: f32, @@ -69,17 +75,17 @@ pub extern "C" fn active_account_get_initial_map_item_plain( unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::active_account::get_balance")] +#[unsafe(export_name = "miden::protocol::active_account::get_balance")] pub extern "C" fn active_account_get_balance_plain(_prefix: f32, _suffix: f32) -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::active_account::get_initial_balance")] +#[unsafe(export_name = "miden::protocol::active_account::get_initial_balance")] pub extern "C" fn active_account_get_initial_balance_plain(_prefix: f32, _suffix: f32) -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::active_account::has_non_fungible_asset")] +#[unsafe(export_name = "miden::protocol::active_account::has_non_fungible_asset")] pub extern "C" fn active_account_has_non_fungible_asset_plain( _a0: f32, _a1: f32, @@ -89,27 +95,27 @@ pub extern "C" fn active_account_has_non_fungible_asset_plain( unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::active_account::get_initial_vault_root")] +#[unsafe(export_name = "miden::protocol::active_account::get_initial_vault_root")] pub extern "C" fn active_account_get_initial_vault_root_plain(_out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::active_account::get_vault_root")] +#[unsafe(export_name = "miden::protocol::active_account::get_vault_root")] pub extern "C" fn active_account_get_vault_root_plain(_out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::active_account::get_num_procedures")] +#[unsafe(export_name = "miden::protocol::active_account::get_num_procedures")] pub extern "C" fn active_account_get_num_procedures_plain() -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::active_account::get_procedure_root")] +#[unsafe(export_name = "miden::protocol::active_account::get_procedure_root")] pub extern "C" fn active_account_get_procedure_root_plain(_index: f32, _out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::active_account::has_procedure")] +#[unsafe(export_name = "miden::protocol::active_account::has_procedure")] pub extern "C" fn active_account_has_procedure_plain( _r0: f32, _r1: f32, diff --git a/sdk/base-sys/stubs/active_note.rs b/sdk/base-sys/stubs/active_note.rs index 87ca01732..eab019f58 100644 --- a/sdk/base-sys/stubs/active_note.rs +++ b/sdk/base-sys/stubs/active_note.rs @@ -1,42 +1,37 @@ use core::ffi::c_void; /// Note interface stubs -#[unsafe(export_name = "miden::active_note::get_inputs")] +#[unsafe(export_name = "miden::protocol::active_note::get_inputs")] pub extern "C" fn note_get_inputs_plain(_ptr: *mut c_void) -> usize { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::active_note::get_assets")] +#[unsafe(export_name = "miden::protocol::active_note::get_assets")] pub extern "C" fn note_get_assets_plain(_ptr: *mut c_void) -> usize { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::active_note::get_sender")] +#[unsafe(export_name = "miden::protocol::active_note::get_sender")] pub extern "C" fn note_get_sender_plain(_ptr: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::active_note::get_recipient")] +#[unsafe(export_name = "miden::protocol::active_note::get_recipient")] pub extern "C" fn note_get_recipient_plain(_ptr: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::active_note::get_script_root")] +#[unsafe(export_name = "miden::protocol::active_note::get_script_root")] pub extern "C" fn note_get_script_root_plain(_ptr: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::active_note::get_serial_number")] +#[unsafe(export_name = "miden::protocol::active_note::get_serial_number")] pub extern "C" fn note_get_serial_number_plain(_ptr: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::active_note::get_metadata")] +#[unsafe(export_name = "miden::protocol::active_note::get_metadata")] pub extern "C" fn note_get_metadata_plain(_ptr: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } - -#[unsafe(export_name = "miden::active_note::add_assets_to_account")] -pub extern "C" fn note_add_assets_to_account_plain() { - unsafe { core::hint::unreachable_unchecked() } -} diff --git a/sdk/base-sys/stubs/asset.rs b/sdk/base-sys/stubs/asset.rs index ef9b03ad4..1d417f379 100644 --- a/sdk/base-sys/stubs/asset.rs +++ b/sdk/base-sys/stubs/asset.rs @@ -1,6 +1,6 @@ use core::ffi::c_void; -#[unsafe(export_name = "miden::asset::build_fungible_asset")] +#[unsafe(export_name = "miden::protocol::asset::build_fungible_asset")] pub extern "C" fn asset_build_fungible_asset_plain( _prefix: f32, _suffix: f32, @@ -10,7 +10,7 @@ pub extern "C" fn asset_build_fungible_asset_plain( unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::asset::build_non_fungible_asset")] +#[unsafe(export_name = "miden::protocol::asset::build_non_fungible_asset")] pub extern "C" fn asset_build_non_fungible_asset_plain( _prefix: f32, _h0: f32, diff --git a/sdk/base-sys/stubs/faucet.rs b/sdk/base-sys/stubs/faucet.rs index 09514bffa..58e705470 100644 --- a/sdk/base-sys/stubs/faucet.rs +++ b/sdk/base-sys/stubs/faucet.rs @@ -1,11 +1,11 @@ use core::ffi::c_void; -#[unsafe(export_name = "miden::faucet::create_fungible_asset")] +#[unsafe(export_name = "miden::protocol::faucet::create_fungible_asset")] pub extern "C" fn faucet_create_fungible_asset_plain(_amount: f32, _out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::faucet::create_non_fungible_asset")] +#[unsafe(export_name = "miden::protocol::faucet::create_non_fungible_asset")] pub extern "C" fn faucet_create_non_fungible_asset_plain( _h0: f32, _h1: f32, @@ -16,22 +16,22 @@ pub extern "C" fn faucet_create_non_fungible_asset_plain( unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::faucet::mint")] +#[unsafe(export_name = "miden::protocol::faucet::mint")] pub extern "C" fn faucet_mint_plain(_a0: f32, _a1: f32, _a2: f32, _a3: f32, _out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::faucet::burn")] +#[unsafe(export_name = "miden::protocol::faucet::burn")] pub extern "C" fn faucet_burn_plain(_a0: f32, _a1: f32, _a2: f32, _a3: f32, _out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::faucet::get_total_issuance")] +#[unsafe(export_name = "miden::protocol::faucet::get_total_issuance")] pub extern "C" fn faucet_get_total_issuance_plain() -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::faucet::is_non_fungible_asset_issued")] +#[unsafe(export_name = "miden::protocol::faucet::is_non_fungible_asset_issued")] pub extern "C" fn faucet_is_non_fungible_asset_issued_plain( _a0: f32, _a1: f32, diff --git a/sdk/base-sys/stubs/input_note.rs b/sdk/base-sys/stubs/input_note.rs index 1aea9aae1..9ab9a210a 100644 --- a/sdk/base-sys/stubs/input_note.rs +++ b/sdk/base-sys/stubs/input_note.rs @@ -1,42 +1,42 @@ use core::ffi::c_void; /// Input note interface stubs -#[unsafe(export_name = "miden::input_note::get_assets_info")] +#[unsafe(export_name = "miden::protocol::input_note::get_assets_info")] pub extern "C" fn input_note_get_assets_info_plain(_note_index: f32, _out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::input_note::get_assets")] +#[unsafe(export_name = "miden::protocol::input_note::get_assets")] pub extern "C" fn input_note_get_assets_plain(_dest_ptr: *mut c_void, _note_index: f32) -> usize { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::input_note::get_recipient")] +#[unsafe(export_name = "miden::protocol::input_note::get_recipient")] pub extern "C" fn input_note_get_recipient_plain(_note_index: f32, _out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::input_note::get_metadata")] +#[unsafe(export_name = "miden::protocol::input_note::get_metadata")] pub extern "C" fn input_note_get_metadata_plain(_note_index: f32, _out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::input_note::get_sender")] +#[unsafe(export_name = "miden::protocol::input_note::get_sender")] pub extern "C" fn input_note_get_sender_plain(_note_index: f32, _out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::input_note::get_inputs_info")] +#[unsafe(export_name = "miden::protocol::input_note::get_inputs_info")] pub extern "C" fn input_note_get_inputs_info_plain(_note_index: f32, _out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::input_note::get_script_root")] +#[unsafe(export_name = "miden::protocol::input_note::get_script_root")] pub extern "C" fn input_note_get_script_root_plain(_note_index: f32, _out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::input_note::get_serial_number")] +#[unsafe(export_name = "miden::protocol::input_note::get_serial_number")] pub extern "C" fn input_note_get_serial_number_plain(_note_index: f32, _out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } diff --git a/sdk/base-sys/stubs/native_account.rs b/sdk/base-sys/stubs/native_account.rs index 99a8c27aa..a153e6c18 100644 --- a/sdk/base-sys/stubs/native_account.rs +++ b/sdk/base-sys/stubs/native_account.rs @@ -1,6 +1,6 @@ use core::ffi::c_void; -#[unsafe(export_name = "miden::native_account::add_asset")] +#[unsafe(export_name = "miden::protocol::native_account::add_asset")] pub extern "C" fn native_account_add_asset_plain( _a0: f32, _a1: f32, @@ -11,7 +11,7 @@ pub extern "C" fn native_account_add_asset_plain( unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::native_account::remove_asset")] +#[unsafe(export_name = "miden::protocol::native_account::remove_asset")] pub extern "C" fn native_account_remove_asset_plain( _a0: f32, _a1: f32, @@ -22,19 +22,20 @@ pub extern "C" fn native_account_remove_asset_plain( unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::native_account::incr_nonce")] +#[unsafe(export_name = "miden::protocol::native_account::incr_nonce")] pub extern "C" fn native_account_incr_nonce_plain() -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::native_account::compute_delta_commitment")] +#[unsafe(export_name = "miden::protocol::native_account::compute_delta_commitment")] pub extern "C" fn native_account_compute_delta_commitment_plain(_out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::native_account::set_item")] +#[unsafe(export_name = "miden::protocol::native_account::set_item")] pub extern "C" fn native_account_set_item_plain( - _index: f32, + _index_prefix: f32, + _index_suffix: f32, _v0: f32, _v1: f32, _v2: f32, @@ -44,9 +45,10 @@ pub extern "C" fn native_account_set_item_plain( unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::native_account::set_map_item")] +#[unsafe(export_name = "miden::protocol::native_account::set_map_item")] pub extern "C" fn native_account_set_map_item_plain( - _index: f32, + _index_prefix: f32, + _index_suffix: f32, _k0: f32, _k1: f32, _k2: f32, @@ -60,7 +62,7 @@ pub extern "C" fn native_account_set_map_item_plain( unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::native_account::was_procedure_called")] +#[unsafe(export_name = "miden::protocol::native_account::was_procedure_called")] pub extern "C" fn native_account_was_procedure_called_plain( _r0: f32, _r1: f32, diff --git a/sdk/base-sys/stubs/output_note.rs b/sdk/base-sys/stubs/output_note.rs index 6a502ea94..70ddbd16f 100644 --- a/sdk/base-sys/stubs/output_note.rs +++ b/sdk/base-sys/stubs/output_note.rs @@ -1,12 +1,10 @@ use core::ffi::c_void; /// Output note interface stubs -#[unsafe(export_name = "miden::output_note::create")] +#[unsafe(export_name = "miden::protocol::output_note::create")] pub extern "C" fn output_note_create_plain( _tag: f32, - _aux: f32, _note_type: f32, - _execution_hint: f32, _r0: f32, _r1: f32, _r2: f32, @@ -15,7 +13,7 @@ pub extern "C" fn output_note_create_plain( unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::output_note::add_asset")] +#[unsafe(export_name = "miden::protocol::output_note::add_asset")] pub extern "C" fn output_note_add_asset_plain( _a0: f32, _a1: f32, @@ -26,22 +24,59 @@ pub extern "C" fn output_note_add_asset_plain( unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::output_note::get_assets_info")] +#[unsafe(export_name = "miden::protocol::output_note::get_assets_info")] pub extern "C" fn output_note_get_assets_info_plain(_note_index: f32, _out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::output_note::get_assets")] +#[unsafe(export_name = "miden::protocol::output_note::get_assets")] pub extern "C" fn output_note_get_assets_plain(_dest_ptr: *mut c_void, _note_index: f32) -> usize { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::output_note::get_recipient")] +#[unsafe(export_name = "miden::protocol::output_note::get_recipient")] pub extern "C" fn output_note_get_recipient_plain(_note_index: f32, _out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::output_note::get_metadata")] +#[unsafe(export_name = "miden::protocol::output_note::get_metadata")] pub extern "C" fn output_note_get_metadata_plain(_note_index: f32, _out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } + +#[unsafe(export_name = "miden::protocol::output_note::set_attachment")] +pub extern "C" fn output_note_set_attachment_plain( + _note_index: f32, + _attachment_scheme: f32, + _attachment_kind: f32, + _a0: f32, + _a1: f32, + _a2: f32, + _a3: f32, +) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[unsafe(export_name = "miden::protocol::output_note::set_word_attachment")] +pub extern "C" fn output_note_set_word_attachment_plain( + _note_index: f32, + _attachment_scheme: f32, + _a0: f32, + _a1: f32, + _a2: f32, + _a3: f32, +) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[unsafe(export_name = "miden::protocol::output_note::set_array_attachment")] +pub extern "C" fn output_note_set_array_attachment_plain( + _note_index: f32, + _attachment_scheme: f32, + _a0: f32, + _a1: f32, + _a2: f32, + _a3: f32, +) { + unsafe { core::hint::unreachable_unchecked() } +} diff --git a/sdk/base-sys/stubs/tx.rs b/sdk/base-sys/stubs/tx.rs index 1112865c0..1d76fba0e 100644 --- a/sdk/base-sys/stubs/tx.rs +++ b/sdk/base-sys/stubs/tx.rs @@ -1,46 +1,46 @@ use core::ffi::c_void; -#[unsafe(export_name = "miden::tx::get_block_number")] +#[unsafe(export_name = "miden::protocol::tx::get_block_number")] pub extern "C" fn tx_get_block_number_plain() -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::tx::get_block_commitment")] +#[unsafe(export_name = "miden::protocol::tx::get_block_commitment")] pub extern "C" fn tx_get_block_commitment_plain(_out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::tx::get_block_timestamp")] +#[unsafe(export_name = "miden::protocol::tx::get_block_timestamp")] pub extern "C" fn tx_get_block_timestamp_plain() -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::tx::get_input_notes_commitment")] +#[unsafe(export_name = "miden::protocol::tx::get_input_notes_commitment")] pub extern "C" fn tx_get_input_notes_commitment_plain(_out: *mut core::ffi::c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::tx::get_output_notes_commitment")] +#[unsafe(export_name = "miden::protocol::tx::get_output_notes_commitment")] pub extern "C" fn tx_get_output_notes_commitment_plain(_out: *mut core::ffi::c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::tx::get_num_input_notes")] +#[unsafe(export_name = "miden::protocol::tx::get_num_input_notes")] pub extern "C" fn tx_get_num_input_notes_plain() -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::tx::get_num_output_notes")] +#[unsafe(export_name = "miden::protocol::tx::get_num_output_notes")] pub extern "C" fn tx_get_num_output_notes_plain() -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::tx::get_expiration_block_delta")] +#[unsafe(export_name = "miden::protocol::tx::get_expiration_block_delta")] pub extern "C" fn tx_get_expiration_block_delta_plain() -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "miden::tx::update_expiration_block_delta")] +#[unsafe(export_name = "miden::protocol::tx::update_expiration_block_delta")] pub extern "C" fn tx_update_expiration_block_delta_plain(_delta: f32) { unsafe { core::hint::unreachable_unchecked() } } diff --git a/sdk/base/Cargo.toml b/sdk/base/Cargo.toml index c340f6400..ab6782328 100644 --- a/sdk/base/Cargo.toml +++ b/sdk/base/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "miden-base" description = "Miden rollup Rust SDK" -version = "0.8.0" +version = "0.10.0" rust-version.workspace = true authors.workspace = true repository.workspace = true @@ -12,9 +12,8 @@ readme.workspace = true edition.workspace = true [dependencies] -miden-base-sys = { version = "0.8.0", path = "../base-sys" } -miden-stdlib-sys = { version = "0.8.0", path = "../stdlib-sys" } -miden-base-macros = { version = "0.8.0", path = "../base-macros" } +miden-base-sys = { version = "0.10.0", path = "../base-sys" } +miden-stdlib-sys = { version = "0.10.0", path = "../stdlib-sys" } [features] default = [] diff --git a/sdk/base/src/lib.rs b/sdk/base/src/lib.rs index 7f1f3b934..716c2c4a0 100644 --- a/sdk/base/src/lib.rs +++ b/sdk/base/src/lib.rs @@ -2,5 +2,4 @@ mod types; -pub use miden_base_macros::{component, export_type, generate, note_script, tx_script}; pub use types::*; diff --git a/sdk/base/src/types/storage.rs b/sdk/base/src/types/storage.rs index 695c43ea9..ee5538ce6 100644 --- a/sdk/base/src/types/storage.rs +++ b/sdk/base/src/types/storage.rs @@ -1,13 +1,15 @@ -use miden_base_sys::bindings::{StorageCommitmentRoot, storage}; +use miden_base_sys::bindings::{StorageSlotId, storage}; use miden_stdlib_sys::Word; pub trait ValueAccess { + /// Reads the current value from account storage. fn read(&self) -> V; - fn write(&mut self, value: V) -> (StorageCommitmentRoot, V); + /// Writes a new value into account storage and returns the previous value. + fn write(&mut self, value: V) -> V; } pub struct Value { - pub slot: u8, + pub slot: StorageSlotId, } impl + From> ValueAccess for Value { @@ -17,26 +19,22 @@ impl + From> ValueAccess for Value { storage::get_item(self.slot).into() } - /// Sets an item `value` in the account storage and returns (new_root, old_value) - /// Where: - /// - new_root is the new storage commitment. - /// - old_value is the previous value of the item. + /// Sets an item `value` in the account storage and returns the previous value. #[inline(always)] - fn write(&mut self, value: V) -> (StorageCommitmentRoot, V) { - let (root, old_word) = storage::set_item(self.slot, value.into()); - (root, old_word.into()) + fn write(&mut self, value: V) -> V { + storage::set_item(self.slot, value.into()).into() } } pub trait StorageMapAccess { /// Returns a map item value for `key` from the account storage. fn get(&self, key: &K) -> V; - /// Sets a map item `value` for `key` in the account storage and returns (old_root, old_value) - fn set(&mut self, key: K, value: V) -> (StorageCommitmentRoot, V); + /// Sets a map item `value` for `key` in the account storage and returns the old value. + fn set(&mut self, key: K, value: V) -> V; } pub struct StorageMap { - pub slot: u8, + pub slot: StorageSlotId, } impl + AsRef, V: From + Into> StorageMapAccess @@ -48,13 +46,9 @@ impl + AsRef, V: From + Into> StorageMapAccess (StorageCommitmentRoot, V) { - let (root, old_word) = storage::set_map_item(self.slot, key.into(), value.into()); - (root, old_word.into()) + fn set(&mut self, key: K, value: V) -> V { + storage::set_map_item(self.slot, key.into(), value.into()).into() } } diff --git a/sdk/field-repr/derive/Cargo.toml b/sdk/field-repr/derive/Cargo.toml new file mode 100644 index 000000000..d515d4859 --- /dev/null +++ b/sdk/field-repr/derive/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "miden-field-repr-derive" +description = "Derive macros for felt representation serialization/deserialization" +version = "0.10.0" +rust-version.workspace = true +authors.workspace = true +repository.workspace = true +categories.workspace = true +keywords.workspace = true +license.workspace = true +readme = "README.md" +edition.workspace = true + +[lib] +proc-macro = true + +[dependencies] +proc-macro2.workspace = true +quote.workspace = true +syn.workspace = true diff --git a/sdk/field-repr/derive/README.md b/sdk/field-repr/derive/README.md new file mode 100644 index 000000000..aa241d1b4 --- /dev/null +++ b/sdk/field-repr/derive/README.md @@ -0,0 +1,111 @@ +# `miden-field-repr-derive` + +Derive macros used by `miden-field-repr` to implement serialization/deserialization to a flat +sequence of `Felt` elements (“felt repr”). + +## Usage + +This crate is not typically used directly. Instead, depend on `miden-field-repr` and derive the +traits re-exported by that crate. + +### Struct example + +```rust +use miden_field::Felt; +use miden_field_repr::{FromFeltRepr, ToFeltRepr}; + +#[derive(Debug, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct AccountId { + prefix: Felt, + suffix: Felt, +} + +let value = AccountId { + prefix: Felt::from_u64_unchecked(1), + suffix: Felt::from_u64_unchecked(2), +}; +let felts = value.to_felt_repr(); +let roundtrip = AccountId::from(felts.as_slice()); +assert_eq!(roundtrip, value); +``` + +### Enum example + +```rust +use miden_field::Felt; +use miden_field_repr::{FromFeltRepr, ToFeltRepr}; + +#[derive(Debug, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +enum Message { + Ping, + Transfer { to: Felt, amount: u32 }, +} + +// Encoded as: [tag, payload...], where `tag` is the variant ordinal in declaration order. +// Ping -> tag = 0 +// Transfer -> tag = 1 +let value = Message::Transfer { + to: Felt::from_u64_unchecked(7), + amount: 10, +}; +let felts = value.to_felt_repr(); +let roundtrip = Message::from(felts.as_slice()); +assert_eq!(roundtrip, value); +``` + +## Felt-repr format + +The felt representation of a value is a flat, ordered sequence of field elements (`Felt`). The +encoding is **not** self-describing: it does not include field names, variant names, or schema +metadata. + +### Primitives + +Provided by the runtime crates: + +- `Felt`: 1 felt +- `u64`: 2 felts (low `u32`, then high `u32`) +- `u32`, `u8`: 1 felt +- `bool`: 1 felt (`0` = `false`, non-zero = `true`) + +### Structs + +Only structs with **named fields** are supported. + +Encoding is the concatenation of field encodings in **declaration order**: + +`struct S { a: A, b: B }` → `A` then `B` + +Important: **field order is part of the wire format**. Reordering fields (or inserting a field in +the middle) changes the encoding and breaks compatibility. + +### Enums + +Enums are encoded as: + +`tag: u32` (variant ordinal starting at `0` in **declaration order**) followed by the selected +variant payload encoded in declaration order. + +- Unit variants have no payload. +- Tuple variants serialize their fields left-to-right. +- Struct variants serialize their named fields in declaration order. + +Important: **variant order is part of the wire format**. Reordering variants (or inserting new +variants before existing ones) changes the tag values and breaks compatibility. + +Current limitation: explicit discriminants are not supported; tags are always ordinals. + +### Nesting + +Fields may themselves be types that implement `ToFeltRepr`/`FromFeltRepr`. Nested encodings are +simply concatenated. + +## Unsupported items + +- Tuple structs and unit structs +- Unions + +## Compatibility note + +If you need evolvable formats, add an explicit version field and/or build a schema layer on top; +this crate intentionally keeps the encoding minimal and order-dependent. diff --git a/sdk/field-repr/derive/src/lib.rs b/sdk/field-repr/derive/src/lib.rs new file mode 100644 index 000000000..d16e8e0ea --- /dev/null +++ b/sdk/field-repr/derive/src/lib.rs @@ -0,0 +1,467 @@ +//! Derive macros for felt representation serialization/deserialization. +//! +//! This crate provides proc-macros used by `miden-field-repr` to derive `ToFeltRepr`/`FromFeltRepr` +//! implementations for user-defined types. +//! +//! # Usage +//! +//! This crate is not typically used directly. Instead, depend on `miden-field-repr` and derive the +//! traits re-exported by that crate. +//! +//! ## Struct example +//! +//! ```ignore +//! use miden_field_repr::{FromFeltRepr, ToFeltRepr}; +//! use miden_core::Felt; +//! +//! #[derive(Debug, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +//! struct AccountId { +//! prefix: Felt, +//! suffix: Felt, +//! } +//! +//! let value = AccountId { prefix: Felt::new(1), suffix: Felt::new(2) }; +//! let felts = value.to_felt_repr(); +//! let roundtrip = AccountId::from(felts.as_slice()); +//! assert_eq!(roundtrip, value); +//! ``` +//! +//! ## Enum example +//! +//! ```ignore +//! use miden_field_repr::{FromFeltRepr, ToFeltRepr}; +//! use miden_core::Felt; +//! +//! #[derive(Debug, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +//! enum Message { +//! Ping, +//! Transfer { to: Felt, amount: u32 }, +//! } +//! +//! // Encoded as: [tag, payload...], where `tag` is the variant ordinal in declaration order. +//! // Ping -> tag = 0 +//! // Transfer -> tag = 1 +//! let value = Message::Transfer { to: Felt::new(7), amount: 10 }; +//! let felts = value.to_felt_repr(); +//! let roundtrip = Message::from(felts.as_slice()); +//! assert_eq!(roundtrip, value); +//! ``` +//! +//! # Felt-repr format +//! +//! The *felt representation* of a value is a flat sequence of field elements (`Felt`). The format +//! is intentionally simple: it is just a concatenation of the encodings of each component, with no +//! self-describing schema, no field names, and no length prefixes unless the type itself contains +//! them. +//! +//! ## Primitives +//! +//! The following primitive encodings are provided by the runtime crates: +//! +//! - `Felt`: encoded as a single `Felt` +//! - `u64`: encoded as 2 `Felt`s (low `u32`, then high `u32`) +//! - `u32`, `u8`: encoded as a single `Felt` +//! - `bool`: encoded as a single `Felt` (`0` = `false`, non-zero = `true`) +//! +//! ## Structs +//! +//! Named-field structs are encoded by serializing fields in *declaration order*: +//! +//! `struct S { a: A, b: B }` → `A` then `B` +//! +//! Tuple structs are encoded by serializing fields left-to-right: +//! +//! `struct T(A, B)` → `A` then `B` +//! +//! Important: the field order is part of the wire format. Reordering fields (or inserting a field +//! in the middle) changes the encoding and will break compatibility with existing data. +//! +//! Current limitations: +//! - Unit structs are not supported. +//! +//! ## Enums +//! +//! Enums are encoded as: +//! +//! `tag: u32` (variant ordinal, starting at `0`, in *declaration order*) followed by the selected +//! variant payload (if any), encoded in declaration order. +//! +//! - Unit variants add no payload. +//! - Tuple variants serialize their fields left-to-right. +//! - Struct variants serialize their named fields in declaration order. +//! +//! Important: the **variant order is part of the wire format**. Reordering variants (or inserting +//! a new variant before existing ones) changes the tag values and will break compatibility. +//! +//! Current limitations: +//! - Explicit discriminants are not supported (e.g. `Foo = 10`); tags are always ordinals. +//! +//! ## Nesting +//! +//! Struct/enum fields may themselves be structs/enums (or other types) that implement +//! `ToFeltRepr`/`FromFeltRepr`. The overall encoding is always the concatenation of the nested +//! encodings. +//! +//! ## Unsupported items +//! +//! - Unions are not supported. +//! +//! ## Compatibility note +//! +//! Since the format is not self-describing, keeping field/variant order stable is required for +//! forward/backward compatibility. If you need evolution, introduce an explicit version field or a +//! dedicated schema layer on top. + +#![deny(warnings)] + +extern crate proc_macro; + +use proc_macro::TokenStream; +use proc_macro2::TokenStream as TokenStream2; +use quote::{format_ident, quote}; +use syn::{ + Data, DeriveInput, Error, Field, Fields, Index, Variant, parse_macro_input, + punctuated::Punctuated, spanned::Spanned, token::Comma, +}; + +/// Field list extracted from a struct, either named or tuple-style. +enum StructFields<'a> { + Named(&'a Punctuated), + Unnamed(&'a Punctuated), +} + +/// Extracts fields from a struct, returning an error for unsupported items. +fn extract_struct_fields<'a>( + input: &'a DeriveInput, + trait_name: &str, +) -> Result, Error> { + let name = &input.ident; + match &input.data { + Data::Struct(data) => match &data.fields { + Fields::Named(fields) => Ok(StructFields::Named(&fields.named)), + Fields::Unnamed(fields) => Ok(StructFields::Unnamed(&fields.unnamed)), + Fields::Unit => Err(Error::new( + input.span(), + format!("{trait_name} cannot be derived for unit struct `{name}`"), + )), + }, + Data::Enum(_) => Err(Error::new(input.span(), enum_mismatch_msg(trait_name, name))), + Data::Union(_) => Err(Error::new( + input.span(), + format!("{trait_name} cannot be derived for union `{name}`"), + )), + } +} + +/// Extracts variants from an enum, returning an error for unsupported items. +fn extract_enum_variants<'a>( + input: &'a DeriveInput, + trait_name: &str, +) -> Result<&'a Punctuated, Error> { + let name = &input.ident; + match &input.data { + Data::Enum(data) => Ok(&data.variants), + Data::Struct(_) => Err(Error::new(input.span(), struct_mismatch_msg(trait_name, name))), + Data::Union(_) => Err(Error::new( + input.span(), + format!("{trait_name} cannot be derived for union `{name}`"), + )), + } +} + +fn struct_mismatch_msg(trait_name: &str, name: &syn::Ident) -> String { + format!("{trait_name} cannot be derived for struct `{name}`") +} + +fn enum_mismatch_msg(trait_name: &str, name: &syn::Ident) -> String { + format!("{trait_name} cannot be derived for enum `{name}`") +} + +/// Validates that an enum does not use explicit discriminants. +fn ensure_no_explicit_discriminants( + variants: &Punctuated, + trait_name: &str, + enum_name: &syn::Ident, +) -> Result<(), Error> { + for variant in variants { + if variant.discriminant.is_some() { + return Err(Error::new( + variant.span(), + format!( + "{trait_name} cannot be derived for enum `{enum_name}` with explicit \ + discriminants" + ), + )); + } + } + Ok(()) +} + +/// Derives `FromFeltRepr` for `miden-field-repr` for a struct with named fields, or an enum. +/// +/// Structs are encoded by serializing their fields in declaration order. +/// +/// Enums are encoded as a `u32` tag (variant ordinal, starting from `0`) +/// followed by the selected variant payload encoded in declaration order. +/// +/// # Example +/// +/// ```ignore +/// use miden_field_repr::FromFeltRepr; +/// +/// #[derive(FromFeltRepr)] +/// pub struct AccountId { +/// pub prefix: Felt, +/// pub suffix: Felt, +/// } +/// ``` +#[proc_macro_derive(DeriveFromFeltRepr)] +pub fn derive_from_felt_repr(input: TokenStream) -> TokenStream { + let input = parse_macro_input!(input as DeriveInput); + + let expanded = derive_from_felt_repr_impl( + &input, + quote!(miden_field_repr), + quote!(miden_field_repr::Felt), + ); + match expanded { + Ok(ts) => ts, + Err(err) => err.into_compile_error().into(), + } +} + +fn derive_from_felt_repr_impl( + input: &DeriveInput, + felt_repr_crate: TokenStream2, + felt_ty: TokenStream2, +) -> Result { + let name = &input.ident; + let generics = &input.generics; + let (impl_generics, ty_generics, where_clause) = generics.split_for_impl(); + + let trait_name = "FromFeltRepr"; + let expanded = match &input.data { + Data::Struct(_) => match extract_struct_fields(input, trait_name)? { + StructFields::Named(fields) => { + let field_names: Vec<_> = + fields.iter().map(|field| field.ident.as_ref().unwrap()).collect(); + let field_types: Vec<_> = fields.iter().map(|field| &field.ty).collect(); + quote! { + impl #impl_generics #felt_repr_crate::FromFeltRepr for #name #ty_generics #where_clause { + #[inline(always)] + fn from_felt_repr(reader: &mut #felt_repr_crate::FeltReader<'_>) -> Self { + Self { + #(#field_names: <#field_types as #felt_repr_crate::FromFeltRepr>::from_felt_repr(reader)),* + } + } + } + } + } + StructFields::Unnamed(fields) => { + let field_types: Vec<_> = fields.iter().map(|field| &field.ty).collect(); + let reads = field_types.iter().map(|ty| { + quote! { <#ty as #felt_repr_crate::FromFeltRepr>::from_felt_repr(reader) } + }); + quote! { + impl #impl_generics #felt_repr_crate::FromFeltRepr for #name #ty_generics #where_clause { + #[inline(always)] + fn from_felt_repr(reader: &mut #felt_repr_crate::FeltReader<'_>) -> Self { + Self(#(#reads),*) + } + } + } + } + }, + Data::Enum(_) => { + let variants = extract_enum_variants(input, trait_name)?; + ensure_no_explicit_discriminants(variants, trait_name, name)?; + + let arms = variants.iter().enumerate().map(|(variant_ordinal, variant)| { + let variant_ident = &variant.ident; + let tag = variant_ordinal as u32; + match &variant.fields { + Fields::Unit => quote! { #tag => Self::#variant_ident }, + Fields::Unnamed(fields) => { + let field_types: Vec<_> = fields.unnamed.iter().map(|f| &f.ty).collect(); + let reads = field_types.iter().map(|ty| { + quote! { <#ty as #felt_repr_crate::FromFeltRepr>::from_felt_repr(reader) } + }); + quote! { #tag => Self::#variant_ident(#(#reads),*) } + } + Fields::Named(fields) => { + let field_idents: Vec<_> = fields + .named + .iter() + .map(|f| f.ident.as_ref().expect("named field")) + .collect(); + let field_types: Vec<_> = fields.named.iter().map(|f| &f.ty).collect(); + let reads = field_idents.iter().zip(field_types.iter()).map(|(ident, ty)| { + quote! { #ident: <#ty as #felt_repr_crate::FromFeltRepr>::from_felt_repr(reader) } + }); + quote! { #tag => Self::#variant_ident { #(#reads),* } } + } + } + }); + + quote! { + impl #impl_generics #felt_repr_crate::FromFeltRepr for #name #ty_generics #where_clause { + #[inline(always)] + fn from_felt_repr(reader: &mut #felt_repr_crate::FeltReader<'_>) -> Self { + let tag: u32 = ::from_felt_repr(reader); + match tag { + #(#arms,)* + other => panic!("Unknown `{}` enum variant tag: {}", stringify!(#name), other), + } + } + } + } + } + Data::Union(_) => { + return Err(Error::new( + input.span(), + format!("{trait_name} cannot be derived for union `{name}`"), + )); + } + }; + + let expanded = quote! { + #expanded + + impl #impl_generics From<&[#felt_ty]> for #name #ty_generics #where_clause { + #[inline(always)] + fn from(felts: &[#felt_ty]) -> Self { + let mut reader = #felt_repr_crate::FeltReader::new(felts); + ::from_felt_repr(&mut reader) + } + } + }; + + Ok(expanded.into()) +} + +/// Derives `ToFeltRepr` trait for a struct with named fields, or an enum. +/// +/// Structs are encoded by serializing their fields in declaration order. +/// +/// Enums are encoded as a `u32` tag (variant ordinal, starting from `0`) +/// followed by the selected variant payload encoded in declaration order. +/// +/// # Example +/// +/// ```ignore +/// use miden_field_repr::ToFeltRepr; +/// +/// #[derive(ToFeltRepr)] +/// pub struct AccountId { +/// pub prefix: Felt, +/// pub suffix: Felt, +/// } +/// ``` +#[proc_macro_derive(DeriveToFeltRepr)] +pub fn derive_to_felt_repr(input: TokenStream) -> TokenStream { + let input = parse_macro_input!(input as DeriveInput); + + match derive_to_felt_repr_impl(&input, quote!(miden_field_repr)) { + Ok(ts) => ts, + Err(err) => err.into_compile_error().into(), + } +} + +fn derive_to_felt_repr_impl( + input: &DeriveInput, + felt_repr_crate: TokenStream2, +) -> Result { + let name = &input.ident; + let generics = &input.generics; + let (impl_generics, ty_generics, where_clause) = generics.split_for_impl(); + + let trait_name = "ToFeltRepr"; + let expanded = match &input.data { + Data::Struct(_) => match extract_struct_fields(input, trait_name)? { + StructFields::Named(fields) => { + let field_names: Vec<_> = + fields.iter().map(|field| field.ident.as_ref().unwrap()).collect(); + quote! { + impl #impl_generics #felt_repr_crate::ToFeltRepr for #name #ty_generics #where_clause { + fn write_felt_repr(&self, writer: &mut #felt_repr_crate::FeltWriter<'_>) { + #(#felt_repr_crate::ToFeltRepr::write_felt_repr(&self.#field_names, writer);)* + } + } + } + } + StructFields::Unnamed(fields) => { + let field_indexes: Vec = (0..fields.len()).map(Index::from).collect(); + quote! { + impl #impl_generics #felt_repr_crate::ToFeltRepr for #name #ty_generics #where_clause { + fn write_felt_repr(&self, writer: &mut #felt_repr_crate::FeltWriter<'_>) { + #(#felt_repr_crate::ToFeltRepr::write_felt_repr(&self.#field_indexes, writer);)* + } + } + } + } + }, + Data::Enum(_) => { + let variants = extract_enum_variants(input, trait_name)?; + ensure_no_explicit_discriminants(variants, trait_name, name)?; + + let arms = variants.iter().enumerate().map(|(variant_ordinal, variant)| { + let variant_ident = &variant.ident; + let tag = variant_ordinal as u32; + + match &variant.fields { + Fields::Unit => quote! { + Self::#variant_ident => { + #felt_repr_crate::ToFeltRepr::write_felt_repr(&(#tag as u32), writer); + return; + } + }, + Fields::Unnamed(fields) => { + let bindings: Vec<_> = (0..fields.unnamed.len()) + .map(|i| format_ident!("__field{i}")) + .collect(); + quote! { + Self::#variant_ident(#(#bindings),*) => { + #felt_repr_crate::ToFeltRepr::write_felt_repr(&(#tag as u32), writer); + #(#felt_repr_crate::ToFeltRepr::write_felt_repr(#bindings, writer);)* + return; + } + } + } + Fields::Named(fields) => { + let bindings: Vec<_> = fields + .named + .iter() + .map(|f| f.ident.as_ref().expect("named field")) + .collect(); + quote! { + Self::#variant_ident { #(#bindings),* } => { + #felt_repr_crate::ToFeltRepr::write_felt_repr(&(#tag as u32), writer); + #(#felt_repr_crate::ToFeltRepr::write_felt_repr(#bindings, writer);)* + return; + } + } + } + } + }); + + quote! { + impl #impl_generics #felt_repr_crate::ToFeltRepr for #name #ty_generics #where_clause { + #[inline(always)] + fn write_felt_repr(&self, writer: &mut #felt_repr_crate::FeltWriter<'_>) { + match self { + #(#arms,)* + } + } + } + } + } + Data::Union(_) => { + return Err(Error::new( + input.span(), + format!("{trait_name} cannot be derived for union `{name}`"), + )); + } + }; + + Ok(expanded.into()) +} diff --git a/sdk/field-repr/repr/Cargo.toml b/sdk/field-repr/repr/Cargo.toml new file mode 100644 index 000000000..0f2666adb --- /dev/null +++ b/sdk/field-repr/repr/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "miden-field-repr" +description = "Serialization/deserialization for felt representation" +version = "0.10.0" +rust-version.workspace = true +authors.workspace = true +repository.workspace = true +categories.workspace = true +keywords.workspace = true +license.workspace = true +readme.workspace = true +edition.workspace = true + +[lib] +crate-type = ["rlib"] + +[dependencies] +miden-field = { version = "0.10.0", path = "../../field" } +miden-field-repr-derive = { path = "../derive", version = "0.10.0" } + +[target.'cfg(not(target_family = "wasm"))'.dependencies] +miden-core.workspace = true + +[features] +default = [] diff --git a/sdk/field-repr/repr/src/lib.rs b/sdk/field-repr/repr/src/lib.rs new file mode 100644 index 000000000..cf2ee7de4 --- /dev/null +++ b/sdk/field-repr/repr/src/lib.rs @@ -0,0 +1,263 @@ +//! Serialization/deserialization for felt representation. +//! +//! This crate provides traits and utilities for converting Rust types to and from +//! a sequence of [`Felt`] elements. + +#![no_std] +#![deny(warnings)] + +extern crate alloc; + +use alloc::vec::Vec; + +pub use miden_field::Felt; +/// Re-export `DeriveFromFeltRepr` as `FromFeltRepr` for `#[derive(FromFeltRepr)]` ergonomics. +pub use miden_field_repr_derive::DeriveFromFeltRepr as FromFeltRepr; +/// Re-export `DeriveToFeltRepr` as `ToFeltRepr` for `#[derive(ToFeltRepr)]` ergonomics. +pub use miden_field_repr_derive::DeriveToFeltRepr as ToFeltRepr; + +/// A reader that wraps a slice of `Felt` elements and tracks the current position. +pub struct FeltReader<'a> { + data: &'a [Felt], + pos: usize, +} + +impl<'a> FeltReader<'a> { + /// Creates a new `FeltReader` from a slice of `Felt` elements. + #[inline(always)] + pub fn new(data: &'a [Felt]) -> Self { + Self { data, pos: 0 } + } + + /// Reads the next `Felt` element, advancing the position. + /// + /// # Panics + /// + /// Panics if there are no more elements to read. + #[inline(always)] + pub fn read(&mut self) -> Felt { + assert!(self.pos < self.data.len(), "FeltReader: no more elements to read"); + let felt = self.data[self.pos]; + self.pos += 1; + felt + } +} + +/// A writer that wraps a `Vec` and appends elements to it. +pub struct FeltWriter<'a> { + data: &'a mut Vec, +} + +impl<'a> FeltWriter<'a> { + /// Creates a new `FeltWriter` from a mutable reference to a `Vec`. + #[inline(always)] + pub fn new(data: &'a mut Vec) -> Self { + Self { data } + } + + /// Writes a `Felt` element to the output. + #[inline(always)] + pub fn write(&mut self, felt: Felt) { + self.data.push(felt); + } +} + +/// Trait for deserialization from felt memory representation. +pub trait FromFeltRepr: Sized { + /// Deserializes from a `FeltReader`, consuming the required elements. + fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self; +} + +impl FromFeltRepr for Felt { + #[inline(always)] + fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { + reader.read() + } +} + +#[cfg(not(target_family = "wasm"))] +impl FromFeltRepr for miden_core::Felt { + #[inline(always)] + fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { + Self::from(reader.read()) + } +} + +impl FromFeltRepr for u64 { + #[inline(always)] + fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { + // Encode u64 as 2 u32 limbs + let lo = reader.read().as_u64(); + assert!(lo <= u32::MAX as u64, "u64: low limb out of range"); + let hi = reader.read().as_u64(); + assert!(hi <= u32::MAX as u64, "u64: high limb out of range"); + + (hi << 32) | lo + } +} + +impl FromFeltRepr for u32 { + #[inline(always)] + fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { + reader.read().as_u64() as u32 + } +} + +impl FromFeltRepr for u8 { + #[inline(always)] + fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { + reader.read().as_u64() as u8 + } +} + +impl FromFeltRepr for bool { + #[inline(always)] + fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { + reader.read().as_u64() != 0 + } +} + +/// Encodes an `Option` as a 1-felt tag followed by the payload (if present). +/// +/// Format: +/// - `None` => `[0]` +/// - `Some(x)` => `[1, x...]` +impl FromFeltRepr for Option +where + T: FromFeltRepr, +{ + #[inline(always)] + fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { + match reader.read().as_u64() { + 0 => None, + 1 => Some(T::from_felt_repr(reader)), + _ => panic!("Option: invalid tag"), + } + } +} + +/// Encodes a `Vec` as a length prefix followed by elements. +/// +/// Format: `[len, elem0..., elemN-1...]` where `len` is a `u32` encoded in a single `Felt`. +impl FromFeltRepr for Vec +where + T: FromFeltRepr, +{ + #[inline(always)] + fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { + let len = reader.read().as_u64(); + assert!(len <= u32::MAX as u64, "Vec: length out of range"); + let len = len as usize; + + let mut result = Vec::with_capacity(len); + + let mut i = 0usize; + while i < len { + result.push(T::from_felt_repr(reader)); + i += 1; + } + result + } +} + +/// Trait for serializing a type into its felt memory representation. +pub trait ToFeltRepr { + /// Writes this value's felt representation to the writer. + fn write_felt_repr(&self, writer: &mut FeltWriter<'_>); + + /// Convenience method that allocates and returns a `Vec`. + fn to_felt_repr(&self) -> Vec { + // Allocate ahead to avoid reallocations + let mut data = Vec::with_capacity(256); + self.write_felt_repr(&mut FeltWriter::new(&mut data)); + data + } +} + +impl ToFeltRepr for Felt { + #[inline(always)] + fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { + writer.write(*self); + } +} + +#[cfg(not(target_family = "wasm"))] +impl ToFeltRepr for miden_core::Felt { + #[inline(always)] + fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { + writer.write((*self).into()); + } +} + +impl ToFeltRepr for u64 { + #[inline(always)] + fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { + let lo = (*self & 0xffff_ffff) as u32; + let hi = (*self >> 32) as u32; + writer.write(Felt::from_u32(lo)); + writer.write(Felt::from_u32(hi)); + } +} + +impl ToFeltRepr for u32 { + #[inline(always)] + fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { + writer.write(Felt::from_u64_unchecked(*self as u64)); + } +} + +impl ToFeltRepr for u8 { + #[inline(always)] + fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { + writer.write(Felt::from_u64_unchecked(*self as u64)); + } +} + +impl ToFeltRepr for bool { + #[inline(always)] + fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { + writer.write(Felt::from_u64_unchecked(*self as u64)); + } +} + +/// Encodes an `Option` as a 1-felt tag followed by the payload (if present). +/// +/// Format: +/// - `None` => `[0]` +/// - `Some(x)` => `[1, x...]` +impl ToFeltRepr for Option +where + T: ToFeltRepr, +{ + #[inline(always)] + fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { + match self { + None => writer.write(Felt::from_u64_unchecked(0)), + Some(value) => { + writer.write(Felt::from_u64_unchecked(1)); + value.write_felt_repr(writer); + } + } + } +} + +/// Encodes a `Vec` as a length prefix followed by elements. +/// +/// Format: `[len, elem0..., elemN-1...]` where `len` is a `u32` encoded in a single `Felt`. +impl ToFeltRepr for Vec +where + T: ToFeltRepr, +{ + #[inline(always)] + fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { + let len = self.len(); + assert!(len <= u32::MAX as usize, "Vec: length out of range"); + writer.write(Felt::from_u64_unchecked(len as u64)); + + let mut i = 0usize; + while i < len { + self[i].write_felt_repr(writer); + i += 1; + } + } +} diff --git a/sdk/field-repr/tests/Cargo.toml b/sdk/field-repr/tests/Cargo.toml new file mode 100644 index 000000000..fefde33cf --- /dev/null +++ b/sdk/field-repr/tests/Cargo.toml @@ -0,0 +1,27 @@ +[package] +name = "miden-field-repr-tests" +description = "Integration tests for felt representation serialization/deserialization" +version = "0.10.0" +rust-version.workspace = true +authors.workspace = true +repository.workspace = true +categories.workspace = true +keywords.workspace = true +license.workspace = true +readme.workspace = true +edition.workspace = true +publish = false + +[dependencies] +miden-field = { path = "../../field", version = "0.10.0" } +miden-field-repr = { path = "../repr", version = "0.10.0" } +miden-core.workspace = true + +[dev-dependencies] +miden-integration-tests = { path = "../../../tests/integration" } +midenc-frontend-wasm.workspace = true +midenc-session.workspace = true +midenc-expect-test.workspace = true +miden-debug.workspace = true +miden-protocol.workspace = true +miden-processor.workspace = true diff --git a/sdk/field-repr/tests/src/lib.rs b/sdk/field-repr/tests/src/lib.rs new file mode 100644 index 000000000..58c6cf842 --- /dev/null +++ b/sdk/field-repr/tests/src/lib.rs @@ -0,0 +1,120 @@ +//! Integration tests for felt representation serialization/deserialization. +//! +//! These tests verify the round-trip correctness of serializing data off-chain, +//! passing it to on-chain code where it's deserialized and re-serialized, +//! then deserializing the result off-chain and comparing to the original. + +#![cfg(test)] + +mod offchain; +mod onchain; + +extern crate alloc; + +use std::path::PathBuf; + +use miden_integration_tests::{CompilerTest, project}; +use midenc_frontend_wasm::WasmTranslationConfig; + +/// Get the path to the `miden-field-repr` crate. +fn felt_repr_path() -> PathBuf { + let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap(); + PathBuf::from(manifest_dir).parent().unwrap().join("repr") +} + +/// Get the path to the `miden-stdlib-sys` crate. +fn stdlib_sys_path() -> PathBuf { + let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap(); + PathBuf::from(manifest_dir) + .parent() + .unwrap() + .parent() + .unwrap() + .join("stdlib-sys") +} + +/// Get the path to the `miden-sdk-alloc` crate. +fn sdk_alloc_path() -> PathBuf { + let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap(); + PathBuf::from(manifest_dir).parent().unwrap().parent().unwrap().join("alloc") +} + +/// Build a [`CompilerTest`] with a `miden-field-repr-onchain` dependency. +/// +/// The test crate is generated on disk via [`project`], which places it under the Cargo target +/// directory to reuse build artifacts across test runs. +fn build_felt_repr_test(name: &str, fn_body: &str, config: WasmTranslationConfig) -> CompilerTest { + let felt_repr = felt_repr_path(); + let stdlib_sys = stdlib_sys_path(); + let sdk_alloc = sdk_alloc_path(); + + let cargo_toml = format!( + r#"cargo-features = ["trim-paths"] + +[package] +name = "{name}" +version = "0.0.1" +edition = "2021" +authors = [] + +[dependencies] +miden-sdk-alloc = {{ path = "{sdk_alloc}" }} +miden-stdlib-sys = {{ path = "{stdlib_sys}" }} +miden-field-repr = {{ path = "{felt_repr}" }} + +[lib] +crate-type = ["cdylib"] + +[profile.release] +panic = "abort" +opt-level = "z" +debug = false +trim-paths = ["diagnostics", "object"] + +[workspace] +"#, + sdk_alloc = sdk_alloc.display(), + stdlib_sys = stdlib_sys.display(), + felt_repr = felt_repr.display(), + ); + + let lib_rs = format!( + r#"#![no_std] +#![feature(alloc_error_handler)] +#![no_main] +#![allow(unused_imports)] + +#[panic_handler] +fn my_panic(_info: &core::panic::PanicInfo) -> ! {{ + core::arch::wasm32::unreachable() +}} + +// Required for no-std crates +#[cfg(not(test))] +#[alloc_error_handler] +fn my_alloc_error(_info: core::alloc::Layout) -> ! {{ + loop {{}} +}} + +#[global_allocator] +static ALLOC: miden_sdk_alloc::BumpAlloc = miden_sdk_alloc::BumpAlloc::new(); + +extern crate miden_stdlib_sys; +use miden_stdlib_sys::{{*, intrinsics}}; + +extern crate alloc; +use alloc::vec::Vec; + +#[no_mangle] +#[allow(improper_ctypes_definitions)] +pub extern "C" fn entrypoint{fn_body} +"# + ); + + let cargo_proj = project(name) + .file("Cargo.toml", &cargo_toml) + .file("src/lib.rs", &lib_rs) + .build(); + + CompilerTest::rust_source_cargo_miden(cargo_proj.root(), config, ["--test-harness".into()]) +} diff --git a/sdk/field-repr/tests/src/offchain.rs b/sdk/field-repr/tests/src/offchain.rs new file mode 100644 index 000000000..705696eae --- /dev/null +++ b/sdk/field-repr/tests/src/offchain.rs @@ -0,0 +1,375 @@ +//! Off-chain serialization/deserialization tests. +//! +//! These tests verify the correctness of `ToFeltRepr` and `FromFeltRepr` implementations without +//! involving on-chain execution. + +use miden_field::Felt; +use miden_field_repr::{FeltReader, FromFeltRepr, ToFeltRepr}; + +/// Serializes `value` off-chain and deserializes it back, asserting equality. +fn assert_roundtrip(value: &T) +where + T: ToFeltRepr + FromFeltRepr + PartialEq + core::fmt::Debug, +{ + let felts = value.to_felt_repr(); + let mut reader = FeltReader::new(&felts); + let roundtrip = ::from_felt_repr(&mut reader); + assert_eq!(roundtrip, *value); +} + +/// Test struct for off-chain serialization tests. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct TwoFelts { + a: Felt, + b: Felt, +} + +#[test] +fn test_serialization() { + let value = TwoFelts { + a: Felt::from_u64_unchecked(12345), + b: Felt::from_u64_unchecked(67890), + }; + + let felts = value.to_felt_repr(); + + assert_eq!(felts.len(), 2); + assert_eq!(felts[0], Felt::from_u64_unchecked(12345)); + assert_eq!(felts[1], Felt::from_u64_unchecked(67890)); +} + +#[test] +fn test_deserialization() { + let felts = [Felt::from_u64_unchecked(12345), Felt::from_u64_unchecked(67890)]; + + let mut reader = FeltReader::new(&felts); + let value = TwoFelts::from_felt_repr(&mut reader); + + assert_eq!(value.a, Felt::from_u64_unchecked(12345)); + assert_eq!(value.b, Felt::from_u64_unchecked(67890)); +} + +#[test] +fn test_roundtrip() { + let original = TwoFelts { + a: Felt::from_u64_unchecked(12345), + b: Felt::from_u64_unchecked(67890), + }; + + assert_roundtrip(&original); +} + +/// Test struct containing multiple non-`Felt` fields. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct MixedStruct { + a: Felt, + b: u32, + c: bool, + d: u8, +} + +#[test] +fn test_struct_roundtrip_mixed_types() { + let original = MixedStruct { + a: Felt::from_u64_unchecked(11), + b: 22, + c: true, + d: 33, + }; + + let felts = original.to_felt_repr(); + assert_eq!(felts.len(), 4); + assert_eq!(felts[0], Felt::from_u64_unchecked(11)); + assert_eq!(felts[1], Felt::from_u64_unchecked(22)); + assert_eq!(felts[2], Felt::from_u64_unchecked(1)); + assert_eq!(felts[3], Felt::from_u64_unchecked(33)); + + assert_roundtrip(&original); +} + +/// Inner struct used by nested struct/enum tests. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct Inner { + x: Felt, + y: u64, +} + +/// Outer struct containing nested `Inner`. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct Outer { + head: u8, + inner: Inner, + tail: bool, +} + +#[test] +fn test_struct_roundtrip_nested() { + let original = Outer { + head: 1, + inner: Inner { + x: Felt::from_u64_unchecked(2), + y: 3, + }, + tail: false, + }; + + let felts = original.to_felt_repr(); + assert_eq!(felts.len(), 5); + assert_eq!(felts[0], Felt::from_u64_unchecked(1)); + assert_eq!(felts[1], Felt::from_u64_unchecked(2)); + assert_eq!(felts[2], Felt::from_u64_unchecked(3)); + assert_eq!(felts[3], Felt::from_u64_unchecked(0)); + assert_eq!(felts[4], Felt::from_u64_unchecked(0)); + + assert_roundtrip(&original); +} + +/// Unit-only enum test type. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +enum SimpleEnum { + A, + B, + C, +} + +#[test] +fn test_enum_roundtrip_unit() { + let original = SimpleEnum::B; + let felts = original.to_felt_repr(); + assert_eq!(felts, vec![Felt::from_u64_unchecked(1)]); + assert_roundtrip(&original); +} + +/// Mixed enum with different shapes to exercise tags and payload encoding. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +enum MixedEnum { + Unit, + Pair(Felt, u32), + Struct { n: u64, flag: bool }, + Nested(Inner), +} + +#[test] +fn test_enum_roundtrip_tuple_variant() { + let original = MixedEnum::Pair(Felt::from_u64_unchecked(7), 8); + let felts = original.to_felt_repr(); + assert_eq!(felts.len(), 3); + assert_eq!(felts[0], Felt::from_u64_unchecked(1)); + assert_eq!(felts[1], Felt::from_u64_unchecked(7)); + assert_eq!(felts[2], Felt::from_u64_unchecked(8)); + assert_roundtrip(&original); +} + +#[test] +fn test_enum_roundtrip_struct_variant() { + let original = MixedEnum::Struct { n: 9, flag: true }; + let felts = original.to_felt_repr(); + assert_eq!(felts.len(), 4); + assert_eq!(felts[0], Felt::from_u64_unchecked(2)); + assert_eq!(felts[1], Felt::from_u64_unchecked(9)); + assert_eq!(felts[2], Felt::from_u64_unchecked(0)); + assert_eq!(felts[3], Felt::from_u64_unchecked(1)); + assert_roundtrip(&original); +} + +/// Struct with an enum field to exercise struct+enum composition. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct WithEnum { + prefix: Felt, + msg: MixedEnum, + suffix: u32, +} + +#[test] +fn test_struct_with_enum_roundtrip() { + let original = WithEnum { + prefix: Felt::from_u64_unchecked(10), + msg: MixedEnum::Nested(Inner { + x: Felt::from_u64_unchecked(11), + y: 12, + }), + suffix: 13, + }; + + // prefix (1) + msg(tag=3 + Inner(3)) + suffix (1) = 6 felts + let felts = original.to_felt_repr(); + assert_eq!(felts.len(), 6); + assert_eq!(felts[0], Felt::from_u64_unchecked(10)); + assert_eq!(felts[1], Felt::from_u64_unchecked(3)); + assert_eq!(felts[2], Felt::from_u64_unchecked(11)); + assert_eq!(felts[3], Felt::from_u64_unchecked(12)); + assert_eq!(felts[4], Felt::from_u64_unchecked(0)); + assert_eq!(felts[5], Felt::from_u64_unchecked(13)); + + assert_roundtrip(&original); +} + +/// Nested enum shape which wraps a struct that itself contains an enum. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +enum Top { + None, + Some(WithEnum), +} + +#[test] +fn test_enum_nested_with_struct_roundtrip() { + let original = Top::Some(WithEnum { + prefix: Felt::from_u64_unchecked(21), + msg: MixedEnum::Struct { n: 22, flag: false }, + suffix: 23, + }); + + // tag (1) + WithEnum(prefix 1 + msg 4 + suffix 1) = 7 felts + let felts = original.to_felt_repr(); + assert_eq!(felts.len(), 7); + assert_roundtrip(&original); +} + +/// Test struct containing an `Option` field. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct WithOption { + prefix: Felt, + maybe: Option, + suffix: bool, +} + +#[test] +fn test_struct_roundtrip_option_some() { + let original = WithOption { + prefix: Felt::from_u64_unchecked(5), + maybe: Some(42), + suffix: true, + }; + + let felts = original.to_felt_repr(); + assert_eq!(felts.len(), 4); + assert_eq!( + felts, + vec![ + Felt::from_u64_unchecked(5), + Felt::from_u64_unchecked(1), + Felt::from_u64_unchecked(42), + Felt::from_u64_unchecked(1) + ] + ); + + assert_roundtrip(&original); +} + +#[test] +fn test_struct_roundtrip_option_none() { + let original = WithOption { + prefix: Felt::from_u64_unchecked(7), + maybe: None, + suffix: false, + }; + + let felts = original.to_felt_repr(); + assert_eq!(felts.len(), 3); + assert_eq!( + felts, + vec![ + Felt::from_u64_unchecked(7), + Felt::from_u64_unchecked(0), + Felt::from_u64_unchecked(0) + ] + ); + + assert_roundtrip(&original); +} + +/// Test struct containing a `Vec` field. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct WithVec { + prefix: Felt, + items: Vec, + suffix: bool, +} + +#[test] +fn test_struct_roundtrip_vec_non_empty() { + let original = WithVec { + prefix: Felt::from_u64_unchecked(9), + items: vec![1, 2, 3], + suffix: true, + }; + + // prefix (1) + Vec (len 1 + 3 elems) + suffix (1) + let felts = original.to_felt_repr(); + assert_eq!(felts.len(), 6); + assert_eq!( + felts, + vec![ + Felt::from_u64_unchecked(9), + Felt::from_u64_unchecked(3), + Felt::from_u64_unchecked(1), + Felt::from_u64_unchecked(2), + Felt::from_u64_unchecked(3), + Felt::from_u64_unchecked(1), + ] + ); + + assert_roundtrip(&original); +} + +#[test] +fn test_struct_roundtrip_vec_empty() { + let original = WithVec { + prefix: Felt::from_u64_unchecked(10), + items: vec![], + suffix: false, + }; + + let felts = original.to_felt_repr(); + assert_eq!(felts.len(), 3); + assert_eq!( + felts, + vec![ + Felt::from_u64_unchecked(10), + Felt::from_u64_unchecked(0), + Felt::from_u64_unchecked(0) + ] + ); + + assert_roundtrip(&original); +} + +/// Test tuple struct serialization/round-trip. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct TupleStruct(u32, bool, Felt); + +#[test] +fn test_tuple_struct_roundtrip() { + let original = TupleStruct(22, true, Felt::from_u64_unchecked(33)); + let felts = original.to_felt_repr(); + + assert_eq!( + felts, + vec![ + Felt::from_u64_unchecked(22), + Felt::from_u64_unchecked(1), + Felt::from_u64_unchecked(33) + ] + ); + assert_roundtrip(&original); +} + +#[test] +fn test_u64_roundtrip_uses_u32_limbs() { + let test_cases: [u64; 6] = + [0, 1, u32::MAX as u64, (u32::MAX as u64) << 32, 0x1122_3344_5566_7788, u64::MAX]; + + for value in test_cases { + let felts = value.to_felt_repr(); + assert_eq!(felts.len(), 2); + + let expected_lo = value & 0xffff_ffff; + let expected_hi = value >> 32; + assert_eq!(felts[0].as_u64(), expected_lo); + assert_eq!(felts[1].as_u64(), expected_hi); + + let mut reader = FeltReader::new(&felts); + let roundtripped = u64::from_felt_repr(&mut reader); + assert_eq!(roundtripped, value); + } +} diff --git a/sdk/field-repr/tests/src/onchain.rs b/sdk/field-repr/tests/src/onchain.rs new file mode 100644 index 000000000..acd9557b3 --- /dev/null +++ b/sdk/field-repr/tests/src/onchain.rs @@ -0,0 +1,1063 @@ +//! On-chain serialization/deserialization tests. +//! +//! These tests verify the full round-trip: off-chain serialize -> on-chain deserialize/serialize +//! -> off-chain deserialize. + +use std::borrow::Cow; + +use miden_debug::{ExecutionTrace, Felt as TestFelt}; +use miden_field::Felt; +use miden_field_repr::{Felt as ReprFelt, FeltReader, FromFeltRepr, ToFeltRepr}; +use miden_integration_tests::testing::{Initializer, eval_package}; +use midenc_frontend_wasm::WasmTranslationConfig; + +use crate::build_felt_repr_test; + +/// Converts `miden-field-repr` felts to `miden-core` felts for VM memory initialization. +fn to_core_felts(felts: &[ReprFelt]) -> Vec { + felts.iter().copied().map(Into::into).collect() +} + +fn read_vec_felts( + trace: &ExecutionTrace, + vec_meta_addr: u32, + expected_len: usize, +) -> Vec { + let vec_metadata: [TestFelt; 4] = trace + .read_from_rust_memory(vec_meta_addr) + .expect("Failed to read Vec metadata from memory"); + // Vec metadata layout is: [capacity, ptr, len, ?] + let data_ptr = vec_metadata[1].0.as_int() as u32; + let len = vec_metadata[2].0.as_int() as usize; + + assert_eq!(len, expected_len, "Unexpected Vec length"); + + let elem_addr = data_ptr / 4; + let mut result = Vec::with_capacity(len); + for i in 0..len { + let byte_addr = (elem_addr + i as u32) * 4; + let word_addr = (byte_addr / 16) * 16; + let word: [TestFelt; 4] = trace + .read_from_rust_memory(word_addr) + .unwrap_or_else(|| panic!("Failed to read word for element {i}")); + let elem_in_word = ((byte_addr % 16) / 4) as usize; + result.push(word[elem_in_word].0.into()); + } + + result +} + +/// Test struct for round-trip tests. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct TwoFelts { + a: Felt, + b: Felt, +} + +/// Test using `FeltReader` from `miden-field-repr`. +#[test] +fn test_felt_reader() { + let original = TwoFelts { + a: Felt::from_u64_unchecked(12345), + b: Felt::from_u64_unchecked(67890), + }; + let serialized = original.to_felt_repr(); + + let onchain_code = r#"(input: Word) -> Word { + use miden_field_repr::FeltReader; + + let input_arr: [Felt; 4] = input.into(); + + let mut reader = FeltReader::new(&input_arr); + let first = reader.read(); + let second = reader.read(); + + Word::from([first, second, felt!(0), felt!(0)]) + }"#; + + let config = WasmTranslationConfig::default(); + let name = "onchain_felt_reader"; + let mut test = build_felt_repr_test(name, onchain_code, config); + let package = test.compiled_package(); + + let in_elem_addr = 21u32 * 16384; + let out_elem_addr = 20u32 * 16384; + let in_byte_addr = in_elem_addr * 4; + let out_byte_addr = out_elem_addr * 4; + + let input_word: Vec = vec![ + serialized[0].into(), + serialized[1].into(), + miden_core::Felt::new(0), + miden_core::Felt::new(0), + ]; + + let initializers = [Initializer::MemoryFelts { + addr: in_elem_addr, + felts: Cow::from(input_word), + }]; + + let args = [ + miden_core::Felt::new(in_byte_addr as u64), + miden_core::Felt::new(out_byte_addr as u64), + ]; + + let _: miden_core::Felt = eval_package(&package, initializers, &args, &test.session, |trace| { + let result_word: [TestFelt; 4] = trace + .read_from_rust_memory(out_byte_addr) + .expect("Failed to read result from memory"); + + let result_felts = [result_word[0].0.into(), result_word[1].0.into()]; + let mut reader = FeltReader::new(&result_felts); + let result_struct = TwoFelts::from_felt_repr(&mut reader); + + assert_eq!(result_struct, original, "Round-trip failed: values don't match"); + Ok(()) + }) + .unwrap(); +} + +/// Test full round-trip using the actual FromFeltRepr and ToFeltRepr from onchain crate. +/// +/// Test struct serialization with 2 Felt fields. +/// +/// This tests the full flow: off-chain serialize -> on-chain deserialize via derive +/// -> on-chain serialize -> off-chain deserialize. +#[test] +fn test_two_felts_struct_round_trip() { + let original = TwoFelts { + a: Felt::from_u64_unchecked(12345), + b: Felt::from_u64_unchecked(67890), + }; + let serialized = original.to_felt_repr(); + + let onchain_code = r#"(input: [Felt; 2]) -> Vec { + use miden_field_repr::{FeltReader, FromFeltRepr, ToFeltRepr}; + + #[derive(FromFeltRepr, ToFeltRepr)] + struct TestStruct { + a: Felt, + b: Felt, + } + + let mut reader = FeltReader::new(&input); + let deserialized = TestStruct::from_felt_repr(&mut reader); + + deserialized.to_felt_repr() + }"#; + + let config = WasmTranslationConfig::default(); + let name = "onchain_two_felts_struct"; + let mut test = build_felt_repr_test(name, onchain_code, config); + let package = test.compiled_package(); + + let in_elem_addr = 21u32 * 16384; + let out_elem_addr = 20u32 * 16384; + let in_byte_addr = in_elem_addr * 4; + let out_byte_addr = out_elem_addr * 4; + + let input_felts: Vec = vec![serialized[0].into(), serialized[1].into()]; + + let initializers = [Initializer::MemoryFelts { + addr: in_elem_addr, + felts: Cow::from(input_felts), + }]; + + let args = [ + miden_core::Felt::new(in_byte_addr as u64), + miden_core::Felt::new(out_byte_addr as u64), + ]; + + let _: miden_core::Felt = eval_package(&package, initializers, &args, &test.session, |trace| { + let result_felts = read_vec_felts(trace, out_byte_addr, 2); + let mut reader = FeltReader::new(&result_felts); + let result_struct = TwoFelts::from_felt_repr(&mut reader); + + assert_eq!(result_struct, original, "Full FromFeltRepr/ToFeltRepr round-trip failed"); + Ok(()) + }) + .unwrap(); +} + +/// Test struct for 5 Felt round-trip tests. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct FiveFelts { + a: Felt, + b: Felt, + c: Felt, + d: Felt, + e: Felt, +} + +/// Test struct serialization with 5 Felt fields - full round-trip execution. +#[test] +fn test_five_felts_struct_round_trip() { + let original = FiveFelts { + a: Felt::from_u64_unchecked(11111), + b: Felt::from_u64_unchecked(22222), + c: Felt::from_u64_unchecked(33333), + d: Felt::from_u64_unchecked(44444), + e: Felt::from_u64_unchecked(55555), + }; + let serialized = original.to_felt_repr(); + + assert_eq!(serialized.len(), 5); + assert_eq!(serialized[4], Felt::from_u64_unchecked(55555)); + + let onchain_code = r#"(input: [Felt; 5]) -> Vec { + use miden_field_repr::{FeltReader, FromFeltRepr, ToFeltRepr}; + + #[derive(FromFeltRepr, ToFeltRepr)] + struct TestStruct { + a: Felt, + b: Felt, + c: Felt, + d: Felt, + e: Felt, + } + + let mut reader = FeltReader::new(&input); + let deserialized = TestStruct::from_felt_repr(&mut reader); + + deserialized.to_felt_repr() + }"#; + + let config = WasmTranslationConfig::default(); + let name = "onchain_five_felts_struct"; + let mut test = build_felt_repr_test(name, onchain_code, config); + let package = test.compiled_package(); + + let in_elem_addr = 21u32 * 16384; + let out_elem_addr = 20u32 * 16384; + let in_byte_addr = in_elem_addr * 4; + let out_byte_addr = out_elem_addr * 4; + + let input_felts: Vec = to_core_felts(&serialized); + + let initializers = [Initializer::MemoryFelts { + addr: in_elem_addr, + felts: Cow::from(input_felts), + }]; + + let args = [ + miden_core::Felt::new(in_byte_addr as u64), + miden_core::Felt::new(out_byte_addr as u64), + ]; + + let _: miden_core::Felt = eval_package(&package, initializers, &args, &test.session, |trace| { + let result_felts = read_vec_felts(trace, out_byte_addr, 5); + let mut reader = FeltReader::new(&result_felts); + let result_struct = FiveFelts::from_felt_repr(&mut reader); + + assert_eq!(result_struct, original, "Full 5-felt round-trip failed"); + Ok(()) + }) + .unwrap(); +} + +/// Minimal struct used to reproduce issue #815 ("u64 in a struct leads to heap MAGIC corruption"). +/// +/// The field mix is chosen to increase register pressure during (de)serialization and force values +/// to be spilled to procedure locals. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct MinimalU64Bug { + n1: u64, + a: u32, + b: u32, + x: u32, + y: u32, +} + +/// Regression test for issue https://github.com/0xMiden/compiler/issues/815 +/// Historically, spilling to procedure locals could overwrite the heap header magic, causing the +/// first `Vec` allocation to fail with "rust heap has not been initialized". +#[test] +fn test_minimal_u64_bug() { + let original = MinimalU64Bug { + n1: 111111, + a: 22, + b: 33, + x: 44, + y: 55, + }; + let serialized = original.to_felt_repr(); + + assert_eq!(serialized.len(), 6); + + let onchain_code = r#"(input: [Felt; 6]) -> Vec { + use miden_field_repr::{FeltReader, FromFeltRepr, ToFeltRepr}; + + assert_eq(input[0], felt!(111111)); + assert_eq(input[1], felt!(0)); + assert_eq(input[5], felt!(55)); + + #[derive(FromFeltRepr, ToFeltRepr)] + struct TestStruct { + n1: u64, + a: u32, + b: u32, + x: u32, + y: u32, + } + + let mut reader = FeltReader::new(&input); + let deserialized = TestStruct::from_felt_repr(&mut reader); + + // NOTE: Keep `y` live until `to_felt_repr()` to force spilling to locals. + + deserialized.to_felt_repr() + }"#; + + let config = WasmTranslationConfig::default(); + let name = "onchain_minimal_u64_bug"; + let mut test = build_felt_repr_test(name, onchain_code, config); + let package = test.compiled_package(); + + let in_elem_addr = 21u32 * 16384; + let out_elem_addr = 20u32 * 16384; + let in_byte_addr = in_elem_addr * 4; + let out_byte_addr = out_elem_addr * 4; + + let input_felts: Vec = to_core_felts(&serialized); + + let initializers = [Initializer::MemoryFelts { + addr: in_elem_addr, + felts: Cow::from(input_felts), + }]; + + let args = [ + miden_core::Felt::new(in_byte_addr as u64), + miden_core::Felt::new(out_byte_addr as u64), + ]; + + let _: miden_core::Felt = eval_package(&package, initializers, &args, &test.session, |trace| { + let result_felts = read_vec_felts(trace, out_byte_addr, 6); + let mut reader = FeltReader::new(&result_felts); + let result_struct = MinimalU64Bug::from_felt_repr(&mut reader); + + assert_eq!(result_struct, original, "Minimal u64 bug round-trip failed"); + Ok(()) + }) + .unwrap(); +} + +/// Test struct with Felt fields instead of u64 (to test if u64 causes the stack tracking bug). +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct MixedTypesNoU64 { + f1: Felt, + f2: Felt, + f3: Felt, + f4: Felt, + x: u32, + y: u8, +} + +/// Test struct serialization with Felt fields instead of u64 - to verify u64 involvement in bug. +/// +/// Tests a struct with 4 Felt, 1 u32, and 1 u8 fields (no u64). +/// Each field is serialized as one Felt, so total is 6 Felts. +#[test] +fn test_mixed_types_no_u64_round_trip() { + let original = MixedTypesNoU64 { + f1: Felt::from_u64_unchecked(111111), + f2: Felt::from_u64_unchecked(222222), + f3: Felt::from_u64_unchecked(333333), + f4: Felt::from_u64_unchecked(444444), + x: 55555, + y: 66, + }; + let serialized = original.to_felt_repr(); + + // Each field serializes to one Felt + assert_eq!(serialized.len(), 6); + + let onchain_code = r#"(input: [Felt; 6]) -> Vec { + use miden_field_repr::{FeltReader, FromFeltRepr, ToFeltRepr}; + + #[derive(FromFeltRepr, ToFeltRepr)] + struct TestStruct { + f1: Felt, + f2: Felt, + f3: Felt, + f4: Felt, + x: u32, + y: u8, + } + + let mut reader = FeltReader::new(&input); + let deserialized = TestStruct::from_felt_repr(&mut reader); + + // Deliberately NOT using assert_eq on y to trigger the bug (if u64 is involved) + // assert_eq(Felt::from(deserialized.y as u32), felt!(66)); + + deserialized.to_felt_repr() + }"#; + + let config = WasmTranslationConfig::default(); + let name = "onchain_mixed_types_no_u64"; + let mut test = build_felt_repr_test(name, onchain_code, config); + let package = test.compiled_package(); + + let in_elem_addr = 21u32 * 16384; + let out_elem_addr = 20u32 * 16384; + let in_byte_addr = in_elem_addr * 4; + let out_byte_addr = out_elem_addr * 4; + + let input_felts: Vec = to_core_felts(&serialized); + + let initializers = [Initializer::MemoryFelts { + addr: in_elem_addr, + felts: Cow::from(input_felts), + }]; + + let args = [ + miden_core::Felt::new(in_byte_addr as u64), + miden_core::Felt::new(out_byte_addr as u64), + ]; + + let _: miden_core::Felt = eval_package(&package, initializers, &args, &test.session, |trace| { + let result_felts = read_vec_felts(trace, out_byte_addr, 6); + let mut reader = FeltReader::new(&result_felts); + let result_struct = MixedTypesNoU64::from_felt_repr(&mut reader); + + assert_eq!(result_struct, original, "Mixed types (no u64) round-trip failed"); + Ok(()) + }) + .unwrap(); +} + +/// Inner struct for nested struct tests. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct Inner { + x: Felt, + y: u64, +} + +/// Outer struct containing nested Inner struct. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct Outer { + a: Felt, + inner: Inner, + b: u32, + flag1: bool, + flag2: bool, +} + +/// Test nested struct serialization - full round-trip execution. +/// +/// Tests a struct containing another struct as a field, plus bool fields. +/// Outer has: 1 Felt + Inner(1 Felt + 1 u64) + 1 u32 + 2 bool = 7 Felts total. +#[test] +fn test_nested_struct_round_trip() { + let original = Outer { + a: Felt::from_u64_unchecked(111111), + inner: Inner { + x: Felt::from_u64_unchecked(222222), + y: 333333, + }, + b: 44444, + flag1: true, + flag2: false, + }; + let serialized = original.to_felt_repr(); + + // Outer.a (1) + Inner.x (1) + Inner.y (2) + Outer.b (1) + flag1 (1) + flag2 (1) = 7 Felts + assert_eq!(serialized.len(), 7); + + let onchain_code = r#"(input: [Felt; 7]) -> Vec { + use miden_field_repr::{FeltReader, FromFeltRepr, ToFeltRepr}; + + #[derive(FromFeltRepr, ToFeltRepr)] + struct Inner { + x: Felt, + y: u64, + } + + #[derive(FromFeltRepr, ToFeltRepr)] + struct Outer { + a: Felt, + inner: Inner, + b: u32, + flag1: bool, + flag2: bool, + } + + let mut reader = FeltReader::new(&input); + let deserialized = Outer::from_felt_repr(&mut reader); + + // Verify fields were deserialized correctly + assert_eq(deserialized.a, felt!(111111)); + assert_eq(deserialized.inner.x, felt!(222222)); + assert_eq(Felt::from(deserialized.b), felt!(44444)); + assert_eq(Felt::from(deserialized.flag1 as u32), felt!(1)); + assert_eq(Felt::from(deserialized.flag2 as u32), felt!(0)); + + deserialized.to_felt_repr() + }"#; + + let config = WasmTranslationConfig::default(); + let name = "onchain_nested_struct"; + let mut test = build_felt_repr_test(name, onchain_code, config); + let package = test.compiled_package(); + + let in_elem_addr = 21u32 * 16384; + let out_elem_addr = 20u32 * 16384; + let in_byte_addr = in_elem_addr * 4; + let out_byte_addr = out_elem_addr * 4; + + let input_felts: Vec = to_core_felts(&serialized); + + let initializers = [Initializer::MemoryFelts { + addr: in_elem_addr, + felts: Cow::from(input_felts), + }]; + + let args = [ + miden_core::Felt::new(in_byte_addr as u64), + miden_core::Felt::new(out_byte_addr as u64), + ]; + + let _: miden_core::Felt = eval_package(&package, initializers, &args, &test.session, |trace| { + let result_felts = read_vec_felts(trace, out_byte_addr, 7); + let mut reader = FeltReader::new(&result_felts); + let result_struct = Outer::from_felt_repr(&mut reader); + + assert_eq!(result_struct, original, "Nested struct round-trip failed"); + Ok(()) + }) + .unwrap(); +} + +#[test] +fn test_enum_unit_round_trip() { + #[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] + enum SimpleEnum { + A, + B, + C, + } + + #[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] + struct Wrapper { + pad: Felt, + value: SimpleEnum, + } + + let original = Wrapper { + pad: Felt::from_u64_unchecked(999), + value: SimpleEnum::B, + }; + let serialized = original.to_felt_repr(); + + assert_eq!(serialized.len(), 2); + assert_eq!(serialized[0], Felt::from_u64_unchecked(999)); + assert_eq!(serialized[1], Felt::from_u64_unchecked(1)); + + let onchain_code = r#"(input: [Felt; 2]) -> Vec { + use miden_field_repr::{FeltReader, FromFeltRepr, ToFeltRepr}; + + #[derive(FromFeltRepr, ToFeltRepr)] + enum SimpleEnum { + A, + B, + C, + } + + #[derive(FromFeltRepr, ToFeltRepr)] + struct Wrapper { + pad: Felt, + value: SimpleEnum, + } + + let mut reader = FeltReader::new(&input); + let deserialized = Wrapper::from_felt_repr(&mut reader); + deserialized.to_felt_repr() + }"#; + + let config = WasmTranslationConfig::default(); + let name = "onchain_enum_unit"; + let mut test = build_felt_repr_test(name, onchain_code, config); + let package = test.compiled_package(); + + let in_elem_addr = 21u32 * 16384; + let out_elem_addr = 20u32 * 16384; + let in_byte_addr = in_elem_addr * 4; + let out_byte_addr = out_elem_addr * 4; + + let initializers = [Initializer::MemoryFelts { + addr: in_elem_addr, + felts: Cow::from(to_core_felts(&serialized)), + }]; + + let args = [ + miden_core::Felt::new(in_byte_addr as u64), + miden_core::Felt::new(out_byte_addr as u64), + ]; + + let _: miden_core::Felt = eval_package(&package, initializers, &args, &test.session, |trace| { + let result_felts = read_vec_felts(trace, out_byte_addr, 2); + let mut reader = FeltReader::new(&result_felts); + let result_struct = Wrapper::from_felt_repr(&mut reader); + assert_eq!(result_struct, original, "Unit enum round-trip failed"); + Ok(()) + }) + .unwrap(); +} + +#[test] +fn test_enum_tuple_round_trip() { + #[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] + enum MixedEnum { + Unit, + Pair(Felt, u32), + Struct { x: u64, flag: bool }, + } + + let original = MixedEnum::Pair(Felt::from_u64_unchecked(111), 222); + let serialized = original.to_felt_repr(); + + assert_eq!(serialized.len(), 3); + assert_eq!(serialized[0], Felt::from_u64_unchecked(1)); + assert_eq!(serialized[1], Felt::from_u64_unchecked(111)); + assert_eq!(serialized[2], Felt::from_u64_unchecked(222)); + + let onchain_code = r#"(input: [Felt; 3]) -> Vec { + use miden_field_repr::{FeltReader, FromFeltRepr, ToFeltRepr}; + + #[derive(FromFeltRepr, ToFeltRepr)] + enum MixedEnum { + Unit, + Pair(Felt, u32), + Struct { x: u64, flag: bool }, + } + + let mut reader = FeltReader::new(&input); + let deserialized = MixedEnum::from_felt_repr(&mut reader); + deserialized.to_felt_repr() + }"#; + + let config = WasmTranslationConfig::default(); + let name = "onchain_enum_tuple"; + let mut test = build_felt_repr_test(name, onchain_code, config); + let package = test.compiled_package(); + + let in_elem_addr = 21u32 * 16384; + let out_elem_addr = 20u32 * 16384; + let in_byte_addr = in_elem_addr * 4; + let out_byte_addr = out_elem_addr * 4; + + let initializers = [Initializer::MemoryFelts { + addr: in_elem_addr, + felts: Cow::from(to_core_felts(&serialized)), + }]; + + let args = [ + miden_core::Felt::new(in_byte_addr as u64), + miden_core::Felt::new(out_byte_addr as u64), + ]; + + let _: miden_core::Felt = eval_package(&package, initializers, &args, &test.session, |trace| { + let result_felts = read_vec_felts(trace, out_byte_addr, 3); + let mut reader = FeltReader::new(&result_felts); + let result_enum = MixedEnum::from_felt_repr(&mut reader); + assert_eq!(result_enum, original, "Tuple enum round-trip failed"); + Ok(()) + }) + .unwrap(); +} + +#[test] +fn test_struct_with_enum_round_trip() { + #[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] + struct Inner { + a: Felt, + b: u32, + } + + #[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] + enum Kind { + Empty, + Inline { inner: Inner, ok: bool }, + Tuple(Inner, u64), + } + + #[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] + struct Outer { + prefix: Felt, + kind: Kind, + suffix: u8, + } + + let original = Outer { + prefix: Felt::from_u64_unchecked(999), + kind: Kind::Inline { + inner: Inner { + a: Felt::from_u64_unchecked(111), + b: 222, + }, + ok: true, + }, + suffix: 9, + }; + let serialized = original.to_felt_repr(); + + assert_eq!(serialized.len(), 6); + + let onchain_code = r#"(input: [Felt; 6]) -> Vec { + use miden_field_repr::{FeltReader, FromFeltRepr, ToFeltRepr}; + + #[derive(FromFeltRepr, ToFeltRepr)] + struct Inner { + a: Felt, + b: u32, + } + + #[derive(FromFeltRepr, ToFeltRepr)] + enum Kind { + Empty, + Inline { inner: Inner, ok: bool }, + Tuple(Inner, u64), + } + + #[derive(FromFeltRepr, ToFeltRepr)] + struct Outer { + prefix: Felt, + kind: Kind, + suffix: u8, + } + + let mut reader = FeltReader::new(&input); + let deserialized = Outer::from_felt_repr(&mut reader); + deserialized.to_felt_repr() + }"#; + + let config = WasmTranslationConfig::default(); + let name = "onchain_struct_with_enum"; + let mut test = build_felt_repr_test(name, onchain_code, config); + let package = test.compiled_package(); + + let in_elem_addr = 21u32 * 16384; + let out_elem_addr = 20u32 * 16384; + let in_byte_addr = in_elem_addr * 4; + let out_byte_addr = out_elem_addr * 4; + + let initializers = [Initializer::MemoryFelts { + addr: in_elem_addr, + felts: Cow::from(to_core_felts(&serialized)), + }]; + + let args = [ + miden_core::Felt::new(in_byte_addr as u64), + miden_core::Felt::new(out_byte_addr as u64), + ]; + + let _: miden_core::Felt = eval_package(&package, initializers, &args, &test.session, |trace| { + let result_felts = read_vec_felts(trace, out_byte_addr, 6); + let mut reader = FeltReader::new(&result_felts); + let result_struct = Outer::from_felt_repr(&mut reader); + assert_eq!(result_struct, original, "Struct-with-enum round-trip failed"); + Ok(()) + }) + .unwrap(); +} + +#[test] +fn test_enum_nested_with_struct_round_trip() { + #[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] + enum State { + A, + B { n: u64, f: bool }, + } + + #[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] + struct Wrapper { + left: Felt, + right: Felt, + state: State, + } + + #[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] + enum Top { + None, + Wrap(Wrapper), + } + + let original = Top::Wrap(Wrapper { + left: Felt::from_u64_unchecked(7), + right: Felt::from_u64_unchecked(8), + state: State::B { + n: 999_999, + f: false, + }, + }); + let serialized = original.to_felt_repr(); + + assert_eq!(serialized.len(), 7); + + let onchain_code = r#"(input: [Felt; 7]) -> Vec { + use miden_field_repr::{FeltReader, FromFeltRepr, ToFeltRepr}; + + #[derive(FromFeltRepr, ToFeltRepr)] + enum State { + A, + B { n: u64, f: bool }, + } + + #[derive(FromFeltRepr, ToFeltRepr)] + struct Wrapper { + left: Felt, + right: Felt, + state: State, + } + + #[derive(FromFeltRepr, ToFeltRepr)] + enum Top { + None, + Wrap(Wrapper), + } + + let mut reader = FeltReader::new(&input); + let deserialized = Top::from_felt_repr(&mut reader); + deserialized.to_felt_repr() + }"#; + + let config = WasmTranslationConfig::default(); + let name = "onchain_enum_nested_struct"; + let mut test = build_felt_repr_test(name, onchain_code, config); + let package = test.compiled_package(); + + let in_elem_addr = 21u32 * 16384; + let out_elem_addr = 20u32 * 16384; + let in_byte_addr = in_elem_addr * 4; + let out_byte_addr = out_elem_addr * 4; + + let initializers = [Initializer::MemoryFelts { + addr: in_elem_addr, + felts: Cow::from(to_core_felts(&serialized)), + }]; + + let args = [ + miden_core::Felt::new(in_byte_addr as u64), + miden_core::Felt::new(out_byte_addr as u64), + ]; + + let _: miden_core::Felt = eval_package(&package, initializers, &args, &test.session, |trace| { + let result_felts = read_vec_felts(trace, out_byte_addr, 7); + let mut reader = FeltReader::new(&result_felts); + let result_enum = Top::from_felt_repr(&mut reader); + assert_eq!(result_enum, original, "Nested enum round-trip failed"); + Ok(()) + }) + .unwrap(); +} + +/// Test struct containing an `Option` field for on-chain/off-chain round-trip tests. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct WithOption { + prefix: Felt, + maybe: Option, + suffix: bool, +} + +#[test] +fn test_struct_with_option_round_trip() { + let original_none = WithOption { + prefix: Felt::from_u64_unchecked(7), + maybe: None, + suffix: false, + }; + let original_some = WithOption { + prefix: Felt::from_u64_unchecked(5), + maybe: Some(42), + suffix: true, + }; + + let serialized_none = original_none.to_felt_repr(); + let serialized_some = original_some.to_felt_repr(); + + assert_eq!(serialized_none.len(), 3); + assert_eq!(serialized_some.len(), 4); + + let onchain_code = r#"(input: [Felt; 4]) -> Vec { + use miden_field_repr::{FeltReader, FromFeltRepr, ToFeltRepr}; + + #[derive(FromFeltRepr, ToFeltRepr)] + struct WithOption { + prefix: Felt, + maybe: Option, + suffix: bool, + } + + let mut reader = FeltReader::new(&input); + let deserialized = WithOption::from_felt_repr(&mut reader); + + deserialized.to_felt_repr() + }"#; + + let config = WasmTranslationConfig::default(); + let name = "onchain_struct_with_option"; + let mut test = build_felt_repr_test(name, onchain_code, config); + let package = test.compiled_package(); + + let in_elem_addr = 21u32 * 16384; + let out_elem_addr = 20u32 * 16384; + let in_byte_addr = in_elem_addr * 4; + let out_byte_addr = out_elem_addr * 4; + + // Case 1: `None` serializes to 3 felts, but the compiled on-chain entrypoint takes + // `[Felt; 4]` so we can reuse the same compiled package for both `None` and `Some`. + // The extra trailing `0` is never read by `FromFeltRepr`. + let mut input_none = serialized_none.clone(); + input_none.resize(4, ReprFelt::from_u64_unchecked(0)); + let initializers = [Initializer::MemoryFelts { + addr: in_elem_addr, + felts: Cow::from(to_core_felts(&input_none)), + }]; + let args = [ + miden_core::Felt::new(in_byte_addr as u64), + miden_core::Felt::new(out_byte_addr as u64), + ]; + let _: miden_core::Felt = eval_package(&package, initializers, &args, &test.session, |trace| { + let result_felts = read_vec_felts(trace, out_byte_addr, serialized_none.len()); + let mut reader = FeltReader::new(&result_felts); + let result_struct = WithOption::from_felt_repr(&mut reader); + assert_eq!(result_struct, original_none, "Option round-trip (None) failed"); + Ok(()) + }) + .unwrap(); + + // Case 2: Some + let initializers = [Initializer::MemoryFelts { + addr: in_elem_addr, + felts: Cow::from(to_core_felts(&serialized_some)), + }]; + let _: miden_core::Felt = eval_package(&package, initializers, &args, &test.session, |trace| { + let result_felts = read_vec_felts(trace, out_byte_addr, serialized_some.len()); + let mut reader = FeltReader::new(&result_felts); + let result_struct = WithOption::from_felt_repr(&mut reader); + assert_eq!(result_struct, original_some, "Option round-trip (Some) failed"); + Ok(()) + }) + .unwrap(); +} + +/// Test struct containing a `Vec` field for on-chain/off-chain round-trip tests. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct WithVec { + prefix: Felt, + items: Vec, + suffix: bool, +} + +#[test] +fn test_struct_with_vec_round_trip() { + let original = WithVec { + prefix: Felt::from_u64_unchecked(9), + items: vec![1, 2, 3], + suffix: true, + }; + let serialized = original.to_felt_repr(); + assert_eq!(serialized.len(), 6); + + let onchain_code = r#"(input: [Felt; 6]) -> Vec { + use miden_field_repr::{FeltReader, FromFeltRepr, ToFeltRepr}; + + #[derive(FromFeltRepr, ToFeltRepr)] + struct WithVec { + prefix: Felt, + items: Vec, + suffix: bool, + } + + let mut reader = FeltReader::new(&input); + let deserialized = WithVec::from_felt_repr(&mut reader); + deserialized.to_felt_repr() + }"#; + + let config = WasmTranslationConfig::default(); + let name = "onchain_struct_with_vec"; + let mut test = build_felt_repr_test(name, onchain_code, config); + let package = test.compiled_package(); + + let in_elem_addr = 21u32 * 16384; + let out_elem_addr = 20u32 * 16384; + let in_byte_addr = in_elem_addr * 4; + let out_byte_addr = out_elem_addr * 4; + + let initializers = [Initializer::MemoryFelts { + addr: in_elem_addr, + felts: Cow::from(to_core_felts(&serialized)), + }]; + + let args = [ + miden_core::Felt::new(in_byte_addr as u64), + miden_core::Felt::new(out_byte_addr as u64), + ]; + + let _: miden_core::Felt = eval_package(&package, initializers, &args, &test.session, |trace| { + let result_felts = read_vec_felts(trace, out_byte_addr, 6); + let mut reader = FeltReader::new(&result_felts); + let result_struct = WithVec::from_felt_repr(&mut reader); + assert_eq!(result_struct, original, "Vec round-trip failed"); + Ok(()) + }) + .unwrap(); +} + +/// Test tuple struct serialization - full round-trip execution. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct TupleStruct(u32, bool, Felt); + +#[test] +fn test_tuple_struct_round_trip() { + let original = TupleStruct(22, true, Felt::from_u64_unchecked(33)); + let serialized = original.to_felt_repr(); + assert_eq!( + serialized, + vec![ + ReprFelt::from_u64_unchecked(22), + ReprFelt::from_u64_unchecked(1), + ReprFelt::from_u64_unchecked(33), + ] + ); + + let onchain_code = r#"(input: [Felt; 3]) -> Vec { + use miden_field_repr::{FeltReader, FromFeltRepr, ToFeltRepr}; + + #[derive(FromFeltRepr, ToFeltRepr)] + struct TupleStruct(u32, bool, Felt); + + let mut reader = FeltReader::new(&input); + let deserialized = TupleStruct::from_felt_repr(&mut reader); + deserialized.to_felt_repr() + }"#; + + let config = WasmTranslationConfig::default(); + let name = "onchain_tuple_struct"; + let mut test = build_felt_repr_test(name, onchain_code, config); + let package = test.compiled_package(); + + let in_elem_addr = 21u32 * 16384; + let out_elem_addr = 20u32 * 16384; + let in_byte_addr = in_elem_addr * 4; + let out_byte_addr = out_elem_addr * 4; + + let initializers = [Initializer::MemoryFelts { + addr: in_elem_addr, + felts: Cow::from(to_core_felts(&serialized)), + }]; + + let args = [ + miden_core::Felt::new(in_byte_addr as u64), + miden_core::Felt::new(out_byte_addr as u64), + ]; + + let _: miden_core::Felt = eval_package(&package, initializers, &args, &test.session, |trace| { + let result_felts = read_vec_felts(trace, out_byte_addr, 3); + let mut reader = FeltReader::new(&result_felts); + let result_struct = TupleStruct::from_felt_repr(&mut reader); + assert_eq!(result_struct, original, "Tuple struct round-trip failed"); + Ok(()) + }) + .unwrap(); +} diff --git a/sdk/field/Cargo.toml b/sdk/field/Cargo.toml new file mode 100644 index 000000000..7ed11de40 --- /dev/null +++ b/sdk/field/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "miden-field" +description = "A unified field element type for on-chain and off-chain Miden Rust code" +version = "0.10.0" +rust-version.workspace = true +authors.workspace = true +repository.workspace = true +homepage.workspace = true +documentation.workspace = true +categories.workspace = true +keywords.workspace = true +license.workspace = true +readme.workspace = true +edition.workspace = true + +[lib] +crate-type = ["rlib"] + +[dependencies] + +[target.'cfg(not(target_family = "wasm"))'.dependencies] +miden-core.workspace = true + +[target.'cfg(all(target_family = "wasm", not(miden)))'.dependencies] +miden-core.workspace = true + +[features] +default = [] diff --git a/sdk/field/build.rs b/sdk/field/build.rs new file mode 100644 index 000000000..733da30b9 --- /dev/null +++ b/sdk/field/build.rs @@ -0,0 +1,13 @@ +use std::env; + +fn main() { + println!("cargo::rerun-if-env-changed=MIDENC_TARGET_IS_MIDEN_VM"); + println!("cargo::rustc-check-cfg=cfg(miden)"); + + // `cargo-miden` compiles Rust to Wasm which will then be compiled to Miden VM code by `midenc`. + // When targeting a "real" Wasm runtime (e.g. `wasm32-unknown-unknown` for a web SDK), we want a + // regular felt representation instead. + if env::var_os("MIDENC_TARGET_IS_MIDEN_VM").is_some() { + println!("cargo::rustc-cfg=miden"); + } +} diff --git a/sdk/field/src/lib.rs b/sdk/field/src/lib.rs new file mode 100644 index 000000000..2bab6fd7c --- /dev/null +++ b/sdk/field/src/lib.rs @@ -0,0 +1,136 @@ +//! A unified `Felt` for on-chain and off-chain Miden Rust code. +//! +//! This crate provides a single `Felt` type that can be used in both on-chain (Wasm) and off-chain +//! (native) Rust code: +//! - When targeting the Miden VM via Wasm, `Felt` is backed by an on-chain felt. +//! - Otherwise, `Felt` is backed by a felt (`miden-core`'s field element). + +#![no_std] +#![deny(warnings)] + +use core::{fmt, hash::Hash}; + +/// The field modulus, `2^64 - 2^32 + 1`. +pub const MODULUS: u64 = 0xffff_ffff_0000_0001; + +/// Errors returned by [`Felt::new`]. +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +pub enum FeltError { + /// The provided value was not a valid canonical felt. + InvalidValue, +} + +/// A crate-local trait capturing the API surface shared by all `Felt` representations. +/// +/// This is used to ensure the on-chain and off-chain implementations don't drift in the common +/// "core" operations, and that required operator traits are implemented consistently. +pub(crate) trait FeltImpl: + Copy + + Clone + + fmt::Debug + + fmt::Display + + Eq + + Ord + + Hash + + core::ops::Add + + core::ops::Sub + + core::ops::Mul + + core::ops::Div + + core::ops::Neg + + core::ops::AddAssign + + core::ops::SubAssign + + core::ops::MulAssign + + core::ops::DivAssign +{ + /// Creates a `Felt` from `value`. + /// + /// # Panics + /// + /// Panics if `value > Felt::M`. + fn from_u64_unchecked(value: u64) -> Self; + + /// Creates a `Felt` from a `u32` value. + fn from_u32(value: u32) -> Self; + + /// Returns the canonical `u64` value of this felt. + fn as_u64(self) -> u64; + + /// Returns true if this felt is odd. + fn is_odd(self) -> bool; + + /// Returns `self^-1`. Fails if `self = 0`. + fn inv(self) -> Self; + + /// Returns `2^self`. Fails if `self > 63`. + fn pow2(self) -> Self; + + /// Returns `self^other`. + fn exp(self, other: Self) -> Self; +} + +#[cfg(all(target_family = "wasm", miden))] +mod wasm32; +#[cfg(all(target_family = "wasm", miden))] +pub use wasm32::Felt; + +#[cfg(not(all(target_family = "wasm", miden)))] +mod native; +#[cfg(not(all(target_family = "wasm", miden)))] +pub use native::Felt; + +impl Felt { + /// Field modulus = 2^64 - 2^32 + 1. + pub const M: u64 = MODULUS; + + /// Creates a `Felt` from `value` without range checks. + #[inline(always)] + pub fn from_u64_unchecked(value: u64) -> Self { + ::from_u64_unchecked(value) + } + + /// Creates a `Felt` from a `u32` value. + #[inline(always)] + pub fn from_u32(value: u32) -> Self { + ::from_u32(value) + } + + /// Creates a `Felt` from `value`, returning an error if it is out of range. + #[inline(always)] + pub fn new(value: u64) -> Result { + if value >= Self::M { + Err(FeltError::InvalidValue) + } else { + Ok(Self::from_u64_unchecked(value)) + } + } + + /// Returns the canonical `u64` value of this felt. + #[inline(always)] + pub fn as_u64(self) -> u64 { + ::as_u64(self) + } + + /// Returns true if this felt is odd. + #[inline(always)] + pub fn is_odd(self) -> bool { + ::is_odd(self) + } + + /// Returns `self^-1`. Fails if `self = 0`. + #[inline(always)] + pub fn inv(self) -> Self { + ::inv(self) + } + + /// Returns `2^self`. Fails if `self > 63`. + #[inline(always)] + pub fn pow2(self) -> Self { + ::pow2(self) + } + + /// Returns `self^other`. + #[inline(always)] + pub fn exp(self, other: Self) -> Self { + ::exp(self, other) + } +} diff --git a/sdk/field/src/native.rs b/sdk/field/src/native.rs new file mode 100644 index 000000000..1b352f699 --- /dev/null +++ b/sdk/field/src/native.rs @@ -0,0 +1,203 @@ +//! Off-chain implementation of [`crate::Felt`]. + +use miden_core::{Felt as CoreFelt, FieldElement}; + +use crate::FeltImpl; + +#[repr(transparent)] +#[derive(Copy, Clone, Debug)] +/// A `Felt` represented as a felt (`miden_core::Felt`). +pub struct Felt(pub miden_core::Felt); + +impl FeltImpl for Felt { + #[inline(always)] + fn from_u64_unchecked(value: u64) -> Self { + assert!(value <= Felt::M, "value {value} is larger than field modulus {}", Felt::M); + Self(CoreFelt::new(value)) + } + + #[inline(always)] + fn from_u32(value: u32) -> Self { + Self::from_u64_unchecked(value as u64) + } + + #[inline(always)] + fn as_u64(self) -> u64 { + self.0.as_int() + } + + #[inline(always)] + fn is_odd(self) -> bool { + self.as_u64() & 1 == 1 + } + + #[inline(always)] + fn inv(self) -> Self { + Self(self.0.inv()) + } + + #[inline(always)] + fn pow2(self) -> Self { + let n = self.as_u64(); + assert!(n <= 63, "pow2: exponent out of range"); + Self(CoreFelt::new(1u64 << (n as u32))) + } + + #[inline(always)] + fn exp(self, other: Self) -> Self { + Self(self.0.exp(other.as_u64())) + } +} + +impl From for Felt { + fn from(value: CoreFelt) -> Self { + Self(value) + } +} + +impl From for CoreFelt { + fn from(value: Felt) -> Self { + value.0 + } +} + +impl From for u64 { + fn from(felt: Felt) -> u64 { + felt.as_u64() + } +} + +impl From for Felt { + fn from(value: u32) -> Self { + Self::from_u32(value) + } +} + +impl From for Felt { + fn from(value: u16) -> Self { + Self::from_u64_unchecked(value as u64) + } +} + +impl From for Felt { + fn from(value: u8) -> Self { + Self::from_u64_unchecked(value as u64) + } +} + +#[cfg(target_pointer_width = "32")] +impl From for Felt { + fn from(value: usize) -> Self { + Self::from_u64_unchecked(value as u64) + } +} + +impl core::ops::Add for Felt { + type Output = Self; + + #[inline(always)] + fn add(self, other: Self) -> Self { + Self(self.0 + other.0) + } +} + +impl core::ops::AddAssign for Felt { + #[inline(always)] + fn add_assign(&mut self, other: Self) { + *self = *self + other; + } +} + +impl core::ops::Sub for Felt { + type Output = Self; + + #[inline(always)] + fn sub(self, other: Self) -> Self { + Self(self.0 - other.0) + } +} + +impl core::ops::SubAssign for Felt { + #[inline(always)] + fn sub_assign(&mut self, other: Self) { + *self = *self - other; + } +} + +impl core::ops::Mul for Felt { + type Output = Self; + + #[inline(always)] + fn mul(self, other: Self) -> Self { + Self(self.0 * other.0) + } +} + +impl core::ops::MulAssign for Felt { + #[inline(always)] + fn mul_assign(&mut self, other: Self) { + *self = *self * other; + } +} + +impl core::ops::Div for Felt { + type Output = Self; + + #[inline(always)] + fn div(self, other: Self) -> Self { + Self(self.0 / other.0) + } +} + +impl core::ops::DivAssign for Felt { + #[inline(always)] + fn div_assign(&mut self, other: Self) { + *self = *self / other; + } +} + +impl core::ops::Neg for Felt { + type Output = Self; + + #[inline(always)] + fn neg(self) -> Self { + Self(-self.0) + } +} + +impl PartialEq for Felt { + #[inline(always)] + fn eq(&self, other: &Self) -> bool { + self.as_u64() == other.as_u64() + } +} + +impl Eq for Felt {} + +impl PartialOrd for Felt { + #[inline(always)] + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +impl Ord for Felt { + #[inline(always)] + fn cmp(&self, other: &Self) -> core::cmp::Ordering { + self.as_u64().cmp(&other.as_u64()) + } +} + +impl core::fmt::Display for Felt { + #[inline] + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + core::fmt::Display::fmt(&self.as_u64(), f) + } +} + +impl core::hash::Hash for Felt { + #[inline] + fn hash(&self, state: &mut H) { + core::hash::Hash::hash(&self.as_u64(), state); + } +} diff --git a/sdk/field/src/wasm32.rs b/sdk/field/src/wasm32.rs new file mode 100644 index 000000000..550ef65db --- /dev/null +++ b/sdk/field/src/wasm32.rs @@ -0,0 +1,296 @@ +//! On-chain implementation of [`crate::Felt`]. + +use crate::FeltImpl; + +#[repr(transparent)] +#[derive(Copy, Clone, Debug)] +/// A `Felt` represented as an on-chain felt. +pub struct Felt { + /// The backing type is `f32` which will be treated as a felt by the compiler. + /// We're basically hijacking the Wasm `f32` type and treat as felt. + pub inner: f32, + // We cannot define this type as `Felt(f32)` since there is no struct tuple support in WIT. + // For the type remapping to work the bindings are expecting the remapped type to be the same + // shape as the one generated from WIT. + // In WIT it's defined as + // ```wit + // record felt { + // inner: f32, + // } + // + //``` + // see sdk/base-macros/wit/miden.wit so we have to define it like that here. + // +} + +unsafe extern "C" { + #[link_name = "intrinsics::felt::from_u64_unchecked"] + pub(crate) fn extern_from_u64_unchecked(value: u64) -> Felt; + + #[link_name = "intrinsics::felt::from_u32"] + pub(crate) fn extern_from_u32(value: u32) -> Felt; + + #[link_name = "intrinsics::felt::as_u64"] + pub(crate) fn extern_as_u64(felt: Felt) -> u64; + + #[link_name = "intrinsics::felt::sub"] + pub(crate) fn extern_sub(a: Felt, b: Felt) -> Felt; + + #[link_name = "intrinsics::felt::mul"] + pub(crate) fn extern_mul(a: Felt, b: Felt) -> Felt; + + #[link_name = "intrinsics::felt::div"] + pub(crate) fn extern_div(a: Felt, b: Felt) -> Felt; + + #[link_name = "intrinsics::felt::neg"] + pub(crate) fn extern_neg(a: Felt) -> Felt; + + #[link_name = "intrinsics::felt::inv"] + pub(crate) fn extern_inv(a: Felt) -> Felt; + + #[link_name = "intrinsics::felt::pow2"] + pub(crate) fn extern_pow2(a: Felt) -> Felt; + + #[link_name = "intrinsics::felt::exp"] + pub(crate) fn extern_exp(a: Felt, b: Felt) -> Felt; + + #[link_name = "intrinsics::felt::eq"] + pub(crate) fn extern_eq(a: Felt, b: Felt) -> i32; + + #[link_name = "intrinsics::felt::gt"] + pub(crate) fn extern_gt(a: Felt, b: Felt) -> i32; + + #[link_name = "intrinsics::felt::lt"] + pub(crate) fn extern_lt(a: Felt, b: Felt) -> i32; + + #[link_name = "intrinsics::felt::ge"] + pub(crate) fn extern_ge(a: Felt, b: Felt) -> i32; + + #[link_name = "intrinsics::felt::le"] + pub(crate) fn extern_le(a: Felt, b: Felt) -> i32; + + #[link_name = "intrinsics::felt::is_odd"] + pub(crate) fn extern_is_odd(a: Felt) -> i32; + + #[link_name = "intrinsics::felt::add"] + pub(crate) fn extern_add(a: Felt, b: Felt) -> Felt; +} + +// Note: inherent `Felt` methods live in `sdk/field/src/lib.rs` and delegate to the crate-local +// `FeltImpl` trait to ensure the on-chain/off-chain APIs don't drift. + +impl FeltImpl for Felt { + #[inline(always)] + fn from_u64_unchecked(value: u64) -> Self { + assert!(value <= Felt::M, "value {value} is larger than field modulus {}", Felt::M); + unsafe { extern_from_u64_unchecked(value) } + } + + #[inline(always)] + fn from_u32(value: u32) -> Self { + unsafe { extern_from_u32(value) } + } + + #[inline(always)] + fn as_u64(self) -> u64 { + unsafe { extern_as_u64(self) } + } + + #[inline(always)] + fn is_odd(self) -> bool { + unsafe { extern_is_odd(self) != 0 } + } + + #[inline(always)] + fn inv(self) -> Self { + unsafe { extern_inv(self) } + } + + #[inline(always)] + fn pow2(self) -> Self { + unsafe { extern_pow2(self) } + } + + #[inline(always)] + fn exp(self, other: Self) -> Self { + unsafe { extern_exp(self, other) } + } +} + +impl From for u64 { + fn from(felt: Felt) -> u64 { + felt.as_u64() + } +} + +impl From for Felt { + fn from(value: u32) -> Self { + Self { + inner: f32::from_bits(value), + } + } +} + +impl From for Felt { + fn from(value: u16) -> Self { + Self { + inner: f32::from_bits(value as u32), + } + } +} + +impl From for Felt { + fn from(value: u8) -> Self { + Self { + inner: f32::from_bits(value as u32), + } + } +} + +#[cfg(target_pointer_width = "32")] +impl From for Felt { + fn from(value: usize) -> Self { + Self { + inner: f32::from_bits(value as u32), + } + } +} + +impl core::ops::Add for Felt { + type Output = Self; + + #[inline(always)] + fn add(self, other: Self) -> Self { + unsafe { extern_add(self, other) } + } +} + +impl core::ops::AddAssign for Felt { + #[inline(always)] + fn add_assign(&mut self, other: Self) { + *self = *self + other; + } +} + +impl core::ops::Sub for Felt { + type Output = Self; + + #[inline(always)] + fn sub(self, other: Self) -> Self { + unsafe { extern_sub(self, other) } + } +} + +impl core::ops::SubAssign for Felt { + #[inline(always)] + fn sub_assign(&mut self, other: Self) { + *self = *self - other; + } +} + +impl core::ops::Mul for Felt { + type Output = Self; + + #[inline(always)] + fn mul(self, other: Self) -> Self { + unsafe { extern_mul(self, other) } + } +} + +impl core::ops::MulAssign for Felt { + #[inline(always)] + fn mul_assign(&mut self, other: Self) { + *self = *self * other; + } +} + +impl core::ops::Div for Felt { + type Output = Self; + + #[inline(always)] + fn div(self, other: Self) -> Self { + unsafe { extern_div(self, other) } + } +} + +impl core::ops::DivAssign for Felt { + #[inline(always)] + fn div_assign(&mut self, other: Self) { + *self = *self / other; + } +} + +impl core::ops::Neg for Felt { + type Output = Self; + + #[inline(always)] + fn neg(self) -> Self { + unsafe { extern_neg(self) } + } +} + +impl PartialEq for Felt { + #[inline(always)] + fn eq(&self, other: &Self) -> bool { + unsafe { extern_eq(*self, *other) == 1 } + } +} + +impl Eq for Felt {} + +impl PartialOrd for Felt { + #[inline(always)] + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } + + #[inline(always)] + fn gt(&self, other: &Self) -> bool { + unsafe { extern_gt(*self, *other) != 0 } + } + + #[inline(always)] + fn ge(&self, other: &Self) -> bool { + unsafe { extern_ge(*self, *other) != 0 } + } + + #[inline(always)] + fn lt(&self, other: &Self) -> bool { + unsafe { extern_lt(*self, *other) != 0 } + } + + #[inline(always)] + fn le(&self, other: &Self) -> bool { + unsafe { extern_le(*self, *other) != 0 } + } +} + +impl Ord for Felt { + #[inline(always)] + fn cmp(&self, other: &Self) -> core::cmp::Ordering { + if self.lt(other) { + core::cmp::Ordering::Less + } else if self.gt(other) { + core::cmp::Ordering::Greater + } else { + core::cmp::Ordering::Equal + } + } +} + +// Note: public `assert` helpers live in `sdk/field/src/lib.rs` to preserve their stable paths in +// emitted WASM and expected-file tests. + +impl core::fmt::Display for Felt { + #[inline] + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + core::fmt::Display::fmt(&self.as_u64(), f) + } +} + +impl core::hash::Hash for Felt { + #[inline] + fn hash(&self, state: &mut H) { + core::hash::Hash::hash(&self.as_u64(), state); + } +} diff --git a/sdk/sdk/CHANGELOG.md b/sdk/sdk/CHANGELOG.md index 9928d634e..7a1e75d6b 100644 --- a/sdk/sdk/CHANGELOG.md +++ b/sdk/sdk/CHANGELOG.md @@ -6,6 +6,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.10.0] + +### BREAKING +- Remove `miden::active_note::add_assets_to_account` #932 +- `*_note::get_metadata` now returns `NoteMetadata` (2 `Word`s) #932 + +## [0.9.0] + +### BREAKING +- Note scripts now use a struct-based API: replace `#[note_script] fn run(...)` with `#[note]` on a note input `struct` and `#[note]` on an inherent `impl` block containing exactly one `#[note_script]` entrypoint method #890. See an example: [before](https://github.com/0xMiden/project-template/blob/6cd50a3312dffba1826fd4f812bc431da7f51d5f/contracts/increment-note/src/lib.rs) and [after](https://github.com/0xMiden/project-template/blob/1dd023311021800002e3a9fb687e936991877e65/contracts/increment-note/src/lib.rs). +- Storage slot IDs are now derived from slot names; `#[storage(slot(...))]`/`slot(...)` is no longer supported, and slot name / id collisions are detected at compile time #907 +- SDK bindings updated for VM v0.20 / protocol v0.13 (some bindings changed, e.g. `output_note::create(tag, note_type, recipient)`) #907 + - Previously auxiliary data could be passed into `output_note::create`. Now it can be attached to a note with `output_note::set_word_attachment`. +- Renamed `AccountId::from` to `AccountId::new` #808 + +### Added +- `ToFeltRepr` and `FromFeltRepr` traits with `derive` macros for felt-representation encoding/decoding #808 +- `Word::from_u64_unchecked` constructor #894 +- Assert `value <= Felt::M` in `Felt::from_u64_unchecked` #891 + +### Fixed +- Reverse the return values of `NativeAccount::add_asset` #862 +- Correct operand order in `Felt` `le`/`lt` op bindings #882 + ## [0.8.0] ### BREAKING @@ -16,6 +40,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Pass an account as a parameter to note and tx script #798 - `ActiveAccount` and `NativeAccount` traits to call tx kernel functions via `self.*` on an account #801 - Expose `miden::note::build_recipient_hash` tx kernel function Rust equivalent as `Recipient::compute` #823 +- Assert range in `Felt` constructor, moving some range checks from runtime to compile time #891 ## [0.7.1](https://github.com/0xMiden/compiler/compare/miden-v0.7.0...miden-v0.7.1) - 2025-11-13 diff --git a/sdk/sdk/Cargo.toml b/sdk/sdk/Cargo.toml index 21c71d859..5c83c4166 100644 --- a/sdk/sdk/Cargo.toml +++ b/sdk/sdk/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "miden" description = "Miden SDK" -version = "0.8.0" +version = "0.10.0" rust-version.workspace = true authors.workspace = true repository.workspace = true @@ -15,10 +15,13 @@ edition.workspace = true crate-type = ["rlib"] [dependencies] -miden-sdk-alloc = { version = "0.8.0", path = "../alloc" } -miden-stdlib-sys = { version = "0.8.0", path = "../stdlib-sys" } -miden-base = { version = "0.8.0", path = "../base" } -miden-base-sys = { version = "0.8.1", path = "../base-sys" } +miden-sdk-alloc = { version = "0.10.0", path = "../alloc" } +miden-stdlib-sys = { version = "0.10.0", path = "../stdlib-sys" } +miden-base = { version = "0.10.0", path = "../base" } +miden-base-macros = { version = "0.10.0", path = "../base-macros" } +miden-base-sys = { version = "0.10.0", path = "../base-sys" } +miden-field-repr = { version = "0.10.0", path = "../field-repr/repr" } +miden-field = { version = "0.10.0", path = "../field" } wit-bindgen = { version = "0.46", default-features = false, features = ["macros"] } [features] diff --git a/sdk/sdk/src/lib.rs b/sdk/sdk/src/lib.rs index e78082812..2e71404d2 100644 --- a/sdk/sdk/src/lib.rs +++ b/sdk/sdk/src/lib.rs @@ -2,7 +2,14 @@ #![deny(warnings)] pub use miden_base::*; +pub use miden_base_macros::{component, export_type, generate, note, note_script, tx_script}; pub use miden_base_sys::bindings::*; +/// Unified `Felt` and related helpers. +pub use miden_field as felt; +/// Error type for [`felt::Felt::new`]. +pub use miden_field::FeltError; +/// Felt representation helpers. +pub use miden_field_repr as felt_repr; pub use miden_sdk_alloc::BumpAlloc; pub use miden_stdlib_sys::*; // Re-export since `wit_bindgen::generate!` is used in `generate!` diff --git a/sdk/stdlib-sys/Cargo.toml b/sdk/stdlib-sys/Cargo.toml index 9b9ac83e4..b17008a13 100644 --- a/sdk/stdlib-sys/Cargo.toml +++ b/sdk/stdlib-sys/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "miden-stdlib-sys" description = "Low-level Rust bindings for the Miden standard library" -version = "0.8.0" +version = "0.10.0" rust-version.workspace = true authors.workspace = true repository.workspace = true @@ -17,6 +17,7 @@ links = "miden_stdlib_sys_stubs" crate-type = ["rlib"] [dependencies] +miden-field = { version = "0.10.0", path = "../field" } [features] default = [] diff --git a/sdk/stdlib-sys/README.md b/sdk/stdlib-sys/README.md index 46f11bf37..bc1e20ff4 100644 --- a/sdk/stdlib-sys/README.md +++ b/sdk/stdlib-sys/README.md @@ -1,6 +1,6 @@ # Miden Standard Library -The `miden-stdlib-sys` crate provides a `Felt` type that represents field element in the Miden VM and a standard library for developing Miden programs. +The `miden-stdlib-sys` crate provides low-level bindings for the Miden standard library, and re-exports the unified `Felt` type from the `miden-field` crate. ## Miden VM instructions @@ -32,4 +32,4 @@ Missing in IR: Missing in IR: - `emit`; -- `trace`; \ No newline at end of file +- `trace`; diff --git a/sdk/stdlib-sys/build.rs b/sdk/stdlib-sys/build.rs index 33a79fee1..78fcd23ba 100644 --- a/sdk/stdlib-sys/build.rs +++ b/sdk/stdlib-sys/build.rs @@ -18,6 +18,12 @@ use std::{env, path::PathBuf, process::Command}; fn main() { + println!("cargo::rerun-if-env-changed=MIDENC_TARGET_IS_MIDEN_VM"); + println!("cargo::rustc-check-cfg=cfg(miden)"); + if env::var_os("MIDENC_TARGET_IS_MIDEN_VM").is_some() { + println!("cargo::rustc-cfg=miden"); + } + let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); let target = env::var("TARGET").unwrap_or_else(|_| "wasm32-wasip1".to_string()); diff --git a/sdk/stdlib-sys/src/intrinsics/advice.rs b/sdk/stdlib-sys/src/intrinsics/advice.rs index d7af65bec..5b928e641 100644 --- a/sdk/stdlib-sys/src/intrinsics/advice.rs +++ b/sdk/stdlib-sys/src/intrinsics/advice.rs @@ -1,7 +1,8 @@ //! Contains intrinsics for advice operations with the advice provider. -use crate::{Felt, Word}; +use crate::intrinsics::{Felt, Word}; +#[cfg(all(target_family = "wasm", miden))] unsafe extern "C" { /// Pushes a list of field elements onto the advice stack. /// The list is looked up in the advice map using `key` as the key. @@ -14,10 +15,18 @@ unsafe extern "C" { /// The list is looked up in the advice map using `key` as the key. /// Returns the number of elements pushed on the advice stack. #[inline] +#[cfg(all(target_family = "wasm", miden))] pub fn adv_push_mapvaln(key: Word) -> Felt { unsafe { extern_adv_push_mapvaln(key[3], key[2], key[1], key[0]) } } +#[inline] +#[cfg(not(all(target_family = "wasm", miden)))] +pub fn adv_push_mapvaln(_key: Word) -> Felt { + unimplemented!("advice intrinsics are only available when targeting the Miden VM") +} + +#[cfg(all(target_family = "wasm", miden))] unsafe extern "C" { /// Emits an event to request a Falcon signature for the provided message/public key. /// This maps to the MASM instruction: `emit.AUTH_REQUEST_EVENT`. @@ -38,6 +47,7 @@ unsafe extern "C" { /// Host is expected to push the signature onto the advice stack in response. /// This is a workaround until migrating to VM v0.18 where the `emit` op reads the value from the stack. #[inline] +#[cfg(all(target_family = "wasm", miden))] pub fn emit_falcon_sig_to_stack(msg: Word, pub_key: Word) { unsafe { extern_emit_falcon_sig_to_stack( @@ -46,6 +56,13 @@ pub fn emit_falcon_sig_to_stack(msg: Word, pub_key: Word) { } } +#[inline] +#[cfg(not(all(target_family = "wasm", miden)))] +pub fn emit_falcon_sig_to_stack(_msg: Word, _pub_key: Word) { + unimplemented!("advice intrinsics are only available when targeting the Miden VM") +} + +#[cfg(all(target_family = "wasm", miden))] unsafe extern "C" { /// Inserts values from memory into the advice map using the provided key and memory range. /// Maps to the VM op: adv.insert_mem @@ -63,14 +80,29 @@ unsafe extern "C" { /// Insert memory region [start, end) into advice map under the given key. #[inline] +#[cfg(all(target_family = "wasm", miden))] pub fn adv_insert_mem(key: Word, start_addr: u32, end_addr: u32) { unsafe { extern_adv_insert_mem(key[3], key[2], key[1], key[0], start_addr, end_addr) } } +/// Insert memory region [start, end) into advice map under the given key. +#[inline] +#[cfg(not(all(target_family = "wasm", miden)))] +pub fn adv_insert_mem(_key: Word, _start_addr: u32, _end_addr: u32) { + unimplemented!("advice intrinsics are only available when targeting the Miden VM") +} + /// Insert values into advice map under the given key. +#[cfg(all(target_family = "wasm", miden))] pub fn adv_insert(key: Word, values: &[Word]) { let rust_ptr = values.as_ptr() as u32; let miden_ptr = rust_ptr / 4; let end_addr = miden_ptr + values.len() as u32 * 4; adv_insert_mem(key, miden_ptr, end_addr); } + +/// Insert values into advice map under the given key. +#[cfg(not(all(target_family = "wasm", miden)))] +pub fn adv_insert(_key: Word, _values: &[Word]) { + unimplemented!("advice intrinsics are only available when targeting the Miden VM") +} diff --git a/sdk/stdlib-sys/src/intrinsics/crypto.rs b/sdk/stdlib-sys/src/intrinsics/crypto.rs index 341f9e80c..0afd81750 100644 --- a/sdk/stdlib-sys/src/intrinsics/crypto.rs +++ b/sdk/stdlib-sys/src/intrinsics/crypto.rs @@ -61,6 +61,7 @@ impl From for [Felt; 4] { // Remove WIT import module and resolve via a linker stub instead. The stub will export // the MASM symbol `intrinsics::crypto::hmerge`, and the frontend will lower its // unreachable body to a MASM exec. +#[cfg(all(target_family = "wasm", miden))] unsafe extern "C" { /// Computes the hash of two digests using the Rescue Prime Optimized (RPO) /// permutation in 2-to-1 mode. @@ -87,6 +88,7 @@ unsafe extern "C" { /// * `digests` - An array of two digests to be merged. The function internally /// reorders them as required by the VM instruction (from [A, B] to [B, A] on the stack). #[inline] +#[cfg(all(target_family = "wasm", miden))] pub fn merge(digests: [Digest; 2]) -> Digest { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); @@ -98,3 +100,11 @@ pub fn merge(digests: [Digest; 2]) -> Digest { Digest::from_word(ret_area.assume_init()) } } + +/// Computes the hash of two digests using the Rescue Prime Optimized (RPO) permutation in 2-to-1 +/// mode. +#[inline] +#[cfg(not(all(target_family = "wasm", miden)))] +pub fn merge(_digests: [Digest; 2]) -> Digest { + unimplemented!("crypto intrinsics are only available when targeting the Miden VM") +} diff --git a/sdk/stdlib-sys/src/intrinsics/debug.rs b/sdk/stdlib-sys/src/intrinsics/debug.rs index 6e6978f7c..20d952ae9 100644 --- a/sdk/stdlib-sys/src/intrinsics/debug.rs +++ b/sdk/stdlib-sys/src/intrinsics/debug.rs @@ -1,3 +1,4 @@ +#[cfg(all(target_family = "wasm", miden))] unsafe extern "C" { #[link_name = "intrinsics::debug::break"] fn extern_break(); @@ -6,8 +7,17 @@ unsafe extern "C" { /// Sets a breakpoint in the emitted Miden Assembly at the point this function is called. #[inline(always)] #[track_caller] +#[cfg(all(target_family = "wasm", miden))] pub fn breakpoint() { unsafe { extern_break(); } } + +/// Sets a breakpoint in the emitted Miden Assembly at the point this function is called. +#[inline(always)] +#[track_caller] +#[cfg(not(all(target_family = "wasm", miden)))] +pub fn breakpoint() { + unimplemented!("debug intrinsics are only available when targeting the Miden VM") +} diff --git a/sdk/stdlib-sys/src/intrinsics/felt.rs b/sdk/stdlib-sys/src/intrinsics/felt.rs index adb38bee7..7079ba8a2 100644 --- a/sdk/stdlib-sys/src/intrinsics/felt.rs +++ b/sdk/stdlib-sys/src/intrinsics/felt.rs @@ -1,54 +1,9 @@ -use core::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign}; +//! Felt-related intrinsics and helpers. -unsafe extern "C" { - #[link_name = "intrinsics::felt::from_u64_unchecked"] - fn extern_from_u64_unchecked(value: u64) -> Felt; - - #[link_name = "intrinsics::felt::from_u32"] - fn extern_from_u32(value: u32) -> Felt; - - #[link_name = "intrinsics::felt::as_u64"] - fn extern_as_u64(felt: Felt) -> u64; - - #[link_name = "intrinsics::felt::sub"] - fn extern_sub(a: Felt, b: Felt) -> Felt; - - #[link_name = "intrinsics::felt::mul"] - fn extern_mul(a: Felt, b: Felt) -> Felt; - - #[link_name = "intrinsics::felt::div"] - fn extern_div(a: Felt, b: Felt) -> Felt; - - #[link_name = "intrinsics::felt::neg"] - fn extern_neg(a: Felt) -> Felt; - - #[link_name = "intrinsics::felt::inv"] - fn extern_inv(a: Felt) -> Felt; - - #[link_name = "intrinsics::felt::pow2"] - fn extern_pow2(a: Felt) -> Felt; - - #[link_name = "intrinsics::felt::exp"] - fn extern_exp(a: Felt, b: Felt) -> Felt; - - #[link_name = "intrinsics::felt::eq"] - fn extern_eq(a: Felt, b: Felt) -> i32; - - #[link_name = "intrinsics::felt::gt"] - fn extern_gt(a: Felt, b: Felt) -> i32; - - #[link_name = "intrinsics::felt::lt"] - fn extern_lt(a: Felt, b: Felt) -> i32; - - #[link_name = "intrinsics::felt::ge"] - fn extern_ge(a: Felt, b: Felt) -> i32; - - #[link_name = "intrinsics::felt::le"] - fn extern_le(a: Felt, b: Felt) -> i32; - - #[link_name = "intrinsics::felt::is_odd"] - fn extern_is_odd(a: Felt) -> i32; +pub use miden_field::{Felt, FeltError}; +#[cfg(all(target_family = "wasm", miden))] +unsafe extern "C" { #[link_name = "intrinsics::felt::assert"] fn extern_assert(a: Felt); @@ -57,284 +12,68 @@ unsafe extern "C" { #[link_name = "intrinsics::felt::assert_eq"] fn extern_assert_eq(a: Felt, b: Felt); - - #[link_name = "intrinsics::felt::add"] - fn extern_add(a: Felt, b: Felt) -> Felt; -} - -/// Creates a `Felt` from an integer constant checking that it is within the -/// valid range at compile time. -#[macro_export] -macro_rules! felt { - // Trigger a compile-time error if the value is not a constant - ($value:literal) => {{ - const VALUE: u64 = $value as u64; - // assert!(VALUE <= Felt::M, "Invalid Felt value, must be >= 0 and <= 2^64 - 2^32 + 1"); - // Temporarily switch to `from_u32` to use `bitcast` and avoid checks. - // see https://github.com/0xMiden/compiler/issues/361 - assert!(VALUE <= u32::MAX as u64, "Invalid value, must be >= 0 and <= 2^32"); - const VALUE_U32: u32 = $value as u32; - Felt::from_u32(VALUE_U32) - }}; -} - -#[derive(Debug)] -pub enum FeltError { - InvalidValue, -} - -#[repr(transparent)] -#[derive(Copy, Clone, Debug)] -pub struct Felt { - pub inner: f32, -} - -impl Felt { - /// Field modulus = 2^64 - 2^32 + 1 - pub const M: u64 = 0xffffffff00000001; - - #[inline(always)] - pub fn from_u64_unchecked(value: u64) -> Self { - unsafe { extern_from_u64_unchecked(value) } - } - - #[inline(always)] - pub fn from_u32(value: u32) -> Self { - unsafe { extern_from_u32(value) } - } - - #[inline(always)] - pub fn new(value: u64) -> Result { - if value > Self::M { - Err(FeltError::InvalidValue) - } else { - Ok(Self::from_u64_unchecked(value)) - } - } - - #[inline(always)] - pub fn as_u64(self) -> u64 { - unsafe { extern_as_u64(self) } - } - - /// Returns true if x is odd and false if x is even - #[inline(always)] - pub fn is_odd(self) -> bool { - unsafe { extern_is_odd(self) != 0 } - } - - /// Returns x^-1 - /// Fails if a=0 - #[inline(always)] - pub fn inv(self) -> Felt { - unsafe { extern_inv(self) } - } - - /// Returns 2^x - /// Fails if x > 63 - #[inline(always)] - pub fn pow2(self) -> Felt { - unsafe { extern_pow2(self) } - } - - /// Returns a^b - #[inline(always)] - pub fn exp(self, other: Felt) -> Felt { - unsafe { extern_exp(self, other) } - } } -impl From for u64 { - fn from(felt: Felt) -> u64 { - felt.as_u64() - } -} - -impl From for Felt { - fn from(value: u32) -> Self { - Self { - inner: f32::from_bits(value), - } - } -} - -impl From for Felt { - fn from(value: u16) -> Self { - Self { - inner: f32::from_bits(value as u32), - } - } -} - -impl From for Felt { - fn from(value: u8) -> Self { - Self { - inner: f32::from_bits(value as u32), - } - } -} - -#[cfg(target_pointer_width = "32")] -impl From for Felt { - fn from(value: usize) -> Self { - Self { - inner: f32::from_bits(value as u32), - } - } -} - -impl Add for Felt { - type Output = Self; - - #[inline(always)] - fn add(self, other: Self) -> Self { - unsafe { extern_add(self, other) } - } -} - -impl AddAssign for Felt { - #[inline(always)] - fn add_assign(&mut self, other: Self) { - *self = *self + other; - } -} - -impl Sub for Felt { - type Output = Self; - - #[inline(always)] - fn sub(self, other: Self) -> Self { - unsafe { extern_sub(self, other) } - } -} - -impl SubAssign for Felt { - #[inline(always)] - fn sub_assign(&mut self, other: Self) { - *self = *self - other; - } -} - -impl Mul for Felt { - type Output = Self; - - #[inline(always)] - fn mul(self, other: Self) -> Self { - unsafe { extern_mul(self, other) } - } -} - -impl MulAssign for Felt { - #[inline(always)] - fn mul_assign(&mut self, other: Self) { - *self = *self * other; - } -} - -impl Div for Felt { - type Output = Self; - - #[inline(always)] - fn div(self, other: Self) -> Self { - unsafe { extern_div(self, other) } - } -} - -impl DivAssign for Felt { - #[inline(always)] - fn div_assign(&mut self, other: Self) { - *self = *self / other; - } -} - -impl Neg for Felt { - type Output = Self; - - #[inline(always)] - fn neg(self) -> Self { - unsafe { extern_neg(self) } - } -} - -impl PartialEq for Felt { - #[inline(always)] - fn eq(&self, other: &Self) -> bool { - unsafe { extern_eq(*self, *other) == 1 } - } +/// Fails if `a` != 1. +#[cfg(all(target_family = "wasm", miden))] +#[inline(always)] +pub fn assert(a: Felt) { + unsafe { extern_assert(a) } } -impl Eq for Felt {} - -impl PartialOrd for Felt { - #[inline(always)] - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } - - #[inline(always)] - fn gt(&self, other: &Self) -> bool { - unsafe { extern_gt(*self, *other) != 0 } - } - - #[inline(always)] - fn ge(&self, other: &Self) -> bool { - unsafe { extern_ge(*self, *other) != 0 } - } - - #[inline(always)] - fn lt(&self, other: &Self) -> bool { - unsafe { extern_lt(*other, *self) != 0 } - } - - #[inline(always)] - fn le(&self, other: &Self) -> bool { - unsafe { extern_le(*other, *self) != 0 } - } +/// Fails if `a` != 0. +#[cfg(all(target_family = "wasm", miden))] +#[inline(always)] +pub fn assertz(a: Felt) { + unsafe { extern_assertz(a) } } -impl Ord for Felt { - #[inline(always)] - fn cmp(&self, other: &Self) -> core::cmp::Ordering { - if self.lt(other) { - core::cmp::Ordering::Less - } else if self.gt(other) { - core::cmp::Ordering::Greater - } else { - core::cmp::Ordering::Equal - } - } +/// Fails if `a` != `b`. +#[cfg(all(target_family = "wasm", miden))] +#[inline(always)] +pub fn assert_eq(a: Felt, b: Felt) { + unsafe { extern_assert_eq(a, b) } } -/// Fails if `a` != 1 +/// Fails if `a` != 1. +#[cfg(not(all(target_family = "wasm", miden)))] #[inline(always)] pub fn assert(a: Felt) { - unsafe { - extern_assert(a); + if a != Felt::from_u64_unchecked(1) { + panic!("assert: expected 1"); } } -/// Fails if `a` != 0 +/// Fails if `a` != 0. +#[cfg(not(all(target_family = "wasm", miden)))] #[inline(always)] pub fn assertz(a: Felt) { - unsafe { - extern_assertz(a); + if a != Felt::from_u64_unchecked(0) { + panic!("assertz: expected 0"); } } -/// Fails if `a` != `b` +/// Fails if `a` != `b`. +#[cfg(not(all(target_family = "wasm", miden)))] #[inline(always)] pub fn assert_eq(a: Felt, b: Felt) { - unsafe { - extern_assert_eq(a, b); + if a != b { + panic!("assert_eq: values differ"); } } -// #[cfg(test)] -// mod tests { -// use super::*; - -// #[test] -// fn felt_macro_smoke_test() { -// let _ = felt!(1); -// } -// } +/// Creates a `Felt` from an integer constant checking that it is within the +/// valid range at compile time. +#[macro_export] +macro_rules! felt { + // Trigger a compile-time error if the value is not a constant + ($value:literal) => {{ + const VALUE: u64 = $value as u64; + // assert!(VALUE <= Felt::M, "Invalid Felt value, must be >= 0 and <= 2^64 - 2^32 + 1"); + // Temporarily switch to `from_u32` to use `bitcast` and avoid checks. + // see https://github.com/0xMiden/compiler/issues/361 + assert!(VALUE <= u32::MAX as u64, "Invalid value, must be >= 0 and <= 2^32"); + const VALUE_U32: u32 = $value as u32; + $crate::Felt::from_u32(VALUE_U32) + }}; +} diff --git a/sdk/stdlib-sys/src/intrinsics/mod.rs b/sdk/stdlib-sys/src/intrinsics/mod.rs index e773b3f1a..588328821 100644 --- a/sdk/stdlib-sys/src/intrinsics/mod.rs +++ b/sdk/stdlib-sys/src/intrinsics/mod.rs @@ -2,7 +2,7 @@ use core::ops::{Deref, DerefMut}; pub use self::{ crypto::Digest, - felt::{Felt, assert_eq}, + felt::{Felt, assert, assert_eq, assertz}, word::Word, }; diff --git a/sdk/stdlib-sys/src/intrinsics/word.rs b/sdk/stdlib-sys/src/intrinsics/word.rs index af7e96211..41b61d540 100644 --- a/sdk/stdlib-sys/src/intrinsics/word.rs +++ b/sdk/stdlib-sys/src/intrinsics/word.rs @@ -15,12 +15,33 @@ impl Word { } } + /// Converts each of the `values` to `Felt`. + /// + /// # Panics + /// + /// Panics if a value is larger than `Felt::M`. + #[inline(always)] + pub fn from_u64_unchecked(a: u64, b: u64, c: u64, d: u64) -> Self { + Self { + inner: ( + Felt::from_u64_unchecked(a), + Felt::from_u64_unchecked(b), + Felt::from_u64_unchecked(c), + Felt::from_u64_unchecked(d), + ), + } + } + + #[inline(always)] pub fn reverse(&self) -> Word { - // This is workaround for the https://github.com/0xMiden/compiler/issues/596 to avoid - // i64.rotl op in the compiled Wasm - let mut arr: [Felt; 4] = self.into(); - arr.reverse(); - arr.into() + Word { + inner: (self.inner.3, self.inner.2, self.inner.1, self.inner.0), + } + } +} +impl From<(Felt, Felt, Felt, Felt)> for Word { + fn from(word: (Felt, Felt, Felt, Felt)) -> Self { + Self { inner: word } } } impl From<[Felt; 4]> for Word { @@ -30,6 +51,12 @@ impl From<[Felt; 4]> for Word { } } } +impl From for (Felt, Felt, Felt, Felt) { + #[inline(always)] + fn from(word: Word) -> Self { + word.inner + } +} impl From for [Felt; 4] { #[inline(always)] fn from(word: Word) -> Self { diff --git a/sdk/stdlib-sys/src/lib.rs b/sdk/stdlib-sys/src/lib.rs index f234afdc7..f61626d7e 100644 --- a/sdk/stdlib-sys/src/lib.rs +++ b/sdk/stdlib-sys/src/lib.rs @@ -7,6 +7,6 @@ pub mod intrinsics; mod stdlib; pub use intrinsics::{ - Digest, Felt, Word, WordAligned, advice::emit_falcon_sig_to_stack, assert_eq, + Digest, Felt, Word, WordAligned, advice::emit_falcon_sig_to_stack, assert, assert_eq, assertz, }; pub use stdlib::*; diff --git a/sdk/stdlib-sys/src/stdlib/collections/smt.rs b/sdk/stdlib-sys/src/stdlib/collections/smt.rs index b981f0bc8..6ea261277 100644 --- a/sdk/stdlib-sys/src/stdlib/collections/smt.rs +++ b/sdk/stdlib-sys/src/stdlib/collections/smt.rs @@ -29,7 +29,7 @@ unsafe extern "C" { /// /// Fails if the tree with the specified `root` does not exist in the VM's advice provider. When /// no value has previously been inserted under `key`, the procedure returns the empty word. - #[link_name = "std::collections::smt::get"] + #[link_name = "miden::core::collections::smt::get"] fn extern_smt_get( k3: Felt, k2: Felt, @@ -53,7 +53,7 @@ unsafe extern "C" { /// `value` is the empty word, the new tree state is equivalent to omitting the update. /// /// Fails if the tree with the specified `root` does not exist in the VM's advice provider. - #[link_name = "std::collections::smt::set"] + #[link_name = "miden::core::collections::smt::set"] fn extern_smt_set( v3: Felt, v2: Felt, diff --git a/sdk/stdlib-sys/src/stdlib/crypto/dsa.rs b/sdk/stdlib-sys/src/stdlib/crypto/dsa.rs index 289590e0d..2799d5b8b 100644 --- a/sdk/stdlib-sys/src/stdlib/crypto/dsa.rs +++ b/sdk/stdlib-sys/src/stdlib/crypto/dsa.rs @@ -1,7 +1,11 @@ +#[cfg(not(all(target_family = "wasm", miden)))] +use crate::intrinsics::Word; +#[cfg(all(target_family = "wasm", miden))] use crate::intrinsics::{Felt, Word}; +#[cfg(all(target_family = "wasm", miden))] unsafe extern "C" { - #[link_name = "std::crypto::dsa::rpo_falcon512::verify"] + #[link_name = "miden::core::crypto::dsa::falcon512rpo::verify"] fn extern_rpo_falcon512_verify( pk1: Felt, pk2: Felt, @@ -28,8 +32,17 @@ unsafe extern "C" { /// pushing the signature to the advice stack. For production deployments, ensure secret key /// handling occurs outside the VM. #[inline(always)] +#[cfg(all(target_family = "wasm", miden))] pub fn rpo_falcon512_verify(pk: Word, msg: Word) { unsafe { extern_rpo_falcon512_verify(pk[3], pk[2], pk[1], pk[0], msg[3], msg[2], msg[1], msg[0]); } } + +#[inline(always)] +#[cfg(not(all(target_family = "wasm", miden)))] +pub fn rpo_falcon512_verify(_pk: Word, _msg: Word) { + unimplemented!( + "miden::core::crypto::dsa bindings are only available when targeting the Miden VM" + ) +} diff --git a/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs b/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs index ac8c36fe1..2930e8a90 100644 --- a/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs +++ b/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs @@ -2,318 +2,395 @@ //! functions. The input and output elements are assumed to contain one 32-bit //! value per element. -use alloc::vec::Vec; +#[cfg(all(target_family = "wasm", miden))] +mod imp { + use alloc::vec::Vec; -use crate::{ - felt, - intrinsics::{Digest, Felt, Word, assert_eq}, -}; + use crate::{ + felt, + intrinsics::{Digest, Felt, Word, assert_eq}, + }; -unsafe extern "C" { - /// Computes BLAKE3 1-to-1 hash. - /// - /// Input: 32-bytes stored in the first 8 elements of the stack (32 bits per element). - /// Output: A 32-byte digest stored in the first 8 elements of stack (32 bits per element). - /// The output is passed back to the caller via a pointer. - #[link_name = "std::crypto::hashes::blake3::hash_1to1"] - fn extern_blake3_hash_1to1( - e1: u32, - e2: u32, - e3: u32, - e4: u32, - e5: u32, - e6: u32, - e7: u32, - e8: u32, - ptr: *mut u8, - ); + unsafe extern "C" { + /// Computes BLAKE3 1-to-1 hash. + /// + /// Input: 32-bytes stored in the first 8 elements of the stack (32 bits per element). + /// Output: A 32-byte digest stored in the first 8 elements of stack (32 bits per element). + /// The output is passed back to the caller via a pointer. + #[link_name = "miden::core::crypto::hashes::blake3::hash"] + fn extern_blake3_hash( + e1: u32, + e2: u32, + e3: u32, + e4: u32, + e5: u32, + e6: u32, + e7: u32, + e8: u32, + ptr: *mut u8, + ); - /// Computes BLAKE3 2-to-1 hash. - /// - /// Input: 64-bytes stored in the first 16 elements of the stack (32 bits per element). - /// Output: A 32-byte digest stored in the first 8 elements of stack (32 bits per element) - /// The output is passed back to the caller via a pointer. - #[link_name = "std::crypto::hashes::blake3::hash_2to1"] - fn extern_blake3_hash_2to1( - e1: u32, - e2: u32, - e3: u32, - e4: u32, - e5: u32, - e6: u32, - e7: u32, - e8: u32, - e9: u32, - e10: u32, - e11: u32, - e12: u32, - e13: u32, - e14: u32, - e15: u32, - e16: u32, - ptr: *mut u8, - ); -} + /// Computes BLAKE3 2-to-1 hash. + /// + /// Input: 64-bytes stored in the first 16 elements of the stack (32 bits per element). + /// Output: A 32-byte digest stored in the first 8 elements of stack (32 bits per element) + /// The output is passed back to the caller via a pointer. + #[link_name = "miden::core::crypto::hashes::blake3::merge"] + fn extern_blake3_merge( + e1: u32, + e2: u32, + e3: u32, + e4: u32, + e5: u32, + e6: u32, + e7: u32, + e8: u32, + e9: u32, + e10: u32, + e11: u32, + e12: u32, + e13: u32, + e14: u32, + e15: u32, + e16: u32, + ptr: *mut u8, + ); + } -unsafe extern "C" { - /// Computes SHA256 1-to-1 hash. - /// - /// Input: 32-bytes stored in the first 8 elements of the stack (32 bits per element). - /// Output: A 32-byte digest stored in the first 8 elements of stack (32 bits per element). - /// The output is passed back to the caller via a pointer. - #[link_name = "std::crypto::hashes::sha256::hash_1to1"] - fn extern_sha256_hash_1to1( - e1: u32, - e2: u32, - e3: u32, - e4: u32, - e5: u32, - e6: u32, - e7: u32, - e8: u32, - ptr: *mut u8, - ); + unsafe extern "C" { + /// Computes SHA256 1-to-1 hash. + /// + /// Input: 32-bytes stored in the first 8 elements of the stack (32 bits per element). + /// Output: A 32-byte digest stored in the first 8 elements of stack (32 bits per element). + /// The output is passed back to the caller via a pointer. + #[link_name = "miden::core::crypto::hashes::sha256::hash"] + fn extern_sha256_hash( + e1: u32, + e2: u32, + e3: u32, + e4: u32, + e5: u32, + e6: u32, + e7: u32, + e8: u32, + ptr: *mut u8, + ); - /// Computes SHA256 2-to-1 hash. - /// - /// Input: 64-bytes stored in the first 16 elements of the stack (32 bits per element). - /// Output: A 32-byte digest stored in the first 8 elements of stack (32 bits per element). - /// The output is passed back to the caller via a pointer. - #[link_name = "std::crypto::hashes::sha256::hash_2to1"] - fn extern_sha256_hash_2to1( - e1: u32, - e2: u32, - e3: u32, - e4: u32, - e5: u32, - e6: u32, - e7: u32, - e8: u32, - e9: u32, - e10: u32, - e11: u32, - e12: u32, - e13: u32, - e14: u32, - e15: u32, - e16: u32, - ptr: *mut u8, - ); -} + /// Computes SHA256 2-to-1 hash. + /// + /// Input: 64-bytes stored in the first 16 elements of the stack (32 bits per element). + /// Output: A 32-byte digest stored in the first 8 elements of stack (32 bits per element). + /// The output is passed back to the caller via a pointer. + #[link_name = "miden::core::crypto::hashes::sha256::merge"] + fn extern_sha256_merge( + e1: u32, + e2: u32, + e3: u32, + e4: u32, + e5: u32, + e6: u32, + e7: u32, + e8: u32, + e9: u32, + e10: u32, + e11: u32, + e12: u32, + e13: u32, + e14: u32, + e15: u32, + e16: u32, + ptr: *mut u8, + ); + } -unsafe extern "C" { - /// Computes the hash of a sequence of field elements using the Rescue Prime Optimized (RPO) - /// hash function. - /// - /// This maps to the `std::crypto::rpo::hash_memory` procedure in the Miden stdlib. - /// - /// Input: A pointer to the memory location and the number of elements to hash - /// Output: One digest (4 field elements) - /// The output is passed back to the caller via a pointer. - #[link_name = "std::crypto::hashes::rpo::hash_memory"] - pub fn extern_hash_memory(ptr: u32, num_elements: u32, result_ptr: *mut Felt); + unsafe extern "C" { + /// Computes the hash of a sequence of field elements using the Rescue Prime Optimized (RPO) + /// hash function. + /// + /// This maps to the `miden::core::crypto::hashes::rpo256::hash_elements` procedure. + /// + /// Input: A pointer to the memory location and the number of elements to hash + /// Output: One digest (4 field elements) + /// The output is passed back to the caller via a pointer. + #[link_name = "miden::core::crypto::hashes::rpo256::hash_elements"] + pub fn extern_hash_elements(ptr: u32, num_elements: u32, result_ptr: *mut Felt); - /// Computes the hash of a sequence of words using the Rescue Prime Optimized (RPO) hash - /// function. - /// - /// This maps to the `std::crypto::hashes::rpo::hash_memory_words` procedure in the Miden - /// stdlib. - /// - /// Input: The start and end addresses (in field elements) of the words to hash. - /// Output: One digest (4 field elements) - /// The output is passed back to the caller via a pointer. - #[link_name = "std::crypto::hashes::rpo::hash_memory_words"] - pub fn extern_hash_memory_words(start_addr: u32, end_addr: u32, result_ptr: *mut Felt); -} + /// Computes the hash of a sequence of words using the Rescue Prime Optimized (RPO) hash + /// function. + /// + /// This maps to the `miden::core::crypto::hashes::rpo256::hash_words` procedure. + /// + /// Input: The start and end addresses (in field elements) of the words to hash. + /// Output: One digest (4 field elements) + /// The output is passed back to the caller via a pointer. + #[link_name = "miden::core::crypto::hashes::rpo256::hash_words"] + pub fn extern_hash_words(start_addr: u32, end_addr: u32, result_ptr: *mut Felt); + } -/// Hashes a 32-byte input to a 32-byte output using the given hash function. -#[inline(always)] -fn hash_1to1( - input: [u8; 32], - extern_hash_1to1: unsafe extern "C" fn(u32, u32, u32, u32, u32, u32, u32, u32, *mut u8), -) -> [u8; 32] { - use crate::intrinsics::WordAligned; - let input = unsafe { core::mem::transmute::<[u8; 32], [u32; 8]>(input) }; - unsafe { - let mut ret_area = ::core::mem::MaybeUninit::>::uninit(); - let ptr = ret_area.as_mut_ptr() as *mut u8; - extern_hash_1to1( - input[0], input[1], input[2], input[3], input[4], input[5], input[6], input[7], ptr, - ); - ret_area.assume_init().into_inner() + /// Hashes a 32-byte input to a 32-byte output using the given hash function. + #[inline(always)] + fn hash( + input: [u8; 32], + extern_hash: unsafe extern "C" fn(u32, u32, u32, u32, u32, u32, u32, u32, *mut u8), + ) -> [u8; 32] { + use crate::intrinsics::WordAligned; + let input = unsafe { core::mem::transmute::<[u8; 32], [u32; 8]>(input) }; + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::>::uninit(); + let ptr = ret_area.as_mut_ptr() as *mut u8; + extern_hash( + input[0], input[1], input[2], input[3], input[4], input[5], input[6], input[7], ptr, + ); + ret_area.assume_init().into_inner() + } } -} -/// Hashes a 64-byte input to a 32-byte output using the given hash function. -#[inline(always)] -fn hash_2to1( - input: [u8; 64], - extern_hash_2to1: unsafe extern "C" fn( - u32, - u32, - u32, - u32, - u32, - u32, - u32, - u32, - u32, - u32, - u32, - u32, - u32, - u32, - u32, - u32, - *mut u8, - ), -) -> [u8; 32] { - let input = unsafe { core::mem::transmute::<[u8; 64], [u32; 16]>(input) }; - unsafe { - let mut ret_area = ::core::mem::MaybeUninit::<[u8; 32]>::uninit(); - let ptr = ret_area.as_mut_ptr() as *mut u8; - extern_hash_2to1( - input[0], input[1], input[2], input[3], input[4], input[5], input[6], input[7], - input[8], input[9], input[10], input[11], input[12], input[13], input[14], input[15], - ptr, - ); - ret_area.assume_init() + /// Hashes a 64-byte input to a 32-byte output using the given hash function. + #[inline(always)] + fn merge( + input: [u8; 64], + extern_merge: unsafe extern "C" fn( + u32, + u32, + u32, + u32, + u32, + u32, + u32, + u32, + u32, + u32, + u32, + u32, + u32, + u32, + u32, + u32, + *mut u8, + ), + ) -> [u8; 32] { + let input = unsafe { core::mem::transmute::<[u8; 64], [u32; 16]>(input) }; + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::<[u8; 32]>::uninit(); + let ptr = ret_area.as_mut_ptr() as *mut u8; + extern_merge( + input[0], input[1], input[2], input[3], input[4], input[5], input[6], input[7], + input[8], input[9], input[10], input[11], input[12], input[13], input[14], + input[15], ptr, + ); + ret_area.assume_init() + } } -} -/// Hashes a 32-byte input to a 32-byte output using the BLAKE3 hash function. -#[inline] -pub fn blake3_hash_1to1(input: [u8; 32]) -> [u8; 32] { - hash_1to1(input, extern_blake3_hash_1to1) -} + /// Hashes a 32-byte input to a 32-byte output using the BLAKE3 hash function. + #[inline] + pub fn blake3_hash(input: [u8; 32]) -> [u8; 32] { + hash(input, extern_blake3_hash) + } -/// Hashes a 64-byte input to a 32-byte output using the BLAKE3 hash function. -#[inline] -pub fn blake3_hash_2to1(input: [u8; 64]) -> [u8; 32] { - hash_2to1(input, extern_blake3_hash_2to1) -} + /// Hashes a 64-byte input to a 32-byte output using the BLAKE3 hash function. + #[inline] + pub fn blake3_merge(input: [u8; 64]) -> [u8; 32] { + merge(input, extern_blake3_merge) + } -/// Hashes a 32-byte input to a 32-byte output using the SHA256 hash function. -#[inline] -pub fn sha256_hash_1to1(input: [u8; 32]) -> [u8; 32] { - use crate::intrinsics::WordAligned; - - let swapped_words = { - let mut be_bytes = input; - // The SHA-2 family is specified over big-endian 32-bit words. The Miden ABI mirrors that - // spec, so each lane we pass across the boundary must be encoded as a big-endian word. - // Our public Rust API uses `[u8; 32]` in native little-endian order, so we convert the bytes - // here before calling into the ABI. - for chunk in be_bytes.chunks_exact_mut(4) { - chunk.reverse(); - } - unsafe { core::mem::transmute::<[u8; 32], [u32; 8]>(be_bytes) } - }; + /// Hashes a 32-byte input to a 32-byte output using the SHA256 hash function. + #[inline] + pub fn sha256_hash(input: [u8; 32]) -> [u8; 32] { + use crate::intrinsics::WordAligned; - let [w0, w1, w2, w3, w4, w5, w6, w7] = swapped_words; - - unsafe { - let mut ret_area = ::core::mem::MaybeUninit::>::uninit(); - let ptr = ret_area.as_mut_ptr() as *mut u8; - extern_sha256_hash_1to1(w0, w1, w2, w3, w4, w5, w6, w7, ptr); - let mut output = ret_area.assume_init().into_inner(); - // The extern returns the digest as big-endian words as well; flip each lane so callers see - // the conventional Rust `[u8; 32]` ordering. - for chunk in output.chunks_exact_mut(4) { - chunk.reverse(); + let swapped_words = { + let mut be_bytes = input; + // The SHA-2 family is specified over big-endian 32-bit words. The Miden ABI mirrors that + // spec, so each lane we pass across the boundary must be encoded as a big-endian word. + // Our public Rust API uses `[u8; 32]` in native little-endian order, so we convert the bytes + // here before calling into the ABI. + for chunk in be_bytes.chunks_exact_mut(4) { + chunk.reverse(); + } + unsafe { core::mem::transmute::<[u8; 32], [u32; 8]>(be_bytes) } + }; + + let [w0, w1, w2, w3, w4, w5, w6, w7] = swapped_words; + + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::>::uninit(); + let ptr = ret_area.as_mut_ptr() as *mut u8; + extern_sha256_hash(w0, w1, w2, w3, w4, w5, w6, w7, ptr); + let mut output = ret_area.assume_init().into_inner(); + // The extern returns the digest as big-endian words as well; flip each lane so callers see + // the conventional Rust `[u8; 32]` ordering. + for chunk in output.chunks_exact_mut(4) { + chunk.reverse(); + } + output } - output } -} -/// Hashes a 64-byte input to a 32-byte output using the SHA256 hash function. -#[inline] -pub fn sha256_hash_2to1(input: [u8; 64]) -> [u8; 32] { - use crate::intrinsics::WordAligned; - - let swapped_words = { - let mut be_bytes = input; - // Same story as `sha256_hash_1to1`: adjust the byte layout so the ABI receives big-endian - // 32-bit words. - for chunk in be_bytes.chunks_exact_mut(4) { - chunk.reverse(); + /// Hashes a 64-byte input to a 32-byte output using the SHA256 hash function. + #[inline] + pub fn sha256_merge(input: [u8; 64]) -> [u8; 32] { + use crate::intrinsics::WordAligned; + + let swapped_words = { + let mut be_bytes = input; + // Same story as `sha256_hash`: adjust the byte layout so the ABI receives big-endian + // 32-bit words. + for chunk in be_bytes.chunks_exact_mut(4) { + chunk.reverse(); + } + unsafe { core::mem::transmute::<[u8; 64], [u32; 16]>(be_bytes) } + }; + + let [w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15] = swapped_words; + + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::>::uninit(); + let ptr = ret_area.as_mut_ptr() as *mut u8; + extern_sha256_merge( + w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15, ptr, + ); + let mut output = ret_area.assume_init().into_inner(); + // Restore the little-endian byte layout expected by Rust callers. + for chunk in output.chunks_exact_mut(4) { + chunk.reverse(); + } + output } - unsafe { core::mem::transmute::<[u8; 64], [u32; 16]>(be_bytes) } - }; + } - let [w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15] = swapped_words; + /// Computes the hash of a sequence of field elements using the Rescue Prime Optimized (RPO) + /// hash function. + /// + /// This maps to the `miden::core::crypto::hashes::rpo256::hash_elements` procedure and to the + /// `miden::core::crypto::hashes::rpo256::hash_words` word-optimized variant when the input + /// length is a multiple of 4. + /// + /// # Arguments + /// * `elements` - A Vec of field elements to be hashed + #[inline] + pub fn hash_elements(elements: Vec) -> Digest { + let rust_ptr = elements.as_ptr().addr() as u32; + let element_count = elements.len(); + let num_elements = element_count as u32; - unsafe { - let mut ret_area = ::core::mem::MaybeUninit::>::uninit(); - let ptr = ret_area.as_mut_ptr() as *mut u8; - extern_sha256_hash_2to1( - w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15, ptr, - ); - let mut output = ret_area.assume_init().into_inner(); - // Restore the little-endian byte layout expected by Rust callers. - for chunk in output.chunks_exact_mut(4) { - chunk.reverse(); + unsafe { + let mut ret_area = core::mem::MaybeUninit::::uninit(); + let result_ptr = ret_area.as_mut_ptr() as *mut Felt; + let miden_ptr = rust_ptr / 4; + // Since our BumpAlloc produces word-aligned allocations the pointer should be word-aligned + assert_eq(Felt::from_u32(miden_ptr % 4), felt!(0)); + + if element_count.is_multiple_of(4) { + let start_addr = miden_ptr; + let end_addr = start_addr + num_elements; + extern_hash_words(start_addr, end_addr, result_ptr); + } else { + extern_hash_elements(miden_ptr, num_elements, result_ptr); + } + + Digest::from_word(ret_area.assume_init().reverse()) } - output } -} -/// Computes the hash of a sequence of field elements using the Rescue Prime Optimized (RPO) -/// hash function. -/// -/// This maps to the `std::crypto::rpo::hash_memory` procedure in the Miden stdlib and to the -/// `std::crypto::hashes::rpo::hash_memory_words` word-optimized variant when the input length is a -/// multiple of 4. -/// -/// # Arguments -/// * `elements` - A Vec of field elements to be hashed -#[inline] -pub fn hash_elements(elements: Vec) -> Digest { - let rust_ptr = elements.as_ptr().addr() as u32; - let element_count = elements.len(); - let num_elements = element_count as u32; - - unsafe { - let mut ret_area = core::mem::MaybeUninit::::uninit(); - let result_ptr = ret_area.as_mut_ptr() as *mut Felt; + /// Computes the hash of a sequence of words using the Rescue Prime Optimized (RPO) + /// hash function. + /// + /// This maps to the `miden::core::crypto::hashes::rpo256::hash_words` procedure. + /// + /// # Arguments + /// * `words` - A slice of words to be hashed + #[inline] + pub fn hash_words(words: &[Word]) -> Digest { + let rust_ptr = words.as_ptr().addr() as u32; + let miden_ptr = rust_ptr / 4; - // Since our BumpAlloc produces word-aligned allocations the pointer should be word-aligned + // It's safe to assume the `words` ptr is word-aligned. assert_eq(Felt::from_u32(miden_ptr % 4), felt!(0)); - if element_count.is_multiple_of(4) { + unsafe { + let mut ret_area = core::mem::MaybeUninit::::uninit(); + let result_ptr = ret_area.as_mut_ptr() as *mut Felt; let start_addr = miden_ptr; - let end_addr = start_addr + num_elements; - extern_hash_memory_words(start_addr, end_addr, result_ptr); - } else { - extern_hash_memory(miden_ptr, num_elements, result_ptr); - } + let end_addr = start_addr + (words.len() as u32 * 4); + extern_hash_words(start_addr, end_addr, result_ptr); - Digest::from_word(ret_area.assume_init().reverse()) + Digest::from_word(ret_area.assume_init().reverse()) + } } } -/// Computes the hash of a sequence of words using the Rescue Prime Optimized (RPO) -/// hash function. -/// -/// This maps to the `std::crypto::hashes::rpo::hash_memory_words` procedure in the Miden stdlib. -/// -/// # Arguments -/// * `words` - A slice of words to be hashed -#[inline] -pub fn hash_words(words: &[Word]) -> Digest { - let rust_ptr = words.as_ptr().addr() as u32; - - unsafe { - let mut ret_area = core::mem::MaybeUninit::::uninit(); - let result_ptr = ret_area.as_mut_ptr() as *mut Felt; - let miden_ptr = rust_ptr / 4; - // It's safe to assume the `words` ptr is word-aligned. - assert_eq(Felt::from_u32(miden_ptr % 4), felt!(0)); +#[cfg(not(all(target_family = "wasm", miden)))] +mod imp { + use alloc::vec::Vec; + + use crate::intrinsics::{Digest, Felt, Word}; - let start_addr = miden_ptr; - let end_addr = start_addr + (words.len() as u32 * 4); - extern_hash_memory_words(start_addr, end_addr, result_ptr); + /// Computes BLAKE3 1-to-1 hash. + #[inline] + pub fn blake3_hash(_input: [u8; 32]) -> [u8; 32] { + unimplemented!( + "miden::core::crypto::hashes bindings are only available when targeting the Miden VM" + ) + } + + /// Computes BLAKE3 2-to-1 hash. + #[inline] + pub fn blake3_merge(_input: [u8; 64]) -> [u8; 32] { + unimplemented!( + "miden::core::crypto::hashes bindings are only available when targeting the Miden VM" + ) + } + + /// Computes SHA256 1-to-1 hash. + #[inline] + pub fn sha256_hash(_input: [u8; 32]) -> [u8; 32] { + unimplemented!( + "miden::core::crypto::hashes bindings are only available when targeting the Miden VM" + ) + } + + /// Computes SHA256 2-to-1 hash. + #[inline] + pub fn sha256_merge(_input: [u8; 64]) -> [u8; 32] { + unimplemented!( + "miden::core::crypto::hashes bindings are only available when targeting the Miden VM" + ) + } - Digest::from_word(ret_area.assume_init().reverse()) + /// Computes the hash of a sequence of field elements using the Rescue Prime Optimized (RPO) + /// hash function. + #[inline] + pub fn hash_elements(_elements: Vec) -> Digest { + unimplemented!( + "miden::core::crypto::hashes bindings are only available when targeting the Miden VM" + ) + } + + /// Computes the hash of a sequence of words using the Rescue Prime Optimized (RPO) hash + /// function. + #[inline] + pub fn hash_words(_words: &[Word]) -> Digest { + unimplemented!( + "miden::core::crypto::hashes bindings are only available when targeting the Miden VM" + ) + } + + /// ABI helper for `miden::core::crypto::hashes::rpo256::hash_elements`. + #[inline] + pub fn extern_hash_elements(_ptr: u32, _num_elements: u32, _result_ptr: *mut Felt) { + unimplemented!( + "miden::core::crypto::hashes bindings are only available when targeting the Miden VM" + ) + } + + /// ABI helper for `miden::core::crypto::hashes::rpo256::hash_words`. + #[inline] + pub fn extern_hash_words(_start_addr: u32, _end_addr: u32, _result_ptr: *mut Felt) { + unimplemented!( + "miden::core::crypto::hashes bindings are only available when targeting the Miden VM" + ) } } + +pub use imp::*; diff --git a/sdk/stdlib-sys/src/stdlib/mem.rs b/sdk/stdlib-sys/src/stdlib/mem.rs index a6d47bff0..27c15ed1f 100644 --- a/sdk/stdlib-sys/src/stdlib/mem.rs +++ b/sdk/stdlib-sys/src/stdlib/mem.rs @@ -3,11 +3,11 @@ extern crate alloc; use alloc::vec::Vec; -use crate::{ - felt, - intrinsics::{Felt, Word}, -}; +#[cfg(all(target_family = "wasm", miden))] +use crate::felt; +use crate::intrinsics::{Felt, Word}; +#[cfg(all(target_family = "wasm", miden))] unsafe extern "C" { /// Moves an arbitrary number of words from the advice stack to memory. @@ -20,7 +20,7 @@ unsafe extern "C" { /// Cycles: /// - Even num_words: 48 + 9 * num_words / 2 /// - Odd num_words: 65 + 9 * round_down(num_words / 2) - #[link_name = "std::mem::pipe_words_to_memory"] + #[link_name = "miden::core::mem::pipe_words_to_memory"] fn extern_pipe_words_to_memory(num_words: Felt, ptr: *mut Felt, out_ptr: *mut Felt); /// Moves an even number of words from the advice stack to memory. @@ -35,7 +35,7 @@ unsafe extern "C" { /// - The value num_words = end_ptr - write_ptr must be positive and even /// /// Cycles: 10 + 9 * num_words / 2 - #[link_name = "std::mem::pipe_double_words_to_memory"] + #[link_name = "miden::core::mem::pipe_double_words_to_memory"] fn extern_pipe_double_words_to_memory( c0: Felt, c1: Felt, @@ -62,7 +62,7 @@ unsafe extern "C" { /// Cycles: /// - Even num_words: 58 + 9 * (num_words / 2) /// - Odd num_words: 75 + 9 * round_down(num_words / 2) - #[link_name = "std::mem::pipe_preimage_to_memory"] + #[link_name = "miden::core::mem::pipe_preimage_to_memory"] pub(crate) fn extern_pipe_preimage_to_memory( num_words: Felt, write_ptr: *mut Felt, @@ -79,6 +79,7 @@ unsafe extern "C" { /// Cycles: /// - Even num_words: 48 + 9 * num_words / 2 /// - Odd num_words: 65 + 9 * round_down(num_words / 2) +#[cfg(all(target_family = "wasm", miden))] pub fn pipe_words_to_memory(num_words: Felt) -> (Word, Vec) { struct Result { hash: Word, @@ -99,9 +100,17 @@ pub fn pipe_words_to_memory(num_words: Felt) -> (Word, Vec) { } } +/// Reads an arbitrary number of words `num_words` from the advice stack and returns them along with +/// sequantial RPO hash of all read words. +#[cfg(not(all(target_family = "wasm", miden)))] +pub fn pipe_words_to_memory(_num_words: Felt) -> (Word, Vec) { + unimplemented!("miden::core::mem bindings are only available when targeting the Miden VM") +} + /// Returns an even number of words from the advice stack along with the RPO hash of all read words. /// /// Cycles: 10 + 9 * num_words / 2 +#[cfg(all(target_family = "wasm", miden))] pub fn pipe_double_words_to_memory(num_words: Felt) -> (Word, Vec) { struct Result { c: Word, @@ -141,9 +150,16 @@ pub fn pipe_double_words_to_memory(num_words: Felt) -> (Word, Vec) { } } +/// Returns an even number of words from the advice stack along with the RPO hash of all read words. +#[cfg(not(all(target_family = "wasm", miden)))] +pub fn pipe_double_words_to_memory(_num_words: Felt) -> (Word, Vec) { + unimplemented!("miden::core::mem bindings are only available when targeting the Miden VM") +} + /// Pops an arbitrary number of words from the advice stack and asserts it matches the commitment. /// Returns a Vec containing the loaded words. #[inline] +#[cfg(all(target_family = "wasm", miden))] pub fn adv_load_preimage(num_words: Felt, commitment: Word) -> Vec { // Allocate a Vec with the specified capacity let num_words_usize = num_words.as_u64() as usize; @@ -168,3 +184,11 @@ pub fn adv_load_preimage(num_words: Felt, commitment: Word) -> Vec { result } + +/// Pops an arbitrary number of words from the advice stack and asserts it matches the commitment. +/// Returns a Vec containing the loaded words. +#[cfg(not(all(target_family = "wasm", miden)))] +#[inline] +pub fn adv_load_preimage(_num_words: Felt, _commitment: Word) -> Vec { + unimplemented!("miden::core::mem bindings are only available when targeting the Miden VM") +} diff --git a/sdk/stdlib-sys/stubs/collections.rs b/sdk/stdlib-sys/stubs/collections.rs index eb19580ec..586d579d2 100644 --- a/sdk/stdlib-sys/stubs/collections.rs +++ b/sdk/stdlib-sys/stubs/collections.rs @@ -2,7 +2,7 @@ use core::ffi::c_void; /// Unreachable stubs for std::collections::smt procedures used via the SDK -#[unsafe(export_name = "std::collections::smt::get")] +#[unsafe(export_name = "miden::core::collections::smt::get")] pub extern "C" fn std_collections_smt_get_stub( k0: f32, k1: f32, @@ -18,7 +18,7 @@ pub extern "C" fn std_collections_smt_get_stub( unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "std::collections::smt::set")] +#[unsafe(export_name = "miden::core::collections::smt::set")] pub extern "C" fn std_collections_smt_set_stub( v0: f32, v1: f32, diff --git a/sdk/stdlib-sys/stubs/crypto/hashes_blake3.rs b/sdk/stdlib-sys/stubs/crypto/hashes_blake3.rs index d4255f2ec..bdec53360 100644 --- a/sdk/stdlib-sys/stubs/crypto/hashes_blake3.rs +++ b/sdk/stdlib-sys/stubs/crypto/hashes_blake3.rs @@ -2,8 +2,8 @@ use core::ffi::c_void; /// Unreachable stubs for std::crypto::hashes::blake3 -#[unsafe(export_name = "std::crypto::hashes::blake3::hash_1to1")] -pub extern "C" fn blake3_hash_1to1_stub( +#[unsafe(export_name = "miden::core::crypto::hashes::blake3::hash")] +pub extern "C" fn blake3_hash_stub( e1: u32, e2: u32, e3: u32, @@ -18,8 +18,8 @@ pub extern "C" fn blake3_hash_1to1_stub( unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "std::crypto::hashes::blake3::hash_2to1")] -pub extern "C" fn blake3_hash_2to1_stub( +#[unsafe(export_name = "miden::core::crypto::hashes::blake3::merge")] +pub extern "C" fn blake3_merge_stub( e1: u32, e2: u32, e3: u32, diff --git a/sdk/stdlib-sys/stubs/crypto/hashes_rpo.rs b/sdk/stdlib-sys/stubs/crypto/hashes_rpo.rs index b39e67020..2eaebc6c3 100644 --- a/sdk/stdlib-sys/stubs/crypto/hashes_rpo.rs +++ b/sdk/stdlib-sys/stubs/crypto/hashes_rpo.rs @@ -1,20 +1,16 @@ use core::ffi::c_void; -/// Unreachable stub for std::crypto::hashes::rpo::hash_memory +/// Unreachable stub for std::crypto::hashes::rpo256::hash_elements -#[unsafe(export_name = "std::crypto::hashes::rpo::hash_memory")] -pub extern "C" fn rpo_hash_memory_stub(ptr: u32, num_elements: u32, result_ptr: *mut c_void) { +#[unsafe(export_name = "miden::core::crypto::hashes::rpo256::hash_elements")] +pub extern "C" fn rpo_hash_elements_stub(ptr: u32, num_elements: u32, result_ptr: *mut c_void) { let _ = (ptr, num_elements, result_ptr); unsafe { core::hint::unreachable_unchecked() } } -/// Unreachable stub for std::crypto::hashes::rpo::hash_memory_words -#[unsafe(export_name = "std::crypto::hashes::rpo::hash_memory_words")] -pub extern "C" fn rpo_hash_memory_words_stub( - start_addr: u32, - end_addr: u32, - result_ptr: *mut c_void, -) { +/// Unreachable stub for std::crypto::hashes::rpo256::hash_words +#[unsafe(export_name = "miden::core::crypto::hashes::rpo256::hash_words")] +pub extern "C" fn rpo_hash_words_stub(start_addr: u32, end_addr: u32, result_ptr: *mut c_void) { let _ = (start_addr, end_addr, result_ptr); unsafe { core::hint::unreachable_unchecked() } } diff --git a/sdk/stdlib-sys/stubs/crypto/hashes_sha256.rs b/sdk/stdlib-sys/stubs/crypto/hashes_sha256.rs index c34ff1d23..73c6d40e9 100644 --- a/sdk/stdlib-sys/stubs/crypto/hashes_sha256.rs +++ b/sdk/stdlib-sys/stubs/crypto/hashes_sha256.rs @@ -2,8 +2,8 @@ use core::ffi::c_void; /// Unreachable stubs for std::crypto::hashes::sha256 -#[unsafe(export_name = "std::crypto::hashes::sha256::hash_1to1")] -pub extern "C" fn sha256_hash_1to1_stub( +#[unsafe(export_name = "miden::core::crypto::hashes::sha256::hash")] +pub extern "C" fn sha256_hash_stub( e1: u32, e2: u32, e3: u32, @@ -18,8 +18,8 @@ pub extern "C" fn sha256_hash_1to1_stub( unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "std::crypto::hashes::sha256::hash_2to1")] -pub extern "C" fn sha256_hash_2to1_stub( +#[unsafe(export_name = "miden::core::crypto::hashes::sha256::merge")] +pub extern "C" fn sha256_merge_stub( e1: u32, e2: u32, e3: u32, diff --git a/sdk/stdlib-sys/stubs/crypto/rpo_falcon_dsa.rs b/sdk/stdlib-sys/stubs/crypto/rpo_falcon_dsa.rs index 342ea6457..f73bef49e 100644 --- a/sdk/stdlib-sys/stubs/crypto/rpo_falcon_dsa.rs +++ b/sdk/stdlib-sys/stubs/crypto/rpo_falcon_dsa.rs @@ -3,7 +3,7 @@ /// Unreachable stub for `std::crypto::dsa::rpo_falcon512::verify`. /// /// This satisfies link-time references and allows the compiler to lower calls to MASM. -#[unsafe(export_name = "std::crypto::dsa::rpo_falcon512::verify")] +#[unsafe(export_name = "miden::core::crypto::dsa::falcon512rpo::verify")] pub extern "C" fn rpo_falcon512_verify_stub( _pk1: f32, _pk2: f32, diff --git a/sdk/stdlib-sys/stubs/mem.rs b/sdk/stdlib-sys/stubs/mem.rs index 1b9498775..44cad7c3a 100644 --- a/sdk/stdlib-sys/stubs/mem.rs +++ b/sdk/stdlib-sys/stubs/mem.rs @@ -2,7 +2,7 @@ use core::ffi::c_void; /// Unreachable stubs for std::mem procedures used via SDK -#[unsafe(export_name = "std::mem::pipe_words_to_memory")] +#[unsafe(export_name = "miden::core::mem::pipe_words_to_memory")] pub extern "C" fn std_mem_pipe_words_to_memory_stub( _num_words: f32, _write_ptr: *mut c_void, @@ -11,7 +11,7 @@ pub extern "C" fn std_mem_pipe_words_to_memory_stub( unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "std::mem::pipe_double_words_to_memory")] +#[unsafe(export_name = "miden::core::mem::pipe_double_words_to_memory")] pub extern "C" fn std_mem_pipe_double_words_to_memory_stub( _c0: f32, _c1: f32, @@ -32,7 +32,7 @@ pub extern "C" fn std_mem_pipe_double_words_to_memory_stub( unsafe { core::hint::unreachable_unchecked() } } -#[unsafe(export_name = "std::mem::pipe_preimage_to_memory")] +#[unsafe(export_name = "miden::core::mem::pipe_preimage_to_memory")] pub extern "C" fn std_mem_pipe_preimage_to_memory_stub( _num_words: f32, _write_ptr: *mut c_void, diff --git a/test-harness/test-harness-lib/Cargo.toml b/test-harness/test-harness-lib/Cargo.toml new file mode 100644 index 000000000..7b21b5d63 --- /dev/null +++ b/test-harness/test-harness-lib/Cargo.toml @@ -0,0 +1,31 @@ +[package] +name = "miden-test-harness" +description = "Custom testing harness used in rust code targetting the miden compiler." +publish = false +version.workspace = true +rust-version.workspace = true +authors.workspace = true +repository.workspace = true +categories.workspace = true +keywords.workspace = true +license.workspace = true +readme.workspace = true +edition.workspace = true + +[lib] +path = "src/mod.rs" + +[dependencies] +cfg-if = "1.0" + +# Miden dependencies +miden-test-harness-macros.workspace = true + +# Host-only dependencies (used for testing) +[target.'cfg(not(target_family = "wasm"))'.dependencies] +libtest-mimic = "0.8.1" +inventory.workspace = true +clap.workspace = true +miden-testing = "0.13" +miden-protocol = { version = "0.13", features = ["std"] } +cargo-miden.workspace = true diff --git a/test-harness/test-harness-lib/README.md b/test-harness/test-harness-lib/README.md new file mode 100644 index 000000000..320e22c8d --- /dev/null +++ b/test-harness/test-harness-lib/README.md @@ -0,0 +1,25 @@ +# miden-test-harness + +A custom test harness for Rust code targeting the Miden contracts. + +It re-exports the `miden-test-harness-macros` which comes with the `#[miden_test]` and `#[miden_test_suite]`. + +## `#[miden_test_suite]` +This macro wraps the `mod tests` module which contains all the tests. It's used by the test harness internally and is thusly required in order for the test harness to work correctly. +For example: +```rust +#[miden_test_suite] +mod tests { + (...) +} +``` + +## `#[miden_test]` + +This macro serves as a `#[test]` equivalent but for Miden's test harness. +Notably, functions marked with `#[miden_test]` can recognize some **special** arguments, currently: + +- `var: Package`: The `Package` variable will have the resulting `.masp` file loaded into it. Only 1 `Package` variable is allowed. +- `var: MockChainBuilder`: This simply instantiates a `MockChainBuilder`. Only 1 `MockChainBuilder` variable is allowed. + +To see examples see: `tests/examples/counter`. diff --git a/test-harness/test-harness-lib/src/libtest.rs b/test-harness/test-harness-lib/src/libtest.rs new file mode 100644 index 000000000..0caf7e290 --- /dev/null +++ b/test-harness/test-harness-lib/src/libtest.rs @@ -0,0 +1,91 @@ +use alloc::vec::Vec; + +extern crate std; + +// ================================ Build ====================================== + +/// Runs `cargo miden build` to build the .masp Package and returns the path +/// where it is stored. +pub fn build_package() -> std::path::PathBuf { + let build_cmd = cargo_miden::BuildCommand { args: Vec::new() }; + + let output = build_cmd.exec(cargo_miden::OutputType::Masm).expect("failed to build project."); + + let build_output = output.expect("failed to obtain build output.").unwrap_build_output(); + + build_output.into_artifact_path() +} + +// ============================= Test function ================================ + +/// Struct that represents a function marked with #[miden_test]. +/// NOTE: This structure is only intended to be used by the +/// miden-test-harness-macros crate. +pub struct MidenTest { + /// The name of the test, normally whatever text is followed by the `fn` + /// keyword.. + pub name: &'static str, + + /// Actual test function. + pub test_fn: fn() -> (), +} + +// Register MidenTest as a pluging in order for it to be collected. +inventory::collect!(MidenTest); + +pub use inventory::submit as miden_test_submit; + +impl From for libtest_mimic::Trial { + fn from(value: MidenTest) -> Self { + libtest_mimic::Trial::test(value.name, runner(value.test_fn)) + } +} + +impl From<&MidenTest> for libtest_mimic::Trial { + fn from(value: &MidenTest) -> Self { + libtest_mimic::Trial::test(value.name, runner(value.test_fn)) + } +} + +pub struct MidenTestArguments(libtest_mimic::Arguments); + +impl From for libtest_mimic::Arguments { + fn from(value: MidenTestArguments) -> Self { + value.0 + } +} + +// ============================= Test arguments ================================ + +impl MidenTestArguments { + pub fn from_args() -> Self { + let inner_args = libtest_mimic::Arguments::from_args(); + Self(inner_args) + } +} + +// Wrapper used to make normal rust function with libtest. +fn runner(test: fn() -> ()) -> impl FnOnce() -> Result<(), libtest_mimic::Failed> + Send + 'static { + move || { + test(); + Ok(()) + } +} + +// =========================== Querying functions ============================== + +/// Access all functions tagged with #[miden_test]. +/// +/// NOTE: currently we don't use `inventory`'s vector to execute tests, since we +/// rely on cargo's default registration mechanism. This stems from the fact +/// that we rely on the #[test] attribute for execution, since it enables +/// specific test execution from IDEs, like VSCode. Using #[test], however, +/// generates the libtest related code, *even when libtest harness is off*. This +/// means that if both `inventory` and `#[test]` are used, every test gets run +/// run twice, once in [libtest_mimic::run] and another time in rust's libtest +/// harness. +/// +/// Currently, this list is not used. +pub fn registered_test_function() -> impl Iterator { + inventory::iter::.into_iter() +} diff --git a/test-harness/test-harness-lib/src/mod.rs b/test-harness/test-harness-lib/src/mod.rs new file mode 100644 index 000000000..abd72f86c --- /dev/null +++ b/test-harness/test-harness-lib/src/mod.rs @@ -0,0 +1,20 @@ +#![no_std] + +extern crate alloc; + +#[cfg(not(target_family = "wasm"))] +pub mod libtest; + +// External dependencies +// RE-EXPORTS +// ================================================================================================ +pub use cfg_if::cfg_if; +pub use miden_test_harness_macros::{miden_test, miden_test_suite}; + +#[cfg(not(target_family = "wasm"))] +pub mod reexports { + pub use miden_protocol::utils::serde::Deserializable; + pub use miden_testing; + + pub use crate::libtest::*; +} diff --git a/test-harness/test-harness-macros/Cargo.toml b/test-harness/test-harness-macros/Cargo.toml new file mode 100644 index 000000000..1b8dcd56f --- /dev/null +++ b/test-harness/test-harness-macros/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "miden-test-harness-macros" +description = "Macros used to aid in test writing." +publish = false +version.workspace = true +rust-version.workspace = true +authors.workspace = true +repository.workspace = true +categories.workspace = true +keywords.workspace = true +license.workspace = true +readme.workspace = true +edition.workspace = true + +[lib] +proc-macro = true + +[dependencies] +# Miden dependencies +miden-mast-package.workspace = true +miden-testing = "0.13" + +# External dependencies +quote.workspace = true +syn.workspace = true diff --git a/test-harness/test-harness-macros/src/lib.rs b/test-harness/test-harness-macros/src/lib.rs new file mode 100644 index 000000000..0ddbdb67e --- /dev/null +++ b/test-harness/test-harness-macros/src/lib.rs @@ -0,0 +1,256 @@ +use miden_mast_package::Package; +use miden_testing::MockChainBuilder; +use proc_macro::TokenStream; +use quote::quote; +use syn::{ItemFn, parse_macro_input}; + +// Returns the identifier for a specific FnArg +fn get_binding_and_type(fn_arg: &syn::FnArg) -> Option<(&syn::PatIdent, &syn::PathSegment)> { + let syn::FnArg::Typed(arg) = fn_arg else { + return None; + }; + + let syn::Type::Path(syn::TypePath { path, .. }) = arg.ty.as_ref() else { + return None; + }; + + // The last token in the segments vector is the actual type, the rest + // are just path specifiers. + let path_segment = path.segments.last()?; + + let syn::Pat::Ident(binding) = arg.pat.as_ref() else { + return None; + }; + + Some((binding, path_segment)) +} + +/// Function that parses and consumes types T from `function`. `max_args` +/// represents the maximum amount of arguments of type T that `function` may +/// have. +fn process_arguments( + function: &mut syn::ItemFn, + max_args: usize, +) -> Result, String> { + // "T"'s name as used in the argument list. We skip the whole path + let struct_name = std::any::type_name::() + .split("::") + .last() + .unwrap_or_else(|| panic!("Failed to split the {}'s", ::core::any::type_name::())); + + let mut found_vars = Vec::new(); + + let fn_args = &mut function.sig.inputs; + + *fn_args = fn_args + .iter() + .filter(|&fn_arg| { + let Some((binding, var_type)) = get_binding_and_type(fn_arg) else { + return true; + }; + + if var_type.ident != struct_name { + return true; + } + + found_vars.push(binding.ident.clone()); + false + }) + .cloned() + .collect(); + + if found_vars.len() > max_args { + let identifiers = found_vars + .iter() + .map(|ident| ident.to_string()) + .collect::>() + .join(", "); + + let err = format!( + " +Detected that all of the following variables are `{struct_name}`s: {identifiers} + +#[miden_test] only supports having {max_args} `{struct_name}` in its argument list." + ); + return Err(err); + } + + Ok(found_vars) +} + +/// Parse the arguments of a `#[miden-test]` function and check for `Package`s. +/// +/// If the function has a single `Package` as argument, then it is removed from +/// the argument list and the boilerplate code to load the generated `Package` +/// into a variable will be generated. The name of the variable will match the +/// one used as argument. +/// +/// This will "consume" all the tokens that are of type `Package`. +fn load_package(function: &mut syn::ItemFn) { + let found_packages_vars = + process_arguments::(function, 1).unwrap_or_else(|err| panic!("{err}")); + + let Some(package_binding_name) = found_packages_vars.first() else { + // If there are no variables with `Package` as its type, then don't load + // the `Package`. + return; + }; + + let load_package: Vec = syn::parse_quote! { + // Since we rely on the standard libtest function registration mechanism + // We currently rely on rustc's standard libtest function registration + // mechanism. This is because IDEs, like VSCode, rely on rust-analyzer's + // #[test] detection attribute to display the "Run Test" icon. + // As far as I've seen, using #[test] on a function generates the + // *default* registration code, even when a custom test harness is being + // used. This restricts what we can do as "setup code", since we can not + // control the order in which tests are executed. + let bytes = crate::PACKAGE_BYTES.get_or_init(|| crate::build_package()); + + let #package_binding_name = + <::miden_protocol::vm::Package as ::miden_protocol::utils::serde::Deserializable>::read_from_bytes(&bytes).unwrap(); + }; + + // We add the required lines to load the generated Package right at the + // beginning of the function. + for (i, package) in load_package.iter().enumerate() { + function.block.as_mut().stmts.insert(i, package.clone()); + } +} + +fn load_mock_chain(function: &mut syn::ItemFn) { + let found_mock_chain = + process_arguments::(function, 1).unwrap_or_else(|err| panic!("{err}")); + + let Some(mock_chain_builder_name) = found_mock_chain.first() else { + // If there are no variables with `MockChainBuilder` as its type, then don't load + // the `MockChainBuilder`. + return; + }; + + let load_mock_chain_builder: Vec = syn::parse_quote! { + let mut #mock_chain_builder_name = ::miden_test_harness::reexports::miden_testing::MockChainBuilder::new(); + }; + + // We add the required lines to load the generated MockChainBuilder right at the + // beginning of the function. + for (i, package) in load_mock_chain_builder.iter().enumerate() { + function.block.as_mut().stmts.insert(i, package.clone()); + } +} + +/// Used to mark a function as a test that runs under miden's test-harness. +#[proc_macro_attribute] +pub fn miden_test( + _attr: proc_macro::TokenStream, + item: proc_macro::TokenStream, +) -> proc_macro::TokenStream { + let mut input_fn = parse_macro_input!(item as ItemFn); + + load_package(&mut input_fn); + load_mock_chain(&mut input_fn); + + let fn_ident = input_fn.sig.ident.clone(); + let fn_name = fn_ident.clone().span().source_text().unwrap_or(String::from("test_function")); + let fn_block = input_fn.block; + + let inner_ident = + syn::Ident::new(format!("inner_{}", fn_name.as_str()).as_str(), fn_ident.span()); + + { + // We create a wrapping inner_ident function in order to both register the + // function and use #[test]. If we try to register the original function + // identifier with [miden_test_submit], we get a compilation error stating + // that the symbol does exist. + let block: syn::Block = syn::parse_quote! { + { + #inner_ident() + } + }; + input_fn.block = Box::new(block); + } + + let function = quote! { + #[test] + #input_fn + + fn #inner_ident() { + #fn_block + } + + ::miden_test_harness::reexports::miden_test_submit!( + ::miden_test_harness::reexports::MidenTest { + name: #fn_name, + test_fn: #inner_ident, + } + ); + + }; + + TokenStream::from(function) +} + +/// Used to wrap the `mod tests` declaration. +#[proc_macro_attribute] +pub fn miden_test_suite( + _attr: proc_macro::TokenStream, + item: proc_macro::TokenStream, +) -> proc_macro::TokenStream { + let mut input_module = parse_macro_input!(item as syn::ItemMod); + + { + // We add an internal "use" here in order for the tests inside the `mod + // tests` block to use the `miden_test` macro without needing to pass + // the full path. + let internal_use = syn::parse_quote! { + use miden_test_harness_macros::miden_test; + }; + input_module + .content + .as_mut() + .expect("Failed to open 'mod test''s content as mut") + .1 + .insert(0, internal_use); + } + + { + let cfg_test: syn::Attribute = syn::parse_quote!(#[cfg(test)]); + + // We add #[cfg(test)] so that it is only expanded with the test + // profile. However, we want the code to always be present in order for + // rust-analyzer to provide information. + input_module.attrs.insert(0, cfg_test); + } + + let main_function = { + quote! { + miden_test_harness::cfg_if! { + if #[cfg(test)] { + fn build_package() -> std::vec::Vec { + let package_path = ::miden_test_harness::reexports::build_package(); + let package_bytes = std::fs::read(package_path.clone()).unwrap_or_else(|err| { + panic!("failed to read .masp Package file {} logger: {err}", package_path.display()) + }); + package_bytes + } + + extern crate std; + + static PACKAGE_BYTES: std::sync::OnceLock> = std::sync::OnceLock::new(); + + fn main() { + } + } else { + } + } + } + }; + + let block = quote! { + #input_module + + #main_function + }; + + block.into() +} diff --git a/tests/examples/counter/Cargo.lock b/tests/examples/counter/Cargo.lock new file mode 100644 index 000000000..2b0b92c5f --- /dev/null +++ b/tests/examples/counter/Cargo.lock @@ -0,0 +1,4211 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "cpp_demangle", + "fallible-iterator", + "gimli 0.31.1", + "memmap2", + "object 0.36.7", + "rustc-demangle", + "smallvec", + "typed-arena", +] + +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli 0.32.3", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "allocator-api2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c880a97d28a3681c0267bd29cff89621202715b065127cd445fa0f0fe0aa2880" + +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + +[[package]] +name = "anyhow" +version = "1.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" +dependencies = [ + "backtrace", +] + +[[package]] +name = "anymap2" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d301b3b94cb4b2f23d7917810addbbaff90738e0ca2be692bd027e70d7e0330c" + +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "ascii-canvas" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1e3e699d84ab1b0911a1010c5c106aa34ae89aeac103be5ce0c3859db1e891" +dependencies = [ + "term", +] + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line 0.25.1", + "cfg-if", + "libc", + "miniz_oxide", + "object 0.37.3", + "rustc-demangle", + "windows-link", +] + +[[package]] +name = "backtrace-ext" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" +dependencies = [ + "backtrace", +] + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" + +[[package]] +name = "bech32" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32637268377fc7b10a8c6d51de3e7fba1ce5dd371a96e342b34e6078db558e7f" + +[[package]] +name = "bit-set" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + +[[package]] +name = "bitflags" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "blake3" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2468ef7d57b3fb7e16b576e8377cdbde2320c60e1491e961d11da40fc4f02a2d" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq", + "cpufeatures", +] + +[[package]] +name = "blink-alloc" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce4c15bad517bc0fb4a44523adf470e2c3eb3a365769327acdba849948ea3705" +dependencies = [ + "allocator-api2 0.4.0", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" + +[[package]] +name = "camino" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629a66d692cb9ff1a1c664e41771b3dcaf961985a9774c0eb0bd1b51cf60a48" +dependencies = [ + "serde_core", +] + +[[package]] +name = "cargo-miden" +version = "0.6.0" +dependencies = [ + "anyhow", + "cargo_metadata", + "clap", + "env_logger", + "liquid", + "log", + "midenc-compile", + "midenc-session", + "path-absolutize", + "semver 1.0.27", + "serde", + "serde_json", + "tempfile", + "toml_edit 0.23.10+spec-1.0.0", + "walkdir", +] + +[[package]] +name = "cargo-platform" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba" +dependencies = [ + "camino", + "cargo-platform", + "semver 1.0.27", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "castaway" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a" +dependencies = [ + "rustversion", +] + +[[package]] +name = "cc" +version = "1.2.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "755d2fce177175ffca841e9a06afdb2c4ab0f593d53b4dee48147dfaade85932" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "clap" +version = "4.5.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6e6ff9dcd79cff5cd969a17a545d79e84ab086e444102a591e288a8aa3ce394" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa42cf4d2b7a41bc8f663a7cab4031ebafa1bf3875705bfaf8466dc60ab52c00" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "clap_lex" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e64b0cc0439b12df2fa678eae89a1c56a529fd067a9115f7827f1fffd22b32" + +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + +[[package]] +name = "compact_str" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb1325a1cece981e8a296ab8f0f9b63ae357bd0784a9faaf548cc7b480707a" +dependencies = [ + "castaway", + "cfg-if", + "itoa", + "rustversion", + "ryu", + "static_assertions", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "constant_time_eq" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b" + +[[package]] +name = "counter-contract-with-tests" +version = "0.1.0" +dependencies = [ + "miden", + "miden-protocol", + "miden-standards", + "miden-test-harness", + "miden-test-harness-macros", +] + +[[package]] +name = "cpp_demangle" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2bb79cb74d735044c972aae58ed0aaa9a837e85b01106a54c39e42e97f62253" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "cranelift-bitset" +version = "0.120.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7b2ee9eec6ca8a716d900d5264d678fb2c290c58c46c8da7f94ee268175d17" + +[[package]] +name = "cranelift-entity" +version = "0.120.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d75418674520cb400c8772bfd6e11a62736c78fc1b6e418195696841d1bf91f1" +dependencies = [ + "cranelift-bitset", +] + +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "typenum", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version 0.4.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.114", +] + +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "deranged" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version 0.4.1", + "syn 2.0.114", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "dissimilar" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921" + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "ena" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5" +dependencies = [ + "log", +] + +[[package]] +name = "env_filter" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "escape8259" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5692dd7b5a1978a5aeb0ce83b7655c58ca8efdcb79d21036ea249da95afec2c6" + +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "find-msvc-tools" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8591b0bcc8a98a64310a2fae1bb3e9b8564dd10e381e6e28010fde8e8e8568db" + +[[package]] +name = "fixedbitset" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" + +[[package]] +name = "flate2" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b375d6465b98090a5f25b1c7703f3859783755aa9a80433b36e0379a3ec2f369" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "spin", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "fs-err" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf68cef89750956493a66a10f512b9e58d9db21f2a573c079c0bdf1207a54a7" +dependencies = [ + "autocfg", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-core", + "futures-sink", + "futures-task", + "pin-project-lite", + "pin-utils", +] + +[[package]] +name = "generator" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52f04ae4152da20c76fe800fa48659201d5cf627c5149ca0b707b69d7eef6cf9" +dependencies = [ + "cc", + "cfg-if", + "libc", + "log", + "rustversion", + "windows-link", + "windows-result", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "wasip2", + "wasm-bindgen", +] + +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +dependencies = [ + "fallible-iterator", + "stable_deref_trait", +] + +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + +[[package]] +name = "glob" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "allocator-api2 0.2.21", + "equivalent", + "foldhash 0.1.5", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "allocator-api2 0.2.21", + "equivalent", + "foldhash 0.2.0", + "rayon", + "serde", + "serde_core", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "indenter" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5" + +[[package]] +name = "indexmap" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" +dependencies = [ + "equivalent", + "hashbrown 0.16.1", + "serde", + "serde_core", +] + +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + +[[package]] +name = "intrusive-collections" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "189d0897e4cbe8c75efedf3502c18c887b05046e59d28404d4d8e46cbc4d1e86" +dependencies = [ + "memoffset", +] + +[[package]] +name = "inventory" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc61209c082fbeb19919bee74b176221b27223e27b65d781eb91af24eb1fb46e" +dependencies = [ + "rustversion", +] + +[[package]] +name = "is_ci" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" + +[[package]] +name = "jiff" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.4", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "kstring" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "558bf9508a558512042d3095138b1f7b8fe90c5467d94f9f1da28b3731c5dbd1" +dependencies = [ + "serde", + "static_assertions", +] + +[[package]] +name = "lalrpop" +version = "0.22.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba4ebbd48ce411c1d10fb35185f5a51a7bfa3d8b24b4e330d30c9e3a34129501" +dependencies = [ + "ascii-canvas", + "bit-set", + "ena", + "itertools", + "lalrpop-util", + "petgraph 0.7.1", + "regex", + "regex-syntax", + "sha3", + "string_cache", + "term", + "unicode-xid", + "walkdir", +] + +[[package]] +name = "lalrpop-util" +version = "0.22.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5baa5e9ff84f1aefd264e6869907646538a52147a755d494517a8007fb48733" +dependencies = [ + "rustversion", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "libc" +version = "0.2.180" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" + +[[package]] +name = "libm" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" + +[[package]] +name = "libtest-mimic" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5297962ef19edda4ce33aaa484386e0a5b3d7f2f4e037cbeee00503ef6b29d33" +dependencies = [ + "anstream", + "anstyle", + "clap", + "escape8259", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" + +[[package]] +name = "liquid" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a494c3f9dad3cb7ed16f1c51812cbe4b29493d6c2e5cd1e2b87477263d9534d" +dependencies = [ + "liquid-core", + "liquid-derive", + "liquid-lib", + "serde", +] + +[[package]] +name = "liquid-core" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc623edee8a618b4543e8e8505584f4847a4e51b805db1af6d9af0a3395d0d57" +dependencies = [ + "anymap2", + "itertools", + "kstring", + "liquid-derive", + "pest", + "pest_derive", + "regex", + "serde", + "time", +] + +[[package]] +name = "liquid-derive" +version = "0.26.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de66c928222984aea59fcaed8ba627f388aaac3c1f57dcb05cc25495ef8faefe" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "liquid-lib" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9befeedd61f5995bc128c571db65300aeb50d62e4f0542c88282dbcb5f72372a" +dependencies = [ + "itertools", + "liquid-core", + "percent-encoding", + "regex", + "time", + "unicode-segmentation", +] + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "loom" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "419e0dc8046cb947daa77eb95ae174acfbddb7673b4151f56d1eed8e93fbfaca" +dependencies = [ + "cfg-if", + "generator", + "scoped-tls", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "matchers" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "memmap2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "744133e4a0e0a658e1374cf3bf8e415c4052a15a111acd372764c55b4177d490" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "miden" +version = "0.8.0" +dependencies = [ + "miden-base", + "miden-base-macros", + "miden-base-sys", + "miden-field", + "miden-field-repr", + "miden-sdk-alloc", + "miden-stdlib-sys", + "wit-bindgen 0.46.0", +] + +[[package]] +name = "miden-agglayer" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21a867217bab689c0539f6b4797cb452f0932de6904479a38f1322e045b9383b" +dependencies = [ + "fs-err", + "miden-assembly", + "miden-core", + "miden-core-lib", + "miden-protocol", + "miden-standards", + "miden-utils-sync", + "regex", + "walkdir", +] + +[[package]] +name = "miden-air" +version = "0.20.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33eacdeeaf50a704b221efe81abf1f1e9870154c5bd4acc11f5ad3f872e73509" +dependencies = [ + "miden-core", + "miden-utils-indexing", + "thiserror", + "winter-air", + "winter-prover", +] + +[[package]] +name = "miden-assembly" +version = "0.20.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdebc6a73964aaf92179d9a9925ca48d662894f24774ab6380e784214de00fdb" +dependencies = [ + "env_logger", + "log", + "miden-assembly-syntax", + "miden-core", + "miden-mast-package", + "smallvec", + "thiserror", +] + +[[package]] +name = "miden-assembly-syntax" +version = "0.20.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7b96df3facd26ae58fe0c3c30bd1d8e83c2b7f0b0c9c046800901dc1eff14e" +dependencies = [ + "aho-corasick", + "env_logger", + "lalrpop", + "lalrpop-util", + "log", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", + "midenc-hir-type", + "proptest", + "proptest-derive", + "regex", + "rustc_version 0.4.1", + "semver 1.0.27", + "smallvec", + "thiserror", +] + +[[package]] +name = "miden-base" +version = "0.8.0" +dependencies = [ + "miden-base-sys", + "miden-stdlib-sys", +] + +[[package]] +name = "miden-base-macros" +version = "0.8.0" +dependencies = [ + "heck", + "miden-protocol", + "proc-macro2", + "quote", + "semver 1.0.27", + "syn 2.0.114", + "toml 0.8.23", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "miden-base-sys" +version = "0.8.1" +dependencies = [ + "miden-field-repr", + "miden-stdlib-sys", +] + +[[package]] +name = "miden-block-prover" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e92a0ddae8d0983e37bc636edba741947b1e3dc63baed2ad85921342080154a" +dependencies = [ + "miden-protocol", + "thiserror", +] + +[[package]] +name = "miden-core" +version = "0.20.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cb3c6b071a7a5fc6a10dfbaed76f3d0170f3739a231233a3c5e27596a5612f" +dependencies = [ + "derive_more", + "itertools", + "miden-crypto", + "miden-debug-types", + "miden-formatting", + "miden-utils-core-derive", + "miden-utils-indexing", + "num-derive", + "num-traits", + "proptest", + "proptest-derive", + "thiserror", + "winter-math", + "winter-utils", +] + +[[package]] +name = "miden-core-lib" +version = "0.20.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703c0e94089a3135ba75e3586fcb4e5d61e3bee10a7ee1dad0b2ac0a497c14e9" +dependencies = [ + "env_logger", + "fs-err", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", + "sha2", + "thiserror", +] + +[[package]] +name = "miden-crypto" +version = "0.19.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e28b6e110f339c2edc2760a8cb94863f0a055ee658a49bc90c8560eff2feef4" +dependencies = [ + "blake3", + "cc", + "chacha20poly1305", + "curve25519-dalek", + "ed25519-dalek", + "flume", + "glob", + "hashbrown 0.16.1", + "hkdf", + "k256", + "miden-crypto-derive", + "num", + "num-complex", + "rand", + "rand_chacha", + "rand_core 0.9.5", + "rand_hc", + "rayon", + "sha2", + "sha3", + "subtle", + "thiserror", + "winter-crypto", + "winter-math", + "winter-utils", + "x25519-dalek", +] + +[[package]] +name = "miden-crypto-derive" +version = "0.19.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40e95b9c7c99ed6bbf073d9e02721d812dedd2c195019c0a0e0a3dbb9cbf034" +dependencies = [ + "quote", + "syn 2.0.114", +] + +[[package]] +name = "miden-debug-types" +version = "0.20.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cb127273a9ee9ac1f9ad71899c1c2a0dea8cf768a90024d2d8b91800980c756" +dependencies = [ + "memchr", + "miden-crypto", + "miden-formatting", + "miden-miette", + "miden-utils-indexing", + "miden-utils-sync", + "paste", + "serde", + "serde_spanned 1.0.4", + "thiserror", +] + +[[package]] +name = "miden-field" +version = "0.8.0" +dependencies = [ + "miden-core", +] + +[[package]] +name = "miden-field-repr" +version = "0.7.1" +dependencies = [ + "miden-core", + "miden-field", + "miden-field-repr-derive", +] + +[[package]] +name = "miden-field-repr-derive" +version = "0.7.1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "miden-formatting" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e392e0a8c34b32671012b439de35fa8987bf14f0f8aac279b97f8b8cc6e263b" +dependencies = [ + "unicode-width 0.1.14", +] + +[[package]] +name = "miden-mast-package" +version = "0.20.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f7b21cd2593ed5930d5af10b197917dd6668ab34e203e47fb9c1ba712dc9a2c" +dependencies = [ + "derive_more", + "miden-assembly-syntax", + "miden-core", + "thiserror", +] + +[[package]] +name = "miden-miette" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eef536978f24a179d94fa2a41e4f92b28e7d8aab14b8d23df28ad2a3d7098b20" +dependencies = [ + "backtrace", + "backtrace-ext", + "cfg-if", + "futures", + "indenter", + "lazy_static", + "miden-miette-derive", + "owo-colors", + "regex", + "rustc_version 0.2.3", + "rustversion", + "serde_json", + "spin", + "strip-ansi-escapes", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "syn 2.0.114", + "terminal_size", + "textwrap", + "thiserror", + "trybuild", + "unicode-width 0.1.14", +] + +[[package]] +name = "miden-miette-derive" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86a905f3ea65634dd4d1041a4f0fd0a3e77aa4118341d265af1a94339182222f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "miden-processor" +version = "0.20.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72712c2c71774f7a49d66a0265b57be7a283919ffbdc4b034ab355b0283de021" +dependencies = [ + "itertools", + "miden-air", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", + "thiserror", + "tokio", + "tracing", + "winter-prover", +] + +[[package]] +name = "miden-protocol" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "785be319a826c9cb43d2e1a41a1fb1eee3f2baafe360e0d743690641f7c93ad5" +dependencies = [ + "bech32", + "fs-err", + "getrandom 0.3.4", + "miden-assembly", + "miden-assembly-syntax", + "miden-core", + "miden-core-lib", + "miden-crypto", + "miden-mast-package", + "miden-processor", + "miden-protocol-macros", + "miden-utils-sync", + "miden-verifier", + "rand", + "rand_chacha", + "rand_xoshiro", + "regex", + "semver 1.0.27", + "serde", + "thiserror", + "toml 0.9.11+spec-1.1.0", + "walkdir", + "winter-rand-utils", +] + +[[package]] +name = "miden-protocol-macros" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2dc854c1b9e49e82d3f39c5710345226e0b2a62ec0ea220c616f1f3a099cfb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "miden-prover" +version = "0.20.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6a65651c8bf931743580c4a8c00a35f3453da39679bd23fa95f29ae7849ffd" +dependencies = [ + "miden-air", + "miden-debug-types", + "miden-processor", + "tracing", + "winter-maybe-async", + "winter-prover", +] + +[[package]] +name = "miden-sdk-alloc" +version = "0.8.0" + +[[package]] +name = "miden-standards" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98e33771fc35e1e640582bcd26c88b2ab449dd3a70888b315546d0d3447f4bb3" +dependencies = [ + "fs-err", + "miden-assembly", + "miden-core", + "miden-core-lib", + "miden-processor", + "miden-protocol", + "rand", + "regex", + "thiserror", + "walkdir", +] + +[[package]] +name = "miden-stdlib-sys" +version = "0.8.0" +dependencies = [ + "miden-field", +] + +[[package]] +name = "miden-test-harness" +version = "0.6.0" +dependencies = [ + "cargo-miden", + "cfg-if", + "clap", + "inventory", + "libtest-mimic", + "miden-protocol", + "miden-test-harness-macros", + "miden-testing", +] + +[[package]] +name = "miden-test-harness-macros" +version = "0.6.0" +dependencies = [ + "miden-mast-package", + "miden-testing", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "miden-testing" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae5d41a888d1a5e520a9312a170975d0fbadefb1b9200543cebdf54dd0960310" +dependencies = [ + "anyhow", + "itertools", + "miden-agglayer", + "miden-assembly", + "miden-block-prover", + "miden-core-lib", + "miden-processor", + "miden-protocol", + "miden-standards", + "miden-tx", + "miden-tx-batch-prover", + "rand", + "rand_chacha", + "winterfell", +] + +[[package]] +name = "miden-thiserror" +version = "1.0.59" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "183ff8de338956ecfde3a38573241eb7a6f3d44d73866c210e5629c07fa00253" +dependencies = [ + "miden-thiserror-impl", +] + +[[package]] +name = "miden-thiserror-impl" +version = "1.0.59" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee4176a0f2e7d29d2a8ee7e60b6deb14ce67a20e94c3e2c7275cdb8804e1862" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "miden-tx" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "430e4ee02b5efb71b104926e229441e0071a93a259a70740bf8c436495caa64f" +dependencies = [ + "miden-processor", + "miden-protocol", + "miden-prover", + "miden-standards", + "miden-verifier", + "thiserror", +] + +[[package]] +name = "miden-tx-batch-prover" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03bc209b6487ebac0de230461e229a99d17ed73596c7d99fc59eea47a28a89cc" +dependencies = [ + "miden-protocol", + "miden-tx", +] + +[[package]] +name = "miden-utils-core-derive" +version = "0.20.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3753ff5c16cb83244d234b7f76fb8abec3377200b215859fe599c41465e7d36b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "miden-utils-diagnostics" +version = "0.20.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de6c667538374e6a3579397a29f82d94e62d2f9cf1eca8a95da1a7acbfed381d" +dependencies = [ + "miden-crypto", + "miden-debug-types", + "miden-miette", + "paste", + "tracing", +] + +[[package]] +name = "miden-utils-indexing" +version = "0.20.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e135423d4d3d626ea15fdfe7070abe5f7908ac71a2d174c832c870668fb2a3" +dependencies = [ + "thiserror", +] + +[[package]] +name = "miden-utils-sync" +version = "0.20.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9e678634bd9ce5d6f89809cda926a268bcbfe72aa0a5d2031a0c8182074992" +dependencies = [ + "lock_api", + "loom", + "parking_lot", +] + +[[package]] +name = "miden-verifier" +version = "0.20.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9513494a2a8cd876150bbbb5a2985b078368de280cc8a52e9aff41320c344b7" +dependencies = [ + "miden-air", + "miden-core", + "thiserror", + "tracing", + "winter-verifier", +] + +[[package]] +name = "midenc-codegen-masm" +version = "0.6.0" +dependencies = [ + "anyhow", + "inventory", + "log", + "miden-assembly", + "miden-assembly-syntax", + "miden-core", + "miden-mast-package", + "miden-processor", + "miden-protocol", + "miden-thiserror", + "midenc-dialect-arith", + "midenc-dialect-cf", + "midenc-dialect-hir", + "midenc-dialect-scf", + "midenc-dialect-ub", + "midenc-hir", + "midenc-hir-analysis", + "midenc-session", + "petgraph 0.8.3", + "serde", + "smallvec", +] + +[[package]] +name = "midenc-compile" +version = "0.6.0" +dependencies = [ + "anyhow", + "clap", + "inventory", + "log", + "miden-assembly", + "miden-mast-package", + "miden-thiserror", + "midenc-codegen-masm", + "midenc-dialect-hir", + "midenc-dialect-scf", + "midenc-frontend-wasm", + "midenc-hir", + "midenc-hir-transform", + "midenc-session", + "wat", +] + +[[package]] +name = "midenc-dialect-arith" +version = "0.6.0" +dependencies = [ + "midenc-hir", + "paste", +] + +[[package]] +name = "midenc-dialect-cf" +version = "0.6.0" +dependencies = [ + "log", + "midenc-dialect-arith", + "midenc-hir", +] + +[[package]] +name = "midenc-dialect-hir" +version = "0.6.0" +dependencies = [ + "log", + "midenc-dialect-arith", + "midenc-dialect-cf", + "midenc-hir", + "midenc-hir-analysis", + "midenc-hir-transform", +] + +[[package]] +name = "midenc-dialect-scf" +version = "0.6.0" +dependencies = [ + "bitvec", + "log", + "midenc-dialect-arith", + "midenc-dialect-cf", + "midenc-dialect-ub", + "midenc-hir", + "midenc-hir-transform", +] + +[[package]] +name = "midenc-dialect-ub" +version = "0.6.0" +dependencies = [ + "midenc-hir", +] + +[[package]] +name = "midenc-frontend-wasm" +version = "0.6.0" +dependencies = [ + "addr2line 0.24.2", + "anyhow", + "cranelift-entity", + "gimli 0.31.1", + "indexmap", + "log", + "miden-core", + "miden-thiserror", + "midenc-dialect-arith", + "midenc-dialect-cf", + "midenc-dialect-hir", + "midenc-dialect-ub", + "midenc-hir", + "midenc-hir-symbol", + "midenc-session", + "wasmparser 0.227.1", + "wasmprinter", +] + +[[package]] +name = "midenc-hir" +version = "0.6.0" +dependencies = [ + "anyhow", + "bitflags", + "bitvec", + "blink-alloc", + "compact_str", + "hashbrown 0.15.5", + "intrusive-collections", + "inventory", + "log", + "miden-core", + "miden-thiserror", + "midenc-hir-macros", + "midenc-hir-symbol", + "midenc-hir-type", + "midenc-session", + "rustc-demangle", + "rustc-hash", + "semver 1.0.27", + "smallvec", +] + +[[package]] +name = "midenc-hir-analysis" +version = "0.6.0" +dependencies = [ + "bitvec", + "blink-alloc", + "log", + "midenc-hir", +] + +[[package]] +name = "midenc-hir-macros" +version = "0.6.0" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "midenc-hir-symbol" +version = "0.6.0" +dependencies = [ + "Inflector", + "hashbrown 0.15.5", + "lock_api", + "miden-formatting", + "parking_lot", + "rustc-hash", + "toml 0.8.23", +] + +[[package]] +name = "midenc-hir-transform" +version = "0.6.0" +dependencies = [ + "log", + "midenc-hir", + "midenc-hir-analysis", + "midenc-session", +] + +[[package]] +name = "midenc-hir-type" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" +dependencies = [ + "miden-formatting", + "serde", + "serde_repr", + "smallvec", + "thiserror", +] + +[[package]] +name = "midenc-session" +version = "0.6.0" +dependencies = [ + "anyhow", + "clap", + "inventory", + "log", + "miden-assembly", + "miden-assembly-syntax", + "miden-core", + "miden-core-lib", + "miden-debug-types", + "miden-mast-package", + "miden-protocol", + "miden-thiserror", + "midenc-hir-macros", + "midenc-hir-symbol", + "parking_lot", + "smallvec", + "termcolor", +] + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "num" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "object" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "flate2", + "memchr", + "ruzstd", +] + +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "owo-colors" +version = "4.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c6901729fa79e91a0913333229e9ca5dc725089d1c363b2f4b4760709dc4a52" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "path-absolutize" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4af381fe79fa195b4909485d99f73a80792331df0625188e707854f0b3383f5" +dependencies = [ + "path-dedot", +] + +[[package]] +name = "path-dedot" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07ba0ad7e047712414213ff67533e6dd477af0a4e1d14fb52343e53d30ea9397" +dependencies = [ + "once_cell", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pest" +version = "2.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9eb05c21a464ea704b53158d358a31e6425db2f63a1a7312268b05fe2b75f7" +dependencies = [ + "memchr", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f9dbced329c441fa79d80472764b1a2c7e57123553b8519b36663a2fb234ed" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bb96d5051a78f44f43c8f712d8e810adb0ebf923fc9ed2655a7f66f63ba8ee5" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "pest_meta" +version = "2.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "602113b5b5e8621770cfd490cfd90b9f84ab29bd2b0e49ad83eb6d186cef2365" +dependencies = [ + "pest", + "sha2", +] + +[[package]] +name = "petgraph" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3672b37090dbd86368a4145bc067582552b29c27377cad4e0a306c97f9bd7772" +dependencies = [ + "fixedbitset", + "indexmap", +] + +[[package]] +name = "petgraph" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" +dependencies = [ + "fixedbitset", + "hashbrown 0.15.5", + "indexmap", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "portable-atomic" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn 2.0.114", +] + +[[package]] +name = "proc-macro2" +version = "1.0.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "535d180e0ecab6268a3e718bb9fd44db66bbbc256257165fc699dadf70d16fe7" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proptest" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +dependencies = [ + "bitflags", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax", + "unarray", +] + +[[package]] +name = "proptest-derive" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb6dc647500e84a25a85b100e76c85b8ace114c209432dc174f20aac11d4ed6c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "quote" +version = "1.0.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "rand_hc" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b363d4f6370f88d62bf586c80405657bde0f0e1b8945d47d2ad59b906cb4f54" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.5", +] + +[[package]] +name = "rand_xoshiro" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f703f4665700daf5512dcca5f43afa6af89f09db47fb56be587f80636bda2d41" +dependencies = [ + "rand_core 0.9.5", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" + +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver 0.9.0", +] + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver 1.0.27", +] + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys 0.11.0", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ruzstd" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fad02996bfc73da3e301efe90b1837be9ed8f4a462b6ed410aa35d00381de89f" +dependencies = [ + "twox-hash", +] + +[[package]] +name = "ryu" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a50f4cf475b65d88e057964e0e9bb1f0aa9bbb2036dc65c64596b42932536984" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" +dependencies = [ + "serde", + "serde_core", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_repr" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_spanned" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8bbf91e5a4d6315eee45e704372590b30e260ee83af6639d64557f51b067776" +dependencies = [ + "serde_core", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest", + "keccak", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core 0.6.4", +] + +[[package]] +name = "simd-adler32" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" + +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +dependencies = [ + "serde", +] + +[[package]] +name = "smawk" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "string_cache" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf776ba3fa74f83bf4b63c3dcbbf82173db2632ed8452cb2d891d33f459de70f" +dependencies = [ + "new_debug_unreachable", + "parking_lot", + "phf_shared", + "precomputed-hash", +] + +[[package]] +name = "strip-ansi-escapes" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a8f8038e7e7969abb3f1b7c2a811225e9296da208539e0f79c5251d6cac0025" +dependencies = [ + "vte", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "supports-color" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c64fc7232dd8d2e4ac5ce4ef302b1d81e0b80d055b9d77c7c4f51f6aa4c867d6" +dependencies = [ + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e396b6523b11ccb83120b115a0b7366de372751aa6edf19844dfb13a6af97e91" + +[[package]] +name = "supports-unicode" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "target-triple" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "591ef38edfb78ca4771ee32cf494cb8771944bee237a9b91fc9c1424ac4b777b" + +[[package]] +name = "tempfile" +version = "3.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" +dependencies = [ + "fastrand", + "getrandom 0.3.4", + "once_cell", + "rustix 1.1.3", + "windows-sys 0.61.2", +] + +[[package]] +name = "term" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8c27177b12a6399ffc08b98f76f7c9a1f4fe9fc967c784c5a071fa8d93cf7e1" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix 0.38.44", + "windows-sys 0.48.0", +] + +[[package]] +name = "textwrap" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c13547615a44dc9c452a8a534638acdf07120d4b6847c8178705da06306a3057" +dependencies = [ + "smawk", + "unicode-linebreak", + "unicode-width 0.2.2", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "thread_local" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "time" +version = "0.3.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9e442fc33d7fdb45aa9bfeb312c095964abdf596f7567261062b2a7107aaabd" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b36ee98fd31ec7426d599183e8fe26932a8dc1fb76ddb6214d05493377d34ca" + +[[package]] +name = "time-macros" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71e552d1249bf61ac2a52db88179fd0673def1e1ad8243a00d9ec9ed71fee3dd" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tokio" +version = "1.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" +dependencies = [ + "pin-project-lite", +] + +[[package]] +name = "toml" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +dependencies = [ + "indexmap", + "serde", + "serde_spanned 0.6.9", + "toml_datetime 0.6.11", + "toml_edit 0.22.27", +] + +[[package]] +name = "toml" +version = "0.9.11+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3afc9a848309fe1aaffaed6e1546a7a14de1f935dc9d89d32afd9a44bab7c46" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned 1.0.4", + "toml_datetime 0.7.5+spec-1.1.0", + "toml_parser", + "toml_writer", + "winnow", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_datetime" +version = "0.7.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap", + "serde", + "serde_spanned 0.6.9", + "toml_datetime 0.6.11", + "toml_write", + "winnow", +] + +[[package]] +name = "toml_edit" +version = "0.23.10+spec-1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned 1.0.4", + "toml_datetime 0.7.5+spec-1.1.0", + "toml_parser", + "toml_writer", + "winnow", +] + +[[package]] +name = "toml_parser" +version = "1.0.6+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3198b4b0a8e11f09dd03e133c0280504d0801269e9afa46362ffde1cbeebf44" +dependencies = [ + "winnow", +] + +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "toml_writer" +version = "1.0.6+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab16f14aed21ee8bfd8ec22513f7287cd4a91aa92e44edfe2c17ddd004e92607" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex-automata", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "trybuild" +version = "1.0.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e17e807bff86d2a06b52bca4276746584a78375055b6e45843925ce2802b335" +dependencies = [ + "dissimilar", + "glob", + "serde", + "serde_derive", + "serde_json", + "target-triple", + "termcolor", + "toml 0.9.11+spec-1.1.0", +] + +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "static_assertions", +] + +[[package]] +name = "typed-arena" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" + +[[package]] +name = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + +[[package]] +name = "unicode-ident" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" + +[[package]] +name = "unicode-linebreak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" + +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[package]] +name = "unicode-width" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "vte" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "231fdcd7ef3037e8330d8e17e61011a2c244126acc0a982f4040ac3f9f0bc077" +dependencies = [ + "memchr", +] + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.2+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +dependencies = [ + "wit-bindgen 0.51.0", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 2.0.114", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-encoder" +version = "0.239.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be00faa2b4950c76fe618c409d2c3ea5a3c9422013e079482d78544bb2d184c" +dependencies = [ + "leb128fmt", + "wasmparser 0.239.0", +] + +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser 0.244.0", +] + +[[package]] +name = "wasm-metadata" +version = "0.239.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20b3ec880a9ac69ccd92fbdbcf46ee833071cf09f82bb005b2327c7ae6025ae2" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder 0.239.0", + "wasmparser 0.239.0", +] + +[[package]] +name = "wasmparser" +version = "0.227.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f51cad774fb3c9461ab9bccc9c62dfb7388397b5deda31bf40e8108ccd678b2" +dependencies = [ + "bitflags", + "indexmap", + "semver 1.0.27", +] + +[[package]] +name = "wasmparser" +version = "0.239.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9d90bb93e764f6beabf1d02028c70a2156a6583e63ac4218dd07ef733368b0" +dependencies = [ + "bitflags", + "hashbrown 0.15.5", + "indexmap", + "semver 1.0.27", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags", + "indexmap", + "semver 1.0.27", +] + +[[package]] +name = "wasmprinter" +version = "0.227.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32475a0459db5639e989206dd8833fb07110ec092a7cb3468c82341989cac4d3" +dependencies = [ + "anyhow", + "termcolor", + "wasmparser 0.227.1", +] + +[[package]] +name = "wast" +version = "244.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2e7b9f9e23311275920e3d6b56d64137c160cf8af4f84a7283b36cfecbf4acb" +dependencies = [ + "bumpalo", + "leb128fmt", + "memchr", + "unicode-width 0.2.2", + "wasm-encoder 0.244.0", +] + +[[package]] +name = "wat" +version = "1.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbf35b87ed352f9ab6cd0732abde5a67dd6153dfd02c493e61459218b19456fa" +dependencies = [ + "wast", +] + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829" +dependencies = [ + "memchr", +] + +[[package]] +name = "winter-air" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef01227f23c7c331710f43b877a8333f5f8d539631eea763600f1a74bf018c7c" +dependencies = [ + "libm", + "winter-crypto", + "winter-fri", + "winter-math", + "winter-utils", +] + +[[package]] +name = "winter-crypto" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cdb247bc142438798edb04067ab72a22cf815f57abbd7b78a6fa986fc101db8" +dependencies = [ + "blake3", + "sha3", + "winter-math", + "winter-utils", +] + +[[package]] +name = "winter-fri" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd592b943f9d65545683868aaf1b601eb66e52bfd67175347362efff09101d3a" +dependencies = [ + "winter-crypto", + "winter-math", + "winter-utils", +] + +[[package]] +name = "winter-math" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aecfb48ee6a8b4746392c8ff31e33e62df8528a3b5628c5af27b92b14aef1ea" +dependencies = [ + "winter-utils", +] + +[[package]] +name = "winter-maybe-async" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d31a19dae58475d019850e25b0170e94b16d382fbf6afee9c0e80fdc935e73e" +dependencies = [ + "quote", + "syn 2.0.114", +] + +[[package]] +name = "winter-prover" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84cc631ed56cd39b78ef932c1ec4060cc6a44d114474291216c32f56655b3048" +dependencies = [ + "tracing", + "winter-air", + "winter-crypto", + "winter-fri", + "winter-math", + "winter-maybe-async", + "winter-utils", +] + +[[package]] +name = "winter-rand-utils" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4ff3b651754a7bd216f959764d0a5ab6f4b551c9a3a08fb9ccecbed594b614a" +dependencies = [ + "rand", + "winter-utils", +] + +[[package]] +name = "winter-utils" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9951263ef5317740cd0f49e618db00c72fabb70b75756ea26c4d5efe462c04dd" + +[[package]] +name = "winter-verifier" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0425ea81f8f703a1021810216da12003175c7974a584660856224df04b2e2fdb" +dependencies = [ + "winter-air", + "winter-crypto", + "winter-fri", + "winter-math", + "winter-utils", +] + +[[package]] +name = "winterfell" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43f824ddd5aec8ca6a54307f20c115485a8a919ea94dd26d496d856ca6185f4f" +dependencies = [ + "winter-air", + "winter-prover", + "winter-verifier", +] + +[[package]] +name = "wit-bindgen" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" + +[[package]] +name = "wit-bindgen-core" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cabd629f94da277abc739c71353397046401518efb2c707669f805205f0b9890" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a4232e841089fa5f3c4fc732a92e1c74e1a3958db3b12f1de5934da2027f1f4" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn 2.0.114", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0d4698c2913d8d9c2b220d116409c3f51a7aa8d7765151b886918367179ee9" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn 2.0.114", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.239.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88a866b19dba2c94d706ec58c92a4c62ab63e482b4c935d2a085ac94caecb136" +dependencies = [ + "anyhow", + "bitflags", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder 0.239.0", + "wasm-metadata", + "wasmparser 0.239.0", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.239.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55c92c939d667b7bf0c6bf2d1f67196529758f99a2a45a3355cc56964fd5315d" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver 1.0.27", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser 0.239.0", +] + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", +] + +[[package]] +name = "zerocopy" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "668f5168d10b9ee831de31933dc111a459c97ec93225beb307aed970d1372dfd" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" + +[[package]] +name = "zmij" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfcd145825aace48cff44a8844de64bf75feec3080e0aa5cdbde72961ae51a65" diff --git a/tests/examples/counter/Cargo.toml b/tests/examples/counter/Cargo.toml new file mode 100644 index 000000000..35d8a9886 --- /dev/null +++ b/tests/examples/counter/Cargo.toml @@ -0,0 +1,31 @@ +[package] +name = "counter-contract-with-tests" +description = "A simple example of how to use miden's custom test harness." +version = "0.1.0" +edition = "2024" + +[lib] +# Build this crate as a self-contained, C-style dynamic library +# This is required to emit the proper Wasm module type +crate-type = ["cdylib"] + +[dependencies] +miden = { path = "../../../sdk/sdk" } +miden-test-harness-macros = { path = "../../../test-harness/test-harness-macros"} +miden-test-harness = { path = "../../../test-harness/test-harness-lib"} + +[dev-dependencies] +miden-protocol = { version = "0.13", default-features = false, features = ["std"] } +miden-standards = { version = "0.13", default-features = false, features = ["std"] } + +[package.metadata.component] +package = "miden:counter-contract" + +[package.metadata.miden] +project-kind = "account" +supported-types = ["RegularAccountUpdatableCode"] + +[[test]] +name = "lib" +path = "src/lib.rs" +harness = false diff --git a/tests/examples/counter/README.md b/tests/examples/counter/README.md new file mode 100644 index 000000000..e60ed2d98 --- /dev/null +++ b/tests/examples/counter/README.md @@ -0,0 +1,7 @@ +# Counter Contract + +## Build + +```bash +cargo miden build --release +``` diff --git a/tests/examples/counter/cargo-generate.toml b/tests/examples/counter/cargo-generate.toml new file mode 100644 index 000000000..26029f3e7 --- /dev/null +++ b/tests/examples/counter/cargo-generate.toml @@ -0,0 +1,2 @@ +[template] +ignore = ["target"] diff --git a/tests/examples/counter/rust-toolchain.toml b/tests/examples/counter/rust-toolchain.toml new file mode 100644 index 000000000..d9d7c02f0 --- /dev/null +++ b/tests/examples/counter/rust-toolchain.toml @@ -0,0 +1,5 @@ +[toolchain] +channel = "nightly-2025-12-10" +components = ["rustfmt", "rust-src", "clippy"] +targets = ["wasm32-wasip2"] +profile = "minimal" diff --git a/tests/examples/counter/src/lib.rs b/tests/examples/counter/src/lib.rs new file mode 100644 index 000000000..85ae7719a --- /dev/null +++ b/tests/examples/counter/src/lib.rs @@ -0,0 +1,120 @@ +// Do not link against libstd (i.e. anything defined in `std::`) +#![no_std] +#![feature(alloc_error_handler)] + +// However, we could still use some standard library types while +// remaining no-std compatible, if we uncommented the following lines: +// +// extern crate alloc; + +use miden_test_harness::miden_test_suite; + +#[cfg(target_family = "wasm")] +mod component { + use miden::{Felt, StorageMap, StorageMapAccess, Word, component, felt}; + + /// Main contract structure for the counter example. + #[component] + struct CounterContract { + /// Storage map holding the counter value. + #[storage(description = "counter contract storage map")] + count_map: StorageMap, + } + + #[component] + impl CounterContract { + /// Returns the current counter value stored in the contract's storage map. + pub fn get_count(&self) -> Felt { + let key = Word::from_u64_unchecked(0, 0, 0, 1); + self.count_map.get(&key) + } + + /// Increments the counter value stored in the contract's storage map by one. + pub fn increment_count(&mut self) -> Felt { + let key = Word::from_u64_unchecked(0, 0, 0, 1); + let current_value: Felt = self.count_map.get(&key); + let new_value = current_value + felt!(1); + self.count_map.set(key, new_value); + new_value + } + } +} + +#[miden_test_suite] +mod tests { + use miden::Felt; + use miden_protocol::account::{ + AccountBuilder, AccountComponent, auth::AuthSecretKey, component::InitStorageData, + }; + use miden_standards::account::auth::AuthFalcon512Rpo; + + // This tests loads the generated package in the `foo` variable and is then + // printed. + #[miden_test] + #[should_panic] + fn bar(_bar: Package) { + // To see what the generated Package looks like, uncomment this line: + std::dbg!(&_bar); + assert_eq!(1, 1 + 1); + } + + // This test will fail at compile time because it is only legal to have a + // single package as an argument. The following error message is displayed: + // + // error: custom attribute panicked + // --> src/lib.rs:55:5 + // | + // 55 | #[miden_test] + // | ^^^^^^^^^^^^^ + // | + // = help: message: + // Detected that all of the following variables are `Package`s: foo, bar + // + // #[miden_test] only supports having a single `Package` in its argument list. + // Uncomment to see the failure! + // #[miden_test] + // fn bing(foo: Package, bar: Package) { + // std::dbg!(&foo); + // assert_eq!(1, 1 + 1); + // } + + // This tests will work as a traditional test, since neither `Package` nor + // `MockChainBuilder` are declared, the test harness does not produce any + // type of code generation. + #[miden_test] + fn biz() { + assert_eq!(2, 1 + 1) + } + + #[miden_test] + fn foo(chain: MockChainBuilder) { + assert_eq!(2, 1 + 1) + } + + // This function instantiates a `MockChain` with an `Account` with the + // `AccountComponent` generated from the rust code from this file.. + #[miden_test] + fn load_generated_account(account: Package, mock: MockChainBuilder) { + let init_storage_data = InitStorageData::default(); + let account_component = + AccountComponent::from_package(&account, &init_storage_data).unwrap(); + + let (_key_pair, auth_component) = { + let key_pair = AuthSecretKey::new_falcon512_rpo(); + let auth_component: AccountComponent = + AuthFalcon512Rpo::new(key_pair.public_key().to_commitment()).into(); + (key_pair, auth_component) + }; + + let account = AccountBuilder::new(Default::default()) + .nonce(Felt::new(1).unwrap().into()) + .with_component(account_component) + .with_auth_component(auth_component) + .build() + .unwrap(); + + let _chain = mock.clone().build().unwrap(); + + let _ = mock.add_account(account).unwrap().clone(); + } +} diff --git a/tests/integration-node/Cargo.toml b/tests/integration-network/Cargo.toml similarity index 63% rename from tests/integration-node/Cargo.toml rename to tests/integration-network/Cargo.toml index a0032fce9..8b4f41b0c 100644 --- a/tests/integration-node/Cargo.toml +++ b/tests/integration-network/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "miden-integration-node-tests" +name = "midenc-integration-network-tests" version.workspace = true rust-version.workspace = true authors.workspace = true @@ -12,18 +12,15 @@ edition.workspace = true publish = false [dependencies] -anyhow.workspace = true -fs2 = "0.4" -miden-client = { version = "0.12", features = ["std", "tonic"] } -miden-client-sqlite-store = { version = "0.12" } +miden-client = { version = "0.13", features = ["std", "tonic", "testing"] } miden-core.workspace = true +miden-protocol = { workspace = true, features = ["std"] } +miden-standards = { workspace = true, features = ["std"] } +miden-field-repr = { version = "0.10.0", path = "../../sdk/field-repr/repr" } miden-mast-package.workspace = true -miden-objects = { workspace = true, features = ["std"] } midenc-frontend-wasm.workspace = true rand = "0.9" -temp-dir = "0.1" tokio.workspace = true -uuid = { version = "1.10", features = ["v4"] } # For accessing the test builder from the main integration tests miden-integration-tests = { path = "../integration" } diff --git a/tests/integration-network/README.md b/tests/integration-network/README.md new file mode 100644 index 000000000..7d78eca8e --- /dev/null +++ b/tests/integration-network/README.md @@ -0,0 +1,22 @@ +# Miden Integration Network Tests + +This crate contains integration tests that exercise contract deployment and execution on a mock +chain (`miden_client::testing::MockChain`). + +## Overview + +The tests in this crate are separated from the main integration tests because they: +- Exercise multi-step end-to-end scenarios (account setup, block production, tx execution) +- Can be slower due to proving and compiling example packages + +## Running Tests + +```bash +cargo test -p midenc-integration-network-tests +``` + +To see test output: + +```bash +cargo test -p midenc-integration-network-tests -- --nocapture +``` diff --git a/tests/integration-network/src/lib.rs b/tests/integration-network/src/lib.rs new file mode 100644 index 000000000..eb311288b --- /dev/null +++ b/tests/integration-network/src/lib.rs @@ -0,0 +1,4 @@ +//! Integration tests which exercise contract deployment and execution on a mock chain. + +#[cfg(test)] +mod mockchain; diff --git a/tests/integration-network/src/mockchain/basic_wallet.rs b/tests/integration-network/src/mockchain/basic_wallet.rs new file mode 100644 index 000000000..b79c9b9e1 --- /dev/null +++ b/tests/integration-network/src/mockchain/basic_wallet.rs @@ -0,0 +1,367 @@ +//! Basic wallet test module + +use miden_client::{ + asset::FungibleAsset, + crypto::RpoRandomCoin, + note::NoteAssets, + testing::{AccountState, Auth, MockChain}, + transaction::OutputNote, +}; +use miden_core::Felt; + +use super::helpers::{ + NoteCreationConfig, assert_account_has_fungible_asset, build_asset_transfer_tx, + build_existing_basic_wallet_account_builder, build_send_notes_script, compile_rust_package, + create_note_from_package, execute_tx, to_core_felts, +}; + +/// Tests the basic-wallet contract deployment and p2id note consumption workflow on a mock chain. +#[test] +pub fn test_basic_wallet_p2id() { + // Compile the contracts first (before creating any runtime) + let wallet_package = compile_rust_package("../../examples/basic-wallet", true); + let note_package = compile_rust_package("../../examples/p2id-note", true); + let tx_script_package = compile_rust_package("../../examples/basic-wallet-tx-script", true); + + let mut builder = MockChain::builder(); + let max_supply = 1_000_000_000u64; + let faucet_account = builder + .add_existing_basic_faucet(Auth::BasicAuth, "TEST", max_supply, None) + .unwrap(); + let faucet_id = faucet_account.id(); + + let alice_account = builder + .add_account_from_builder( + Auth::BasicAuth, + build_existing_basic_wallet_account_builder(wallet_package.clone(), false, [1_u8; 32]), + AccountState::Exists, + ) + .unwrap(); + let alice_id = alice_account.id(); + + let bob_account = builder + .add_account_from_builder( + Auth::BasicAuth, + build_existing_basic_wallet_account_builder(wallet_package, false, [2_u8; 32]), + AccountState::Exists, + ) + .unwrap(); + let bob_id = bob_account.id(); + + let mut chain = builder.build().unwrap(); + chain.prove_next_block().unwrap(); + chain.prove_next_block().unwrap(); + + eprintln!("\n=== Step 1: Minting tokens from faucet to Alice ==="); + let mint_amount = 100_000u64; // 100,000 tokens + let mint_asset = FungibleAsset::new(faucet_id, mint_amount).unwrap(); + + let mut note_rng = RpoRandomCoin::new(note_package.unwrap_program().hash()); + let p2id_note_mint = create_note_from_package( + note_package.clone(), + faucet_id, + NoteCreationConfig { + assets: NoteAssets::new(vec![mint_asset.into()]).unwrap(), + inputs: to_core_felts(&alice_id), + ..Default::default() + }, + &mut note_rng, + ); + + let faucet_account = chain.committed_account(faucet_id).unwrap().clone(); + let mint_tx_script = + build_send_notes_script(&faucet_account, std::slice::from_ref(&p2id_note_mint)); + let mint_tx_context_builder = chain + .build_tx_context(faucet_id, &[], &[]) + .unwrap() + .tx_script(mint_tx_script) + .extend_expected_output_notes(vec![OutputNote::Full(p2id_note_mint.clone())]); + execute_tx(&mut chain, mint_tx_context_builder); + + eprintln!("\n=== Step 2: Alice consumes mint note ==="); + let consume_tx_context_builder = + chain.build_tx_context(alice_id, &[p2id_note_mint.id()], &[]).unwrap(); + execute_tx(&mut chain, consume_tx_context_builder); + + eprintln!("\n=== Checking Alice's account has the minted asset ==="); + let alice_account = chain.committed_account(alice_id).unwrap(); + assert_account_has_fungible_asset(alice_account, faucet_id, mint_amount); + + eprintln!("\n=== Step 3: Alice creates p2id note for Bob (custom tx script) ==="); + let transfer_amount = 10_000u64; // 10,000 tokens + let transfer_asset = FungibleAsset::new(faucet_id, transfer_amount).unwrap(); + + let (alice_tx_context_builder, bob_note) = build_asset_transfer_tx( + &chain, + alice_id, + bob_id, + transfer_asset, + note_package, + tx_script_package, + &mut note_rng, + ); + execute_tx(&mut chain, alice_tx_context_builder); + + eprintln!("\n=== Step 4: Bob consumes p2id note ==="); + let consume_tx_context_builder = chain.build_tx_context(bob_id, &[bob_note.id()], &[]).unwrap(); + execute_tx(&mut chain, consume_tx_context_builder); + + eprintln!("\n=== Checking Bob's account has the transferred asset ==="); + let bob_account = chain.committed_account(bob_id).unwrap(); + assert_account_has_fungible_asset(bob_account, faucet_id, transfer_amount); + + eprintln!("\n=== Checking Alice's account reflects the new token amount ==="); + let alice_account = chain.committed_account(alice_id).unwrap(); + assert_account_has_fungible_asset(alice_account, faucet_id, mint_amount - transfer_amount); +} + +/// Tests the basic-wallet contract deployment and p2ide note consumption workflow on a mock chain. +/// +/// Flow: +/// - Create fungible faucet and mint tokens to Alice +/// - Alice creates a p2ide note for Bob (with timelock=0, reclaim=0) +/// - Bob consumes the p2ide note and receives the assets +#[test] +pub fn test_basic_wallet_p2ide() { + // Compile the contracts first (before creating any runtime) + let wallet_package = compile_rust_package("../../examples/basic-wallet", true); + let p2id_note_package = compile_rust_package("../../examples/p2id-note", true); + let p2ide_note_package = compile_rust_package("../../examples/p2ide-note", true); + + let mut builder = MockChain::builder(); + let max_supply = 1_000_000_000u64; + let faucet_account = builder + .add_existing_basic_faucet(Auth::BasicAuth, "TEST", max_supply, None) + .unwrap(); + let faucet_id = faucet_account.id(); + + let alice_account = builder + .add_account_from_builder( + Auth::BasicAuth, + build_existing_basic_wallet_account_builder(wallet_package.clone(), true, [3_u8; 32]), + AccountState::Exists, + ) + .unwrap(); + let alice_id = alice_account.id(); + + let bob_account = builder + .add_account_from_builder( + Auth::BasicAuth, + build_existing_basic_wallet_account_builder(wallet_package, false, [4_u8; 32]), + AccountState::Exists, + ) + .unwrap(); + let bob_id = bob_account.id(); + + let mut chain = builder.build().unwrap(); + chain.prove_next_block().unwrap(); + chain.prove_next_block().unwrap(); + + // Step 1: Mint assets from faucet to Alice using p2id note + let mint_amount = 100_000u64; + let mint_asset = FungibleAsset::new(faucet_id, mint_amount).unwrap(); + + let mut p2id_rng = RpoRandomCoin::new(p2id_note_package.unwrap_program().hash()); + let p2id_note_mint = create_note_from_package( + p2id_note_package.clone(), + faucet_id, + NoteCreationConfig { + assets: NoteAssets::new(vec![mint_asset.into()]).unwrap(), + inputs: to_core_felts(&alice_id), + ..Default::default() + }, + &mut p2id_rng, + ); + + let faucet_account = chain.committed_account(faucet_id).unwrap().clone(); + let mint_tx_script = + build_send_notes_script(&faucet_account, std::slice::from_ref(&p2id_note_mint)); + let mint_tx_context_builder = chain + .build_tx_context(faucet_id, &[], &[]) + .unwrap() + .tx_script(mint_tx_script) + .extend_expected_output_notes(vec![OutputNote::Full(p2id_note_mint.clone())]); + execute_tx(&mut chain, mint_tx_context_builder); + + // Step 2: Alice consumes the p2id note + let consume_tx_context_builder = + chain.build_tx_context(alice_id, &[p2id_note_mint.id()], &[]).unwrap(); + execute_tx(&mut chain, consume_tx_context_builder); + + let alice_account = chain.committed_account(alice_id).unwrap(); + assert_account_has_fungible_asset(alice_account, faucet_id, mint_amount); + + // Step 3: Alice creates p2ide note for Bob + let transfer_amount = 10_000u64; + let transfer_asset = FungibleAsset::new(faucet_id, transfer_amount).unwrap(); + let timelock_height = Felt::new(0); + let reclaim_height = Felt::new(0); + + let mut p2ide_rng = RpoRandomCoin::new(p2ide_note_package.unwrap_program().hash()); + let p2ide_note = create_note_from_package( + p2ide_note_package, + alice_id, + NoteCreationConfig { + assets: NoteAssets::new(vec![transfer_asset.into()]).unwrap(), + inputs: { + let mut inputs = to_core_felts(&bob_id); + inputs.extend([timelock_height, reclaim_height]); + inputs + }, + ..Default::default() + }, + &mut p2ide_rng, + ); + + let alice_account = chain.committed_account(alice_id).unwrap().clone(); + let transfer_tx_script = + build_send_notes_script(&alice_account, std::slice::from_ref(&p2ide_note)); + let transfer_tx_context_builder = chain + .build_tx_context(alice_id, &[], &[]) + .unwrap() + .tx_script(transfer_tx_script) + .extend_expected_output_notes(vec![OutputNote::Full(p2ide_note.clone())]); + execute_tx(&mut chain, transfer_tx_context_builder); + + // Step 4: Bob consumes the p2ide note + let consume_tx_context_builder = + chain.build_tx_context(bob_id, &[p2ide_note.id()], &[]).unwrap(); + execute_tx(&mut chain, consume_tx_context_builder); + + // Step 5: verify balances + let bob_account = chain.committed_account(bob_id).unwrap(); + assert_account_has_fungible_asset(bob_account, faucet_id, transfer_amount); + + let alice_account = chain.committed_account(alice_id).unwrap(); + assert_account_has_fungible_asset(alice_account, faucet_id, mint_amount - transfer_amount); +} + +/// Tests the p2ide note reclaim functionality. +/// +/// Flow: +/// - Create fungible faucet and mint tokens to Alice +/// - Alice creates a p2ide note intended for Bob (with reclaim enabled) +/// - Alice reclaims the note herself (exercises the reclaim branch) +/// - Verify Alice has her original balance back +#[test] +pub fn test_basic_wallet_p2ide_reclaim() { + // Compile the contracts first (before creating any runtime) + let wallet_package = compile_rust_package("../../examples/basic-wallet", true); + let p2id_note_package = compile_rust_package("../../examples/p2id-note", true); + let p2ide_note_package = compile_rust_package("../../examples/p2ide-note", true); + + let mut builder = MockChain::builder(); + let max_supply = 1_000_000_000u64; + let faucet_account = builder + .add_existing_basic_faucet(Auth::BasicAuth, "TEST", max_supply, None) + .unwrap(); + let faucet_id = faucet_account.id(); + + let alice_account = builder + .add_account_from_builder( + Auth::BasicAuth, + build_existing_basic_wallet_account_builder(wallet_package.clone(), true, [5_u8; 32]), + AccountState::Exists, + ) + .unwrap(); + let alice_id = alice_account.id(); + + let bob_account = builder + .add_account_from_builder( + Auth::BasicAuth, + build_existing_basic_wallet_account_builder(wallet_package, false, [6_u8; 32]), + AccountState::Exists, + ) + .unwrap(); + let bob_id = bob_account.id(); + + let mut chain = builder.build().unwrap(); + chain.prove_next_block().unwrap(); + chain.prove_next_block().unwrap(); + + // Step 1: Mint assets from faucet to Alice using p2id note + let mint_amount = 100_000u64; + let mint_asset = FungibleAsset::new(faucet_id, mint_amount).unwrap(); + + let mut p2id_rng = RpoRandomCoin::new(p2id_note_package.unwrap_program().hash()); + let p2id_note_mint = create_note_from_package( + p2id_note_package.clone(), + faucet_id, + NoteCreationConfig { + assets: NoteAssets::new(vec![mint_asset.into()]).unwrap(), + inputs: to_core_felts(&alice_id), + ..Default::default() + }, + &mut p2id_rng, + ); + + let faucet_account = chain.committed_account(faucet_id).unwrap().clone(); + let mint_tx_script = + build_send_notes_script(&faucet_account, std::slice::from_ref(&p2id_note_mint)); + let mint_tx_context_builder = chain + .build_tx_context(faucet_id, &[], &[]) + .unwrap() + .tx_script(mint_tx_script) + .extend_expected_output_notes(vec![OutputNote::Full(p2id_note_mint.clone())]); + execute_tx(&mut chain, mint_tx_context_builder); + + // Step 2: Alice consumes the p2id note + let consume_tx_context_builder = + chain.build_tx_context(alice_id, &[p2id_note_mint.id()], &[]).unwrap(); + execute_tx(&mut chain, consume_tx_context_builder); + + let alice_account = chain.committed_account(alice_id).unwrap(); + assert_account_has_fungible_asset(alice_account, faucet_id, mint_amount); + + // Step 3: Alice creates p2ide note for Bob with reclaim enabled + let transfer_amount = 10_000u64; + let transfer_asset = FungibleAsset::new(faucet_id, transfer_amount).unwrap(); + let timelock_height = Felt::new(0); + let reclaim_height = Felt::new(1000); + + let mut p2ide_rng = RpoRandomCoin::new(p2ide_note_package.unwrap_program().hash()); + let p2ide_note = create_note_from_package( + p2ide_note_package, + alice_id, + NoteCreationConfig { + assets: NoteAssets::new(vec![transfer_asset.into()]).unwrap(), + inputs: { + let mut inputs = to_core_felts(&bob_id); + inputs.extend([timelock_height, reclaim_height]); + inputs + }, + ..Default::default() + }, + &mut p2ide_rng, + ); + + let alice_account = chain.committed_account(alice_id).unwrap().clone(); + let transfer_tx_script = + build_send_notes_script(&alice_account, std::slice::from_ref(&p2ide_note)); + let transfer_tx_context_builder = chain + .build_tx_context(alice_id, &[], &[]) + .unwrap() + .tx_script(transfer_tx_script) + .extend_expected_output_notes(vec![OutputNote::Full(p2ide_note.clone())]); + execute_tx(&mut chain, transfer_tx_context_builder); + + // Step 4: Alice reclaims the note (exercises the reclaim branch) + let reclaim_tx_context_builder = + chain.build_tx_context(alice_id, &[p2ide_note.id()], &[]).unwrap(); + execute_tx(&mut chain, reclaim_tx_context_builder); + + // Step 5: verify Alice has her original amount back + let alice_account = chain.committed_account(alice_id).unwrap(); + assert_account_has_fungible_asset(alice_account, faucet_id, mint_amount); + + // Ensure Bob did not receive the asset. + let bob_account = chain.committed_account(bob_id).unwrap(); + let bob_found = bob_account.vault().assets().find(|asset| { + matches!( + asset, + miden_protocol::asset::Asset::Fungible(fungible_asset) + if fungible_asset.faucet_id() == faucet_id + ) + }); + assert!(bob_found.is_none(), "Bob unexpectedly received reclaimed assets"); +} diff --git a/tests/integration-network/src/mockchain/counter_contract.rs b/tests/integration-network/src/mockchain/counter_contract.rs new file mode 100644 index 000000000..2a5ab4b51 --- /dev/null +++ b/tests/integration-network/src/mockchain/counter_contract.rs @@ -0,0 +1,86 @@ +//! Counter contract test module + +use miden_client::{ + Word, + account::component::BasicWallet, + crypto::RpoRandomCoin, + note::NoteTag, + testing::{AccountState, Auth, MockChain}, + transaction::OutputNote, +}; +use miden_core::{Felt, FieldElement}; +use miden_protocol::account::{ + AccountBuilder, AccountStorageMode, AccountType, StorageMap, StorageSlot, StorageSlotName, +}; + +use super::helpers::{ + NoteCreationConfig, account_component_from_package, assert_counter_storage, + compile_rust_package, create_note_from_package, execute_tx, +}; + +/// Tests the counter contract deployment and note consumption workflow on a mock chain. +#[test] +pub fn test_counter_contract() { + // Compile the contracts first (before creating any runtime) + let contract_package = compile_rust_package("../../examples/counter-contract", true); + let note_package = compile_rust_package("../../examples/counter-note", true); + + let key = Word::from([Felt::ZERO, Felt::ZERO, Felt::ZERO, Felt::ONE]); + let value = Word::from([Felt::ZERO, Felt::ZERO, Felt::ZERO, Felt::ONE]); + let counter_storage_slot = + StorageSlotName::new("miden::component::miden_counter_contract::count_map").unwrap(); + let storage_slots = vec![StorageSlot::with_map( + counter_storage_slot.clone(), + StorageMap::with_entries([(key, value)]).unwrap(), + )]; + + let counter_component = account_component_from_package(contract_package, storage_slots); + let counter_account_builder = AccountBuilder::new([0_u8; 32]) + .account_type(AccountType::RegularAccountUpdatableCode) + .storage_mode(AccountStorageMode::Public) + .with_component(BasicWallet) + .with_component(counter_component); + + let mut builder = MockChain::builder(); + let counter_account = builder + .add_account_from_builder(Auth::BasicAuth, counter_account_builder, AccountState::Exists) + .expect("failed to add counter account to mock chain builder"); + + let mut rng = RpoRandomCoin::new(note_package.clone().unwrap_program().hash()); + let counter_note = create_note_from_package( + note_package, + counter_account.id(), + NoteCreationConfig { + tag: NoteTag::with_account_target(counter_account.id()), + ..Default::default() + }, + &mut rng, + ); + builder.add_output_note(OutputNote::Full(counter_note.clone())); + + let mut chain = builder.build().expect("failed to build mock chain"); + chain.prove_next_block().unwrap(); + chain.prove_next_block().unwrap(); + + eprintln!("Counter account ID: {:?}", counter_account.id().to_hex()); + + // The counter contract storage value should be 1 after account creation (initialized to 1). + assert_counter_storage( + chain.committed_account(counter_account.id()).unwrap().storage(), + &counter_storage_slot, + 1, + ); + + // Consume the note to increment the counter + let tx_context_builder = chain + .build_tx_context(counter_account.clone(), &[counter_note.id()], &[]) + .unwrap(); + execute_tx(&mut chain, tx_context_builder); + + // The counter contract storage value should be 2 after the note is consumed (incremented by 1). + assert_counter_storage( + chain.committed_account(counter_account.id()).unwrap().storage(), + &counter_storage_slot, + 2, + ); +} diff --git a/tests/integration-network/src/mockchain/counter_contract_no_auth.rs b/tests/integration-network/src/mockchain/counter_contract_no_auth.rs new file mode 100644 index 000000000..04fffd086 --- /dev/null +++ b/tests/integration-network/src/mockchain/counter_contract_no_auth.rs @@ -0,0 +1,109 @@ +//! Counter contract test with no-auth authentication component + +use miden_client::{ + Word, + account::component::BasicWallet, + crypto::RpoRandomCoin, + note::NoteTag, + testing::{AccountState, Auth, MockChain}, + transaction::OutputNote, +}; +use miden_core::{Felt, FieldElement}; +use miden_protocol::account::{ + AccountBuilder, AccountStorageMode, AccountType, StorageMap, StorageSlot, StorageSlotName, +}; + +use super::helpers::{ + NoteCreationConfig, assert_counter_storage, + build_existing_counter_account_builder_with_auth_package, compile_rust_package, + create_note_from_package, execute_tx, +}; + +/// Tests the counter contract with a "no-auth" authentication component. +/// +/// Flow: +/// - Build counter account using `examples/auth-component-no-auth` as the auth component +/// - Build a separate sender account (basic wallet) +/// - Sender issues a counter note to the network +/// - Counter account consumes the note without requiring authentication/signature +#[test] +pub fn test_counter_contract_no_auth() { + // Compile the contracts first (before creating any runtime) + let contract_package = compile_rust_package("../../examples/counter-contract", true); + let note_package = compile_rust_package("../../examples/counter-note", true); + let no_auth_auth_component = + compile_rust_package("../../examples/auth-component-no-auth", true); + + let key = Word::from([Felt::ZERO, Felt::ZERO, Felt::ZERO, Felt::ONE]); + let value = Word::from([Felt::ZERO, Felt::ZERO, Felt::ZERO, Felt::ONE]); + let counter_storage_slot = + StorageSlotName::new("miden::component::miden_counter_contract::count_map").unwrap(); + let counter_storage_slots = vec![StorageSlot::with_map( + counter_storage_slot.clone(), + StorageMap::with_entries([(key, value)]).unwrap(), + )]; + + let mut builder = MockChain::builder(); + + let counter_account = build_existing_counter_account_builder_with_auth_package( + contract_package, + no_auth_auth_component, + vec![], + counter_storage_slots, + [0_u8; 32], + ) + .build_existing() + .expect("failed to build counter account"); + builder + .add_account(counter_account.clone()) + .expect("failed to add counter account to mock chain builder"); + eprintln!("Counter account (no-auth) ID: {:?}", counter_account.id().to_hex()); + + // Create a separate sender account using only the BasicWallet component + let seed = [1_u8; 32]; + let sender_builder = AccountBuilder::new(seed) + .account_type(AccountType::RegularAccountUpdatableCode) + .storage_mode(AccountStorageMode::Public) + .with_component(BasicWallet); + let sender_account = builder + .add_account_from_builder(Auth::BasicAuth, sender_builder, AccountState::Exists) + .expect("failed to add sender account to mock chain builder"); + eprintln!("Sender account ID: {:?}", sender_account.id().to_hex()); + + // Sender creates the counter note (note script increments counter's storage on consumption) + let mut rng = RpoRandomCoin::new(note_package.unwrap_program().hash()); + let counter_note = create_note_from_package( + note_package.clone(), + sender_account.id(), + NoteCreationConfig { + tag: NoteTag::with_account_target(counter_account.id()), + ..Default::default() + }, + &mut rng, + ); + eprintln!("Counter note hash: {:?}", counter_note.id().to_hex()); + builder.add_output_note(OutputNote::Full(counter_note.clone())); + + let mut chain = builder.build().expect("failed to build mock chain"); + chain.prove_next_block().unwrap(); + chain.prove_next_block().unwrap(); + + assert_counter_storage( + chain.committed_account(counter_account.id()).unwrap().storage(), + &counter_storage_slot, + 1, + ); + + // Consume the note with the counter account (no signature/auth required). + let tx_context_builder = chain + .build_tx_context(counter_account.clone(), &[counter_note.id()], &[]) + .unwrap(); + execute_tx(&mut chain, tx_context_builder); + + // The counter contract storage value should be 2 after the note is consumed + assert_counter_storage( + chain.committed_account(counter_account.id()).unwrap().storage(), + &counter_storage_slot, + 2, + ); +} diff --git a/tests/integration-network/src/mockchain/counter_contract_rust_auth.rs b/tests/integration-network/src/mockchain/counter_contract_rust_auth.rs new file mode 100644 index 000000000..8688104d7 --- /dev/null +++ b/tests/integration-network/src/mockchain/counter_contract_rust_auth.rs @@ -0,0 +1,109 @@ +//! Counter contract test using an auth component compiled from Rust (RPO-Falcon512) +//! +//! This test ensures that an account which does not possess the correct +//! RPO-Falcon512 secret key cannot create notes on behalf of the counter +//! contract account that uses the Rust-compiled auth component. + +use miden_client::{ + auth::BasicAuthenticator, crypto::RpoRandomCoin, note::NoteTag, testing::MockChain, + transaction::OutputNote, +}; +use miden_protocol::account::StorageSlotName; + +use super::helpers::{ + NoteCreationConfig, assert_counter_storage, block_on, build_counter_account_with_rust_rpo_auth, + build_send_notes_script, compile_rust_package, create_note_from_package, +}; + +/// Verify that another client (without the RPO-Falcon512 key) cannot create notes for +/// the counter account which uses the Rust-compiled RPO-Falcon512 authentication component. +#[test] +pub fn test_counter_contract_rust_auth_blocks_unauthorized_note_creation() { + let contract_package = compile_rust_package("../../examples/counter-contract", true); + let note_package = compile_rust_package("../../examples/counter-note", true); + let rpo_auth_package = + compile_rust_package("../../examples/auth-component-rpo-falcon512", true); + + let (counter_account, secret_key) = + build_counter_account_with_rust_rpo_auth(contract_package, rpo_auth_package, [0_u8; 32]); + let counter_account_id = counter_account.id(); + + let mut builder = MockChain::builder(); + builder + .add_account(counter_account) + .expect("failed to add counter account to mock chain builder"); + + let mut chain = builder.build().expect("failed to build mock chain"); + chain.prove_next_block().unwrap(); + chain.prove_next_block().unwrap(); + + let counter_account = chain.committed_account(counter_account_id).unwrap().clone(); + eprintln!( + "Counter account (Rust RPO-Falcon512 auth) ID: {:?}", + counter_account.id().to_hex() + ); + + let counter_storage_slot = + StorageSlotName::new("miden::component::miden_counter_contract::count_map").unwrap(); + assert_counter_storage( + chain.committed_account(counter_account.id()).unwrap().storage(), + &counter_storage_slot, + 1, + ); + + // Positive check: original client (with the key) can create a note + let mut rng = RpoRandomCoin::new(note_package.unwrap_program().hash()); + let own_note = create_note_from_package( + note_package.clone(), + counter_account.id(), + NoteCreationConfig { + tag: NoteTag::with_account_target(counter_account.id()), + ..Default::default() + }, + &mut rng, + ); + let tx_script = build_send_notes_script(&counter_account, std::slice::from_ref(&own_note)); + let authenticator = BasicAuthenticator::new(std::slice::from_ref(&secret_key)); + + let tx_context_builder = chain + .build_tx_context(counter_account.clone(), &[], &[]) + .unwrap() + .tx_script(tx_script) + .extend_expected_output_notes(vec![OutputNote::Full(own_note.clone())]) + .authenticator(Some(authenticator)); + let tx_context = tx_context_builder.build().unwrap(); + let executed_tx = + block_on(tx_context.execute()).expect("authorized client should be able to create a note"); + assert_eq!(executed_tx.output_notes().num_notes(), 1); + assert_eq!(executed_tx.output_notes().get_note(0).id(), own_note.id()); + + chain.add_pending_executed_transaction(&executed_tx).unwrap(); + chain.prove_next_block().unwrap(); + + // Negative check: without the RPO-Falcon512 key, creating output notes should fail. + let counter_account = chain.committed_account(counter_account_id).unwrap().clone(); + let forged_note = create_note_from_package( + note_package, + counter_account.id(), + NoteCreationConfig { + tag: NoteTag::with_account_target(counter_account.id()), + ..Default::default() + }, + &mut rng, + ); + let tx_script = build_send_notes_script(&counter_account, std::slice::from_ref(&forged_note)); + + let tx_context_builder = chain + .build_tx_context(counter_account, &[], &[]) + .unwrap() + .tx_script(tx_script) + .extend_expected_output_notes(vec![OutputNote::Full(forged_note)]) + .authenticator(None); + let tx_context = tx_context_builder.build().unwrap(); + + let result = block_on(tx_context.execute()); + assert!( + result.is_err(), + "Unauthorized executor unexpectedly created a transaction for the counter account" + ); +} diff --git a/tests/integration-network/src/mockchain/helpers.rs b/tests/integration-network/src/mockchain/helpers.rs new file mode 100644 index 000000000..695c659d0 --- /dev/null +++ b/tests/integration-network/src/mockchain/helpers.rs @@ -0,0 +1,362 @@ +//! Common helper functions for mock-chain integration tests. + +use std::{collections::BTreeSet, future::Future, sync::Arc}; + +use miden_client::{ + Word, + account::component::BasicWallet, + asset::FungibleAsset, + auth::AuthSecretKey, + crypto::FeltRng, + note::{ + Note, NoteAssets, NoteInputs, NoteMetadata, NoteRecipient, NoteScript, NoteTag, NoteType, + }, + testing::{MockChain, TransactionContextBuilder}, + transaction::OutputNote, +}; +use miden_core::{Felt, FieldElement, crypto::hash::Rpo256}; +use miden_integration_tests::CompilerTestBuilder; +use miden_mast_package::Package; +use miden_protocol::{ + account::{ + Account, AccountBuilder, AccountComponent, AccountComponentMetadata, AccountId, + AccountStorage, AccountStorageMode, AccountType, StorageMap, StorageSlot, StorageSlotName, + }, + asset::Asset, + note::PartialNote, + transaction::TransactionScript, +}; +use miden_standards::account::interface::{AccountInterface, AccountInterfaceExt}; +use midenc_frontend_wasm::WasmTranslationConfig; +use rand::{SeedableRng, rngs::StdRng}; + +/// Converts a value's felt representation into `miden_core::Felt` elements. +pub(super) fn to_core_felts(value: &AccountId) -> Vec { + vec![value.prefix().as_felt(), value.suffix()] +} + +// ASYNC HELPERS +// ================================================================================================ + +thread_local! { + static TOKIO_RUNTIME: tokio::runtime::Runtime = tokio::runtime::Runtime::new() + .expect("failed to build tokio runtime for integration-network tests"); +} + +/// Runs the provided future to completion on a shared Tokio runtime. +pub(super) fn block_on(future: F) -> F::Output { + TOKIO_RUNTIME.with(|rt| rt.block_on(future)) +} + +// COMPILATION +// ================================================================================================ + +/// Helper to compile a Rust package to a Miden `Package`. +pub(super) fn compile_rust_package(package_path: &str, release: bool) -> Arc { + let config = WasmTranslationConfig::default(); + let mut builder = CompilerTestBuilder::rust_source_cargo_miden(package_path, config, []); + + if release { + builder.with_release(true); + } + + let mut test = builder.build(); + test.compiled_package() +} + +// NOTE HELPERS +// ================================================================================================ + +/// Configuration for creating a note. +#[derive(Debug, Clone)] +pub(super) struct NoteCreationConfig { + /// The note type (public/private). + pub note_type: NoteType, + /// The note tag. + pub tag: NoteTag, + /// Assets carried by the note. + pub assets: NoteAssets, + /// Note inputs (e.g. target account id, timelock/reclaim height, etc.). + pub inputs: Vec, +} + +impl Default for NoteCreationConfig { + fn default() -> Self { + Self { + note_type: NoteType::Public, + tag: NoteTag::new(0), + assets: Default::default(), + inputs: Default::default(), + } + } +} + +/// Creates a note from a compiled note package without requiring a `miden_client::Client`. +pub(super) fn create_note_from_package( + package: Arc, + sender_id: AccountId, + config: NoteCreationConfig, + rng: &mut impl FeltRng, +) -> Note { + let note_program = package.unwrap_program(); + let note_script = + NoteScript::from_parts(note_program.mast_forest().clone(), note_program.entrypoint()); + + let serial_num = rng.draw_word(); + let note_inputs = NoteInputs::new(config.inputs).unwrap(); + let recipient = NoteRecipient::new(serial_num, note_script, note_inputs); + + let metadata = NoteMetadata::new(sender_id, config.note_type, config.tag); + + Note::new(config.assets, metadata, recipient) +} + +// ACCOUNT COMPONENT HELPERS +// ================================================================================================ + +/// Creates an account component from a compiled package's component metadata. +pub(super) fn account_component_from_package( + package: Arc, + storage_slots: Vec, +) -> AccountComponent { + let metadata = AccountComponentMetadata::try_from(package.as_ref()) + .expect("no account component metadata present"); + AccountComponent::new(package.unwrap_library().as_ref().clone(), storage_slots) + .unwrap() + .with_metadata(metadata) +} + +// BASIC WALLET HELPERS +// ================================================================================================ + +/// Builds an account builder for an existing basic-wallet account based on the provided component +/// package. +pub(super) fn build_existing_basic_wallet_account_builder( + wallet_package: Arc, + with_std_basic_wallet: bool, + seed: [u8; 32], +) -> AccountBuilder { + let wallet_component = account_component_from_package(wallet_package, vec![]); + + let mut builder = AccountBuilder::new(seed) + .account_type(AccountType::RegularAccountUpdatableCode) + .storage_mode(AccountStorageMode::Public) + .with_component(wallet_component); + + if with_std_basic_wallet { + builder = builder.with_component(BasicWallet); + } + + builder +} + +/// Asserts that the account vault contains a fungible asset from the expected faucet with the +/// expected total amount. +pub(super) fn assert_account_has_fungible_asset( + account: &Account, + expected_faucet_id: AccountId, + expected_amount: u64, +) { + let found_asset = account.vault().assets().find_map(|asset| match asset { + Asset::Fungible(fungible_asset) if fungible_asset.faucet_id() == expected_faucet_id => { + Some(fungible_asset) + } + _ => None, + }); + + match found_asset { + Some(fungible_asset) => assert_eq!( + fungible_asset.amount(), + expected_amount, + "Found asset from faucet {expected_faucet_id} but amount {} doesn't match expected \ + {expected_amount}", + fungible_asset.amount() + ), + None => { + panic!("Account does not contain a fungible asset from faucet {expected_faucet_id}") + } + } +} + +/// Builds a `send_notes` transaction script for accounts that support a standard note creation +/// interface (e.g. basic wallets and basic fungible faucets). +pub(super) fn build_send_notes_script(account: &Account, notes: &[Note]) -> TransactionScript { + let partial_notes = notes.iter().cloned().map(PartialNote::from).collect::>(); + + AccountInterface::from_account(account) + .build_send_notes_script(&partial_notes, None) + .expect("failed to build send_notes transaction script") +} + +/// Executes a transaction context against the chain and commits it in the next block. +pub(super) fn execute_tx(chain: &mut MockChain, tx_context_builder: TransactionContextBuilder) { + let tx_context = tx_context_builder.build().unwrap(); + let executed_tx = block_on(tx_context.execute()).unwrap_or_else(|err| panic!("{err}")); + chain.add_pending_executed_transaction(&executed_tx).unwrap(); + chain.prove_next_block().unwrap(); +} + +/// Builds a transaction context which transfers an asset from `sender_id` to `recipient_id` using +/// the custom transaction script package. +/// +/// Builds the transaction context by constructing the same advice-map + script-arg commitment +/// expected by the tx script, without requiring a `miden_client::Client`. +/// +/// The caller provides an RNG used to generate a unique note serial number, to avoid accidental +/// note ID collisions across multiple transfers. +pub(super) fn build_asset_transfer_tx( + chain: &MockChain, + sender_id: AccountId, + recipient_id: AccountId, + asset: FungibleAsset, + p2id_note_package: Arc, + tx_script_package: Arc, + rng: &mut impl FeltRng, +) -> (TransactionContextBuilder, Note) { + let note_program = p2id_note_package.unwrap_program(); + let note_script = + NoteScript::from_parts(note_program.mast_forest().clone(), note_program.entrypoint()); + + let tx_script_program = tx_script_package.unwrap_program(); + let tx_script = TransactionScript::from_parts( + tx_script_program.mast_forest().clone(), + tx_script_program.entrypoint(), + ); + + let serial_num = rng.draw_word(); + let inputs = NoteInputs::new(to_core_felts(&recipient_id)).unwrap(); + let note_recipient = NoteRecipient::new(serial_num, note_script, inputs); + + let config = NoteCreationConfig { + assets: NoteAssets::new(vec![asset.into()]).unwrap(), + ..Default::default() + }; + let metadata = NoteMetadata::new(sender_id, config.note_type, config.tag); + let output_note = Note::new(config.assets, metadata, note_recipient.clone()); + + // Prepare commitment data + // This must match the input layout expected by `examples/basic-wallet-tx-script`. + let mut commitment_input: Vec = vec![config.tag.into(), Felt::from(config.note_type)]; + let recipient_digest: [Felt; 4] = note_recipient.digest().into(); + commitment_input.extend(recipient_digest); + + let asset_arr: Word = asset.into(); + commitment_input.extend(asset_arr); + // Ensure word alignment for `adv_load_preimage` in the tx script. + commitment_input.extend([Felt::ZERO, Felt::ZERO]); + + let commitment_key: Word = Rpo256::hash_elements(&commitment_input); + assert_eq!(commitment_input.len() % 4, 0, "commitment input needs to be word-aligned"); + + // NOTE: passed on the stack reversed + let mut commitment_arg = commitment_key; + commitment_arg.reverse(); + + let tx_context_builder = chain + .build_tx_context(sender_id, &[], &[]) + .unwrap() + .tx_script(tx_script) + .tx_script_args(commitment_arg) + .extend_advice_map([(commitment_key, commitment_input)]) + .extend_expected_output_notes(vec![OutputNote::Full(output_note.clone())]); + + (tx_context_builder, output_note) +} + +// COUNTER CONTRACT HELPERS +// ================================================================================================ + +fn counter_storage_slot_name() -> StorageSlotName { + StorageSlotName::new("miden::component::miden_counter_contract::count_map") + .expect("counter storage slot name should be valid") +} + +fn auth_public_key_slot_name() -> StorageSlotName { + StorageSlotName::new("miden::component::miden_auth_component_rpo_falcon512::owner_public_key") + .expect("auth component storage slot name should be valid") +} + +/// Asserts the counter value stored in the counter contract's storage map at `storage_slot`. +pub(super) fn assert_counter_storage( + counter_account_storage: &AccountStorage, + storage_slot: &StorageSlotName, + expected: u64, +) { + // according to `examples/counter-contract` for inner (slot, key) values + let counter_contract_storage_key = Word::from([Felt::ZERO, Felt::ZERO, Felt::ZERO, Felt::ONE]); + + let word = counter_account_storage + .get_map_item(storage_slot, counter_contract_storage_key) + .expect("Failed to get counter value from storage slot"); + + let val = word.last().unwrap(); + assert_eq!( + val.as_int(), + expected, + "Counter value mismatch. Expected: {}, Got: {}", + expected, + val.as_int() + ); +} + +/// Builds an account builder for an existing public counter account containing the counter +/// contract component and a custom authentication component compiled as a package library. +pub(super) fn build_existing_counter_account_builder_with_auth_package( + contract_package: Arc, + auth_component_package: Arc, + auth_storage_slots: Vec, + counter_storage_slots: Vec, + seed: [u8; 32], +) -> AccountBuilder { + let supported_types = BTreeSet::from_iter([AccountType::RegularAccountUpdatableCode]); + let auth_component = AccountComponent::new( + auth_component_package.unwrap_library().as_ref().clone(), + auth_storage_slots, + ) + .unwrap() + .with_supported_types(supported_types); + let counter_component = account_component_from_package(contract_package, counter_storage_slots); + + AccountBuilder::new(seed) + .account_type(AccountType::RegularAccountUpdatableCode) + .storage_mode(AccountStorageMode::Public) + .with_auth_component(auth_component) + .with_component(BasicWallet) + .with_component(counter_component) +} + +/// Builds an existing counter account using a Rust-compiled RPO-Falcon512 authentication component. +/// +/// Returns the account along with the generated secret key which can authenticate transactions for +/// this account. +pub(super) fn build_counter_account_with_rust_rpo_auth( + component_package: Arc, + auth_component_package: Arc, + seed: [u8; 32], +) -> (Account, AuthSecretKey) { + let key = Word::from([Felt::ZERO, Felt::ZERO, Felt::ZERO, Felt::ONE]); + let value = Word::from([Felt::ZERO, Felt::ZERO, Felt::ZERO, Felt::ONE]); + let counter_storage_slots = vec![StorageSlot::with_map( + counter_storage_slot_name(), + StorageMap::with_entries([(key, value)]).unwrap(), + )]; + + let mut rng = StdRng::seed_from_u64(1); + let secret_key = AuthSecretKey::new_falcon512_rpo_with_rng(&mut rng); + let pk_commitment: Word = secret_key.public_key().to_commitment().into(); + + let auth_storage_slots = + vec![StorageSlot::with_value(auth_public_key_slot_name(), pk_commitment)]; + + let account = build_existing_counter_account_builder_with_auth_package( + component_package, + auth_component_package, + auth_storage_slots, + counter_storage_slots, + seed, + ) + .build_existing() + .expect("failed to build counter account"); + + (account, secret_key) +} diff --git a/tests/integration-network/src/mockchain/mod.rs b/tests/integration-network/src/mockchain/mod.rs new file mode 100644 index 000000000..b6d2e6432 --- /dev/null +++ b/tests/integration-network/src/mockchain/mod.rs @@ -0,0 +1,7 @@ +//! Integration tests which exercise contract deployment and execution on a mock chain. + +mod basic_wallet; +mod counter_contract; +mod counter_contract_no_auth; +mod counter_contract_rust_auth; +mod helpers; diff --git a/tests/integration-node/README.md b/tests/integration-node/README.md deleted file mode 100644 index 0bdd85ddb..000000000 --- a/tests/integration-node/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# Miden Integration Node Tests - -This crate contains integration tests that require a local Miden node instance or testnet connection. - -## Overview - -The tests in this crate are separated from the main integration tests because they: -- Require a local Miden node to be running or testnet connectivity -- Are slower due to network operations and multi-step nature of the test scenarios - -## Running Tests - -To see debug output from the node: - -```bash -MIDEN_NODE_OUTPUT=1 cargo test -p miden-integration-node-tests -``` - -## Process Cleanup - -The local node management system ensures that: -- Only one node instance runs at a time, shared across all tests -- The node is automatically stopped when the last test using the node is finished -- No orphaned miden-node processes remain after test execution diff --git a/tests/integration-node/src/lib.rs b/tests/integration-node/src/lib.rs deleted file mode 100644 index a11a749db..000000000 --- a/tests/integration-node/src/lib.rs +++ /dev/null @@ -1,6 +0,0 @@ -//! Integration tests that are deploying code and runnning test scenarior on a local Miden node instance or testnet - -pub mod local_node; - -#[cfg(test)] -mod node_tests; diff --git a/tests/integration-node/src/local_node/handle.rs b/tests/integration-node/src/local_node/handle.rs deleted file mode 100644 index e97f85b3e..000000000 --- a/tests/integration-node/src/local_node/handle.rs +++ /dev/null @@ -1,92 +0,0 @@ -//! Handle for managing shared node instances - -use std::fs; - -use anyhow::{Context, Result}; -use uuid::Uuid; - -use super::{ - RPC_PORT, - process::{is_port_in_use, is_process_running, start_shared_node}, - ref_count_dir, rpc_url, - setup::LocalMidenNode, - sync::{ - acquire_lock, add_reference, get_ref_count, read_pid, stop_node_if_no_references, write_pid, - }, -}; - -/// Handle to the shared node instance. When dropped, decrements the reference count. -pub struct SharedNodeHandle { - /// The RPC URL of the shared node - rpc_url: String, - /// Unique ID for this handle - handle_id: String, -} - -impl SharedNodeHandle { - /// Get the RPC URL for connecting to the node - pub fn rpc_url(&self) -> &str { - &self.rpc_url - } -} - -impl Drop for SharedNodeHandle { - fn drop(&mut self) { - eprintln!("[SharedNode] Dropping handle {}", self.handle_id); - - // Remove our reference file - let ref_file = ref_count_dir().join(&self.handle_id); - if let Err(e) = fs::remove_file(&ref_file) { - eprintln!("[SharedNode] Warning: Failed to remove ref file: {e}"); - } - - stop_node_if_no_references(); - } -} - -/// Ensure the shared node is running and return a handle to it -pub async fn ensure_shared_node() -> Result { - LocalMidenNode::ensure_installed().context("Failed to ensure miden-node is installed")?; - - let handle_id = format!("handle-{}-{}", std::process::id(), Uuid::new_v4()); - let _lock = acquire_lock().context("Failed to acquire lock for node coordination")?; - - let existing_pid = read_pid().context("Failed to read PID file")?; - - let pid = match existing_pid { - Some(pid) if is_process_running(pid) => { - // Check if the node is actually responding - if is_port_in_use(RPC_PORT) { - eprintln!("[SharedNode] Using existing node process {pid}"); - pid - } else { - eprintln!("[SharedNode] Found dead node process {pid}, restarting..."); - // Node process exists but isn't responding, start a new one - let new_pid = start_shared_node() - .await - .context("Failed to start new node after finding dead process")?; - write_pid(new_pid).context("Failed to write PID file")?; - new_pid - } - } - _ => { - // No running node, start a new one - eprintln!("[SharedNode] No existing node found, starting new instance"); - let new_pid = start_shared_node().await.context("Failed to start new node instance")?; - write_pid(new_pid).context("Failed to write PID file")?; - new_pid - } - }; - - // Add our reference - add_reference(&handle_id).context("Failed to add reference for handle")?; - - // Log current state - let ref_count = get_ref_count().context("Failed to get reference count")?; - eprintln!("[SharedNode] Node PID: {pid}, Reference count: {ref_count}"); - - Ok(SharedNodeHandle { - rpc_url: rpc_url(), - handle_id, - }) -} diff --git a/tests/integration-node/src/local_node/mod.rs b/tests/integration-node/src/local_node/mod.rs deleted file mode 100644 index 729fe1c91..000000000 --- a/tests/integration-node/src/local_node/mod.rs +++ /dev/null @@ -1,40 +0,0 @@ -//! Infrastructure for running a local Miden node for integration tests - -use std::path::PathBuf; - -mod handle; -mod process; -mod setup; -mod sync; - -pub use handle::{SharedNodeHandle, ensure_shared_node}; - -// Base directory for all miden test node files -const BASE_DIR: &str = "/tmp/miden-test-node"; - -// Re-export constants that are used in multiple modules -pub(crate) const COORD_DIR: &str = BASE_DIR; - -// Construct paths at runtime since concat! doesn't work with const values -pub(crate) fn pid_file() -> PathBuf { - PathBuf::from(BASE_DIR).join("node.pid") -} - -pub(crate) fn ref_count_dir() -> PathBuf { - PathBuf::from(BASE_DIR).join("refs") -} - -pub(crate) fn lock_file() -> PathBuf { - PathBuf::from(BASE_DIR).join("node.lock") -} - -pub(crate) fn data_dir() -> PathBuf { - PathBuf::from(BASE_DIR).join("data") -} - -pub(crate) const RPC_PORT: u16 = 57291; - -// Construct RPC URL using the port constant -pub(crate) fn rpc_url() -> String { - format!("http://127.0.0.1:{RPC_PORT}") -} diff --git a/tests/integration-node/src/local_node/process.rs b/tests/integration-node/src/local_node/process.rs deleted file mode 100644 index 8b9ef49fd..000000000 --- a/tests/integration-node/src/local_node/process.rs +++ /dev/null @@ -1,144 +0,0 @@ -//! Process management functionality for the shared node - -use std::{ - fs, - net::TcpStream, - process::{Command, Stdio}, - thread, - time::{Duration, Instant}, -}; - -use anyhow::{Context, Result, anyhow}; - -use super::{RPC_PORT, data_dir, rpc_url, setup::LocalMidenNode}; - -/// Check if a port is in use -pub fn is_port_in_use(port: u16) -> bool { - TcpStream::connect(("127.0.0.1", port)).is_ok() -} - -/// Check if a process is running -pub fn is_process_running(pid: u32) -> bool { - // Try to read from /proc/{pid}/stat on Linux/macOS - #[cfg(target_os = "linux")] - { - std::path::Path::new(&format!("/proc/{pid}")).exists() - } - - #[cfg(not(target_os = "linux"))] - { - // On macOS, use ps command - Command::new("ps") - .args(["-p", &pid.to_string()]) - .output() - .map(|output| output.status.success()) - .unwrap_or(false) - } -} - -/// Kill a process by PID -pub fn kill_process(pid: u32) -> Result<()> { - eprintln!("[SharedNode] Killing process {pid}"); - - // Use kill command for cross-platform compatibility - // First try SIGTERM - let term_result = Command::new("kill") - .args(["-TERM", &pid.to_string()]) - .output() - .context("Failed to execute kill command")?; - - if !term_result.status.success() { - let stderr = String::from_utf8_lossy(&term_result.stderr); - // If process doesn't exist, that's fine - if stderr.contains("No such process") { - return Ok(()); - } - return Err(anyhow!("Failed to send SIGTERM to process {pid}: {stderr}")); - } - - // Wait a bit for graceful shutdown - thread::sleep(Duration::from_millis(500)); - - // If still running, use SIGKILL - if is_process_running(pid) { - let kill_result = Command::new("kill") - .args(["-KILL", &pid.to_string()]) - .output() - .context("Failed to execute kill command")?; - - if !kill_result.status.success() { - let stderr = String::from_utf8_lossy(&kill_result.stderr); - if !stderr.contains("No such process") { - return Err(anyhow!("Failed to send SIGKILL to process {pid}: {stderr}")); - } - } - } - - Ok(()) -} - -/// Start the shared node process -pub async fn start_shared_node() -> Result { - eprintln!("[SharedNode] Starting shared node process..."); - - // Bootstrap if needed (data directory empty or doesn't exist) - let data_dir_path = data_dir(); - let needs_bootstrap = !data_dir_path.exists() - || fs::read_dir(&data_dir_path) - .map(|mut entries| entries.next().is_none()) - .unwrap_or(true); - - if needs_bootstrap { - // Ensure we have a clean, empty data directory for bootstrap - if data_dir_path.exists() { - fs::remove_dir_all(&data_dir_path).context("Failed to remove data directory")?; - } - fs::create_dir_all(&data_dir_path).context("Failed to create data directory")?; - LocalMidenNode::bootstrap(&data_dir_path).context("Failed to bootstrap miden-node")?; - } - - // Start the node process - // Use Stdio::null() for stdout/stderr to avoid buffer blocking issues. - // When pipes are used, the child process can block if the pipe buffer fills up - // and the reading end doesn't consume data fast enough. Using inherit() also - // causes issues with nextest's parallel test execution. - // - // For debugging, users can run the node manually with RUST_LOG=debug. - let child = Command::new("miden-node") - .args([ - "bundled", - "start", - "--data-directory", - data_dir_path.to_str().unwrap(), - "--rpc.url", - &rpc_url(), - "--block.interval", - "1sec", - ]) - .stdout(Stdio::null()) - .stderr(Stdio::null()) - .spawn() - .context("Failed to start miden-node process")?; - - let pid = child.id(); - - // Detach the child process so it continues running after we exit - drop(child); - - // Wait for node to be ready - eprintln!("[SharedNode] Waiting for node to be ready..."); - let start = Instant::now(); - let timeout = Duration::from_secs(10); - - while start.elapsed() < timeout { - if is_port_in_use(RPC_PORT) { - eprintln!("[SharedNode] Node is ready"); - return Ok(pid); - } - tokio::time::sleep(Duration::from_millis(100)).await; - } - - // If we get here, node failed to start - kill_process(pid).context("Failed to kill unresponsive node process")?; - Err(anyhow!("Timeout waiting for node to be ready")) -} diff --git a/tests/integration-node/src/local_node/setup.rs b/tests/integration-node/src/local_node/setup.rs deleted file mode 100644 index 1e49339e1..000000000 --- a/tests/integration-node/src/local_node/setup.rs +++ /dev/null @@ -1,122 +0,0 @@ -//! Node installation and bootstrap functionality - -use std::{fs, path::Path, process::Command}; - -use anyhow::{Context, Result, anyhow}; - -use super::{COORD_DIR, process::kill_process, sync::read_pid}; - -// Version configuration for miden-node -// NOTE: When updating miden-client version in Cargo.toml, update this constant to match -// the compatible miden-node version. Both should typically use the same major.minor version. - -/// The exact miden-node version that is compatible with the miden-client version used in tests -const MIDEN_NODE_VERSION: &str = "0.12.2"; - -/// Manages the lifecycle of a local Miden node instance -pub struct LocalMidenNode; - -impl LocalMidenNode { - /// Install miden-node binary if not already installed - pub fn ensure_installed() -> Result<()> { - // Check if miden-node is already installed and get version - let check = Command::new("miden-node").arg("--version").output(); - - let need_install = match check { - Ok(output) if output.status.success() => { - let version = String::from_utf8_lossy(&output.stdout); - let version_line = version.lines().next().unwrap_or(""); - - // Check if it's the exact version we need - if version_line.contains(MIDEN_NODE_VERSION) { - eprintln!("miden-node already installed: {version_line}"); - false - } else { - eprintln!( - "Found incompatible miden-node version: {version_line} (need \ - {MIDEN_NODE_VERSION})" - ); - eprintln!("Uninstalling current version..."); - - // Uninstall the current version - let uninstall_output = Command::new("cargo") - .args(["uninstall", "miden-node"]) - .output() - .context("Failed to run cargo uninstall")?; - - if !uninstall_output.status.success() { - let stderr = String::from_utf8_lossy(&uninstall_output.stderr); - eprintln!("Warning: Failed to uninstall miden-node: {stderr}"); - } else { - eprintln!("Successfully uninstalled old version"); - } - - // Clean all node-related data when version changes - eprintln!("Cleaning node data due to version change..."); - - // Kill any running node process - if let Ok(Some(pid)) = read_pid() { - eprintln!("Stopping existing node process {pid}"); - let _ = kill_process(pid); - } - - // Clean the entire coordination directory - if let Err(e) = fs::remove_dir_all(COORD_DIR) - && e.kind() != std::io::ErrorKind::NotFound - { - eprintln!("Warning: Failed to clean coordination directory: {e}"); - } - - true - } - } - _ => { - eprintln!("miden-node not found"); - true - } - }; - - if need_install { - // Install specific version compatible with miden-client - eprintln!("Installing miden-node version {MIDEN_NODE_VERSION} from crates.io..."); - let output = Command::new("cargo") - .args(["install", "miden-node", "--version", MIDEN_NODE_VERSION, "--locked"]) - .output() - .context("Failed to run cargo install")?; - - if !output.status.success() { - let stderr = String::from_utf8_lossy(&output.stderr); - return Err(anyhow!("Failed to install miden-node: {stderr}")); - } - - eprintln!("miden-node {MIDEN_NODE_VERSION} installed successfully"); - } - - Ok(()) - } - - /// Bootstrap the node with genesis data - pub fn bootstrap(data_dir: &Path) -> Result<()> { - eprintln!("Bootstrapping miden-node..."); - - let output = Command::new("miden-node") - .args([ - "bundled", - "bootstrap", - "--data-directory", - data_dir.to_str().unwrap(), - "--accounts-directory", - data_dir.to_str().unwrap(), - ]) - .output() - .context("Failed to run miden-node bootstrap command")?; - - if !output.status.success() { - let stderr = String::from_utf8_lossy(&output.stderr); - return Err(anyhow!("Failed to bootstrap node: {stderr}")); - } - - eprintln!("Node bootstrapped successfully"); - Ok(()) - } -} diff --git a/tests/integration-node/src/local_node/sync.rs b/tests/integration-node/src/local_node/sync.rs deleted file mode 100644 index 8a41549fa..000000000 --- a/tests/integration-node/src/local_node/sync.rs +++ /dev/null @@ -1,164 +0,0 @@ -//! Synchronization and reference counting logic for the shared node - -use std::{ - fs::{self, File, OpenOptions}, - thread, - time::Duration, -}; - -use anyhow::{Context, Result, anyhow}; -use fs2::FileExt; - -use super::{ - COORD_DIR, lock_file, pid_file, - process::{is_process_running, kill_process}, - ref_count_dir, -}; - -/// Lock guard using fs2 file locking -pub struct LockGuard(File); - -impl Drop for LockGuard { - fn drop(&mut self) { - let _ = self.0.unlock(); - } -} - -/// Acquire a file lock for atomic operations -pub fn acquire_lock() -> Result { - // Ensure coordination directory exists - fs::create_dir_all(COORD_DIR).context("Failed to create coordination directory")?; - - // Open or create lock file - let file = OpenOptions::new() - .write(true) - .create(true) - .truncate(true) - .open(lock_file()) - .context("Failed to open lock file")?; - - // Try to acquire exclusive lock with retries - let mut attempts = 0; - const MAX_ATTEMPTS: u32 = 100; // 10 seconds max wait - - loop { - match file.try_lock_exclusive() { - Ok(_) => return Ok(LockGuard(file)), - Err(e) => { - if attempts >= MAX_ATTEMPTS { - return Err(anyhow!("Timeout acquiring lock: {e}")); - } - attempts += 1; - thread::sleep(Duration::from_millis(100)); - } - } - } -} - -/// Read PID from file -pub fn read_pid() -> Result> { - match fs::read_to_string(pid_file()) { - Ok(contents) => { - let pid = contents.trim().parse::().context("Failed to parse PID")?; - Ok(Some(pid)) - } - Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(None), - Err(e) => Err(anyhow!("Failed to read PID file: {e}")), - } -} - -/// Write PID to file -pub fn write_pid(pid: u32) -> Result<()> { - fs::write(pid_file(), pid.to_string()).context("Failed to write PID file") -} - -/// Remove PID file -pub fn remove_pid() -> Result<()> { - match fs::remove_file(pid_file()) { - Ok(_) => Ok(()), - Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(()), - Err(e) => Err(anyhow!("Failed to remove PID file: {e}")), - } -} - -/// Get count of active references, cleaning up stale ones -pub fn get_ref_count() -> Result { - fs::create_dir_all(ref_count_dir()).context("Failed to create reference count directory")?; - - let entries = - fs::read_dir(ref_count_dir()).context("Failed to read reference count directory")?; - - let mut active_count = 0; - for entry in entries.flatten() { - let file_name = entry.file_name(); - let file_name_str = file_name.to_string_lossy(); - - // Extract PID from handle name (format: handle-{pid}-{uuid}) - if let Some(pid_str) = file_name_str.split('-').nth(1) - && let Ok(pid) = pid_str.parse::() - { - if is_process_running(pid) { - active_count += 1; - } else { - // Clean up stale reference from dead process - eprintln!("[SharedNode] Cleaning up stale reference from dead process {pid}"); - let _ = fs::remove_file(entry.path()); - } - } - } - - Ok(active_count) -} - -/// Add a reference -pub fn add_reference(handle_id: &str) -> Result<()> { - fs::create_dir_all(ref_count_dir()).context("Failed to create reference count directory")?; - - let ref_file = ref_count_dir().join(handle_id); - File::create(&ref_file).context("Failed to create reference file")?; - - Ok(()) -} - -/// Check and stop the node if no more references exist -pub fn stop_node_if_no_references() { - // Acquire lock for atomic operation - let _lock = match acquire_lock() { - Ok(lock) => lock, - Err(e) => { - eprintln!("[SharedNode] Failed to acquire lock: {e}"); - return; - } - }; - - // Check reference count - let ref_count = match get_ref_count() { - Ok(count) => count, - Err(e) => { - eprintln!("[SharedNode] Failed to get reference count: {e}"); - return; - } - }; - - eprintln!("[SharedNode] Reference count: {ref_count}"); - - if ref_count == 0 { - // No more references, stop the node - if let Ok(Some(pid)) = read_pid() { - eprintln!("[SharedNode] No more references, stopping node process {pid}"); - - if let Err(e) = kill_process(pid) { - eprintln!("[SharedNode] Failed to kill node process: {e}"); - } - - if let Err(e) = remove_pid() { - eprintln!("[SharedNode] Failed to remove PID file: {e}"); - } - - // Clean up coordination directory - if let Err(e) = fs::remove_dir_all(COORD_DIR) { - eprintln!("[SharedNode] Failed to clean up coordination directory: {e}"); - } - } - } -} diff --git a/tests/integration-node/src/node_tests/basic_wallet.rs b/tests/integration-node/src/node_tests/basic_wallet.rs deleted file mode 100644 index 3086df732..000000000 --- a/tests/integration-node/src/node_tests/basic_wallet.rs +++ /dev/null @@ -1,596 +0,0 @@ -//! Basic wallet test module - -use miden_client::{ - asset::{FungibleAsset, TokenSymbol}, - note::NoteAssets, - transaction::{OutputNote, TransactionRequestBuilder}, -}; -use miden_core::{Felt, utils::Serializable}; - -use super::helpers::*; -use crate::local_node::ensure_shared_node; - -/// Tests the basic-wallet contract deployment and p2id note consumption workflow on a local node. -#[test] -pub fn test_basic_wallet_p2id_local() { - // Compile the contracts first (before creating any runtime) - let wallet_package = compile_rust_package("../../examples/basic-wallet", true); - let note_package = compile_rust_package("../../examples/p2id-note", true); - let tx_script_package = compile_rust_package("../../examples/basic-wallet-tx-script", true); - - let rt = tokio::runtime::Runtime::new().unwrap(); - rt.block_on(async { - // Create temp directory and get node handle - let temp_dir = temp_dir::TempDir::with_prefix("test_basic_wallet_p2id_local_") - .expect("Failed to create temp directory"); - let node_handle = ensure_shared_node().await.expect("Failed to get shared node"); - - // Initialize test infrastructure - let TestSetup { - mut client, - keystore, - } = setup_test_infrastructure(&temp_dir, &node_handle) - .await - .expect("Failed to setup test infrastructure"); - - // Write wallet package to disk for potential future use - let wallet_package_path = temp_dir.path().join("basic_wallet.masp"); - std::fs::write(&wallet_package_path, wallet_package.to_bytes()) - .expect("Failed to write wallet"); - - // Create a fungible faucet account - let token_symbol = TokenSymbol::new("TEST").unwrap(); - let decimals = 8u8; - let max_supply = Felt::new(1_000_000_000); // 1 billion tokens - - let faucet_account = create_fungible_faucet_account( - &mut client, - keystore.clone(), - token_symbol, - decimals, - max_supply, - ) - .await - .unwrap(); - - eprintln!("Faucet account ID: {:?}", faucet_account.id().to_hex()); - - // Create Alice's account with basic-wallet component - let alice_config = AccountCreationConfig { - with_basic_wallet: false, - ..Default::default() - }; - let alice_account = create_account_with_component( - &mut client, - keystore.clone(), - wallet_package.clone(), - alice_config, - ) - .await - .unwrap(); - eprintln!("Alice account ID: {:?}", alice_account.id().to_hex()); - - eprintln!("\n=== Step 1: Minting tokens from faucet to Alice ==="); - - let mint_amount = 100_000u64; // 100,000 tokens - let fungible_asset = FungibleAsset::new(faucet_account.id(), mint_amount).unwrap(); - - // Create the p2id note from faucet to Alice - let p2id_note_mint = create_note_from_package( - &mut client, - note_package.clone(), - faucet_account.id(), - NoteCreationConfig { - assets: NoteAssets::new(vec![fungible_asset.into()]).unwrap(), - inputs: vec![alice_account.id().prefix().as_felt(), alice_account.id().suffix()], - ..Default::default() - }, - ); - eprintln!("P2ID mint note hash: {:?}", p2id_note_mint.id().to_hex()); - - let mint_request = TransactionRequestBuilder::new() - .own_output_notes(vec![OutputNote::Full(p2id_note_mint.clone())]) - .build() - .unwrap(); - - let mint_tx_id = - client.submit_new_transaction(faucet_account.id(), mint_request).await.unwrap(); - eprintln!("Submitted mint transaction. Tx ID: {mint_tx_id:?}"); - - eprintln!("\n=== Step 2: Alice attempts to consume mint note ==="); - - let consume_request = TransactionRequestBuilder::new() - .unauthenticated_input_notes([(p2id_note_mint, None)]) - .build() - .unwrap(); - - let _consume_tx_id = client - .submit_new_transaction(alice_account.id(), consume_request) - .await - .map_err(|e| format!("{e:?}")) - .unwrap(); - - eprintln!("\n=== Checking Alice's account has the minted asset ==="); - - assert_account_has_fungible_asset( - &mut client, - alice_account.id(), - faucet_account.id(), - mint_amount, - ) - .await; - - eprintln!("\n=== Step 3: Creating Bob's account ==="); - - let bob_config = AccountCreationConfig { - with_basic_wallet: false, - ..Default::default() - }; - let bob_account = create_account_with_component( - &mut client, - keystore.clone(), - wallet_package, - bob_config, - ) - .await - .unwrap(); - eprintln!("Bob account ID: {:?}", bob_account.id().to_hex()); - - eprintln!("\n=== Step 4: Alice creates p2id note for Bob ==="); - - let transfer_amount = 10_000u64; // 10,000 tokens - let transfer_asset = FungibleAsset::new(faucet_account.id(), transfer_amount).unwrap(); - - let (alice_tx_id, bob_note) = send_asset_to_account( - &mut client, - alice_account.id(), - bob_account.id(), - transfer_asset, - note_package.clone(), - tx_script_package, - None, // Use default configuration - ) - .await - .unwrap(); - - eprintln!("Alice created p2id transaction. Tx ID: {alice_tx_id:?}"); - - // Step 5: Bob attempts to consume the p2id note - eprintln!("\n=== Step 5: Bob attempts to consume p2id note ==="); - - let consume_request = TransactionRequestBuilder::new() - .unauthenticated_input_notes([(bob_note, None)]) - .build() - .unwrap(); - - let consume_tx_id = - client.submit_new_transaction(bob_account.id(), consume_request).await.unwrap(); - eprintln!("Bob created consume transaction. Tx ID: {consume_tx_id:?}"); - - eprintln!("\n=== Step 6: Checking Bob's account has the transferred asset ==="); - - assert_account_has_fungible_asset( - &mut client, - bob_account.id(), - faucet_account.id(), - transfer_amount, - ) - .await; - - eprintln!( - "\n=== Step 7: Checking Alice's account reflects the new token amount after sending \ - to Bob ===" - ); - - assert_account_has_fungible_asset( - &mut client, - alice_account.id(), - faucet_account.id(), - mint_amount - transfer_amount, - ) - .await; - }); -} - -/// Tests the basic-wallet contract deployment and p2ide note consumption workflow on a local node. -/// -/// Flow: -/// - Create fungible faucet and mint tokens to Alice -/// - Alice creates a p2ide note for Bob (with timelock=0, reclaim=0) -/// - Bob consumes the p2ide note and receives the assets -#[test] -pub fn test_basic_wallet_p2ide_local() { - // Compile the contracts first (before creating any runtime) - let wallet_package = compile_rust_package("../../examples/basic-wallet", true); - let p2id_note_package = compile_rust_package("../../examples/p2id-note", true); - let p2ide_note_package = compile_rust_package("../../examples/p2ide-note", true); - - let rt = tokio::runtime::Runtime::new().unwrap(); - rt.block_on(async { - // Create temp directory and get node handle - let temp_dir = temp_dir::TempDir::with_prefix("test_basic_wallet_p2ide_local_") - .expect("Failed to create temp directory"); - let node_handle = ensure_shared_node().await.expect("Failed to get shared node"); - - // Initialize test infrastructure - let TestSetup { - mut client, - keystore, - } = setup_test_infrastructure(&temp_dir, &node_handle) - .await - .expect("Failed to setup test infrastructure"); - - // Step 1: Create a fungible faucet account - eprintln!("\n=== Step 1: Creating fungible faucet ==="); - let token_symbol = TokenSymbol::new("TEST").unwrap(); - let decimals = 8u8; - let max_supply = Felt::new(1_000_000_000); // 1 billion tokens - - let faucet_account = create_fungible_faucet_account( - &mut client, - keystore.clone(), - token_symbol, - decimals, - max_supply, - ) - .await - .unwrap(); - - eprintln!("Faucet account ID: {:?}", faucet_account.id().to_hex()); - - // Create Alice's account with basic-wallet component - let alice_config = AccountCreationConfig { - with_basic_wallet: true, - ..Default::default() - }; - let alice_account = create_account_with_component( - &mut client, - keystore.clone(), - wallet_package.clone(), - alice_config, - ) - .await - .unwrap(); - eprintln!("Alice account ID: {:?}", alice_account.id().to_hex()); - - // Step 2: Mint assets from faucet to Alice using p2id note - eprintln!("\n=== Step 2: Minting tokens from faucet to Alice (p2id note) ==="); - - let mint_amount = 100_000u64; // 100,000 tokens - let fungible_asset = FungibleAsset::new(faucet_account.id(), mint_amount).unwrap(); - - // Create the p2id note from faucet to Alice - let p2id_note_mint = create_note_from_package( - &mut client, - p2id_note_package.clone(), - faucet_account.id(), - NoteCreationConfig { - assets: NoteAssets::new(vec![fungible_asset.into()]).unwrap(), - inputs: vec![alice_account.id().prefix().as_felt(), alice_account.id().suffix()], - ..Default::default() - }, - ); - eprintln!("P2ID mint note hash: {:?}", p2id_note_mint.id().to_hex()); - - let mint_request = TransactionRequestBuilder::new() - .own_output_notes(vec![OutputNote::Full(p2id_note_mint.clone())]) - .build() - .unwrap(); - - let mint_tx_id = - client.submit_new_transaction(faucet_account.id(), mint_request).await.unwrap(); - eprintln!("Submitted mint transaction. Tx ID: {mint_tx_id:?}"); - - // Step 3: Alice consumes the p2id note - eprintln!("\n=== Step 3: Alice consumes p2id mint note ==="); - - let consume_request = TransactionRequestBuilder::new() - .unauthenticated_input_notes([(p2id_note_mint, None)]) - .build() - .unwrap(); - - let _consume_tx_id = client - .submit_new_transaction(alice_account.id(), consume_request) - .await - .map_err(|e| format!("{e:?}")) - .unwrap(); - - eprintln!("\n=== Checking Alice's account has the minted asset ==="); - - assert_account_has_fungible_asset( - &mut client, - alice_account.id(), - faucet_account.id(), - mint_amount, - ) - .await; - - // Create Bob's account - eprintln!("\n=== Creating Bob's account ==="); - - let bob_config = AccountCreationConfig { - with_basic_wallet: false, - ..Default::default() - }; - let bob_account = create_account_with_component( - &mut client, - keystore.clone(), - wallet_package, - bob_config, - ) - .await - .unwrap(); - eprintln!("Bob account ID: {:?}", bob_account.id().to_hex()); - - // Step 4: Alice creates p2ide note for Bob - eprintln!("\n=== Step 4: Alice creates p2ide note for Bob ==="); - - let transfer_amount = 10_000u64; // 10,000 tokens - let transfer_asset = FungibleAsset::new(faucet_account.id(), transfer_amount).unwrap(); - - let timelock_height = Felt::new(0); - let reclaim_height = Felt::new(0); - - // Create the p2ide note - let p2ide_note = create_note_from_package( - &mut client, - p2ide_note_package.clone(), - alice_account.id(), - NoteCreationConfig { - assets: NoteAssets::new(vec![transfer_asset.into()]).unwrap(), - inputs: vec![ - bob_account.id().prefix().as_felt(), - bob_account.id().suffix(), - timelock_height, - reclaim_height, - ], - ..Default::default() - }, - ); - eprintln!("P2IDE note hash: {:?}", p2ide_note.id().to_hex()); - - let transfer_request = TransactionRequestBuilder::new() - .own_output_notes(vec![OutputNote::Full(p2ide_note.clone())]) - .build() - .unwrap(); - - let alice_tx_id = client - .submit_new_transaction(alice_account.id(), transfer_request) - .await - .unwrap(); - eprintln!("Submitted p2ide transaction. Tx ID: {alice_tx_id:?}"); - - // Step 5: Bob consumes the p2ide note - eprintln!("\n=== Step 5: Bob consumes p2ide note ==="); - - let consume_request = TransactionRequestBuilder::new() - .unauthenticated_input_notes([(p2ide_note, None)]) - .build() - .unwrap(); - - let consume_tx_id = - client.submit_new_transaction(bob_account.id(), consume_request).await.unwrap(); - eprintln!("Bob created consume transaction. Tx ID: {consume_tx_id:?}"); - - eprintln!("\n=== Checking Bob's account has the transferred asset ==="); - - assert_account_has_fungible_asset( - &mut client, - bob_account.id(), - faucet_account.id(), - transfer_amount, - ) - .await; - - eprintln!("\n=== Checking Alice's account reflects the new token amount ==="); - - assert_account_has_fungible_asset( - &mut client, - alice_account.id(), - faucet_account.id(), - mint_amount - transfer_amount, - ) - .await; - }); -} - -/// Tests the p2ide note reclaim functionality. -/// -/// Flow: -/// - Create fungible faucet and mint tokens to Alice -/// - Alice creates a p2ide note intended for Bob (with reclaim enabled) -/// - Alice reclaims the note herself (exercises the reclaim branch) -/// - Verify Alice has her original balance back -#[test] -pub fn test_basic_wallet_p2ide_reclaim_local() { - // Compile the contracts first (before creating any runtime) - let wallet_package = compile_rust_package("../../examples/basic-wallet", true); - let p2id_note_package = compile_rust_package("../../examples/p2id-note", true); - let p2ide_note_package = compile_rust_package("../../examples/p2ide-note", true); - - let rt = tokio::runtime::Runtime::new().unwrap(); - rt.block_on(async { - // Create temp directory and get node handle - let temp_dir = temp_dir::TempDir::with_prefix("test_basic_wallet_p2ide_reclaim_local_") - .expect("Failed to create temp directory"); - let node_handle = ensure_shared_node().await.expect("Failed to get shared node"); - - // Initialize test infrastructure - let TestSetup { - mut client, - keystore, - } = setup_test_infrastructure(&temp_dir, &node_handle) - .await - .expect("Failed to setup test infrastructure"); - - // Step 1: Create a fungible faucet account - eprintln!("\n=== Step 1: Creating fungible faucet ==="); - let token_symbol = TokenSymbol::new("TEST").unwrap(); - let decimals = 8u8; - let max_supply = Felt::new(1_000_000_000); // 1 billion tokens - - let faucet_account = create_fungible_faucet_account( - &mut client, - keystore.clone(), - token_symbol, - decimals, - max_supply, - ) - .await - .unwrap(); - - eprintln!("Faucet account ID: {:?}", faucet_account.id().to_hex()); - - // Create Alice's account with basic-wallet component - let alice_config = AccountCreationConfig { - with_basic_wallet: true, - ..Default::default() - }; - let alice_account = create_account_with_component( - &mut client, - keystore.clone(), - wallet_package.clone(), - alice_config, - ) - .await - .unwrap(); - eprintln!("Alice account ID: {:?}", alice_account.id().to_hex()); - - // Step 2: Mint assets from faucet to Alice using p2id note - eprintln!("\n=== Step 2: Minting tokens from faucet to Alice (p2id note) ==="); - - let mint_amount = 100_000u64; // 100,000 tokens - let fungible_asset = FungibleAsset::new(faucet_account.id(), mint_amount).unwrap(); - - // Create the p2id note from faucet to Alice - let p2id_note_mint = create_note_from_package( - &mut client, - p2id_note_package.clone(), - faucet_account.id(), - NoteCreationConfig { - assets: NoteAssets::new(vec![fungible_asset.into()]).unwrap(), - inputs: vec![alice_account.id().prefix().as_felt(), alice_account.id().suffix()], - ..Default::default() - }, - ); - eprintln!("P2ID mint note hash: {:?}", p2id_note_mint.id().to_hex()); - - let mint_request = TransactionRequestBuilder::new() - .own_output_notes(vec![OutputNote::Full(p2id_note_mint.clone())]) - .build() - .unwrap(); - - let mint_tx_id = - client.submit_new_transaction(faucet_account.id(), mint_request).await.unwrap(); - eprintln!("Submitted mint transaction. Tx ID: {mint_tx_id:?}"); - - // Step 3: Alice consumes the p2id note - eprintln!("\n=== Step 3: Alice consumes p2id mint note ==="); - - let consume_request = TransactionRequestBuilder::new() - .unauthenticated_input_notes([(p2id_note_mint, None)]) - .build() - .unwrap(); - - let _consume_tx_id = client - .submit_new_transaction(alice_account.id(), consume_request) - .await - .map_err(|e| format!("{e:?}")) - .unwrap(); - - eprintln!("\n=== Checking Alice's account has the minted asset ==="); - - assert_account_has_fungible_asset( - &mut client, - alice_account.id(), - faucet_account.id(), - mint_amount, - ) - .await; - - // Create Bob's account - eprintln!("\n=== Creating Bob's account ==="); - - let bob_config = AccountCreationConfig { - with_basic_wallet: false, - ..Default::default() - }; - let bob_account = create_account_with_component( - &mut client, - keystore.clone(), - wallet_package, - bob_config, - ) - .await - .unwrap(); - eprintln!("Bob account ID: {:?}", bob_account.id().to_hex()); - - // Step 4: Alice creates p2ide note for Bob with reclaim enabled - eprintln!("\n=== Step 4: Alice creates p2ide note for Bob with reclaim ==="); - - let transfer_amount = 10_000u64; // 10,000 tokens - let transfer_asset = FungibleAsset::new(faucet_account.id(), transfer_amount).unwrap(); - - // Set timelock to 0 (no timelock) and reclaim height to a future block - // This allows Alice to reclaim if she consumes the note herself - let timelock_height = Felt::new(0); - let reclaim_height = Felt::new(1000); // Future block height - - // Create the p2ide note - let p2ide_note = create_note_from_package( - &mut client, - p2ide_note_package.clone(), - alice_account.id(), - NoteCreationConfig { - assets: NoteAssets::new(vec![transfer_asset.into()]).unwrap(), - inputs: vec![ - bob_account.id().prefix().as_felt(), - bob_account.id().suffix(), - timelock_height, - reclaim_height, - ], - ..Default::default() - }, - ); - eprintln!("P2IDE note hash: {:?}", p2ide_note.id().to_hex()); - - let transfer_request = TransactionRequestBuilder::new() - .own_output_notes(vec![OutputNote::Full(p2ide_note.clone())]) - .build() - .unwrap(); - - let alice_tx_id = client - .submit_new_transaction(alice_account.id(), transfer_request) - .await - .unwrap(); - eprintln!("Submitted p2ide transaction. Tx ID: {alice_tx_id:?}"); - - // Step 5: Alice reclaims the note (exercises the reclaim branch) - eprintln!("\n=== Step 5: Alice reclaims the p2ide note ==="); - - let reclaim_request = TransactionRequestBuilder::new() - .unauthenticated_input_notes([(p2ide_note, None)]) - .build() - .unwrap(); - - let reclaim_tx_id = client - .submit_new_transaction(alice_account.id(), reclaim_request) - .await - .unwrap(); - eprintln!("Alice created reclaim transaction. Tx ID: {reclaim_tx_id:?}"); - - eprintln!("\n=== Checking Alice's account has reclaimed the asset ==="); - - // Alice should have her original amount back (mint_amount) - // because she reclaimed the note instead of Bob consuming it - assert_account_has_fungible_asset( - &mut client, - alice_account.id(), - faucet_account.id(), - mint_amount, - ) - .await; - - eprintln!("\n=== Test completed: Alice successfully reclaimed the p2ide note ==="); - }); -} diff --git a/tests/integration-node/src/node_tests/counter_contract.rs b/tests/integration-node/src/node_tests/counter_contract.rs deleted file mode 100644 index 36c75d1bd..000000000 --- a/tests/integration-node/src/node_tests/counter_contract.rs +++ /dev/null @@ -1,133 +0,0 @@ -//! Counter contract test module - -use miden_client::{ - Word, - account::StorageMap, - transaction::{OutputNote, TransactionRequestBuilder}, -}; -use miden_core::{Felt, FieldElement}; - -use super::helpers::*; -use crate::local_node::ensure_shared_node; - -fn assert_counter_storage( - counter_account_storage: &miden_client::account::AccountStorage, - expected: u64, -) { - // according to `examples/counter-contract` for inner (slot, key) values - let counter_contract_storage_key = Word::from([Felt::ZERO, Felt::ZERO, Felt::ZERO, Felt::ONE]); - - // The counter contract is in slot 1 when deployed, auth_component takes slot 0 - let word = counter_account_storage - .get_map_item(1, counter_contract_storage_key) - .expect("Failed to get counter value from storage slot 1"); - - let val = word.last().unwrap(); - assert_eq!( - val.as_int(), - expected, - "Counter value mismatch. Expected: {}, Got: {}", - expected, - val.as_int() - ); -} - -/// Tests the counter contract deployment and note consumption workflow on a local node. -#[test] -pub fn test_counter_contract_local() { - // Compile the contracts first (before creating any runtime) - let contract_package = compile_rust_package("../../examples/counter-contract", true); - let note_package = compile_rust_package("../../examples/counter-note", true); - - let rt = tokio::runtime::Runtime::new().unwrap(); - rt.block_on(async { - // Create temp directory and get node handle - let temp_dir = temp_dir::TempDir::with_prefix("test_counter_contract_local_") - .expect("Failed to create temp directory"); - let node_handle = ensure_shared_node().await.expect("Failed to get shared node"); - - // Initialize test infrastructure - let TestSetup { - mut client, - keystore, - } = setup_test_infrastructure(&temp_dir, &node_handle) - .await - .expect("Failed to setup test infrastructure"); - - let sync_summary = client.sync_state().await.unwrap(); - eprintln!("Latest block: {}", sync_summary.block_num); - - // Create the counter account with initial storage - let key = Word::from([Felt::ZERO, Felt::ZERO, Felt::ZERO, Felt::ONE]); - let value = Word::from([Felt::ZERO, Felt::ZERO, Felt::ZERO, Felt::ONE]); - let config = AccountCreationConfig { - storage_slots: vec![miden_client::account::StorageSlot::Map( - StorageMap::with_entries([(key, value)]).unwrap(), - )], - ..Default::default() - }; - - let counter_account = - create_account_with_component(&mut client, keystore.clone(), contract_package, config) - .await - .unwrap(); - eprintln!("Counter account ID: {:?}", counter_account.id().to_hex()); - - // The counter contract storage value should be zero after the account creation - assert_counter_storage( - client - .get_account(counter_account.id()) - .await - .unwrap() - .unwrap() - .account() - .storage(), - 1, - ); - - // Create the counter note from sender to counter - let counter_note = create_note_from_package( - &mut client, - note_package, - counter_account.id(), - NoteCreationConfig::default(), - ); - eprintln!("Counter note hash: {:?}", counter_note.id().to_hex()); - - // Submit transaction to create the note - let note_request = TransactionRequestBuilder::new() - .own_output_notes(vec![OutputNote::Full(counter_note.clone())]) - .build() - .unwrap(); - - let create_note_tx_id = - client.submit_new_transaction(counter_account.id(), note_request).await.unwrap(); - eprintln!("Created counter note tx: {create_note_tx_id:?}"); - - // Consume the note to increment the counter - let consume_request = TransactionRequestBuilder::new() - .unauthenticated_input_notes([(counter_note, None)]) - .build() - .unwrap(); - - let _consume_tx_id = client - .submit_new_transaction(counter_account.id(), consume_request) - .await - .unwrap(); - - let sync_result = client.sync_state().await.unwrap(); - eprintln!("Synced to block: {}", sync_result.block_num); - - // The counter contract storage value should be 1 (incremented) after the note is consumed - assert_counter_storage( - client - .get_account(counter_account.id()) - .await - .unwrap() - .unwrap() - .account() - .storage(), - 2, - ); - }); -} diff --git a/tests/integration-node/src/node_tests/counter_contract_no_auth.rs b/tests/integration-node/src/node_tests/counter_contract_no_auth.rs deleted file mode 100644 index cd5f144f3..000000000 --- a/tests/integration-node/src/node_tests/counter_contract_no_auth.rs +++ /dev/null @@ -1,181 +0,0 @@ -//! Counter contract test with no-auth authentication component - -use miden_client::{ - Word, - account::StorageMap, - transaction::{OutputNote, TransactionRequestBuilder}, -}; -use miden_core::{Felt, FieldElement}; - -use super::helpers::*; -use crate::local_node::ensure_shared_node; - -fn assert_counter_storage( - counter_account_storage: &miden_client::account::AccountStorage, - expected: u64, -) { - // according to `examples/counter-contract` for inner (slot, key) values - let counter_contract_storage_key = Word::from([Felt::ZERO, Felt::ZERO, Felt::ZERO, Felt::ONE]); - - // With no-auth auth component (no storage), the counter component occupies slot 0 - let word = counter_account_storage - .get_map_item(0, counter_contract_storage_key) - .expect("Failed to get counter value from storage slot 1"); - - let val = word.last().unwrap(); - assert_eq!( - val.as_int(), - expected, - "Counter value mismatch. Expected: {}, Got: {}", - expected, - val.as_int() - ); -} - -/// Tests the counter contract with a "no-auth" authentication component. -/// -/// Flow: -/// - Build counter account using `examples/auth-component-no-auth` as the auth component -/// - Build a separate sender account (basic wallet) -/// - Sender issues a counter note to the network -/// - Counter account consumes the note without requiring authentication/signature -#[test] -pub fn test_counter_contract_no_auth_local() { - // Compile the contracts first (before creating any runtime) - let contract_package = compile_rust_package("../../examples/counter-contract", true); - let note_package = compile_rust_package("../../examples/counter-note", true); - let no_auth_auth_component = - compile_rust_package("../../examples/auth-component-no-auth", true); - - let rt = tokio::runtime::Runtime::new().unwrap(); - rt.block_on(async { - let temp_dir = temp_dir::TempDir::with_prefix("test_counter_contract_no_auth_") - .expect("Failed to create temp directory"); - let node_handle = ensure_shared_node().await.expect("Failed to get shared node"); - - let TestSetup { - mut client, - keystore, - } = setup_test_infrastructure(&temp_dir, &node_handle) - .await - .expect("Failed to setup test infrastructure"); - - let sync_summary = client.sync_state().await.unwrap(); - eprintln!("Latest block: {}", sync_summary.block_num); - - // Create the counter account with initial storage and no-auth auth component - let key = Word::from([Felt::ZERO, Felt::ZERO, Felt::ZERO, Felt::ONE]); - let value = Word::from([Felt::ZERO, Felt::ZERO, Felt::ZERO, Felt::ONE]); - let counter_cfg = AccountCreationConfig { - storage_slots: vec![miden_client::account::StorageSlot::Map( - StorageMap::with_entries([(key, value)]).unwrap(), - )], - ..Default::default() - }; - - let counter_account = create_account_with_component_and_auth_package( - &mut client, - contract_package.clone(), - no_auth_auth_component.clone(), - counter_cfg, - ) - .await - .unwrap(); - eprintln!("Counter account (no-auth) ID: {:?}", counter_account.id().to_hex()); - - assert_counter_storage( - client - .get_account(counter_account.id()) - .await - .unwrap() - .unwrap() - .account() - .storage(), - 1, - ); - - // Create a separate sender account using only the BasicWallet component - let sender_cfg = AccountCreationConfig::default(); - let sender_account = create_basic_wallet_account(&mut client, keystore.clone(), sender_cfg) - .await - .unwrap(); - eprintln!("Sender account ID: {:?}", sender_account.id().to_hex()); - - // Sender creates the counter note (note script increments counter's storage on consumption) - let counter_note = create_note_from_package( - &mut client, - note_package.clone(), - sender_account.id(), - NoteCreationConfig::default(), - ); - eprintln!("Counter note hash: {:?}", counter_note.id().to_hex()); - - // Submit transaction to create the note from the sender account - let note_request = TransactionRequestBuilder::new() - .own_output_notes(vec![OutputNote::Full(counter_note.clone())]) - .build() - .unwrap(); - - let tx_result = client - .execute_transaction(sender_account.id(), note_request) - .await - .map_err(|e| { - eprintln!("Transaction creation error: {e}"); - e - }) - .unwrap(); - let executed_transaction = tx_result.executed_transaction(); - assert_eq!(executed_transaction.output_notes().num_notes(), 1); - let executed_tx_output_note = executed_transaction.output_notes().get_note(0); - assert_eq!(executed_tx_output_note.id(), counter_note.id()); - let create_note_tx_id = executed_transaction.id(); - let proven_tx = client.prove_transaction(&tx_result).await.unwrap(); - let submission_height = client - .submit_proven_transaction(proven_tx, tx_result.tx_inputs().clone()) - .await - .unwrap(); - client.apply_transaction(&tx_result, submission_height).await.unwrap(); - eprintln!("Created counter note tx: {create_note_tx_id:?}"); - - // Consume the note with the counter account - let consume_request = TransactionRequestBuilder::new() - .unauthenticated_input_notes([(counter_note, None)]) - .build() - .unwrap(); - - let tx_result = client - .execute_transaction(counter_account.id(), consume_request) - .await - .map_err(|e| { - eprintln!("Note consumption transaction error: {e}"); - e - }) - .unwrap(); - eprintln!( - "Consumed counter note tx: https://testnet.midenscan.com/tx/{:?}", - &tx_result.executed_transaction().id() - ); - - let proven_tx = client.prove_transaction(&tx_result).await.unwrap(); - let submission_height = client - .submit_proven_transaction(proven_tx, tx_result.tx_inputs().clone()) - .await - .unwrap(); - client.apply_transaction(&tx_result, submission_height).await.unwrap(); - - let sync_result = client.sync_state().await.unwrap(); - eprintln!("Synced to block: {}", sync_result.block_num); - - // The counter contract storage value should be 2 after the note is consumed - assert_counter_storage( - client - .get_account(counter_account.id()) - .await - .unwrap() - .unwrap() - .account() - .storage(), - 2, - ); - }); -} diff --git a/tests/integration-node/src/node_tests/counter_contract_rust_auth.rs b/tests/integration-node/src/node_tests/counter_contract_rust_auth.rs deleted file mode 100644 index 27fa0d9ae..000000000 --- a/tests/integration-node/src/node_tests/counter_contract_rust_auth.rs +++ /dev/null @@ -1,239 +0,0 @@ -//! Counter contract test using an auth component compiled from Rust (RPO-Falcon512) -//! -//! This test ensures that an account which does not possess the correct -//! RPO-Falcon512 secret key cannot create notes on behalf of the counter -//! contract account that uses the Rust-compiled auth component. - -use miden_client::{ - Client, DebugMode, Word, - account::StorageMap, - auth::{AuthSecretKey, PublicKeyCommitment}, - keystore::FilesystemKeyStore, - transaction::{OutputNote, TransactionRequestBuilder}, - utils::Deserializable, -}; -use miden_client_sqlite_store::ClientBuilderSqliteExt; -use miden_core::{Felt, FieldElement}; -use miden_mast_package::SectionId; -use miden_objects::crypto::dsa::rpo_falcon512::SecretKey; -use rand::{RngCore, rngs::StdRng}; - -use super::helpers::*; -use crate::local_node::ensure_shared_node; - -fn assert_counter_storage( - counter_account_storage: &miden_client::account::AccountStorage, - expected: u64, -) { - // According to `examples/counter-contract` for inner (slot, key) values - let counter_contract_storage_key = Word::from([Felt::ZERO, Felt::ZERO, Felt::ZERO, Felt::ONE]); - - // With RPO-Falcon512 auth component occupying slot 0, the counter component is at slot 1. - let word = counter_account_storage - .get_map_item(1, counter_contract_storage_key) - .expect("Failed to get counter value from storage slot 1"); - - let val = word.last().unwrap(); - assert_eq!( - val.as_int(), - expected, - "Counter value mismatch. Expected: {}, Got: {}", - expected, - val.as_int() - ); -} - -/// Build a counter account from the counter component package and the -/// Rust-compiled RPO-Falcon512 auth component package. -async fn create_counter_account_with_rust_rpo_auth( - client: &mut Client>, - component_package: std::sync::Arc, - auth_component_package: std::sync::Arc, - keystore: std::sync::Arc>, -) -> Result { - use std::collections::BTreeSet; - - use miden_objects::account::{ - AccountBuilder, AccountComponent, AccountComponentMetadata, AccountComponentTemplate, - AccountStorageMode, AccountType, StorageSlot, - }; - - // Build counter component from template/metadata with initial storage - let account_component = match component_package.sections.iter().find_map(|s| { - if s.id == SectionId::ACCOUNT_COMPONENT_METADATA { - Some(s.data.as_ref()) - } else { - None - } - }) { - None => panic!("no account component metadata present"), - Some(bytes) => { - let metadata = AccountComponentMetadata::read_from_bytes(bytes).unwrap(); - let template = AccountComponentTemplate::new( - metadata, - component_package.unwrap_library().as_ref().clone(), - ); - - // Initialize the counter storage to 1 at key [0,0,0,1] - let key = Word::from([Felt::ZERO, Felt::ZERO, Felt::ZERO, Felt::ONE]); - let value = Word::from([Felt::ZERO, Felt::ZERO, Felt::ZERO, Felt::ONE]); - let storage = vec![StorageSlot::Map(StorageMap::with_entries([(key, value)]).unwrap())]; - - let component = AccountComponent::new(template.library().clone(), storage).unwrap(); - component.with_supported_types(BTreeSet::from_iter([ - AccountType::RegularAccountUpdatableCode, - ])) - } - }; - - // Build the Rust-compiled auth component with public key commitment in slot 0 - let key_pair = SecretKey::with_rng(client.rng()); - let pk_commitment: Word = PublicKeyCommitment::from(key_pair.public_key()).into(); - let mut auth_component = AccountComponent::new( - auth_component_package.unwrap_library().as_ref().clone(), - vec![StorageSlot::Value(pk_commitment)], - ) - .unwrap(); - auth_component = auth_component - .with_supported_types(BTreeSet::from_iter([AccountType::RegularAccountUpdatableCode])); - - let mut init_seed = [0_u8; 32]; - client.rng().fill_bytes(&mut init_seed); - - let _ = client.sync_state().await?; - - let account = AccountBuilder::new(init_seed) - .account_type(AccountType::RegularAccountUpdatableCode) - .storage_mode(AccountStorageMode::Public) - .with_auth_component(auth_component) - .with_component(miden_client::account::component::BasicWallet) - .with_component(account_component) - .build() - .unwrap(); - - client.add_account(&account, false).await?; - - keystore.add_key(&AuthSecretKey::RpoFalcon512(key_pair)).unwrap(); - - Ok(account) -} - -/// Verify that another client (without the RPO-Falcon512 key) cannot create notes for -/// the counter account which uses the Rust-compiled RPO-Falcon512 authentication component. -#[test] -pub fn test_counter_contract_rust_auth_blocks_unauthorized_note_creation() { - let contract_package = compile_rust_package("../../examples/counter-contract", true); - let note_package = compile_rust_package("../../examples/counter-note", true); - let rpo_auth_package = - compile_rust_package("../../examples/auth-component-rpo-falcon512", true); - - let rt = tokio::runtime::Runtime::new().unwrap(); - rt.block_on(async { - let temp_dir = temp_dir::TempDir::with_prefix("test_counter_contract_rust_auth_") - .expect("Failed to create temp directory"); - let node_handle = ensure_shared_node().await.expect("Failed to get shared node"); - - let TestSetup { - mut client, - keystore, - } = setup_test_infrastructure(&temp_dir, &node_handle) - .await - .expect("Failed to setup test infrastructure"); - - let counter_account = create_counter_account_with_rust_rpo_auth( - &mut client, - contract_package.clone(), - rpo_auth_package.clone(), - keystore.clone(), - ) - .await - .unwrap(); - eprintln!( - "Counter account (Rust RPO-Falcon512 auth) ID: {:?}", - counter_account.id().to_hex() - ); - - assert_counter_storage( - client - .get_account(counter_account.id()) - .await - .unwrap() - .unwrap() - .account() - .storage(), - 1, - ); - - // Positive check: original client (with the key) can create a note - let own_note = create_note_from_package( - &mut client, - note_package.clone(), - counter_account.id(), - NoteCreationConfig::default(), - ); - let own_request = TransactionRequestBuilder::new() - .own_output_notes(vec![OutputNote::Full(own_note.clone())]) - .build() - .unwrap(); - let tx_result = client - .execute_transaction(counter_account.id(), own_request.clone()) - .await - .expect("authorized client should be able to create a note"); - assert_eq!(tx_result.executed_transaction().output_notes().num_notes(), 1); - assert_eq!(tx_result.executed_transaction().output_notes().get_note(0).id(), own_note.id()); - - let proven_tx = client.prove_transaction(&tx_result).await.unwrap(); - let submission_height = client - .submit_proven_transaction(proven_tx, tx_result.tx_inputs().clone()) - .await - .unwrap(); - client.apply_transaction(&tx_result, submission_height).await.unwrap(); - - // Create a separate client with its own empty keystore (no key for counter account) - let attacker_dir = temp_dir::TempDir::with_prefix("attacker_client_") - .expect("Failed to create temp directory"); - let rpc_url = node_handle.rpc_url().to_string(); - let endpoint = miden_client::rpc::Endpoint::try_from(rpc_url.as_str()).unwrap(); - let rpc_api = std::sync::Arc::new(miden_client::rpc::GrpcClient::new(&endpoint, 10_000)); - let attacker_store_path = attacker_dir.path().join("store.sqlite3"); - let attacker_keystore_path = attacker_dir.path().join("keystore"); - - let mut attacker_client = miden_client::builder::ClientBuilder::new() - .rpc(rpc_api) - .sqlite_store(attacker_store_path.clone()) - .filesystem_keystore(attacker_keystore_path.to_str().unwrap()) - .in_debug_mode(DebugMode::Enabled) - .build() - .await - .unwrap(); - - // The attacker needs the account record locally to attempt building a tx - // Reuse the same account object; seed is not needed for reading/state queries - attacker_client - .add_account(&counter_account, false) - .await - .expect("failed to add account to attacker client"); - - // Attacker tries to create an output note on behalf of the counter account - // (origin = counter_account.id()), but does not have the required secret key. - let forged_note = create_note_from_package( - &mut attacker_client, - note_package.clone(), - counter_account.id(), - NoteCreationConfig::default(), - ); - - let forged_request = TransactionRequestBuilder::new() - .own_output_notes(vec![OutputNote::Full(forged_note.clone())]) - .build() - .unwrap(); - - let result = - attacker_client.execute_transaction(counter_account.id(), forged_request).await; - - assert!( - result.is_err(), - "Unauthorized client unexpectedly created a transaction for the counter account" - ); - }); -} diff --git a/tests/integration-node/src/node_tests/helpers.rs b/tests/integration-node/src/node_tests/helpers.rs deleted file mode 100644 index a82734357..000000000 --- a/tests/integration-node/src/node_tests/helpers.rs +++ /dev/null @@ -1,525 +0,0 @@ -//! Common helper functions for node tests - -use std::{borrow::Borrow, collections::BTreeSet, path::Path, sync::Arc}; - -use miden_client::{ - Client, ClientError, - account::{ - Account, AccountId, AccountStorageMode, AccountType, StorageSlot, - component::{AuthRpoFalcon512, BasicFungibleFaucet, BasicWallet}, - }, - asset::{FungibleAsset, TokenSymbol}, - auth::{AuthSecretKey, PublicKeyCommitment}, - builder::ClientBuilder, - crypto::{FeltRng, RpoRandomCoin, rpo_falcon512::SecretKey}, - keystore::FilesystemKeyStore, - note::{ - Note, NoteExecutionHint, NoteInputs, NoteMetadata, NoteRecipient, NoteScript, NoteTag, - NoteType, - }, - rpc::{Endpoint, GrpcClient}, - transaction::{TransactionRequestBuilder, TransactionScript}, - utils::Deserializable, -}; -use miden_client_sqlite_store::ClientBuilderSqliteExt; -use miden_core::{Felt, FieldElement, Word}; -use miden_integration_tests::CompilerTestBuilder; -use miden_mast_package::{Package, SectionId}; -use miden_objects::{ - account::{ - AccountBuilder, AccountComponent, AccountComponentMetadata, AccountComponentTemplate, - }, - asset::Asset, - transaction::TransactionId, -}; -use midenc_frontend_wasm::WasmTranslationConfig; -use rand::{RngCore, rngs::StdRng}; - -/// Test setup configuration -pub struct TestSetup { - pub client: Client>, - pub keystore: Arc>, -} - -/// Initialize test infrastructure with client, keystore, and temporary directory -pub async fn setup_test_infrastructure( - temp_dir: &temp_dir::TempDir, - node_handle: &crate::local_node::SharedNodeHandle, -) -> Result> { - let rpc_url = node_handle.rpc_url().to_string(); - - // Initialize RPC connection - let endpoint = Endpoint::try_from(rpc_url.as_str()).expect("Failed to create endpoint"); - let timeout_ms = 10_000; - let rpc_api = Arc::new(GrpcClient::new(&endpoint, timeout_ms)); - - // Initialize keystore - let keystore_path = temp_dir.path().join("keystore"); - let keystore = Arc::new(FilesystemKeyStore::::new(keystore_path.clone()).unwrap()); - - // Initialize client - let store_path = temp_dir.path().join("store.sqlite3").to_str().unwrap().to_string(); - let builder = ClientBuilder::new() - .rpc(rpc_api) - .sqlite_store(Path::new(&store_path).to_path_buf()) - .filesystem_keystore(keystore_path.to_str().unwrap()) - .in_debug_mode(miden_client::DebugMode::Enabled); - let client = builder.build().await?; - - Ok(TestSetup { client, keystore }) -} - -/// Configuration for creating an account with a custom component -pub struct AccountCreationConfig { - pub account_type: AccountType, - pub storage_mode: AccountStorageMode, - pub storage_slots: Vec, - pub supported_types: Option>, - pub with_basic_wallet: bool, -} - -impl Default for AccountCreationConfig { - fn default() -> Self { - Self { - account_type: AccountType::RegularAccountUpdatableCode, - storage_mode: AccountStorageMode::Public, - storage_slots: vec![], - supported_types: None, - with_basic_wallet: true, - } - } -} - -/// Helper to create an account with a custom component from a package -pub async fn create_account_with_component( - client: &mut Client>, - keystore: Arc>, - package: Arc, - config: AccountCreationConfig, -) -> Result { - let account_component_metadata = package.sections.iter().find_map(|s| { - if s.id == SectionId::ACCOUNT_COMPONENT_METADATA { - Some(s.data.borrow()) - } else { - None - } - }); - let account_component = match account_component_metadata { - None => panic!("no account component metadata present"), - Some(bytes) => { - let metadata = AccountComponentMetadata::read_from_bytes(bytes).unwrap(); - let template = - AccountComponentTemplate::new(metadata, package.unwrap_library().as_ref().clone()); - - let component = - AccountComponent::new(template.library().clone(), config.storage_slots).unwrap(); - - // Use supported types from config if provided, otherwise default to RegularAccountUpdatableCode - let supported_types = if let Some(types) = config.supported_types { - BTreeSet::from_iter(types) - } else { - BTreeSet::from_iter([AccountType::RegularAccountUpdatableCode]) - }; - - component.with_supported_types(supported_types) - } - }; - - let mut init_seed = [0_u8; 32]; - client.rng().fill_bytes(&mut init_seed); - - let key_pair = SecretKey::with_rng(client.rng()); - - // Sync client state to get latest block info - let _sync_summary = client.sync_state().await.unwrap(); - - let mut builder = AccountBuilder::new(init_seed) - .account_type(config.account_type) - .storage_mode(config.storage_mode) - .with_auth_component(AuthRpoFalcon512::new(PublicKeyCommitment::from( - key_pair.public_key().to_commitment(), - ))); - - if config.with_basic_wallet { - builder = builder.with_component(BasicWallet); - } - - builder = builder.with_component(account_component); - - let account = builder.build().unwrap_or_else(|e| { - eprintln!("failed to build account with custom auth component: {e}"); - panic!("failed to build account with custom auth component") - }); - client.add_account(&account, false).await?; - keystore.add_key(&AuthSecretKey::RpoFalcon512(key_pair)).unwrap(); - - Ok(account) -} - -/// Create a basic wallet account with standard RpoFalcon512 auth. -/// -/// This helper does not require a component package and always adds the `BasicWallet` component. -pub async fn create_basic_wallet_account( - client: &mut Client>, - keystore: Arc>, - config: AccountCreationConfig, -) -> Result { - let mut init_seed = [0_u8; 32]; - client.rng().fill_bytes(&mut init_seed); - - let key_pair = SecretKey::with_rng(client.rng()); - - // Sync client state to get latest block info - let _sync_summary = client.sync_state().await.unwrap(); - - let builder = AccountBuilder::new(init_seed) - .account_type(config.account_type) - .storage_mode(config.storage_mode) - .with_auth_component(AuthRpoFalcon512::new(PublicKeyCommitment::from( - key_pair.public_key().to_commitment(), - ))) - .with_component(BasicWallet); - - let account = builder.build().unwrap(); - client.add_account(&account, false).await?; - keystore.add_key(&AuthSecretKey::RpoFalcon512(key_pair)).unwrap(); - - Ok(account) -} - -/// Helper to create an account with a custom component and a custom authentication component -pub async fn create_account_with_component_and_auth_package( - client: &mut Client>, - component_package: Arc, - auth_component_package: Arc, - config: AccountCreationConfig, -) -> Result { - // Build the main account component from its template metadata - let account_component_metadata_section = component_package - .sections - .iter() - .find(|s| s.id == SectionId::ACCOUNT_COMPONENT_METADATA) - .expect("no account component metadata found"); - let account_component = { - let bytes = account_component_metadata_section.data.as_ref(); - let metadata = AccountComponentMetadata::read_from_bytes(bytes).unwrap(); - let template = AccountComponentTemplate::new( - metadata, - component_package.unwrap_library().as_ref().clone(), - ); - - let component = - AccountComponent::new(template.library().clone(), config.storage_slots.clone()) - .unwrap(); - - // Use supported types from config if provided, otherwise default to RegularAccountUpdatableCode - let supported_types = if let Some(types) = &config.supported_types { - BTreeSet::from_iter(types.iter().cloned()) - } else { - BTreeSet::from_iter([AccountType::RegularAccountUpdatableCode]) - }; - - component.with_supported_types(supported_types) - }; - - // Build the authentication component from the compiled library (no storage) - let mut auth_component = - AccountComponent::new(auth_component_package.unwrap_library().as_ref().clone(), vec![]) - .unwrap(); - - // Ensure auth component supports the intended account type - if let Some(types) = &config.supported_types { - auth_component = - auth_component.with_supported_types(BTreeSet::from_iter(types.iter().cloned())); - } else { - auth_component = auth_component - .with_supported_types(BTreeSet::from_iter([AccountType::RegularAccountUpdatableCode])); - } - - let mut init_seed = [0_u8; 32]; - client.rng().fill_bytes(&mut init_seed); - - // Sync client state to get latest block info - let _sync_summary = client.sync_state().await.unwrap(); - - let mut builder = AccountBuilder::new(init_seed) - .account_type(config.account_type) - .storage_mode(config.storage_mode) - .with_auth_component(auth_component); - - if config.with_basic_wallet { - builder = builder.with_component(BasicWallet); - } - - builder = builder.with_component(account_component); - - let account = builder.build().unwrap(); - client.add_account(&account, false).await?; - // No keystore key needed for no-auth auth component - - Ok(account) -} - -pub async fn create_fungible_faucet_account( - client: &mut Client>, - keystore: Arc>, - token_symbol: TokenSymbol, - decimals: u8, - max_supply: Felt, -) -> Result { - let mut init_seed = [0_u8; 32]; - client.rng().fill_bytes(&mut init_seed); - - let key_pair = SecretKey::with_rng(client.rng()); - // Sync client state to get latest block info - let _sync_summary = client.sync_state().await.unwrap(); - let builder = AccountBuilder::new(init_seed) - .account_type(AccountType::FungibleFaucet) - .storage_mode(AccountStorageMode::Public) - .with_auth_component(AuthRpoFalcon512::new(PublicKeyCommitment::from( - key_pair.public_key().to_commitment(), - ))) - .with_component(BasicFungibleFaucet::new(token_symbol, decimals, max_supply).unwrap()); - - let account = builder.build().unwrap(); - client.add_account(&account, false).await?; - keystore.add_key(&AuthSecretKey::RpoFalcon512(key_pair)).unwrap(); - - Ok(account) -} - -/// Helper to compile a Rust package to Miden -pub fn compile_rust_package(package_path: &str, release: bool) -> Arc { - let config = WasmTranslationConfig::default(); - let mut builder = CompilerTestBuilder::rust_source_cargo_miden(package_path, config, []); - - if release { - builder.with_release(true); - } - - let mut test = builder.build(); - test.compiled_package() -} - -/// Configuration for creating a note -pub struct NoteCreationConfig { - pub note_type: NoteType, - pub tag: NoteTag, - pub assets: miden_client::note::NoteAssets, - pub inputs: Vec, - pub execution_hint: NoteExecutionHint, - pub aux: Felt, -} - -impl Default for NoteCreationConfig { - fn default() -> Self { - Self { - note_type: NoteType::Public, - tag: NoteTag::for_local_use_case(0, 0).unwrap(), - assets: Default::default(), - inputs: Default::default(), - execution_hint: NoteExecutionHint::always(), - aux: Felt::ZERO, - } - } -} - -/// Helper to create a note from a compiled package -pub fn create_note_from_package( - client: &mut Client>, - package: Arc, - sender_id: AccountId, - config: NoteCreationConfig, -) -> Note { - let note_program = package.unwrap_program(); - let note_script = - NoteScript::from_parts(note_program.mast_forest().clone(), note_program.entrypoint()); - - let serial_num = client.rng().draw_word(); - let note_inputs = NoteInputs::new(config.inputs).unwrap(); - let recipient = NoteRecipient::new(serial_num, note_script, note_inputs); - - let metadata = NoteMetadata::new( - sender_id, - config.note_type, - config.tag, - config.execution_hint, - config.aux, - ) - .unwrap(); - - Note::new(config.assets, metadata, recipient) -} - -/// Helper function to assert that an account contains a specific fungible asset -/// The account may have other assets as well -pub async fn assert_account_has_fungible_asset( - client: &mut Client>, - account_id: AccountId, - expected_faucet_id: AccountId, - expected_amount: u64, -) { - let account_record = client - .get_account(account_id) - .await - .expect("Failed to get account") - .expect("Account not found"); - - let account_state: miden_objects::account::Account = account_record.into(); - - // Look for the specific fungible asset in the vault - let found_asset = account_state.vault().assets().find_map(|asset| { - if let Asset::Fungible(fungible_asset) = asset { - if fungible_asset.faucet_id() == expected_faucet_id { - Some(fungible_asset) - } else { - None - } - } else { - None - } - }); - - match found_asset { - Some(fungible_asset) => { - assert_eq!( - fungible_asset.amount(), - expected_amount, - "Found asset from faucet {expected_faucet_id} but amount {} doesn't match \ - expected {expected_amount}", - fungible_asset.amount() - ); - } - None => { - panic!("Account does not contain a fungible asset from faucet {expected_faucet_id}"); - } - } -} - -/// Configuration for sending assets between accounts -pub struct AssetTransferConfig { - pub note_type: NoteType, - pub tag: NoteTag, - pub execution_hint: NoteExecutionHint, - pub aux: Felt, -} - -impl Default for AssetTransferConfig { - fn default() -> Self { - Self { - note_type: NoteType::Public, - tag: NoteTag::for_local_use_case(0, 0).unwrap(), - execution_hint: NoteExecutionHint::always(), - aux: Felt::ZERO, - } - } -} - -/// Helper function to send assets from one account to another using a transaction script -/// -/// This function creates a p2id note for the recipient and executes a transaction script -/// to send the specified asset amount. -/// -/// # Arguments -/// * `client` - The client instance -/// * `sender_account_id` - The account ID of the sender -/// * `recipient_account_id` - The account ID of the recipient -/// * `asset` - The fungible asset to transfer -/// * `note_package` - The compiled note package (e.g., p2id-note) -/// * `tx_script_package` - The compiled transaction script package -/// * `config` - Optional configuration for the transfer -/// -/// # Returns -/// A tuple containing the transaction ID and the created Note for the recipient -pub async fn send_asset_to_account( - client: &mut Client>, - sender_account_id: AccountId, - recipient_account_id: AccountId, - asset: FungibleAsset, - note_package: Arc, - tx_script_package: Arc, - config: Option, -) -> Result<(TransactionId, Note), ClientError> { - let config = config.unwrap_or_default(); - - // Create the p2id note for the recipient - let p2id_note = create_note_from_package( - client, - note_package, - sender_account_id, - NoteCreationConfig { - assets: miden_client::note::NoteAssets::new(vec![asset.into()]).unwrap(), - inputs: vec![recipient_account_id.prefix().as_felt(), recipient_account_id.suffix()], - note_type: config.note_type, - tag: config.tag, - execution_hint: config.execution_hint, - aux: config.aux, - }, - ); - - let tx_script_program = tx_script_package.unwrap_program(); - let tx_script = TransactionScript::from_parts( - tx_script_program.mast_forest().clone(), - tx_script_program.entrypoint(), - ); - - // Prepare note recipient - let program_hash = tx_script_program.hash(); - let serial_num = RpoRandomCoin::new(program_hash).draw_word(); - let inputs = NoteInputs::new(vec![ - recipient_account_id.prefix().as_felt(), - recipient_account_id.suffix(), - ]) - .unwrap(); - let note_recipient = NoteRecipient::new(serial_num, p2id_note.script().clone(), inputs); - - // Prepare commitment data - let mut input: Vec = vec![ - config.tag.into(), - config.aux, - config.note_type.into(), - config.execution_hint.into(), - ]; - let recipient_digest: [Felt; 4] = note_recipient.digest().into(); - input.extend(recipient_digest); - - let asset_arr: Word = asset.into(); - input.extend(asset_arr); - - let mut commitment: [Felt; 4] = miden_core::crypto::hash::Rpo256::hash_elements(&input).into(); - - assert_eq!(input.len() % 4, 0, "input needs to be word-aligned"); - - // Prepare advice map - let mut advice_map = std::collections::BTreeMap::new(); - advice_map.insert(commitment.into(), input.clone()); - - let recipients = vec![note_recipient.clone()]; - - // NOTE: passed on the stack reversed - commitment.reverse(); - - let tx_request = TransactionRequestBuilder::new() - .custom_script(tx_script) - .script_arg(miden_core::Word::new(commitment)) - .expected_output_recipients(recipients) - .extend_advice_map(advice_map) - .build() - .unwrap(); - - let tx_id = client.submit_new_transaction(sender_account_id, tx_request).await?; - - // Create the Note that the recipient will consume - let assets = miden_client::note::NoteAssets::new(vec![asset.into()]).unwrap(); - let metadata = NoteMetadata::new( - sender_account_id, - config.note_type, - config.tag, - config.execution_hint, - config.aux, - ) - .unwrap(); - let recipient_note = Note::new(assets, metadata, note_recipient); - - Ok((tx_id, recipient_note)) -} diff --git a/tests/integration-node/src/node_tests/mod.rs b/tests/integration-node/src/node_tests/mod.rs deleted file mode 100644 index 09f58f362..000000000 --- a/tests/integration-node/src/node_tests/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -//! Integration tests that require a local Miden node instance - -pub mod basic_wallet; -pub mod counter_contract; -pub mod counter_contract_no_auth; -pub mod counter_contract_rust_auth; -pub mod helpers; diff --git a/tests/integration/Cargo.toml b/tests/integration/Cargo.toml index db7d1c519..e4e938976 100644 --- a/tests/integration/Cargo.toml +++ b/tests/integration/Cargo.toml @@ -14,7 +14,7 @@ publish = false [dependencies] anyhow.workspace = true cargo-util = "0.2" -env_logger.workspace = true +midenc-log.workspace = true midenc-expect-test.workspace = true filetime = "0.2.23" glob = "0.3.1" @@ -22,7 +22,8 @@ log.workspace = true miden-assembly.workspace = true miden-core.workspace = true miden-mast-package.workspace = true -miden-objects = { workspace = true, features = ["std"] } +miden-protocol = { workspace = true, features = ["std"] } +miden-standards = { workspace = true, features = ["std"] } miden-processor.workspace = true miden-debug = { workspace = true, features = ["proptest"] } midenc-dialect-arith.workspace = true @@ -35,7 +36,6 @@ midenc-codegen-masm.workspace = true midenc-session.workspace = true midenc-compile.workspace = true cargo-miden.workspace = true -miden-lib.workspace = true wasmprinter = "0.227" proptest.workspace = true sha2 = "0.10" diff --git a/tests/integration/expected/abi_transform_stdlib_blake3_hash.hir b/tests/integration/expected/abi_transform_stdlib_blake3_hash.hir index 1ee9fae7c..a4df33034 100644 --- a/tests/integration/expected/abi_transform_stdlib_blake3_hash.hir +++ b/tests/integration/expected/abi_transform_stdlib_blake3_hash.hir @@ -2,143 +2,150 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @abi_transform_stdlib_blake3_hash { public builtin.function @entrypoint(v0: i32, v1: i32) { ^block4(v0: i32, v1: i32): - v3 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_stdlib_blake3_hash/__stack_pointer : ptr - v4 = hir.bitcast v3 : ptr; - v5 = hir.load v4 : i32; - v8 = arith.constant -32 : i32; - v6 = arith.constant 32 : i32; - v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; - v9 = arith.band v7, v8 : i32; - v10 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_stdlib_blake3_hash/__stack_pointer : ptr - v11 = hir.bitcast v10 : ptr; - hir.store v11, v9; + hir.store_local v0 #[local = lv0]; + v2 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_stdlib_blake3_hash/__stack_pointer : ptr + v3 = hir.bitcast v2 : ptr; + v4 = hir.load v3 : i32; + hir.store_local v4 #[local = lv2]; + v159 = arith.constant -32 : i32; + v160 = arith.constant 32 : i32; + v6 = arith.sub v4, v160 : i32 #[overflow = wrapping]; + v8 = arith.band v6, v159 : i32; + hir.store_local v8 #[local = lv3]; + v9 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_stdlib_blake3_hash/__stack_pointer : ptr + v10 = hir.bitcast v9 : ptr; + hir.store v10, v8; v12 = hir.bitcast v1 : u32; v13 = hir.int_to_ptr v12 : ptr; v14 = hir.load v13 : i32; - v16 = arith.constant 4 : u32; - v15 = hir.bitcast v1 : u32; - v17 = arith.add v15, v16 : u32 #[overflow = checked]; - v18 = hir.int_to_ptr v17 : ptr; - v19 = hir.load v18 : i32; - v21 = arith.constant 8 : u32; - v20 = hir.bitcast v1 : u32; - v22 = arith.add v20, v21 : u32 #[overflow = checked]; - v23 = hir.int_to_ptr v22 : ptr; - v24 = hir.load v23 : i32; - v26 = arith.constant 12 : u32; - v25 = hir.bitcast v1 : u32; - v27 = arith.add v25, v26 : u32 #[overflow = checked]; - v28 = hir.int_to_ptr v27 : ptr; - v29 = hir.load v28 : i32; - v31 = arith.constant 16 : u32; - v30 = hir.bitcast v1 : u32; - v32 = arith.add v30, v31 : u32 #[overflow = checked]; - v33 = hir.int_to_ptr v32 : ptr; - v34 = hir.load v33 : i32; - v36 = arith.constant 20 : u32; - v35 = hir.bitcast v1 : u32; - v37 = arith.add v35, v36 : u32 #[overflow = checked]; - v38 = hir.int_to_ptr v37 : ptr; - v39 = hir.load v38 : i32; - v41 = arith.constant 24 : u32; - v40 = hir.bitcast v1 : u32; - v42 = arith.add v40, v41 : u32 #[overflow = checked]; + v16 = hir.bitcast v1 : u32; + v158 = arith.constant 4 : u32; + v18 = arith.add v16, v158 : u32 #[overflow = checked]; + v19 = hir.int_to_ptr v18 : ptr; + v20 = hir.load v19 : i32; + v157 = arith.constant 8 : u32; + v24 = arith.add v16, v157 : u32 #[overflow = checked]; + v25 = hir.int_to_ptr v24 : ptr; + v26 = hir.load v25 : i32; + v156 = arith.constant 12 : u32; + v30 = arith.add v16, v156 : u32 #[overflow = checked]; + v31 = hir.int_to_ptr v30 : ptr; + v32 = hir.load v31 : i32; + v155 = arith.constant 16 : u32; + v36 = arith.add v16, v155 : u32 #[overflow = checked]; + v37 = hir.int_to_ptr v36 : ptr; + v38 = hir.load v37 : i32; + v154 = arith.constant 20 : u32; + v42 = arith.add v16, v154 : u32 #[overflow = checked]; v43 = hir.int_to_ptr v42 : ptr; v44 = hir.load v43 : i32; - v46 = arith.constant 28 : u32; - v45 = hir.bitcast v1 : u32; - v47 = arith.add v45, v46 : u32 #[overflow = checked]; - v48 = hir.int_to_ptr v47 : ptr; - v49 = hir.load v48 : i32; - hir.exec @root_ns:root@1.0.0/abi_transform_stdlib_blake3_hash/std::crypto::hashes::blake3::hash_1to1(v14, v19, v24, v29, v34, v39, v44, v49, v9) - v138 = arith.constant 24 : u32; - v52 = hir.bitcast v9 : u32; - v54 = arith.add v52, v138 : u32 #[overflow = checked]; - v137 = arith.constant 8 : u32; - v56 = arith.mod v54, v137 : u32; - hir.assertz v56 #[code = 250]; - v57 = hir.int_to_ptr v54 : ptr; - v58 = hir.load v57 : i64; - v50 = arith.constant 24 : i32; - v51 = arith.add v0, v50 : i32 #[overflow = wrapping]; - v59 = hir.bitcast v51 : u32; - v60 = hir.int_to_ptr v59 : ptr; - hir.store v60, v58; - v136 = arith.constant 16 : u32; - v63 = hir.bitcast v9 : u32; - v65 = arith.add v63, v136 : u32 #[overflow = checked]; - v135 = arith.constant 8 : u32; - v67 = arith.mod v65, v135 : u32; - hir.assertz v67 #[code = 250]; - v68 = hir.int_to_ptr v65 : ptr; - v69 = hir.load v68 : i64; - v61 = arith.constant 16 : i32; - v62 = arith.add v0, v61 : i32 #[overflow = wrapping]; - v70 = hir.bitcast v62 : u32; - v71 = hir.int_to_ptr v70 : ptr; - hir.store v71, v69; - v134 = arith.constant 8 : u32; - v74 = hir.bitcast v9 : u32; - v76 = arith.add v74, v134 : u32 #[overflow = checked]; - v133 = arith.constant 8 : u32; - v78 = arith.mod v76, v133 : u32; - hir.assertz v78 #[code = 250]; - v79 = hir.int_to_ptr v76 : ptr; - v80 = hir.load v79 : i64; - v72 = arith.constant 8 : i32; - v73 = arith.add v0, v72 : i32 #[overflow = wrapping]; - v81 = hir.bitcast v73 : u32; - v82 = hir.int_to_ptr v81 : ptr; - hir.store v82, v80; - v83 = hir.bitcast v9 : u32; - v132 = arith.constant 8 : u32; - v85 = arith.mod v83, v132 : u32; - hir.assertz v85 #[code = 250]; - v86 = hir.int_to_ptr v83 : ptr; - v87 = hir.load v86 : i64; - v88 = hir.bitcast v0 : u32; - v89 = hir.int_to_ptr v88 : ptr; - hir.store v89, v87; - v90 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_stdlib_blake3_hash/__stack_pointer : ptr - v91 = hir.bitcast v90 : ptr; - hir.store v91, v5; + v153 = arith.constant 24 : u32; + v48 = arith.add v16, v153 : u32 #[overflow = checked]; + v49 = hir.int_to_ptr v48 : ptr; + v50 = hir.load v49 : i32; + v152 = arith.constant 28 : u32; + v54 = arith.add v16, v152 : u32 #[overflow = checked]; + v55 = hir.int_to_ptr v54 : ptr; + v56 = hir.load v55 : i32; + v57 = hir.load_local : i32 #[local = lv3]; + hir.exec @root_ns:root@1.0.0/abi_transform_stdlib_blake3_hash/miden::core::crypto::hashes::blake3::hash(v14, v20, v26, v32, v38, v44, v50, v56, v57) + v58 = hir.load_local : i32 #[local = lv0]; + v61 = hir.load_local : i32 #[local = lv3]; + v174 = arith.constant 24 : u32; + v62 = hir.bitcast v61 : u32; + v64 = arith.add v62, v174 : u32 #[overflow = checked]; + v173 = arith.constant 8 : u32; + v66 = arith.mod v64, v173 : u32; + hir.assertz v66 #[code = 250]; + v67 = hir.int_to_ptr v64 : ptr; + v68 = hir.load v67 : i64; + v151 = arith.constant 24 : i32; + v60 = arith.add v58, v151 : i32 #[overflow = wrapping]; + v69 = hir.bitcast v60 : u32; + v70 = hir.int_to_ptr v69 : ptr; + hir.store v70, v68; + v71 = hir.load_local : i32 #[local = lv0]; + v74 = hir.load_local : i32 #[local = lv3]; + v172 = arith.constant 16 : u32; + v75 = hir.bitcast v74 : u32; + v77 = arith.add v75, v172 : u32 #[overflow = checked]; + v171 = arith.constant 8 : u32; + v79 = arith.mod v77, v171 : u32; + hir.assertz v79 #[code = 250]; + v80 = hir.int_to_ptr v77 : ptr; + v81 = hir.load v80 : i64; + v150 = arith.constant 16 : i32; + v73 = arith.add v71, v150 : i32 #[overflow = wrapping]; + v82 = hir.bitcast v73 : u32; + v83 = hir.int_to_ptr v82 : ptr; + hir.store v83, v81; + v84 = hir.load_local : i32 #[local = lv0]; + v87 = hir.load_local : i32 #[local = lv3]; + v170 = arith.constant 8 : u32; + v88 = hir.bitcast v87 : u32; + v90 = arith.add v88, v170 : u32 #[overflow = checked]; + v169 = arith.constant 8 : u32; + v92 = arith.mod v90, v169 : u32; + hir.assertz v92 #[code = 250]; + v93 = hir.int_to_ptr v90 : ptr; + v94 = hir.load v93 : i64; + v149 = arith.constant 8 : i32; + v86 = arith.add v84, v149 : i32 #[overflow = wrapping]; + v95 = hir.bitcast v86 : u32; + v96 = hir.int_to_ptr v95 : ptr; + hir.store v96, v94; + v97 = hir.load_local : i32 #[local = lv0]; + v98 = hir.load_local : i32 #[local = lv3]; + v99 = hir.bitcast v98 : u32; + v168 = arith.constant 8 : u32; + v101 = arith.mod v99, v168 : u32; + hir.assertz v101 #[code = 250]; + v102 = hir.int_to_ptr v99 : ptr; + v103 = hir.load v102 : i64; + v104 = hir.bitcast v97 : u32; + v105 = hir.int_to_ptr v104 : ptr; + hir.store v105, v103; + v106 = hir.load_local : i32 #[local = lv2]; + v107 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_stdlib_blake3_hash/__stack_pointer : ptr + v108 = hir.bitcast v107 : ptr; + hir.store v108, v106; builtin.ret ; }; - private builtin.function @std::crypto::hashes::blake3::hash_1to1(v92: i32, v93: i32, v94: i32, v95: i32, v96: i32, v97: i32, v98: i32, v99: i32, v100: i32) { - ^block6(v92: i32, v93: i32, v94: i32, v95: i32, v96: i32, v97: i32, v98: i32, v99: i32, v100: i32): - v101, v102, v103, v104, v105, v106, v107, v108 = hir.exec @std/crypto/hashes/blake3/hash_1to1(v92, v93, v94, v95, v96, v97, v98, v99) : i32, i32, i32, i32, i32, i32, i32, i32 - v109 = hir.bitcast v100 : u32; - v110 = hir.int_to_ptr v109 : ptr; - hir.store v110, v101; - v111 = arith.constant 4 : u32; - v112 = arith.add v109, v111 : u32 #[overflow = checked]; - v113 = hir.int_to_ptr v112 : ptr; - hir.store v113, v102; - v114 = arith.constant 8 : u32; - v115 = arith.add v109, v114 : u32 #[overflow = checked]; - v116 = hir.int_to_ptr v115 : ptr; - hir.store v116, v103; - v117 = arith.constant 12 : u32; - v118 = arith.add v109, v117 : u32 #[overflow = checked]; - v119 = hir.int_to_ptr v118 : ptr; - hir.store v119, v104; - v120 = arith.constant 16 : u32; - v121 = arith.add v109, v120 : u32 #[overflow = checked]; - v122 = hir.int_to_ptr v121 : ptr; - hir.store v122, v105; - v123 = arith.constant 20 : u32; - v124 = arith.add v109, v123 : u32 #[overflow = checked]; - v125 = hir.int_to_ptr v124 : ptr; - hir.store v125, v106; - v126 = arith.constant 24 : u32; - v127 = arith.add v109, v126 : u32 #[overflow = checked]; - v128 = hir.int_to_ptr v127 : ptr; - hir.store v128, v107; - v129 = arith.constant 28 : u32; - v130 = arith.add v109, v129 : u32 #[overflow = checked]; - v131 = hir.int_to_ptr v130 : ptr; - hir.store v131, v108; + private builtin.function @miden::core::crypto::hashes::blake3::hash(v109: i32, v110: i32, v111: i32, v112: i32, v113: i32, v114: i32, v115: i32, v116: i32, v117: i32) { + ^block6(v109: i32, v110: i32, v111: i32, v112: i32, v113: i32, v114: i32, v115: i32, v116: i32, v117: i32): + v118, v119, v120, v121, v122, v123, v124, v125 = hir.exec @miden/core/crypto/hashes/blake3/hash(v109, v110, v111, v112, v113, v114, v115, v116) : i32, i32, i32, i32, i32, i32, i32, i32 + v126 = hir.bitcast v117 : u32; + v127 = hir.int_to_ptr v126 : ptr; + hir.store v127, v118; + v181 = arith.constant 4 : u32; + v129 = arith.add v126, v181 : u32 #[overflow = checked]; + v130 = hir.int_to_ptr v129 : ptr; + hir.store v130, v119; + v180 = arith.constant 8 : u32; + v132 = arith.add v126, v180 : u32 #[overflow = checked]; + v133 = hir.int_to_ptr v132 : ptr; + hir.store v133, v120; + v179 = arith.constant 12 : u32; + v135 = arith.add v126, v179 : u32 #[overflow = checked]; + v136 = hir.int_to_ptr v135 : ptr; + hir.store v136, v121; + v178 = arith.constant 16 : u32; + v138 = arith.add v126, v178 : u32 #[overflow = checked]; + v139 = hir.int_to_ptr v138 : ptr; + hir.store v139, v122; + v177 = arith.constant 20 : u32; + v141 = arith.add v126, v177 : u32 #[overflow = checked]; + v142 = hir.int_to_ptr v141 : ptr; + hir.store v142, v123; + v176 = arith.constant 24 : u32; + v144 = arith.add v126, v176 : u32 #[overflow = checked]; + v145 = hir.int_to_ptr v144 : ptr; + hir.store v145, v124; + v175 = arith.constant 28 : u32; + v147 = arith.add v126, v175 : u32 #[overflow = checked]; + v148 = hir.int_to_ptr v147 : ptr; + hir.store v148, v125; builtin.ret ; }; diff --git a/tests/integration/expected/abi_transform_stdlib_blake3_hash.masm b/tests/integration/expected/abi_transform_stdlib_blake3_hash.masm index e1a636be4..67a696074 100644 --- a/tests/integration/expected/abi_transform_stdlib_blake3_hash.masm +++ b/tests/integration/expected/abi_transform_stdlib_blake3_hash.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,10 +10,19 @@ proc init mem_store.278528 end -# mod root_ns:root@1.0.0::abi_transform_stdlib_blake3_hash +# mod ::"root_ns:root@1.0.0"::abi_transform_stdlib_blake3_hash +@locals("4") @callconv("C") pub proc entrypoint(i32, i32) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114112 u32divmod.4 swap.1 @@ -22,15 +31,31 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.4294967264 push.32 - dup.2 + movup.2 swap.1 u32wrapping_sub u32and - push.1114112 - dup.1 + dup.0 + locaddr.3 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114112 u32divmod.4 swap.1 trace.240 @@ -38,7 +63,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_sw trace.252 nop - dup.3 + dup.0 u32divmod.4 swap.1 trace.240 @@ -46,8 +71,9 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop + swap.1 push.4 - dup.5 + dup.1 add u32assert u32divmod.4 @@ -58,7 +84,7 @@ pub proc entrypoint(i32, i32) trace.252 nop push.8 - dup.6 + dup.2 add u32assert u32divmod.4 @@ -69,7 +95,7 @@ pub proc entrypoint(i32, i32) trace.252 nop push.12 - dup.7 + dup.3 add u32assert u32divmod.4 @@ -80,7 +106,7 @@ pub proc entrypoint(i32, i32) trace.252 nop push.16 - dup.8 + dup.4 add u32assert u32divmod.4 @@ -91,7 +117,7 @@ pub proc entrypoint(i32, i32) trace.252 nop push.20 - dup.9 + dup.5 add u32assert u32divmod.4 @@ -102,7 +128,7 @@ pub proc entrypoint(i32, i32) trace.252 nop push.24 - dup.10 + dup.6 add u32assert u32divmod.4 @@ -113,7 +139,7 @@ pub proc entrypoint(i32, i32) trace.252 nop push.28 - movup.11 + movup.7 add u32assert u32divmod.4 @@ -123,7 +149,14 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop - dup.8 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop movup.3 swap.5 movdn.3 @@ -136,11 +169,27 @@ pub proc entrypoint(i32, i32) swap.8 trace.240 nop - exec.::root_ns:root@1.0.0::abi_transform_stdlib_blake3_hash::std::crypto::hashes::blake3::hash_1to1 + exec.::"root_ns:root@1.0.0"::abi_transform_stdlib_blake3_hash::"miden::core::crypto::hashes::blake3::hash" + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.24 - dup.1 + swap.1 add u32assert push.8 @@ -158,7 +207,7 @@ pub proc entrypoint(i32, i32) nop swap.1 push.24 - dup.5 + movup.3 u32wrapping_add u32divmod.4 swap.1 @@ -169,8 +218,24 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - dup.1 + swap.1 add u32assert push.8 @@ -188,7 +253,7 @@ pub proc entrypoint(i32, i32) nop swap.1 push.16 - dup.5 + movup.3 u32wrapping_add u32divmod.4 swap.1 @@ -199,8 +264,24 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.1 + swap.1 add u32assert push.8 @@ -218,7 +299,7 @@ pub proc entrypoint(i32, i32) nop swap.1 push.8 - dup.5 + movup.3 u32wrapping_add u32divmod.4 swap.1 @@ -229,6 +310,22 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 dup.1 swap.1 @@ -243,7 +340,7 @@ pub proc entrypoint(i32, i32) trace.252 nop swap.1 - movup.3 + movup.2 u32divmod.4 swap.1 movup.2 @@ -253,6 +350,14 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.1114112 u32divmod.4 swap.1 @@ -264,7 +369,7 @@ pub proc entrypoint(i32, i32) end @callconv("C") -proc std::crypto::hashes::blake3::hash_1to1( +proc miden::core::crypto::hashes::blake3::hash( i32, i32, i32, @@ -277,7 +382,7 @@ proc std::crypto::hashes::blake3::hash_1to1( ) trace.240 nop - exec.::std::crypto::hashes::blake3::hash_1to1 + exec.::miden::core::crypto::hashes::blake3::hash trace.252 nop movup.8 diff --git a/tests/integration/expected/abi_transform_stdlib_blake3_hash.wat b/tests/integration/expected/abi_transform_stdlib_blake3_hash.wat index 3f2d358f3..5405857b9 100644 --- a/tests/integration/expected/abi_transform_stdlib_blake3_hash.wat +++ b/tests/integration/expected/abi_transform_stdlib_blake3_hash.wat @@ -33,7 +33,7 @@ local.get 1 i32.load offset=28 align=1 local.get 3 - call $std::crypto::hashes::blake3::hash_1to1 + call $miden::core::crypto::hashes::blake3::hash local.get 0 i32.const 24 i32.add @@ -59,7 +59,7 @@ local.get 2 global.set $__stack_pointer ) - (func $std::crypto::hashes::blake3::hash_1to1 (;1;) (type 1) (param i32 i32 i32 i32 i32 i32 i32 i32 i32) + (func $miden::core::crypto::hashes::blake3::hash (;1;) (type 1) (param i32 i32 i32 i32 i32 i32 i32 i32 i32) unreachable ) ) diff --git a/tests/integration/expected/abi_transform_tx_kernel_get_id.hir b/tests/integration/expected/abi_transform_tx_kernel_get_id.hir index a8fd20bad..27db5d102 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_id.hir +++ b/tests/integration/expected/abi_transform_tx_kernel_get_id.hir @@ -2,90 +2,110 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @abi_transform_tx_kernel_get_id { private builtin.function @__rustc::__rust_alloc(v0: i32, v1: i32) -> i32 { ^block4(v0: i32, v1: i32): - v3 = arith.constant 1048580 : i32; - v4 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/::alloc(v3, v1, v0) : i32 - builtin.ret v4; + v278 = arith.constant 1048580 : i32; + v6 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/::alloc(v278, v1, v0) : i32 + builtin.ret v6; }; - private builtin.function @__rustc::__rust_realloc(v5: i32, v6: i32, v7: i32, v8: i32) -> i32 { - ^block6(v5: i32, v6: i32, v7: i32, v8: i32): - v10 = arith.constant 1048580 : i32; - v11 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/::alloc(v10, v7, v8) : i32 - v234 = arith.constant 0 : i32; - v12 = arith.constant 0 : i32; - v13 = arith.eq v11, v12 : i1; - v14 = arith.zext v13 : u32; - v15 = hir.bitcast v14 : i32; - v17 = arith.neq v15, v234 : i1; - scf.if v17{ - ^block8: + private builtin.function @__rustc::__rust_realloc(v7: i32, v8: i32, v9: i32, v10: i32) -> i32 { + ^block6(v7: i32, v8: i32, v9: i32, v10: i32): + hir.store_local v7 #[local = lv0]; + hir.store_local v8 #[local = lv1]; + hir.store_local v9 #[local = lv2]; + hir.store_local v10 #[local = lv3]; + v13 = hir.load_local : i32 #[local = lv2]; + v14 = hir.load_local : i32 #[local = lv3]; + v280 = arith.constant 1048580 : i32; + v15 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/::alloc(v280, v13, v14) : i32 + hir.store_local v15 #[local = lv2]; + v290 = arith.constant 0 : i32; + v284 = arith.constant 0 : i32; + v17 = arith.eq v15, v284 : i1; + v18 = arith.zext v17 : u32; + v19 = hir.bitcast v18 : i32; + v21 = arith.neq v19, v290 : i1; + scf.if v21{ + ^block52: scf.yield ; } else { ^block9: - v233 = arith.constant 0 : i32; - v19 = hir.bitcast v6 : u32; - v18 = hir.bitcast v8 : u32; - v20 = arith.lt v18, v19 : i1; - v21 = arith.zext v20 : u32; - v22 = hir.bitcast v21 : i32; - v24 = arith.neq v22, v233 : i1; - v25 = cf.select v24, v8, v6 : i32; - v231 = arith.constant 0 : i32; - v232 = arith.constant 0 : i32; - v27 = arith.eq v25, v232 : i1; - v28 = arith.zext v27 : u32; - v29 = hir.bitcast v28 : i32; - v31 = arith.neq v29, v231 : i1; - scf.if v31{ - ^block50: + v22 = hir.load_local : i32 #[local = lv3]; + v23 = hir.load_local : i32 #[local = lv1]; + v289 = arith.constant 0 : i32; + v27 = hir.bitcast v23 : u32; + v26 = hir.bitcast v22 : u32; + v28 = arith.lt v26, v27 : i1; + v29 = arith.zext v28 : u32; + v30 = hir.bitcast v29 : i32; + v32 = arith.neq v30, v289 : i1; + v33 = cf.select v32, v22, v23 : i32; + hir.store_local v33 #[local = lv3]; + v287 = arith.constant 0 : i32; + v288 = arith.constant 0 : i32; + v35 = arith.eq v33, v288 : i1; + v36 = arith.zext v35 : u32; + v37 = hir.bitcast v36 : i32; + v39 = arith.neq v37, v287 : i1; + scf.if v39{ + ^block51: scf.yield ; } else { ^block10: - v32 = hir.bitcast v25 : u32; - v33 = hir.bitcast v11 : u32; - v34 = hir.int_to_ptr v33 : ptr; - v35 = hir.bitcast v5 : u32; - v36 = hir.int_to_ptr v35 : ptr; - hir.mem_cpy v36, v34, v32; + v40 = hir.load_local : i32 #[local = lv2]; + v41 = hir.load_local : i32 #[local = lv0]; + v42 = hir.load_local : i32 #[local = lv3]; + v43 = hir.bitcast v42 : u32; + v44 = hir.bitcast v40 : u32; + v45 = hir.int_to_ptr v44 : ptr; + v46 = hir.bitcast v41 : u32; + v47 = hir.int_to_ptr v46 : ptr; + hir.mem_cpy v47, v45, v43; scf.yield ; }; scf.yield ; }; - builtin.ret v11; + v48 = hir.load_local : i32 #[local = lv2]; + builtin.ret v48; }; - public builtin.function @entrypoint(v38: i32) { - ^block11(v38: i32): - v40 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr - v41 = hir.bitcast v40 : ptr; - v42 = hir.load v41 : i32; - v43 = arith.constant 16 : i32; - v44 = arith.sub v42, v43 : i32 #[overflow = wrapping]; - v45 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr - v46 = hir.bitcast v45 : ptr; - hir.store v46, v44; - v47 = arith.constant 8 : i32; - v48 = arith.add v44, v47 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/miden_base_sys::bindings::active_account::get_id(v48) - v50 = arith.constant 8 : u32; - v49 = hir.bitcast v44 : u32; - v51 = arith.add v49, v50 : u32 #[overflow = checked]; - v236 = arith.constant 8 : u32; - v53 = arith.mod v51, v236 : u32; - hir.assertz v53 #[code = 250]; - v54 = hir.int_to_ptr v51 : ptr; - v55 = hir.load v54 : i64; - v56 = hir.bitcast v38 : u32; - v57 = arith.constant 4 : u32; - v58 = arith.mod v56, v57 : u32; - hir.assertz v58 #[code = 250]; - v59 = hir.int_to_ptr v56 : ptr; - hir.store v59, v55; - v235 = arith.constant 16 : i32; - v61 = arith.add v44, v235 : i32 #[overflow = wrapping]; - v62 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr - v63 = hir.bitcast v62 : ptr; - hir.store v63, v61; + public builtin.function @entrypoint(v49: i32) { + ^block11(v49: i32): + hir.store_local v49 #[local = lv0]; + v50 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr + v51 = hir.bitcast v50 : ptr; + v52 = hir.load v51 : i32; + v294 = arith.constant 16 : i32; + v54 = arith.sub v52, v294 : i32 #[overflow = wrapping]; + hir.store_local v54 #[local = lv1]; + v55 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr + v56 = hir.bitcast v55 : ptr; + hir.store v56, v54; + v57 = hir.load_local : i32 #[local = lv1]; + v293 = arith.constant 8 : i32; + v59 = arith.add v57, v293 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/miden_base_sys::bindings::active_account::get_id(v59) + v60 = hir.load_local : i32 #[local = lv0]; + v61 = hir.load_local : i32 #[local = lv1]; + v292 = arith.constant 8 : u32; + v62 = hir.bitcast v61 : u32; + v64 = arith.add v62, v292 : u32 #[overflow = checked]; + v298 = arith.constant 8 : u32; + v66 = arith.mod v64, v298 : u32; + hir.assertz v66 #[code = 250]; + v67 = hir.int_to_ptr v64 : ptr; + v68 = hir.load v67 : i64; + v69 = hir.bitcast v60 : u32; + v291 = arith.constant 4 : u32; + v71 = arith.mod v69, v291 : u32; + hir.assertz v71 #[code = 250]; + v72 = hir.int_to_ptr v69 : ptr; + hir.store v72, v68; + v73 = hir.load_local : i32 #[local = lv1]; + v297 = arith.constant 16 : i32; + v75 = arith.add v73, v297 : i32 #[overflow = wrapping]; + v76 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr + v77 = hir.bitcast v76 : ptr; + hir.store v77, v75; builtin.ret ; }; @@ -94,269 +114,315 @@ builtin.component root_ns:root@1.0.0 { builtin.ret ; }; - private builtin.function @::alloc(v64: i32, v65: i32, v66: i32) -> i32 { - ^block15(v64: i32, v65: i32, v66: i32): - v69 = arith.constant 16 : i32; - v68 = arith.constant 0 : i32; - v238 = arith.constant 16 : u32; - v71 = hir.bitcast v65 : u32; - v73 = arith.gt v71, v238 : i1; - v74 = arith.zext v73 : u32; - v75 = hir.bitcast v74 : i32; - v77 = arith.neq v75, v68 : i1; - v78 = cf.select v77, v65, v69 : i32; - v278 = arith.constant 0 : i32; - v79 = arith.constant -1 : i32; - v80 = arith.add v78, v79 : i32 #[overflow = wrapping]; - v81 = arith.band v78, v80 : i32; - v83 = arith.neq v81, v278 : i1; - v247, v248 = scf.if v83 : i32, u32 { - ^block55: - v239 = arith.constant 0 : u32; - v243 = ub.poison i32 : i32; - scf.yield v243, v239; + private builtin.function @::alloc(v78: i32, v79: i32, v80: i32) -> i32 { + ^block15(v78: i32, v79: i32, v80: i32): + hir.store_local v78 #[local = lv0]; + hir.store_local v79 #[local = lv1]; + hir.store_local v80 #[local = lv2]; + v82 = hir.load_local : i32 #[local = lv1]; + v306 = arith.constant 16 : i32; + v305 = arith.constant 0 : i32; + v301 = arith.constant 16 : u32; + v86 = hir.bitcast v82 : u32; + v88 = arith.gt v86, v301 : i1; + v89 = arith.zext v88 : u32; + v90 = hir.bitcast v89 : i32; + v92 = arith.neq v90, v305 : i1; + v93 = cf.select v92, v82, v306 : i32; + hir.store_local v93 #[local = lv3]; + v94 = hir.load_local : i32 #[local = lv3]; + v349 = arith.constant 0 : i32; + v304 = arith.constant -1 : i32; + v96 = arith.add v94, v304 : i32 #[overflow = wrapping]; + v97 = arith.band v93, v96 : i32; + v99 = arith.neq v97, v349 : i1; + v327, v328 = scf.if v99 : i32, u32 { + ^block58: + v319 = arith.constant 0 : u32; + v323 = ub.poison i32 : i32; + scf.yield v323, v319; } else { ^block18: - v85 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/::max(v65, v78) : i32 - v277 = arith.constant 0 : i32; - v84 = arith.constant -2147483648 : i32; - v86 = arith.sub v84, v85 : i32 #[overflow = wrapping]; - v88 = hir.bitcast v86 : u32; - v87 = hir.bitcast v66 : u32; - v89 = arith.gt v87, v88 : i1; - v90 = arith.zext v89 : u32; - v91 = hir.bitcast v90 : i32; - v93 = arith.neq v91, v277 : i1; - v262 = scf.if v93 : i32 { - ^block54: - v276 = ub.poison i32 : i32; - scf.yield v276; + v100 = hir.load_local : i32 #[local = lv2]; + v102 = hir.load_local : i32 #[local = lv1]; + v103 = hir.load_local : i32 #[local = lv3]; + v104 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/::max(v102, v103) : i32 + hir.store_local v104 #[local = lv1]; + v348 = arith.constant 0 : i32; + v303 = arith.constant -2147483648 : i32; + v105 = arith.sub v303, v104 : i32 #[overflow = wrapping]; + v107 = hir.bitcast v105 : u32; + v106 = hir.bitcast v100 : u32; + v108 = arith.gt v106, v107 : i1; + v109 = arith.zext v108 : u32; + v110 = hir.bitcast v109 : i32; + v112 = arith.neq v110, v348 : i1; + v333 = scf.if v112 : i32 { + ^block57: + v347 = ub.poison i32 : i32; + scf.yield v347; } else { ^block19: - v274 = arith.constant 0 : i32; - v99 = arith.sub v274, v85 : i32 #[overflow = wrapping]; - v275 = arith.constant -1 : i32; - v95 = arith.add v66, v85 : i32 #[overflow = wrapping]; - v97 = arith.add v95, v275 : i32 #[overflow = wrapping]; - v100 = arith.band v97, v99 : i32; - v101 = hir.bitcast v64 : u32; - v102 = arith.constant 4 : u32; - v103 = arith.mod v101, v102 : u32; - hir.assertz v103 #[code = 250]; - v104 = hir.int_to_ptr v101 : ptr; - v105 = hir.load v104 : i32; - v273 = arith.constant 0 : i32; - v107 = arith.neq v105, v273 : i1; - scf.if v107{ - ^block53: + v346 = arith.constant 0 : i32; + hir.store_local v346 #[local = lv3]; + v114 = hir.load_local : i32 #[local = lv2]; + v115 = hir.load_local : i32 #[local = lv1]; + v344 = arith.constant 0 : i32; + v121 = arith.sub v344, v115 : i32 #[overflow = wrapping]; + v345 = arith.constant -1 : i32; + v116 = arith.add v114, v115 : i32 #[overflow = wrapping]; + v118 = arith.add v116, v345 : i32 #[overflow = wrapping]; + v122 = arith.band v118, v121 : i32; + hir.store_local v122 #[local = lv2]; + v123 = hir.load_local : i32 #[local = lv0]; + v124 = hir.bitcast v123 : u32; + v302 = arith.constant 4 : u32; + v126 = arith.mod v124, v302 : u32; + hir.assertz v126 #[code = 250]; + v127 = hir.int_to_ptr v124 : ptr; + v128 = hir.load v127 : i32; + v343 = arith.constant 0 : i32; + v130 = arith.neq v128, v343 : i1; + scf.if v130{ + ^block56: scf.yield ; } else { ^block21: - v108 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/intrinsics::mem::heap_base() : i32 - v109 = hir.mem_size : u32; - v115 = hir.bitcast v64 : u32; - v272 = arith.constant 4 : u32; - v117 = arith.mod v115, v272 : u32; - hir.assertz v117 #[code = 250]; - v271 = arith.constant 16 : u32; - v110 = hir.bitcast v109 : i32; - v113 = arith.shl v110, v271 : i32; - v114 = arith.add v108, v113 : i32 #[overflow = wrapping]; - v118 = hir.int_to_ptr v115 : ptr; - hir.store v118, v114; + v131 = hir.load_local : i32 #[local = lv0]; + v132 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/intrinsics::mem::heap_base() : i32 + v133 = hir.mem_size : u32; + v139 = hir.bitcast v131 : u32; + v342 = arith.constant 4 : u32; + v141 = arith.mod v139, v342 : u32; + hir.assertz v141 #[code = 250]; + v341 = arith.constant 16 : u32; + v134 = hir.bitcast v133 : i32; + v137 = arith.shl v134, v341 : i32; + v138 = arith.add v132, v137 : i32 #[overflow = wrapping]; + v142 = hir.int_to_ptr v139 : ptr; + hir.store v142, v138; scf.yield ; }; - v121 = hir.bitcast v64 : u32; - v270 = arith.constant 4 : u32; - v123 = arith.mod v121, v270 : u32; - hir.assertz v123 #[code = 250]; - v124 = hir.int_to_ptr v121 : ptr; - v125 = hir.load v124 : i32; - v268 = arith.constant 0 : i32; - v269 = arith.constant -1 : i32; - v127 = arith.bxor v125, v269 : i32; - v129 = hir.bitcast v127 : u32; - v128 = hir.bitcast v100 : u32; - v130 = arith.gt v128, v129 : i1; - v131 = arith.zext v130 : u32; - v132 = hir.bitcast v131 : i32; - v134 = arith.neq v132, v268 : i1; - v261 = scf.if v134 : i32 { - ^block22: - v267 = arith.constant 0 : i32; - scf.yield v267; + v143 = hir.load_local : i32 #[local = lv2]; + v144 = hir.load_local : i32 #[local = lv0]; + v145 = hir.bitcast v144 : u32; + v340 = arith.constant 4 : u32; + v147 = arith.mod v145, v340 : u32; + hir.assertz v147 #[code = 250]; + v148 = hir.int_to_ptr v145 : ptr; + v149 = hir.load v148 : i32; + hir.store_local v149 #[local = lv4]; + v338 = arith.constant 0 : i32; + v339 = arith.constant -1 : i32; + v151 = arith.bxor v149, v339 : i32; + v153 = hir.bitcast v151 : u32; + v152 = hir.bitcast v143 : u32; + v154 = arith.gt v152, v153 : i1; + v155 = arith.zext v154 : u32; + v156 = hir.bitcast v155 : i32; + v158 = arith.neq v156, v338 : i1; + scf.if v158{ + ^block55: + scf.yield ; } else { ^block23: - v136 = hir.bitcast v64 : u32; - v266 = arith.constant 4 : u32; - v138 = arith.mod v136, v266 : u32; - hir.assertz v138 #[code = 250]; - v135 = arith.add v125, v100 : i32 #[overflow = wrapping]; - v139 = hir.int_to_ptr v136 : ptr; - hir.store v139, v135; - v141 = arith.add v125, v85 : i32 #[overflow = wrapping]; - scf.yield v141; + v159 = hir.load_local : i32 #[local = lv0]; + v160 = hir.load_local : i32 #[local = lv4]; + v161 = hir.load_local : i32 #[local = lv2]; + v163 = hir.bitcast v159 : u32; + v337 = arith.constant 4 : u32; + v165 = arith.mod v163, v337 : u32; + hir.assertz v165 #[code = 250]; + v162 = arith.add v160, v161 : i32 #[overflow = wrapping]; + v166 = hir.int_to_ptr v163 : ptr; + hir.store v166, v162; + v167 = hir.load_local : i32 #[local = lv4]; + v168 = hir.load_local : i32 #[local = lv1]; + v169 = arith.add v167, v168 : i32 #[overflow = wrapping]; + hir.store_local v169 #[local = lv3]; + scf.yield ; }; - scf.yield v261; + v170 = hir.load_local : i32 #[local = lv3]; + scf.yield v170; }; - v244 = arith.constant 1 : u32; - v265 = arith.constant 0 : u32; - v263 = cf.select v93, v265, v244 : u32; - scf.yield v262, v263; + v324 = arith.constant 1 : u32; + v336 = arith.constant 0 : u32; + v334 = cf.select v112, v336, v324 : u32; + scf.yield v333, v334; }; - v264 = arith.constant 0 : u32; - v260 = arith.eq v248, v264 : i1; - cf.cond_br v260 ^block17, ^block57(v247); + v335 = arith.constant 0 : u32; + v332 = arith.eq v328, v335 : i1; + cf.cond_br v332 ^block17, ^block60(v327); ^block17: ub.unreachable ; - ^block57(v240: i32): - builtin.ret v240; + ^block60(v320: i32): + builtin.ret v320; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { ^block24: - v144 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v144; + v171 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v171; }; - private builtin.function @miden_base_sys::bindings::active_account::get_id(v146: i32) { - ^block28(v146: i32): - v148 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr - v149 = hir.bitcast v148 : ptr; - v150 = hir.load v149 : i32; - v151 = arith.constant 16 : i32; - v152 = arith.sub v150, v151 : i32 #[overflow = wrapping]; - v153 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr - v154 = hir.bitcast v153 : ptr; - hir.store v154, v152; - v155 = arith.constant 8 : i32; - v156 = arith.add v152, v155 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/miden::active_account::get_id(v156) - v158 = arith.constant 8 : u32; - v157 = hir.bitcast v152 : u32; - v159 = arith.add v157, v158 : u32 #[overflow = checked]; - v160 = arith.constant 4 : u32; - v161 = arith.mod v159, v160 : u32; - hir.assertz v161 #[code = 250]; - v162 = hir.int_to_ptr v159 : ptr; - v163 = hir.load v162 : i64; - v164 = hir.bitcast v146 : u32; - v280 = arith.constant 8 : u32; - v166 = arith.mod v164, v280 : u32; - hir.assertz v166 #[code = 250]; - v167 = hir.int_to_ptr v164 : ptr; - hir.store v167, v163; - v279 = arith.constant 16 : i32; - v169 = arith.add v152, v279 : i32 #[overflow = wrapping]; - v170 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr - v171 = hir.bitcast v170 : ptr; - hir.store v171, v169; + private builtin.function @miden_base_sys::bindings::active_account::get_id(v173: i32) { + ^block28(v173: i32): + hir.store_local v173 #[local = lv0]; + v174 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr + v175 = hir.bitcast v174 : ptr; + v176 = hir.load v175 : i32; + v353 = arith.constant 16 : i32; + v178 = arith.sub v176, v353 : i32 #[overflow = wrapping]; + hir.store_local v178 #[local = lv1]; + v179 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr + v180 = hir.bitcast v179 : ptr; + hir.store v180, v178; + v181 = hir.load_local : i32 #[local = lv1]; + v352 = arith.constant 8 : i32; + v183 = arith.add v181, v352 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/miden::protocol::active_account::get_id(v183) + v184 = hir.load_local : i32 #[local = lv0]; + v185 = hir.load_local : i32 #[local = lv1]; + v351 = arith.constant 8 : u32; + v186 = hir.bitcast v185 : u32; + v188 = arith.add v186, v351 : u32 #[overflow = checked]; + v350 = arith.constant 4 : u32; + v190 = arith.mod v188, v350 : u32; + hir.assertz v190 #[code = 250]; + v191 = hir.int_to_ptr v188 : ptr; + v192 = hir.load v191 : i64; + v193 = hir.bitcast v184 : u32; + v357 = arith.constant 8 : u32; + v195 = arith.mod v193, v357 : u32; + hir.assertz v195 #[code = 250]; + v196 = hir.int_to_ptr v193 : ptr; + hir.store v196, v192; + v197 = hir.load_local : i32 #[local = lv1]; + v356 = arith.constant 16 : i32; + v199 = arith.add v197, v356 : i32 #[overflow = wrapping]; + v200 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr + v201 = hir.bitcast v200 : ptr; + hir.store v201, v199; builtin.ret ; }; - private builtin.function @::max(v172: i32, v173: i32) -> i32 { - ^block30(v172: i32, v173: i32): - v180 = arith.constant 0 : i32; - v176 = hir.bitcast v173 : u32; - v175 = hir.bitcast v172 : u32; - v177 = arith.gt v175, v176 : i1; - v178 = arith.zext v177 : u32; - v179 = hir.bitcast v178 : i32; - v181 = arith.neq v179, v180 : i1; - v182 = cf.select v181, v172, v173 : i32; - builtin.ret v182; + private builtin.function @::max(v202: i32, v203: i32) -> i32 { + ^block30(v202: i32, v203: i32): + v358 = arith.constant 0 : i32; + v210 = hir.bitcast v203 : u32; + v209 = hir.bitcast v202 : u32; + v211 = arith.gt v209, v210 : i1; + v212 = arith.zext v211 : u32; + v213 = hir.bitcast v212 : i32; + v215 = arith.neq v213, v358 : i1; + v216 = cf.select v215, v202, v203 : i32; + builtin.ret v216; }; - private builtin.function @miden::active_account::get_id(v183: i32) { - ^block32(v183: i32): - v184, v185 = hir.exec @miden/active_account/get_id() : felt, felt - v186 = hir.bitcast v183 : u32; - v187 = hir.int_to_ptr v186 : ptr; - hir.store v187, v184; - v188 = arith.constant 4 : u32; - v189 = arith.add v186, v188 : u32 #[overflow = checked]; - v190 = hir.int_to_ptr v189 : ptr; - hir.store v190, v185; + private builtin.function @miden::protocol::active_account::get_id(v217: i32) { + ^block32(v217: i32): + v218, v219 = hir.exec @miden/protocol/active_account/get_id() : felt, felt + v220 = hir.bitcast v217 : u32; + v221 = hir.int_to_ptr v220 : ptr; + hir.store v221, v218; + v359 = arith.constant 4 : u32; + v223 = arith.add v220, v359 : u32 #[overflow = checked]; + v224 = hir.int_to_ptr v223 : ptr; + hir.store v224, v219; builtin.ret ; }; - public builtin.function @cabi_realloc(v191: i32, v192: i32, v193: i32, v194: i32) -> i32 { - ^block36(v191: i32, v192: i32, v193: i32, v194: i32): - v196 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/cabi_realloc_wit_bindgen_0_46_0(v191, v192, v193, v194) : i32 - builtin.ret v196; + public builtin.function @cabi_realloc(v225: i32, v226: i32, v227: i32, v228: i32) -> i32 { + ^block37(v225: i32, v226: i32, v227: i32, v228: i32): + v234 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/cabi_realloc_wit_bindgen_0_46_0(v225, v226, v227, v228) : i32 + builtin.ret v234; }; - private builtin.function @alloc::alloc::alloc(v197: i32, v198: i32) -> i32 { - ^block38(v197: i32, v198: i32): + private builtin.function @alloc::alloc::alloc(v235: i32, v236: i32) -> i32 { + ^block39(v235: i32, v236: i32): + hir.store_local v235 #[local = lv0]; + hir.store_local v236 #[local = lv1]; hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v200 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__rustc::__rust_alloc(v198, v197) : i32 - builtin.ret v200; + v238 = hir.load_local : i32 #[local = lv1]; + v239 = hir.load_local : i32 #[local = lv0]; + v240 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__rustc::__rust_alloc(v238, v239) : i32 + builtin.ret v240; }; - private builtin.function @wit_bindgen::rt::cabi_realloc(v201: i32, v202: i32, v203: i32, v204: i32) -> i32 { - ^block40(v201: i32, v202: i32, v203: i32, v204: i32): - v206 = arith.constant 0 : i32; - v207 = arith.neq v202, v206 : i1; - v291, v292, v293 = scf.if v207 : i32, i32, u32 { - ^block44: - v215 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__rustc::__rust_realloc(v201, v202, v203, v204) : i32 - v282 = arith.constant 0 : u32; - v286 = ub.poison i32 : i32; - scf.yield v215, v286, v282; - } else { + private builtin.function @wit_bindgen::rt::cabi_realloc(v241: i32, v242: i32, v243: i32, v244: i32) -> i32 { + ^block41(v241: i32, v242: i32, v243: i32, v244: i32): + hir.store_local v241 #[local = lv0]; + hir.store_local v242 #[local = lv1]; + hir.store_local v243 #[local = lv2]; + hir.store_local v244 #[local = lv3]; + v246 = hir.load_local : i32 #[local = lv1]; + v360 = arith.constant 0 : i32; + v248 = arith.neq v246, v360 : i1; + v369 = scf.if v248 : u32 { ^block45: - v321 = arith.constant 0 : i32; - v322 = arith.constant 0 : i32; - v209 = arith.eq v204, v322 : i1; - v210 = arith.zext v209 : u32; - v211 = hir.bitcast v210 : i32; - v213 = arith.neq v211, v321 : i1; - v309 = scf.if v213 : i32 { - ^block61: - v320 = ub.poison i32 : i32; - scf.yield v320; + v259 = hir.load_local : i32 #[local = lv0]; + v260 = hir.load_local : i32 #[local = lv1]; + v261 = hir.load_local : i32 #[local = lv2]; + v262 = hir.load_local : i32 #[local = lv3]; + v263 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__rustc::__rust_realloc(v259, v260, v261, v262) : i32 + hir.store_local v263 #[local = lv2]; + v365 = arith.constant 0 : u32; + scf.yield v365; + } else { + ^block46: + v249 = hir.load_local : i32 #[local = lv3]; + v385 = arith.constant 0 : i32; + v386 = arith.constant 0 : i32; + v251 = arith.eq v249, v386 : i1; + v252 = arith.zext v251 : u32; + v253 = hir.bitcast v252 : i32; + v255 = arith.neq v253, v385 : i1; + scf.if v255{ + ^block63: + scf.yield ; } else { - ^block46: - v214 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/alloc::alloc::alloc(v203, v204) : i32 - scf.yield v214; + ^block47: + v256 = hir.load_local : i32 #[local = lv2]; + v257 = hir.load_local : i32 #[local = lv3]; + v258 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/alloc::alloc::alloc(v256, v257) : i32 + hir.store_local v258 #[local = lv2]; + scf.yield ; }; - v318 = arith.constant 0 : u32; - v287 = arith.constant 1 : u32; - v311 = cf.select v213, v287, v318 : u32; - v319 = ub.poison i32 : i32; - v310 = cf.select v213, v203, v319 : i32; - scf.yield v309, v310, v311; + v384 = arith.constant 0 : u32; + v367 = arith.constant 1 : u32; + v378 = cf.select v255, v367, v384 : u32; + scf.yield v378; }; - v298, v299 = scf.index_switch v293 : i32, u32 + v372 = scf.index_switch v369 : u32 case 0 { - ^block43: - v316 = arith.constant 0 : i32; - v218 = arith.neq v291, v316 : i1; - v313 = arith.constant 1 : u32; - v314 = arith.constant 0 : u32; - v308 = cf.select v218, v314, v313 : u32; - v315 = ub.poison i32 : i32; - v307 = cf.select v218, v291, v315 : i32; - scf.yield v307, v308; + ^block44: + v264 = hir.load_local : i32 #[local = lv2]; + v380 = arith.constant 1 : u32; + v381 = arith.constant 0 : u32; + v382 = arith.constant 0 : i32; + v266 = arith.neq v264, v382 : i1; + v377 = cf.select v266, v381, v380 : u32; + scf.yield v377; } default { - ^block68: - v317 = arith.constant 0 : u32; - scf.yield v292, v317; + ^block70: + v383 = arith.constant 0 : u32; + scf.yield v383; }; - v312 = arith.constant 0 : u32; - v306 = arith.eq v299, v312 : i1; - cf.cond_br v306 ^block63, ^block64; - ^block63: - builtin.ret v298; - ^block64: + v379 = arith.constant 0 : u32; + v376 = arith.eq v372, v379 : i1; + cf.cond_br v376 ^block43, ^block66; + ^block43: + v267 = hir.load_local : i32 #[local = lv2]; + builtin.ret v267; + ^block66: ub.unreachable ; }; - public builtin.function @cabi_realloc_wit_bindgen_0_46_0(v220: i32, v221: i32, v222: i32, v223: i32) -> i32 { - ^block48(v220: i32, v221: i32, v222: i32, v223: i32): - v225 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/wit_bindgen::rt::cabi_realloc(v220, v221, v222, v223) : i32 - builtin.ret v225; + public builtin.function @cabi_realloc_wit_bindgen_0_46_0(v268: i32, v269: i32, v270: i32, v271: i32) -> i32 { + ^block49(v268: i32, v269: i32, v270: i32, v271: i32): + v277 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/wit_bindgen::rt::cabi_realloc(v268, v269, v270, v271) : i32 + builtin.ret v277; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/abi_transform_tx_kernel_get_id.wat b/tests/integration/expected/abi_transform_tx_kernel_get_id.wat index 9bd5ac881..e5e1647fc 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_id.wat +++ b/tests/integration/expected/abi_transform_tx_kernel_get_id.wat @@ -152,7 +152,7 @@ local.get 1 i32.const 8 i32.add - call $miden::active_account::get_id + call $miden::protocol::active_account::get_id local.get 0 local.get 1 i64.load offset=8 align=4 @@ -170,7 +170,7 @@ i32.gt_u select ) - (func $miden::active_account::get_id (;8;) (type 2) (param i32) + (func $miden::protocol::active_account::get_id (;8;) (type 2) (param i32) unreachable ) (func $cabi_realloc (;9;) (type 1) (param i32 i32 i32 i32) (result i32) diff --git a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir deleted file mode 100644 index c67b09edc..000000000 --- a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir +++ /dev/null @@ -1,1116 +0,0 @@ -builtin.component root_ns:root@1.0.0 { - builtin.module public @abi_transform_tx_kernel_get_inputs_4 { - private builtin.function @__rustc::__rust_alloc(v0: i32, v1: i32) -> i32 { - ^block4(v0: i32, v1: i32): - v3 = arith.constant 1048580 : i32; - v4 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::alloc(v3, v1, v0) : i32 - builtin.ret v4; - }; - - private builtin.function @__rustc::__rust_dealloc(v5: i32, v6: i32, v7: i32) { - ^block6(v5: i32, v6: i32, v7: i32): - builtin.ret ; - }; - - private builtin.function @__rustc::__rust_realloc(v8: i32, v9: i32, v10: i32, v11: i32) -> i32 { - ^block8(v8: i32, v9: i32, v10: i32, v11: i32): - v13 = arith.constant 1048580 : i32; - v14 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::alloc(v13, v10, v11) : i32 - v736 = arith.constant 0 : i32; - v15 = arith.constant 0 : i32; - v16 = arith.eq v14, v15 : i1; - v17 = arith.zext v16 : u32; - v18 = hir.bitcast v17 : i32; - v20 = arith.neq v18, v736 : i1; - scf.if v20{ - ^block10: - scf.yield ; - } else { - ^block11: - v735 = arith.constant 0 : i32; - v22 = hir.bitcast v9 : u32; - v21 = hir.bitcast v11 : u32; - v23 = arith.lt v21, v22 : i1; - v24 = arith.zext v23 : u32; - v25 = hir.bitcast v24 : i32; - v27 = arith.neq v25, v735 : i1; - v28 = cf.select v27, v11, v9 : i32; - v733 = arith.constant 0 : i32; - v734 = arith.constant 0 : i32; - v30 = arith.eq v28, v734 : i1; - v31 = arith.zext v30 : u32; - v32 = hir.bitcast v31 : i32; - v34 = arith.neq v32, v733 : i1; - scf.if v34{ - ^block113: - scf.yield ; - } else { - ^block12: - v35 = hir.bitcast v28 : u32; - v36 = hir.bitcast v14 : u32; - v37 = hir.int_to_ptr v36 : ptr; - v38 = hir.bitcast v8 : u32; - v39 = hir.int_to_ptr v38 : ptr; - hir.mem_cpy v39, v37, v35; - scf.yield ; - }; - scf.yield ; - }; - builtin.ret v14; - }; - - private builtin.function @__rustc::__rust_alloc_zeroed(v41: i32, v42: i32) -> i32 { - ^block13(v41: i32, v42: i32): - v44 = arith.constant 1048580 : i32; - v45 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::alloc(v44, v42, v41) : i32 - v745 = arith.constant 0 : i32; - v46 = arith.constant 0 : i32; - v47 = arith.eq v45, v46 : i1; - v48 = arith.zext v47 : u32; - v49 = hir.bitcast v48 : i32; - v51 = arith.neq v49, v745 : i1; - scf.if v51{ - ^block15: - scf.yield ; - } else { - ^block16: - v743 = arith.constant 0 : i32; - v744 = arith.constant 0 : i32; - v53 = arith.eq v41, v744 : i1; - v54 = arith.zext v53 : u32; - v55 = hir.bitcast v54 : i32; - v57 = arith.neq v55, v743 : i1; - scf.if v57{ - ^block116: - scf.yield ; - } else { - ^block17: - v737 = arith.constant 0 : u8; - v60 = hir.bitcast v41 : u32; - v61 = hir.bitcast v45 : u32; - v62 = hir.int_to_ptr v61 : ptr; - hir.mem_set v62, v60, v737; - scf.yield ; - }; - scf.yield ; - }; - builtin.ret v45; - }; - - public builtin.function @entrypoint() { - ^block18: - v65 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v66 = hir.bitcast v65 : ptr; - v67 = hir.load v66 : i32; - v68 = arith.constant 16 : i32; - v69 = arith.sub v67, v68 : i32 #[overflow = wrapping]; - v70 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v71 = hir.bitcast v70 : ptr; - hir.store v71, v69; - v72 = arith.constant 4 : i32; - v73 = arith.add v69, v72 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/miden_base_sys::bindings::active_note::get_inputs(v73) - v75 = arith.constant 12 : u32; - v74 = hir.bitcast v69 : u32; - v76 = arith.add v74, v75 : u32 #[overflow = checked]; - v77 = arith.constant 4 : u32; - v78 = arith.mod v76, v77 : u32; - hir.assertz v78 #[code = 250]; - v79 = hir.int_to_ptr v76 : ptr; - v80 = hir.load v79 : i32; - v81 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/>::from(v80) : felt - v781 = arith.constant 4 : i32; - v83 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v781) : felt - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::assert_eq(v81, v83) - v780 = arith.constant 0 : i32; - v64 = arith.constant 0 : i32; - v85 = arith.eq v80, v64 : i1; - v86 = arith.zext v85 : u32; - v87 = hir.bitcast v86 : i32; - v89 = arith.neq v87, v780 : i1; - v751 = scf.if v89 : u32 { - ^block122: - v747 = arith.constant 0 : u32; - scf.yield v747; - } else { - ^block21: - v91 = arith.constant 8 : u32; - v90 = hir.bitcast v69 : u32; - v92 = arith.add v90, v91 : u32 #[overflow = checked]; - v779 = arith.constant 4 : u32; - v94 = arith.mod v92, v779 : u32; - hir.assertz v94 #[code = 250]; - v95 = hir.int_to_ptr v92 : ptr; - v96 = hir.load v95 : i32; - v97 = hir.bitcast v96 : u32; - v778 = arith.constant 4 : u32; - v99 = arith.mod v97, v778 : u32; - hir.assertz v99 #[code = 250]; - v100 = hir.int_to_ptr v97 : ptr; - v101 = hir.load v100 : felt; - v102 = arith.constant -1 : i32; - v103 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v102) : felt - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::assert_eq(v101, v103) - v777 = arith.constant 0 : i32; - v104 = arith.constant 1 : i32; - v105 = arith.eq v80, v104 : i1; - v106 = arith.zext v105 : u32; - v107 = hir.bitcast v106 : i32; - v109 = arith.neq v107, v777 : i1; - v753 = scf.if v109 : u32 { - ^block121: - v776 = arith.constant 0 : u32; - scf.yield v776; - } else { - ^block22: - v775 = arith.constant 4 : u32; - v110 = hir.bitcast v96 : u32; - v112 = arith.add v110, v775 : u32 #[overflow = checked]; - v774 = arith.constant 4 : u32; - v114 = arith.mod v112, v774 : u32; - hir.assertz v114 #[code = 250]; - v115 = hir.int_to_ptr v112 : ptr; - v116 = hir.load v115 : felt; - v773 = arith.constant 1 : i32; - v118 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v773) : felt - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::assert_eq(v116, v118) - v772 = arith.constant 0 : i32; - v746 = arith.constant 2 : u32; - v120 = hir.bitcast v80 : u32; - v122 = arith.lte v120, v746 : i1; - v123 = arith.zext v122 : u32; - v124 = hir.bitcast v123 : i32; - v126 = arith.neq v124, v772 : i1; - v755 = scf.if v126 : u32 { - ^block120: - v771 = arith.constant 0 : u32; - scf.yield v771; - } else { - ^block23: - v770 = arith.constant 8 : u32; - v127 = hir.bitcast v96 : u32; - v129 = arith.add v127, v770 : u32 #[overflow = checked]; - v769 = arith.constant 4 : u32; - v131 = arith.mod v129, v769 : u32; - hir.assertz v131 #[code = 250]; - v132 = hir.int_to_ptr v129 : ptr; - v133 = hir.load v132 : felt; - v119 = arith.constant 2 : i32; - v135 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v119) : felt - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::assert_eq(v133, v135) - v768 = arith.constant 0 : i32; - v136 = arith.constant 3 : i32; - v137 = arith.eq v80, v136 : i1; - v138 = arith.zext v137 : u32; - v139 = hir.bitcast v138 : i32; - v141 = arith.neq v139, v768 : i1; - scf.if v141{ - ^block119: - scf.yield ; - } else { - ^block24: - v767 = arith.constant 12 : u32; - v142 = hir.bitcast v96 : u32; - v144 = arith.add v142, v767 : u32 #[overflow = checked]; - v766 = arith.constant 4 : u32; - v146 = arith.mod v144, v766 : u32; - hir.assertz v146 #[code = 250]; - v147 = hir.int_to_ptr v144 : ptr; - v148 = hir.load v147 : felt; - v765 = arith.constant 3 : i32; - v150 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v765) : felt - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::assert_eq(v148, v150) - v764 = arith.constant 4 : i32; - v152 = arith.add v69, v764 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/ as core::ops::drop::Drop>::drop(v152) - v763 = arith.constant 4 : i32; - v154 = arith.add v69, v763 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/ as core::ops::drop::Drop>::drop(v154) - v762 = arith.constant 16 : i32; - v156 = arith.add v69, v762 : i32 #[overflow = wrapping]; - v157 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v158 = hir.bitcast v157 : ptr; - hir.store v158, v156; - scf.yield ; - }; - v749 = arith.constant 1 : u32; - v761 = arith.constant 0 : u32; - v759 = cf.select v141, v761, v749 : u32; - scf.yield v759; - }; - scf.yield v755; - }; - scf.yield v753; - }; - v760 = arith.constant 0 : u32; - v758 = arith.eq v751, v760 : i1; - cf.cond_br v758 ^block20, ^block124; - ^block20: - ub.unreachable ; - ^block124: - builtin.ret ; - }; - - private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { - ^block25: - builtin.ret ; - }; - - private builtin.function @::alloc(v159: i32, v160: i32, v161: i32) -> i32 { - ^block27(v159: i32, v160: i32, v161: i32): - v164 = arith.constant 16 : i32; - v163 = arith.constant 0 : i32; - v783 = arith.constant 16 : u32; - v166 = hir.bitcast v160 : u32; - v168 = arith.gt v166, v783 : i1; - v169 = arith.zext v168 : u32; - v170 = hir.bitcast v169 : i32; - v172 = arith.neq v170, v163 : i1; - v173 = cf.select v172, v160, v164 : i32; - v823 = arith.constant 0 : i32; - v174 = arith.constant -1 : i32; - v175 = arith.add v173, v174 : i32 #[overflow = wrapping]; - v176 = arith.band v173, v175 : i32; - v178 = arith.neq v176, v823 : i1; - v792, v793 = scf.if v178 : i32, u32 { - ^block131: - v784 = arith.constant 0 : u32; - v788 = ub.poison i32 : i32; - scf.yield v788, v784; - } else { - ^block30: - v180 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::max(v160, v173) : i32 - v822 = arith.constant 0 : i32; - v179 = arith.constant -2147483648 : i32; - v181 = arith.sub v179, v180 : i32 #[overflow = wrapping]; - v183 = hir.bitcast v181 : u32; - v182 = hir.bitcast v161 : u32; - v184 = arith.gt v182, v183 : i1; - v185 = arith.zext v184 : u32; - v186 = hir.bitcast v185 : i32; - v188 = arith.neq v186, v822 : i1; - v807 = scf.if v188 : i32 { - ^block130: - v821 = ub.poison i32 : i32; - scf.yield v821; - } else { - ^block31: - v819 = arith.constant 0 : i32; - v194 = arith.sub v819, v180 : i32 #[overflow = wrapping]; - v820 = arith.constant -1 : i32; - v190 = arith.add v161, v180 : i32 #[overflow = wrapping]; - v192 = arith.add v190, v820 : i32 #[overflow = wrapping]; - v195 = arith.band v192, v194 : i32; - v196 = hir.bitcast v159 : u32; - v197 = arith.constant 4 : u32; - v198 = arith.mod v196, v197 : u32; - hir.assertz v198 #[code = 250]; - v199 = hir.int_to_ptr v196 : ptr; - v200 = hir.load v199 : i32; - v818 = arith.constant 0 : i32; - v202 = arith.neq v200, v818 : i1; - scf.if v202{ - ^block129: - scf.yield ; - } else { - ^block33: - v203 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::mem::heap_base() : i32 - v204 = hir.mem_size : u32; - v210 = hir.bitcast v159 : u32; - v817 = arith.constant 4 : u32; - v212 = arith.mod v210, v817 : u32; - hir.assertz v212 #[code = 250]; - v816 = arith.constant 16 : u32; - v205 = hir.bitcast v204 : i32; - v208 = arith.shl v205, v816 : i32; - v209 = arith.add v203, v208 : i32 #[overflow = wrapping]; - v213 = hir.int_to_ptr v210 : ptr; - hir.store v213, v209; - scf.yield ; - }; - v216 = hir.bitcast v159 : u32; - v815 = arith.constant 4 : u32; - v218 = arith.mod v216, v815 : u32; - hir.assertz v218 #[code = 250]; - v219 = hir.int_to_ptr v216 : ptr; - v220 = hir.load v219 : i32; - v813 = arith.constant 0 : i32; - v814 = arith.constant -1 : i32; - v222 = arith.bxor v220, v814 : i32; - v224 = hir.bitcast v222 : u32; - v223 = hir.bitcast v195 : u32; - v225 = arith.gt v223, v224 : i1; - v226 = arith.zext v225 : u32; - v227 = hir.bitcast v226 : i32; - v229 = arith.neq v227, v813 : i1; - v806 = scf.if v229 : i32 { - ^block34: - v812 = arith.constant 0 : i32; - scf.yield v812; - } else { - ^block35: - v231 = hir.bitcast v159 : u32; - v811 = arith.constant 4 : u32; - v233 = arith.mod v231, v811 : u32; - hir.assertz v233 #[code = 250]; - v230 = arith.add v220, v195 : i32 #[overflow = wrapping]; - v234 = hir.int_to_ptr v231 : ptr; - hir.store v234, v230; - v236 = arith.add v220, v180 : i32 #[overflow = wrapping]; - scf.yield v236; - }; - scf.yield v806; - }; - v789 = arith.constant 1 : u32; - v810 = arith.constant 0 : u32; - v808 = cf.select v188, v810, v789 : u32; - scf.yield v807, v808; - }; - v809 = arith.constant 0 : u32; - v805 = arith.eq v793, v809 : i1; - cf.cond_br v805 ^block29, ^block133(v792); - ^block29: - ub.unreachable ; - ^block133(v785: i32): - builtin.ret v785; - }; - - private builtin.function @intrinsics::mem::heap_base() -> i32 { - ^block36: - v239 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v239; - }; - - private builtin.function @::with_capacity_in(v241: i32, v242: i32, v243: i32) { - ^block40(v241: i32, v242: i32, v243: i32): - v245 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v246 = hir.bitcast v245 : ptr; - v247 = hir.load v246 : i32; - v248 = arith.constant 16 : i32; - v249 = arith.sub v247, v248 : i32 #[overflow = wrapping]; - v250 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v251 = hir.bitcast v250 : ptr; - hir.store v251, v249; - v244 = arith.constant 0 : i32; - v254 = arith.constant 256 : i32; - v252 = arith.constant 4 : i32; - v253 = arith.add v249, v252 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::try_allocate_in(v253, v254, v244, v242, v243) - v257 = arith.constant 8 : u32; - v256 = hir.bitcast v249 : u32; - v258 = arith.add v256, v257 : u32 #[overflow = checked]; - v259 = arith.constant 4 : u32; - v260 = arith.mod v258, v259 : u32; - hir.assertz v260 #[code = 250]; - v261 = hir.int_to_ptr v258 : ptr; - v262 = hir.load v261 : i32; - v834 = arith.constant 4 : u32; - v263 = hir.bitcast v249 : u32; - v265 = arith.add v263, v834 : u32 #[overflow = checked]; - v833 = arith.constant 4 : u32; - v267 = arith.mod v265, v833 : u32; - hir.assertz v267 #[code = 250]; - v268 = hir.int_to_ptr v265 : ptr; - v269 = hir.load v268 : i32; - v832 = arith.constant 0 : i32; - v270 = arith.constant 1 : i32; - v271 = arith.neq v269, v270 : i1; - v272 = arith.zext v271 : u32; - v273 = hir.bitcast v272 : i32; - v275 = arith.neq v273, v832 : i1; - cf.cond_br v275 ^block42, ^block43; - ^block42: - v284 = arith.constant 12 : u32; - v283 = hir.bitcast v249 : u32; - v285 = arith.add v283, v284 : u32 #[overflow = checked]; - v831 = arith.constant 4 : u32; - v287 = arith.mod v285, v831 : u32; - hir.assertz v287 #[code = 250]; - v288 = hir.int_to_ptr v285 : ptr; - v289 = hir.load v288 : i32; - v830 = arith.constant 4 : u32; - v290 = hir.bitcast v241 : u32; - v292 = arith.add v290, v830 : u32 #[overflow = checked]; - v829 = arith.constant 4 : u32; - v294 = arith.mod v292, v829 : u32; - hir.assertz v294 #[code = 250]; - v295 = hir.int_to_ptr v292 : ptr; - hir.store v295, v289; - v296 = hir.bitcast v241 : u32; - v828 = arith.constant 4 : u32; - v298 = arith.mod v296, v828 : u32; - hir.assertz v298 #[code = 250]; - v299 = hir.int_to_ptr v296 : ptr; - hir.store v299, v262; - v827 = arith.constant 16 : i32; - v301 = arith.add v249, v827 : i32 #[overflow = wrapping]; - v302 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v303 = hir.bitcast v302 : ptr; - hir.store v303, v301; - builtin.ret ; - ^block43: - v826 = arith.constant 12 : u32; - v276 = hir.bitcast v249 : u32; - v278 = arith.add v276, v826 : u32 #[overflow = checked]; - v825 = arith.constant 4 : u32; - v280 = arith.mod v278, v825 : u32; - hir.assertz v280 #[code = 250]; - v281 = hir.int_to_ptr v278 : ptr; - v282 = hir.load v281 : i32; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::raw_vec::handle_error(v262, v282) - ub.unreachable ; - }; - - private builtin.function @ as core::ops::drop::Drop>::drop(v304: i32) { - ^block44(v304: i32): - v305 = arith.constant 4 : i32; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::deallocate(v304, v305, v305) - builtin.ret ; - }; - - private builtin.function @miden_base_sys::bindings::active_note::get_inputs(v307: i32) { - ^block46(v307: i32): - v309 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v310 = hir.bitcast v309 : ptr; - v311 = hir.load v310 : i32; - v312 = arith.constant 16 : i32; - v313 = arith.sub v311, v312 : i32 #[overflow = wrapping]; - v314 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v315 = hir.bitcast v314 : ptr; - hir.store v315, v313; - v318 = arith.constant 4 : i32; - v316 = arith.constant 8 : i32; - v317 = arith.add v313, v316 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::with_capacity_in(v317, v318, v318) - v321 = arith.constant 8 : u32; - v320 = hir.bitcast v313 : u32; - v322 = arith.add v320, v321 : u32 #[overflow = checked]; - v323 = arith.constant 4 : u32; - v324 = arith.mod v322, v323 : u32; - hir.assertz v324 #[code = 250]; - v325 = hir.int_to_ptr v322 : ptr; - v326 = hir.load v325 : i32; - v328 = arith.constant 12 : u32; - v327 = hir.bitcast v313 : u32; - v329 = arith.add v327, v328 : u32 #[overflow = checked]; - v842 = arith.constant 4 : u32; - v331 = arith.mod v329, v842 : u32; - hir.assertz v331 #[code = 250]; - v332 = hir.int_to_ptr v329 : ptr; - v333 = hir.load v332 : i32; - v835 = arith.constant 2 : u32; - v335 = hir.bitcast v333 : u32; - v337 = arith.shr v335, v835 : u32; - v338 = hir.bitcast v337 : i32; - v339 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/miden::active_note::get_inputs(v338) : i32 - v841 = arith.constant 8 : u32; - v340 = hir.bitcast v307 : u32; - v342 = arith.add v340, v841 : u32 #[overflow = checked]; - v840 = arith.constant 4 : u32; - v344 = arith.mod v342, v840 : u32; - hir.assertz v344 #[code = 250]; - v345 = hir.int_to_ptr v342 : ptr; - hir.store v345, v339; - v839 = arith.constant 4 : u32; - v346 = hir.bitcast v307 : u32; - v348 = arith.add v346, v839 : u32 #[overflow = checked]; - v838 = arith.constant 4 : u32; - v350 = arith.mod v348, v838 : u32; - hir.assertz v350 #[code = 250]; - v351 = hir.int_to_ptr v348 : ptr; - hir.store v351, v333; - v352 = hir.bitcast v307 : u32; - v837 = arith.constant 4 : u32; - v354 = arith.mod v352, v837 : u32; - hir.assertz v354 #[code = 250]; - v355 = hir.int_to_ptr v352 : ptr; - hir.store v355, v326; - v836 = arith.constant 16 : i32; - v357 = arith.add v313, v836 : i32 #[overflow = wrapping]; - v358 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v359 = hir.bitcast v358 : ptr; - hir.store v359, v357; - builtin.ret ; - }; - - private builtin.function @ as core::ops::drop::Drop>::drop(v360: i32) { - ^block48(v360: i32): - builtin.ret ; - }; - - private builtin.function @>::from(v361: i32) -> felt { - ^block50(v361: i32): - v363 = hir.bitcast v361 : felt; - builtin.ret v363; - }; - - private builtin.function @intrinsics::felt::assert_eq(v364: felt, v365: felt) { - ^block52(v364: felt, v365: felt): - hir.assert_eq v364, v365; - builtin.ret ; - }; - - private builtin.function @intrinsics::felt::from_u32(v366: i32) -> felt { - ^block54(v366: i32): - v367 = hir.bitcast v366 : felt; - builtin.ret v367; - }; - - private builtin.function @::alloc_impl(v369: i32, v370: i32, v371: i32, v372: i32) { - ^block56(v369: i32, v370: i32, v371: i32, v372: i32): - v858 = arith.constant 0 : i32; - v373 = arith.constant 0 : i32; - v374 = arith.eq v371, v373 : i1; - v375 = arith.zext v374 : u32; - v376 = hir.bitcast v375 : i32; - v378 = arith.neq v376, v858 : i1; - v854 = scf.if v378 : i32 { - ^block139: - scf.yield v370; - } else { - ^block59: - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v857 = arith.constant 0 : i32; - v380 = arith.neq v372, v857 : i1; - v853 = scf.if v380 : i32 { - ^block60: - v382 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_alloc_zeroed(v371, v370) : i32 - scf.yield v382; - } else { - ^block61: - v381 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_alloc(v371, v370) : i32 - scf.yield v381; - }; - scf.yield v853; - }; - v386 = arith.constant 4 : u32; - v385 = hir.bitcast v369 : u32; - v387 = arith.add v385, v386 : u32 #[overflow = checked]; - v856 = arith.constant 4 : u32; - v389 = arith.mod v387, v856 : u32; - hir.assertz v389 #[code = 250]; - v390 = hir.int_to_ptr v387 : ptr; - hir.store v390, v371; - v392 = hir.bitcast v369 : u32; - v855 = arith.constant 4 : u32; - v394 = arith.mod v392, v855 : u32; - hir.assertz v394 #[code = 250]; - v395 = hir.int_to_ptr v392 : ptr; - hir.store v395, v854; - builtin.ret ; - }; - - private builtin.function @::deallocate(v396: i32, v397: i32, v398: i32) { - ^block62(v396: i32, v397: i32, v398: i32): - v400 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v401 = hir.bitcast v400 : ptr; - v402 = hir.load v401 : i32; - v403 = arith.constant 16 : i32; - v404 = arith.sub v402, v403 : i32 #[overflow = wrapping]; - v405 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v406 = hir.bitcast v405 : ptr; - hir.store v406, v404; - v407 = arith.constant 4 : i32; - v408 = arith.add v404, v407 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::current_memory(v408, v396, v397, v398) - v410 = arith.constant 8 : u32; - v409 = hir.bitcast v404 : u32; - v411 = arith.add v409, v410 : u32 #[overflow = checked]; - v412 = arith.constant 4 : u32; - v413 = arith.mod v411, v412 : u32; - hir.assertz v413 #[code = 250]; - v414 = hir.int_to_ptr v411 : ptr; - v415 = hir.load v414 : i32; - v865 = arith.constant 0 : i32; - v399 = arith.constant 0 : i32; - v417 = arith.eq v415, v399 : i1; - v418 = arith.zext v417 : u32; - v419 = hir.bitcast v418 : i32; - v421 = arith.neq v419, v865 : i1; - scf.if v421{ - ^block142: - scf.yield ; - } else { - ^block65: - v864 = arith.constant 4 : u32; - v422 = hir.bitcast v404 : u32; - v424 = arith.add v422, v864 : u32 #[overflow = checked]; - v863 = arith.constant 4 : u32; - v426 = arith.mod v424, v863 : u32; - hir.assertz v426 #[code = 250]; - v427 = hir.int_to_ptr v424 : ptr; - v428 = hir.load v427 : i32; - v430 = arith.constant 12 : u32; - v429 = hir.bitcast v404 : u32; - v431 = arith.add v429, v430 : u32 #[overflow = checked]; - v862 = arith.constant 4 : u32; - v433 = arith.mod v431, v862 : u32; - hir.assertz v433 #[code = 250]; - v434 = hir.int_to_ptr v431 : ptr; - v435 = hir.load v434 : i32; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::deallocate(v428, v415, v435) - scf.yield ; - }; - v861 = arith.constant 16 : i32; - v438 = arith.add v404, v861 : i32 #[overflow = wrapping]; - v439 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v440 = hir.bitcast v439 : ptr; - hir.store v440, v438; - builtin.ret ; - }; - - private builtin.function @::current_memory(v441: i32, v442: i32, v443: i32, v444: i32) { - ^block66(v441: i32, v442: i32, v443: i32, v444: i32): - v891 = arith.constant 0 : i32; - v445 = arith.constant 0 : i32; - v449 = arith.eq v444, v445 : i1; - v450 = arith.zext v449 : u32; - v451 = hir.bitcast v450 : i32; - v453 = arith.neq v451, v891 : i1; - v878, v879 = scf.if v453 : i32, i32 { - ^block145: - v890 = arith.constant 0 : i32; - v447 = arith.constant 4 : i32; - scf.yield v447, v890; - } else { - ^block69: - v454 = hir.bitcast v442 : u32; - v489 = arith.constant 4 : u32; - v456 = arith.mod v454, v489 : u32; - hir.assertz v456 #[code = 250]; - v457 = hir.int_to_ptr v454 : ptr; - v458 = hir.load v457 : i32; - v888 = arith.constant 0 : i32; - v889 = arith.constant 0 : i32; - v460 = arith.eq v458, v889 : i1; - v461 = arith.zext v460 : u32; - v462 = hir.bitcast v461 : i32; - v464 = arith.neq v462, v888 : i1; - v876 = scf.if v464 : i32 { - ^block144: - v887 = arith.constant 0 : i32; - scf.yield v887; - } else { - ^block70: - v886 = arith.constant 4 : u32; - v465 = hir.bitcast v441 : u32; - v467 = arith.add v465, v886 : u32 #[overflow = checked]; - v885 = arith.constant 4 : u32; - v469 = arith.mod v467, v885 : u32; - hir.assertz v469 #[code = 250]; - v470 = hir.int_to_ptr v467 : ptr; - hir.store v470, v443; - v884 = arith.constant 4 : u32; - v471 = hir.bitcast v442 : u32; - v473 = arith.add v471, v884 : u32 #[overflow = checked]; - v883 = arith.constant 4 : u32; - v475 = arith.mod v473, v883 : u32; - hir.assertz v475 #[code = 250]; - v476 = hir.int_to_ptr v473 : ptr; - v477 = hir.load v476 : i32; - v478 = hir.bitcast v441 : u32; - v882 = arith.constant 4 : u32; - v480 = arith.mod v478, v882 : u32; - hir.assertz v480 #[code = 250]; - v481 = hir.int_to_ptr v478 : ptr; - hir.store v481, v477; - v482 = arith.mul v458, v444 : i32 #[overflow = wrapping]; - scf.yield v482; - }; - v483 = arith.constant 8 : i32; - v881 = arith.constant 4 : i32; - v877 = cf.select v464, v881, v483 : i32; - scf.yield v877, v876; - }; - v486 = arith.add v441, v878 : i32 #[overflow = wrapping]; - v488 = hir.bitcast v486 : u32; - v880 = arith.constant 4 : u32; - v490 = arith.mod v488, v880 : u32; - hir.assertz v490 #[code = 250]; - v491 = hir.int_to_ptr v488 : ptr; - hir.store v491, v879; - builtin.ret ; - }; - - private builtin.function @::deallocate(v492: i32, v493: i32, v494: i32) { - ^block71(v492: i32, v493: i32, v494: i32): - v893 = arith.constant 0 : i32; - v495 = arith.constant 0 : i32; - v496 = arith.eq v494, v495 : i1; - v497 = arith.zext v496 : u32; - v498 = hir.bitcast v497 : i32; - v500 = arith.neq v498, v893 : i1; - scf.if v500{ - ^block73: - scf.yield ; - } else { - ^block74: - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_dealloc(v492, v494, v493) - scf.yield ; - }; - builtin.ret ; - }; - - private builtin.function @::allocate(v501: i32, v502: i32, v503: i32) { - ^block75(v501: i32, v502: i32, v503: i32): - v505 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v506 = hir.bitcast v505 : ptr; - v507 = hir.load v506 : i32; - v508 = arith.constant 16 : i32; - v509 = arith.sub v507, v508 : i32 #[overflow = wrapping]; - v510 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v511 = hir.bitcast v510 : ptr; - hir.store v511, v509; - v504 = arith.constant 0 : i32; - v512 = arith.constant 8 : i32; - v513 = arith.add v509, v512 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::alloc_impl(v513, v502, v503, v504) - v516 = arith.constant 12 : u32; - v515 = hir.bitcast v509 : u32; - v517 = arith.add v515, v516 : u32 #[overflow = checked]; - v518 = arith.constant 4 : u32; - v519 = arith.mod v517, v518 : u32; - hir.assertz v519 #[code = 250]; - v520 = hir.int_to_ptr v517 : ptr; - v521 = hir.load v520 : i32; - v523 = arith.constant 8 : u32; - v522 = hir.bitcast v509 : u32; - v524 = arith.add v522, v523 : u32 #[overflow = checked]; - v898 = arith.constant 4 : u32; - v526 = arith.mod v524, v898 : u32; - hir.assertz v526 #[code = 250]; - v527 = hir.int_to_ptr v524 : ptr; - v528 = hir.load v527 : i32; - v529 = hir.bitcast v501 : u32; - v897 = arith.constant 4 : u32; - v531 = arith.mod v529, v897 : u32; - hir.assertz v531 #[code = 250]; - v532 = hir.int_to_ptr v529 : ptr; - hir.store v532, v528; - v896 = arith.constant 4 : u32; - v533 = hir.bitcast v501 : u32; - v535 = arith.add v533, v896 : u32 #[overflow = checked]; - v895 = arith.constant 4 : u32; - v537 = arith.mod v535, v895 : u32; - hir.assertz v537 #[code = 250]; - v538 = hir.int_to_ptr v535 : ptr; - hir.store v538, v521; - v894 = arith.constant 16 : i32; - v540 = arith.add v509, v894 : i32 #[overflow = wrapping]; - v541 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v542 = hir.bitcast v541 : ptr; - hir.store v542, v540; - builtin.ret ; - }; - - private builtin.function @::try_allocate_in(v543: i32, v544: i32, v545: i32, v546: i32, v547: i32) { - ^block77(v543: i32, v544: i32, v545: i32, v546: i32, v547: i32): - v550 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v551 = hir.bitcast v550 : ptr; - v552 = hir.load v551 : i32; - v553 = arith.constant 16 : i32; - v554 = arith.sub v552, v553 : i32 #[overflow = wrapping]; - v555 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v556 = hir.bitcast v555 : ptr; - hir.store v556, v554; - v566 = hir.bitcast v544 : u32; - v567 = arith.zext v566 : u64; - v568 = hir.bitcast v567 : i64; - v548 = arith.constant 0 : i32; - v561 = arith.sub v548, v546 : i32 #[overflow = wrapping]; - v558 = arith.constant -1 : i32; - v557 = arith.add v546, v547 : i32 #[overflow = wrapping]; - v559 = arith.add v557, v558 : i32 #[overflow = wrapping]; - v562 = arith.band v559, v561 : i32; - v563 = hir.bitcast v562 : u32; - v564 = arith.zext v563 : u64; - v565 = hir.bitcast v564 : i64; - v569 = arith.mul v565, v568 : i64 #[overflow = wrapping]; - v1001 = arith.constant 0 : i32; - v570 = arith.constant 32 : i64; - v572 = hir.cast v570 : u32; - v571 = hir.bitcast v569 : u64; - v573 = arith.shr v571, v572 : u64; - v574 = hir.bitcast v573 : i64; - v575 = arith.trunc v574 : i32; - v577 = arith.neq v575, v1001 : i1; - v914, v915, v916, v917, v918, v919 = scf.if v577 : i32, i32, i32, i32, i32, u32 { - ^block149: - v899 = arith.constant 0 : u32; - v906 = ub.poison i32 : i32; - scf.yield v543, v554, v906, v906, v906, v899; - } else { - ^block82: - v578 = arith.trunc v569 : i32; - v1000 = arith.constant 0 : i32; - v579 = arith.constant -2147483648 : i32; - v580 = arith.sub v579, v546 : i32 #[overflow = wrapping]; - v582 = hir.bitcast v580 : u32; - v581 = hir.bitcast v578 : u32; - v583 = arith.lte v581, v582 : i1; - v584 = arith.zext v583 : u32; - v585 = hir.bitcast v584 : i32; - v587 = arith.neq v585, v1000 : i1; - v962 = scf.if v587 : i32 { - ^block80: - v999 = arith.constant 0 : i32; - v598 = arith.neq v578, v999 : i1; - v961 = scf.if v598 : i32 { - ^block84: - v998 = arith.constant 0 : i32; - v614 = arith.neq v545, v998 : i1; - v960 = scf.if v614 : i32 { - ^block87: - v596 = arith.constant 1 : i32; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::alloc_impl(v554, v546, v578, v596) - v625 = hir.bitcast v554 : u32; - v666 = arith.constant 4 : u32; - v627 = arith.mod v625, v666 : u32; - hir.assertz v627 #[code = 250]; - v628 = hir.int_to_ptr v625 : ptr; - v629 = hir.load v628 : i32; - scf.yield v629; - } else { - ^block88: - v615 = arith.constant 8 : i32; - v616 = arith.add v554, v615 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::allocate(v616, v546, v578) - v600 = arith.constant 8 : u32; - v617 = hir.bitcast v554 : u32; - v619 = arith.add v617, v600 : u32 #[overflow = checked]; - v997 = arith.constant 4 : u32; - v621 = arith.mod v619, v997 : u32; - hir.assertz v621 #[code = 250]; - v622 = hir.int_to_ptr v619 : ptr; - v623 = hir.load v622 : i32; - scf.yield v623; - }; - v996 = arith.constant 0 : i32; - v632 = arith.neq v960, v996 : i1; - scf.if v632{ - ^block89: - v995 = arith.constant 8 : u32; - v649 = hir.bitcast v543 : u32; - v651 = arith.add v649, v995 : u32 #[overflow = checked]; - v994 = arith.constant 4 : u32; - v653 = arith.mod v651, v994 : u32; - hir.assertz v653 #[code = 250]; - v654 = hir.int_to_ptr v651 : ptr; - hir.store v654, v960; - v993 = arith.constant 4 : u32; - v656 = hir.bitcast v543 : u32; - v658 = arith.add v656, v993 : u32 #[overflow = checked]; - v992 = arith.constant 4 : u32; - v660 = arith.mod v658, v992 : u32; - hir.assertz v660 #[code = 250]; - v661 = hir.int_to_ptr v658 : ptr; - hir.store v661, v544; - scf.yield ; - } else { - ^block90: - v991 = arith.constant 8 : u32; - v635 = hir.bitcast v543 : u32; - v637 = arith.add v635, v991 : u32 #[overflow = checked]; - v990 = arith.constant 4 : u32; - v639 = arith.mod v637, v990 : u32; - hir.assertz v639 #[code = 250]; - v640 = hir.int_to_ptr v637 : ptr; - hir.store v640, v578; - v989 = arith.constant 4 : u32; - v642 = hir.bitcast v543 : u32; - v644 = arith.add v642, v989 : u32 #[overflow = checked]; - v988 = arith.constant 4 : u32; - v646 = arith.mod v644, v988 : u32; - hir.assertz v646 #[code = 250]; - v647 = hir.int_to_ptr v644 : ptr; - hir.store v647, v546; - scf.yield ; - }; - v986 = arith.constant 1 : i32; - v987 = arith.constant 0 : i32; - v959 = cf.select v632, v987, v986 : i32; - scf.yield v959; - } else { - ^block85: - v985 = arith.constant 8 : u32; - v599 = hir.bitcast v543 : u32; - v601 = arith.add v599, v985 : u32 #[overflow = checked]; - v984 = arith.constant 4 : u32; - v603 = arith.mod v601, v984 : u32; - hir.assertz v603 #[code = 250]; - v604 = hir.int_to_ptr v601 : ptr; - hir.store v604, v546; - v983 = arith.constant 4 : u32; - v607 = hir.bitcast v543 : u32; - v609 = arith.add v607, v983 : u32 #[overflow = checked]; - v982 = arith.constant 4 : u32; - v611 = arith.mod v609, v982 : u32; - hir.assertz v611 #[code = 250]; - v981 = arith.constant 0 : i32; - v612 = hir.int_to_ptr v609 : ptr; - hir.store v612, v981; - v980 = arith.constant 0 : i32; - scf.yield v980; - }; - scf.yield v961; - } else { - ^block83: - v979 = ub.poison i32 : i32; - scf.yield v979; - }; - v974 = arith.constant 0 : u32; - v907 = arith.constant 1 : u32; - v967 = cf.select v587, v907, v974 : u32; - v975 = ub.poison i32 : i32; - v966 = cf.select v587, v554, v975 : i32; - v976 = ub.poison i32 : i32; - v965 = cf.select v587, v543, v976 : i32; - v977 = ub.poison i32 : i32; - v964 = cf.select v587, v977, v554 : i32; - v978 = ub.poison i32 : i32; - v963 = cf.select v587, v978, v543 : i32; - scf.yield v963, v964, v965, v962, v966, v967; - }; - v920, v921, v922 = scf.index_switch v919 : i32, i32, i32 - case 0 { - ^block81: - v973 = arith.constant 4 : u32; - v590 = hir.bitcast v914 : u32; - v592 = arith.add v590, v973 : u32 #[overflow = checked]; - v972 = arith.constant 4 : u32; - v594 = arith.mod v592, v972 : u32; - hir.assertz v594 #[code = 250]; - v971 = arith.constant 0 : i32; - v595 = hir.int_to_ptr v592 : ptr; - hir.store v595, v971; - v970 = arith.constant 1 : i32; - scf.yield v914, v970, v915; - } - default { - ^block153: - scf.yield v916, v917, v918; - }; - v665 = hir.bitcast v920 : u32; - v969 = arith.constant 4 : u32; - v667 = arith.mod v665, v969 : u32; - hir.assertz v667 #[code = 250]; - v668 = hir.int_to_ptr v665 : ptr; - hir.store v668, v921; - v968 = arith.constant 16 : i32; - v673 = arith.add v922, v968 : i32 #[overflow = wrapping]; - v674 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v675 = hir.bitcast v674 : ptr; - hir.store v675, v673; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::handle_error(v676: i32, v677: i32) { - ^block91(v676: i32, v677: i32): - ub.unreachable ; - }; - - private builtin.function @::max(v678: i32, v679: i32) -> i32 { - ^block93(v678: i32, v679: i32): - v686 = arith.constant 0 : i32; - v682 = hir.bitcast v679 : u32; - v681 = hir.bitcast v678 : u32; - v683 = arith.gt v681, v682 : i1; - v684 = arith.zext v683 : u32; - v685 = hir.bitcast v684 : i32; - v687 = arith.neq v685, v686 : i1; - v688 = cf.select v687, v678, v679 : i32; - builtin.ret v688; - }; - - private builtin.function @miden::active_note::get_inputs(v689: i32) -> i32 { - ^block95(v689: i32): - v690, v691 = hir.exec @miden/active_note/get_inputs(v689) : i32, i32 - builtin.ret v690; - }; - - public builtin.function @cabi_realloc(v693: i32, v694: i32, v695: i32, v696: i32) -> i32 { - ^block99(v693: i32, v694: i32, v695: i32, v696: i32): - v698 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/cabi_realloc_wit_bindgen_0_46_0(v693, v694, v695, v696) : i32 - builtin.ret v698; - }; - - private builtin.function @alloc::alloc::alloc(v699: i32, v700: i32) -> i32 { - ^block101(v699: i32, v700: i32): - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v702 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_alloc(v700, v699) : i32 - builtin.ret v702; - }; - - private builtin.function @wit_bindgen::rt::cabi_realloc(v703: i32, v704: i32, v705: i32, v706: i32) -> i32 { - ^block103(v703: i32, v704: i32, v705: i32, v706: i32): - v708 = arith.constant 0 : i32; - v709 = arith.neq v704, v708 : i1; - v1012, v1013, v1014 = scf.if v709 : i32, i32, u32 { - ^block107: - v717 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_realloc(v703, v704, v705, v706) : i32 - v1003 = arith.constant 0 : u32; - v1007 = ub.poison i32 : i32; - scf.yield v717, v1007, v1003; - } else { - ^block108: - v1042 = arith.constant 0 : i32; - v1043 = arith.constant 0 : i32; - v711 = arith.eq v706, v1043 : i1; - v712 = arith.zext v711 : u32; - v713 = hir.bitcast v712 : i32; - v715 = arith.neq v713, v1042 : i1; - v1030 = scf.if v715 : i32 { - ^block156: - v1041 = ub.poison i32 : i32; - scf.yield v1041; - } else { - ^block109: - v716 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::alloc::alloc(v705, v706) : i32 - scf.yield v716; - }; - v1039 = arith.constant 0 : u32; - v1008 = arith.constant 1 : u32; - v1032 = cf.select v715, v1008, v1039 : u32; - v1040 = ub.poison i32 : i32; - v1031 = cf.select v715, v705, v1040 : i32; - scf.yield v1030, v1031, v1032; - }; - v1019, v1020 = scf.index_switch v1014 : i32, u32 - case 0 { - ^block106: - v1037 = arith.constant 0 : i32; - v720 = arith.neq v1012, v1037 : i1; - v1034 = arith.constant 1 : u32; - v1035 = arith.constant 0 : u32; - v1029 = cf.select v720, v1035, v1034 : u32; - v1036 = ub.poison i32 : i32; - v1028 = cf.select v720, v1012, v1036 : i32; - scf.yield v1028, v1029; - } - default { - ^block163: - v1038 = arith.constant 0 : u32; - scf.yield v1013, v1038; - }; - v1033 = arith.constant 0 : u32; - v1027 = arith.eq v1020, v1033 : i1; - cf.cond_br v1027 ^block158, ^block159; - ^block158: - builtin.ret v1019; - ^block159: - ub.unreachable ; - }; - - public builtin.function @cabi_realloc_wit_bindgen_0_46_0(v722: i32, v723: i32, v724: i32, v725: i32) -> i32 { - ^block111(v722: i32, v723: i32, v724: i32, v725: i32): - v727 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/wit_bindgen::rt::cabi_realloc(v722, v723, v724, v725) : i32 - builtin.ret v727; - }; - - builtin.global_variable private @#__stack_pointer : i32 { - builtin.ret_imm 1048576; - }; - - builtin.segment readonly @1048576 = 0x00000001; - }; -}; \ No newline at end of file diff --git a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.masm b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.masm deleted file mode 100644 index b0c1ef6a9..000000000 --- a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.masm +++ /dev/null @@ -1,2102 +0,0 @@ -# mod root_ns:root@1.0.0 - -proc init - push.1179648 - trace.240 - exec.::intrinsics::mem::heap_init - trace.252 - push.[381941261429277531,4212401613039242911,15832969995826621848,144075553990749275] - adv.push_mapval - push.262144 - push.1 - trace.240 - exec.::std::mem::pipe_preimage_to_memory - trace.252 - drop - push.1048576 - u32assert - mem_store.278536 -end - -# mod root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4 - -@callconv("C") -proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1048580 - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::::alloc - trace.252 - nop -end - -@callconv("C") -proc __rustc::__rust_dealloc(i32, i32, i32) - drop - drop - drop -end - -@callconv("C") -proc __rustc::__rust_realloc(i32, i32, i32, i32) -> i32 - push.1048580 - dup.4 - swap.2 - swap.4 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::::alloc - trace.252 - nop - push.0 - push.0 - dup.2 - eq - neq - if.true - movdn.3 - drop - drop - drop - else - push.0 - dup.2 - dup.5 - swap.1 - u32lt - neq - swap.1 - swap.4 - swap.1 - cdrop - push.0 - push.0 - dup.2 - eq - neq - if.true - drop - drop - else - dup.2 - movup.2 - push.0 - dup.3 - push.0 - gte - while.true - dup.2 - dup.1 - push.1 - u32overflowing_madd - assertz - dup.2 - dup.2 - push.1 - u32overflowing_madd - assertz - u32divmod.4 - swap.1 - swap.1 - dup.1 - mem_load - swap.1 - push.8 - u32wrapping_mul - u32shr - swap.1 - drop - push.255 - u32and - swap.1 - u32divmod.4 - swap.1 - dup.0 - mem_load - dup.2 - push.8 - u32wrapping_mul - push.255 - swap.1 - u32shl - u32not - swap.1 - u32and - movup.3 - movup.3 - push.8 - u32wrapping_mul - u32shl - u32or - swap.1 - mem_store - u32wrapping_add.1 - dup.0 - dup.4 - u32gte - end - dropw - end - end -end - -@callconv("C") -proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 - push.1048580 - dup.1 - swap.2 - swap.3 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::::alloc - trace.252 - nop - push.0 - push.0 - dup.2 - eq - neq - if.true - swap.1 - drop - else - push.0 - push.0 - dup.3 - eq - neq - if.true - swap.1 - drop - else - push.0 - movup.2 - dup.2 - push.0 - dup.2 - push.0 - gte - while.true - dup.1 - dup.1 - push.1 - u32overflowing_madd - assertz - dup.4 - swap.1 - u32divmod.4 - swap.1 - dup.0 - mem_load - dup.2 - push.8 - u32wrapping_mul - push.255 - swap.1 - u32shl - u32not - swap.1 - u32and - movup.3 - movup.3 - push.8 - u32wrapping_mul - u32shl - u32or - swap.1 - mem_store - u32wrapping_add.1 - dup.0 - dup.3 - u32gte - end - dropw - end - end -end - -@callconv("C") -pub proc entrypoint( - -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.1 - u32wrapping_add - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::miden_base_sys::bindings::active_note::get_inputs - trace.252 - nop - push.12 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.0 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::>::from - trace.252 - nop - push.4 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::intrinsics::felt::from_u32 - trace.252 - nop - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::intrinsics::felt::assert_eq - trace.252 - nop - push.0 - push.0 - dup.2 - eq - neq - if.true - drop - drop - push.0 - else - push.8 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.4294967295 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::intrinsics::felt::from_u32 - trace.252 - nop - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::intrinsics::felt::assert_eq - trace.252 - nop - push.0 - push.1 - dup.3 - eq - neq - if.true - drop - drop - drop - push.0 - else - push.4 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::intrinsics::felt::from_u32 - trace.252 - nop - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::intrinsics::felt::assert_eq - trace.252 - nop - push.0 - push.2 - dup.3 - swap.1 - u32lte - neq - if.true - drop - drop - drop - push.0 - else - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::intrinsics::felt::from_u32 - trace.252 - nop - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::intrinsics::felt::assert_eq - trace.252 - nop - push.0 - push.3 - movup.3 - eq - neq - dup.0 - if.true - movdn.2 - drop - drop - else - push.12 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.3 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::intrinsics::felt::from_u32 - trace.252 - nop - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::intrinsics::felt::assert_eq - trace.252 - nop - push.4 - dup.2 - u32wrapping_add - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4:: as core::ops::drop::Drop>::drop - trace.252 - nop - push.4 - dup.2 - u32wrapping_add - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4:: as core::ops::drop::Drop>::drop - trace.252 - nop - push.16 - movup.2 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - end - push.1 - push.0 - movup.2 - cdrop - end - end - end - push.0 - eq - if.true - push.0 - assert - else - nop - end -end - -@callconv("C") -proc __rustc::__rust_no_alloc_shim_is_unstable_v2( - -) - nop -end - -@callconv("C") -proc ::alloc( - i32, - i32, - i32 -) -> i32 - push.16 - push.0 - push.16 - dup.4 - swap.1 - u32gt - neq - dup.3 - swap.1 - cdrop - push.0 - push.4294967295 - dup.2 - u32wrapping_add - dup.2 - u32and - neq - if.true - dropw - push.0 - push.3735929054 - else - movup.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::::max - trace.252 - nop - push.0 - push.2147483648 - dup.2 - u32wrapping_sub - dup.4 - swap.1 - u32gt - neq - dup.0 - if.true - movdn.3 - drop - drop - drop - push.3735929054 - else - push.0 - dup.2 - u32wrapping_sub - push.4294967295 - movup.5 - dup.4 - u32wrapping_add - u32wrapping_add - u32and - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - neq - if.true - nop - else - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::intrinsics::mem::heap_base - trace.252 - nop - trace.240 - nop - exec.::intrinsics::mem::memory_size - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.16 - movup.2 - swap.1 - u32shl - movup.2 - u32wrapping_add - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - end - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.4294967295 - dup.2 - u32xor - dup.3 - swap.1 - u32gt - neq - if.true - drop - drop - movdn.2 - drop - drop - push.0 - else - movup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.2 - dup.2 - u32wrapping_add - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.2 - u32wrapping_add - end - end - push.1 - push.0 - movup.3 - cdrop - swap.1 - end - push.0 - movup.2 - eq - if.true - drop - push.0 - assert - else - nop - end -end - -@callconv("C") -proc intrinsics::mem::heap_base( - -) -> i32 - trace.240 - nop - exec.::intrinsics::mem::heap_base - trace.252 - nop -end - -@callconv("C") -proc ::with_capacity_in( - i32, - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - push.256 - push.4 - dup.3 - u32wrapping_add - movup.4 - swap.6 - movdn.4 - movup.3 - swap.5 - movdn.3 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::::try_allocate_in - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.4 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.1 - movup.2 - neq - neq - if.true - push.12 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.4 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - else - movup.2 - drop - push.12 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::alloc::raw_vec::handle_error - trace.252 - nop - push.0 - assert - end -end - -@callconv("C") -proc as core::ops::drop::Drop>::drop( - i32 -) - push.4 - dup.0 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::::deallocate - trace.252 - nop -end - -@callconv("C") -proc miden_base_sys::bindings::active_note::get_inputs( - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - push.8 - dup.2 - u32wrapping_add - dup.1 - swap.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::::with_capacity_in - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.12 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.2 - dup.1 - swap.1 - u32shr - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::miden::active_note::get_inputs - trace.252 - nop - push.8 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc as core::ops::drop::Drop>::drop( - i32 -) - drop -end - -@callconv("C") -proc >::from( - i32 -) -> felt - nop -end - -@callconv("C") -proc intrinsics::felt::assert_eq(felt, felt) - assert_eq -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc ::alloc_impl( - i32, - i32, - i32, - i32 -) - push.0 - push.0 - dup.4 - eq - neq - if.true - movup.3 - drop - swap.1 - else - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::__rustc::__rust_no_alloc_shim_is_unstable_v2 - trace.252 - nop - push.0 - movup.4 - neq - if.true - swap.1 - dup.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::__rustc::__rust_alloc_zeroed - trace.252 - nop - else - swap.1 - dup.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::__rustc::__rust_alloc - trace.252 - nop - end - end - push.4 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.3 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - swap.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc ::deallocate( - i32, - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.1 - u32wrapping_add - swap.1 - swap.4 - swap.3 - swap.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::::current_memory - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.0 - dup.2 - eq - neq - if.true - drop - else - push.4 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.12 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movdn.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::::deallocate - trace.252 - nop - end - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc ::current_memory( - i32, - i32, - i32, - i32 -) - push.0 - push.0 - dup.5 - eq - neq - if.true - movdn.3 - drop - drop - drop - push.0 - push.4 - else - dup.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.0 - dup.2 - eq - neq - dup.0 - if.true - swap.1 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.0 - else - push.4 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.5 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - movup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - swap.3 - trace.240 - nop - exec.::intrinsics::i32::wrapping_mul - trace.252 - nop - movup.2 - swap.1 - end - push.8 - push.4 - movup.3 - cdrop - end - movup.2 - u32wrapping_add - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc ::deallocate( - i32, - i32, - i32 -) - push.0 - push.0 - dup.4 - eq - neq - if.true - drop - drop - drop - else - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::__rustc::__rust_dealloc - trace.252 - nop - end -end - -@callconv("C") -proc ::allocate( - i32, - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - push.8 - dup.2 - u32wrapping_add - movup.2 - swap.5 - movdn.2 - swap.1 - swap.3 - swap.4 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::::alloc_impl - trace.252 - nop - push.12 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc ::try_allocate_in( - i32, - i32, - i32, - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.2 - push.0 - push.0 - dup.7 - u32wrapping_sub - push.4294967295 - movup.9 - dup.9 - u32wrapping_add - u32wrapping_add - u32and - push.0 - trace.240 - nop - exec.::intrinsics::i64::wrapping_mul - trace.252 - nop - push.0 - push.32 - push.0 - dup.0 - push.2147483648 - u32and - eq.2147483648 - assertz - assertz - dup.0 - push.4294967295 - u32lte - assert - dup.3 - dup.3 - movup.2 - trace.240 - nop - exec.::std::math::u64::shr - trace.252 - nop - drop - neq - if.true - drop - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.0 - push.3735929054 - dup.0 - dup.1 - swap.4 - swap.1 - swap.3 - swap.5 - else - drop - push.0 - push.2147483648 - dup.7 - u32wrapping_sub - dup.2 - swap.1 - u32lte - neq - dup.0 - if.true - push.0 - dup.2 - neq - if.true - push.0 - movup.6 - neq - if.true - push.1 - dup.3 - dup.7 - dup.4 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::::alloc_impl - trace.252 - nop - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - else - push.8 - dup.3 - u32wrapping_add - dup.6 - dup.3 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::::allocate - trace.252 - nop - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - end - push.0 - dup.1 - neq - dup.0 - if.true - movup.7 - movup.4 - drop - drop - push.8 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.5 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - else - movup.6 - movup.2 - drop - drop - push.8 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.3 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.5 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - end - push.1 - push.0 - movup.2 - cdrop - else - movup.2 - swap.5 - movdn.2 - swap.4 - swap.1 - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.4 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - swap.1 - swap.3 - swap.2 - swap.1 - end - else - swap.1 - drop - movup.3 - drop - movup.3 - drop - movup.3 - drop - push.3735929054 - end - push.0 - push.1 - dup.3 - cdrop - push.3735929054 - dup.3 - dup.5 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.7 - swap.1 - cdrop - push.3735929054 - dup.5 - movup.2 - swap.7 - movdn.2 - cdrop - push.3735929054 - movup.2 - swap.7 - movdn.2 - swap.1 - swap.5 - cdrop - swap.1 - swap.5 - swap.4 - swap.2 - swap.3 - swap.1 - end - movup.5 - eq.0 - if.true - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.4 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.1 - swap.1 - else - drop - drop - end - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::handle_error(i32, i32) - drop - drop - push.0 - assert -end - -@callconv("C") -proc ::max( - i32, - i32 -) -> i32 - push.0 - dup.2 - dup.2 - swap.1 - u32gt - neq - cdrop -end - -@callconv("C") -proc miden::active_note::get_inputs(i32) -> i32 - trace.240 - nop - exec.::miden::active_note::get_inputs - trace.252 - nop - swap.1 - drop -end - -@callconv("C") -pub proc cabi_realloc(i32, i32, i32, i32) -> i32 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::cabi_realloc_wit_bindgen_0_46_0 - trace.252 - nop -end - -@callconv("C") -proc alloc::alloc::alloc(i32, i32) -> i32 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::__rustc::__rust_no_alloc_shim_is_unstable_v2 - trace.252 - nop - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::__rustc::__rust_alloc - trace.252 - nop -end - -@callconv("C") -proc wit_bindgen::rt::cabi_realloc( - i32, - i32, - i32, - i32 -) -> i32 - push.0 - dup.2 - neq - if.true - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::__rustc::__rust_realloc - trace.252 - nop - push.0 - push.3735929054 - movup.2 - else - drop - drop - push.0 - push.0 - dup.3 - eq - neq - dup.0 - if.true - movup.2 - drop - push.3735929054 - else - movup.2 - dup.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::alloc::alloc::alloc - trace.252 - nop - end - push.0 - push.1 - dup.3 - cdrop - push.3735929054 - swap.1 - swap.4 - swap.1 - swap.2 - swap.3 - cdrop - swap.1 - end - movup.2 - eq.0 - if.true - swap.1 - drop - push.0 - dup.1 - neq - push.1 - push.0 - dup.2 - cdrop - push.3735929054 - movdn.3 - movdn.3 - cdrop - else - drop - push.0 - swap.1 - end - push.0 - movup.2 - eq - if.true - nop - else - drop - push.0 - assert - end -end - -@callconv("C") -pub proc cabi_realloc_wit_bindgen_0_46_0(i32, i32, i32, i32) -> i32 - trace.240 - nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::wit_bindgen::rt::cabi_realloc - trace.252 - nop -end - -# mod miden::active_note - -pub proc get_inputs - push.4294967295 - push.1 - push.2 - push.3 - dup.4 - mem_storew_be - dropw - push.4 -end - diff --git a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.wat b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.wat deleted file mode 100644 index 88ad45361..000000000 --- a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.wat +++ /dev/null @@ -1,626 +0,0 @@ -(module $abi_transform_tx_kernel_get_inputs_4.wasm - (type (;0;) (func (param i32 i32) (result i32))) - (type (;1;) (func (param i32 i32 i32))) - (type (;2;) (func (param i32 i32 i32 i32) (result i32))) - (type (;3;) (func)) - (type (;4;) (func (param i32 i32 i32) (result i32))) - (type (;5;) (func (result i32))) - (type (;6;) (func (param i32))) - (type (;7;) (func (param i32) (result f32))) - (type (;8;) (func (param f32 f32))) - (type (;9;) (func (param i32 i32 i32 i32))) - (type (;10;) (func (param i32 i32 i32 i32 i32))) - (type (;11;) (func (param i32 i32))) - (type (;12;) (func (param i32) (result i32))) - (table (;0;) 2 2 funcref) - (memory (;0;) 17) - (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) - (export "memory" (memory 0)) - (export "entrypoint" (func $entrypoint)) - (export "cabi_realloc_wit_bindgen_0_46_0" (func $cabi_realloc_wit_bindgen_0_46_0)) - (export "cabi_realloc" (func $cabi_realloc)) - (elem (;0;) (i32.const 1) func $cabi_realloc) - (func $__rustc::__rust_alloc (;0;) (type 0) (param i32 i32) (result i32) - i32.const 1048580 - local.get 1 - local.get 0 - call $::alloc - ) - (func $__rustc::__rust_dealloc (;1;) (type 1) (param i32 i32 i32)) - (func $__rustc::__rust_realloc (;2;) (type 2) (param i32 i32 i32 i32) (result i32) - block ;; label = @1 - i32.const 1048580 - local.get 2 - local.get 3 - call $::alloc - local.tee 2 - i32.eqz - br_if 0 (;@1;) - local.get 3 - local.get 1 - local.get 3 - local.get 1 - i32.lt_u - select - local.tee 3 - i32.eqz - br_if 0 (;@1;) - local.get 2 - local.get 0 - local.get 3 - memory.copy - end - local.get 2 - ) - (func $__rustc::__rust_alloc_zeroed (;3;) (type 0) (param i32 i32) (result i32) - block ;; label = @1 - i32.const 1048580 - local.get 1 - local.get 0 - call $::alloc - local.tee 1 - i32.eqz - br_if 0 (;@1;) - local.get 0 - i32.eqz - br_if 0 (;@1;) - local.get 1 - i32.const 0 - local.get 0 - memory.fill - end - local.get 1 - ) - (func $entrypoint (;4;) (type 3) - (local i32 i32 i32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 0 - global.set $__stack_pointer - local.get 0 - i32.const 4 - i32.add - call $miden_base_sys::bindings::active_note::get_inputs - local.get 0 - i32.load offset=12 - local.tee 1 - call $>::from - i32.const 4 - call $intrinsics::felt::from_u32 - call $intrinsics::felt::assert_eq - block ;; label = @1 - local.get 1 - i32.eqz - br_if 0 (;@1;) - local.get 0 - i32.load offset=8 - local.tee 2 - f32.load - i32.const -1 - call $intrinsics::felt::from_u32 - call $intrinsics::felt::assert_eq - local.get 1 - i32.const 1 - i32.eq - br_if 0 (;@1;) - local.get 2 - f32.load offset=4 - i32.const 1 - call $intrinsics::felt::from_u32 - call $intrinsics::felt::assert_eq - local.get 1 - i32.const 2 - i32.le_u - br_if 0 (;@1;) - local.get 2 - f32.load offset=8 - i32.const 2 - call $intrinsics::felt::from_u32 - call $intrinsics::felt::assert_eq - local.get 1 - i32.const 3 - i32.eq - br_if 0 (;@1;) - local.get 2 - f32.load offset=12 - i32.const 3 - call $intrinsics::felt::from_u32 - call $intrinsics::felt::assert_eq - local.get 0 - i32.const 4 - i32.add - call $ as core::ops::drop::Drop>::drop - local.get 0 - i32.const 4 - i32.add - call $ as core::ops::drop::Drop>::drop - local.get 0 - i32.const 16 - i32.add - global.set $__stack_pointer - return - end - unreachable - ) - (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;5;) (type 3) - return - ) - (func $::alloc (;6;) (type 4) (param i32 i32 i32) (result i32) - (local i32 i32) - block ;; label = @1 - local.get 1 - i32.const 16 - local.get 1 - i32.const 16 - i32.gt_u - select - local.tee 3 - local.get 3 - i32.const -1 - i32.add - i32.and - br_if 0 (;@1;) - local.get 2 - i32.const -2147483648 - local.get 1 - local.get 3 - call $::max - local.tee 1 - i32.sub - i32.gt_u - br_if 0 (;@1;) - i32.const 0 - local.set 3 - local.get 2 - local.get 1 - i32.add - i32.const -1 - i32.add - i32.const 0 - local.get 1 - i32.sub - i32.and - local.set 2 - block ;; label = @2 - local.get 0 - i32.load - br_if 0 (;@2;) - local.get 0 - call $intrinsics::mem::heap_base - memory.size - i32.const 16 - i32.shl - i32.add - i32.store - end - block ;; label = @2 - local.get 2 - local.get 0 - i32.load - local.tee 4 - i32.const -1 - i32.xor - i32.gt_u - br_if 0 (;@2;) - local.get 0 - local.get 4 - local.get 2 - i32.add - i32.store - local.get 4 - local.get 1 - i32.add - local.set 3 - end - local.get 3 - return - end - unreachable - ) - (func $intrinsics::mem::heap_base (;7;) (type 5) (result i32) - unreachable - ) - (func $::with_capacity_in (;8;) (type 1) (param i32 i32 i32) - (local i32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 3 - global.set $__stack_pointer - local.get 3 - i32.const 4 - i32.add - i32.const 256 - i32.const 0 - local.get 1 - local.get 2 - call $::try_allocate_in - local.get 3 - i32.load offset=8 - local.set 2 - block ;; label = @1 - local.get 3 - i32.load offset=4 - i32.const 1 - i32.ne - br_if 0 (;@1;) - local.get 2 - local.get 3 - i32.load offset=12 - call $alloc::raw_vec::handle_error - unreachable - end - local.get 0 - local.get 3 - i32.load offset=12 - i32.store offset=4 - local.get 0 - local.get 2 - i32.store - local.get 3 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $ as core::ops::drop::Drop>::drop (;9;) (type 6) (param i32) - local.get 0 - i32.const 4 - i32.const 4 - call $::deallocate - ) - (func $miden_base_sys::bindings::active_note::get_inputs (;10;) (type 6) (param i32) - (local i32 i32 i32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 1 - global.set $__stack_pointer - local.get 1 - i32.const 8 - i32.add - i32.const 4 - i32.const 4 - call $::with_capacity_in - local.get 1 - i32.load offset=8 - local.set 2 - local.get 0 - local.get 1 - i32.load offset=12 - local.tee 3 - i32.const 2 - i32.shr_u - call $miden::active_note::get_inputs - i32.store offset=8 - local.get 0 - local.get 3 - i32.store offset=4 - local.get 0 - local.get 2 - i32.store - local.get 1 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $ as core::ops::drop::Drop>::drop (;11;) (type 6) (param i32)) - (func $>::from (;12;) (type 7) (param i32) (result f32) - local.get 0 - f32.reinterpret_i32 - ) - (func $intrinsics::felt::assert_eq (;13;) (type 8) (param f32 f32) - unreachable - ) - (func $intrinsics::felt::from_u32 (;14;) (type 7) (param i32) (result f32) - unreachable - ) - (func $::alloc_impl (;15;) (type 9) (param i32 i32 i32 i32) - block ;; label = @1 - local.get 2 - i32.eqz - br_if 0 (;@1;) - call $__rustc::__rust_no_alloc_shim_is_unstable_v2 - block ;; label = @2 - local.get 3 - br_if 0 (;@2;) - local.get 2 - local.get 1 - call $__rustc::__rust_alloc - local.set 1 - br 1 (;@1;) - end - local.get 2 - local.get 1 - call $__rustc::__rust_alloc_zeroed - local.set 1 - end - local.get 0 - local.get 2 - i32.store offset=4 - local.get 0 - local.get 1 - i32.store - ) - (func $::deallocate (;16;) (type 1) (param i32 i32 i32) - (local i32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 3 - global.set $__stack_pointer - local.get 3 - i32.const 4 - i32.add - local.get 0 - local.get 1 - local.get 2 - call $::current_memory - block ;; label = @1 - local.get 3 - i32.load offset=8 - local.tee 2 - i32.eqz - br_if 0 (;@1;) - local.get 3 - i32.load offset=4 - local.get 2 - local.get 3 - i32.load offset=12 - call $::deallocate - end - local.get 3 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $::current_memory (;17;) (type 9) (param i32 i32 i32 i32) - (local i32 i32 i32) - i32.const 0 - local.set 4 - i32.const 4 - local.set 5 - block ;; label = @1 - local.get 3 - i32.eqz - br_if 0 (;@1;) - local.get 1 - i32.load - local.tee 6 - i32.eqz - br_if 0 (;@1;) - local.get 0 - local.get 2 - i32.store offset=4 - local.get 0 - local.get 1 - i32.load offset=4 - i32.store - local.get 6 - local.get 3 - i32.mul - local.set 4 - i32.const 8 - local.set 5 - end - local.get 0 - local.get 5 - i32.add - local.get 4 - i32.store - ) - (func $::deallocate (;18;) (type 1) (param i32 i32 i32) - block ;; label = @1 - local.get 2 - i32.eqz - br_if 0 (;@1;) - local.get 0 - local.get 2 - local.get 1 - call $__rustc::__rust_dealloc - end - ) - (func $::allocate (;19;) (type 1) (param i32 i32 i32) - (local i32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 3 - global.set $__stack_pointer - local.get 3 - i32.const 8 - i32.add - local.get 1 - local.get 2 - i32.const 0 - call $::alloc_impl - local.get 3 - i32.load offset=12 - local.set 2 - local.get 0 - local.get 3 - i32.load offset=8 - i32.store - local.get 0 - local.get 2 - i32.store offset=4 - local.get 3 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $::try_allocate_in (;20;) (type 10) (param i32 i32 i32 i32 i32) - (local i32 i64) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 5 - global.set $__stack_pointer - block ;; label = @1 - block ;; label = @2 - block ;; label = @3 - local.get 3 - local.get 4 - i32.add - i32.const -1 - i32.add - i32.const 0 - local.get 3 - i32.sub - i32.and - i64.extend_i32_u - local.get 1 - i64.extend_i32_u - i64.mul - local.tee 6 - i64.const 32 - i64.shr_u - i32.wrap_i64 - br_if 0 (;@3;) - local.get 6 - i32.wrap_i64 - local.tee 4 - i32.const -2147483648 - local.get 3 - i32.sub - i32.le_u - br_if 1 (;@2;) - end - local.get 0 - i32.const 0 - i32.store offset=4 - i32.const 1 - local.set 3 - br 1 (;@1;) - end - block ;; label = @2 - local.get 4 - br_if 0 (;@2;) - local.get 0 - local.get 3 - i32.store offset=8 - i32.const 0 - local.set 3 - local.get 0 - i32.const 0 - i32.store offset=4 - br 1 (;@1;) - end - block ;; label = @2 - block ;; label = @3 - local.get 2 - br_if 0 (;@3;) - local.get 5 - i32.const 8 - i32.add - local.get 3 - local.get 4 - call $::allocate - local.get 5 - i32.load offset=8 - local.set 2 - br 1 (;@2;) - end - local.get 5 - local.get 3 - local.get 4 - i32.const 1 - call $::alloc_impl - local.get 5 - i32.load - local.set 2 - end - block ;; label = @2 - local.get 2 - br_if 0 (;@2;) - local.get 0 - local.get 4 - i32.store offset=8 - local.get 0 - local.get 3 - i32.store offset=4 - i32.const 1 - local.set 3 - br 1 (;@1;) - end - local.get 0 - local.get 2 - i32.store offset=8 - local.get 0 - local.get 1 - i32.store offset=4 - i32.const 0 - local.set 3 - end - local.get 0 - local.get 3 - i32.store - local.get 5 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $alloc::raw_vec::handle_error (;21;) (type 11) (param i32 i32) - unreachable - ) - (func $::max (;22;) (type 0) (param i32 i32) (result i32) - local.get 0 - local.get 1 - local.get 0 - local.get 1 - i32.gt_u - select - ) - (func $miden::active_note::get_inputs (;23;) (type 12) (param i32) (result i32) - unreachable - ) - (func $cabi_realloc (;24;) (type 2) (param i32 i32 i32 i32) (result i32) - local.get 0 - local.get 1 - local.get 2 - local.get 3 - call $cabi_realloc_wit_bindgen_0_46_0 - ) - (func $alloc::alloc::alloc (;25;) (type 0) (param i32 i32) (result i32) - call $__rustc::__rust_no_alloc_shim_is_unstable_v2 - local.get 1 - local.get 0 - call $__rustc::__rust_alloc - ) - (func $wit_bindgen::rt::cabi_realloc (;26;) (type 2) (param i32 i32 i32 i32) (result i32) - block ;; label = @1 - block ;; label = @2 - block ;; label = @3 - local.get 1 - br_if 0 (;@3;) - local.get 3 - i32.eqz - br_if 2 (;@1;) - local.get 2 - local.get 3 - call $alloc::alloc::alloc - local.set 2 - br 1 (;@2;) - end - local.get 0 - local.get 1 - local.get 2 - local.get 3 - call $__rustc::__rust_realloc - local.set 2 - end - local.get 2 - br_if 0 (;@1;) - unreachable - end - local.get 2 - ) - (func $cabi_realloc_wit_bindgen_0_46_0 (;27;) (type 2) (param i32 i32 i32 i32) (result i32) - local.get 0 - local.get 1 - local.get 2 - local.get 3 - call $wit_bindgen::rt::cabi_realloc - ) - (data $.rodata (;0;) (i32.const 1048576) "\01\00\00\00") -) diff --git a/tests/integration/expected/add_felt.hir b/tests/integration/expected/add_felt.hir index ffadf0fba..6ac560ce4 100644 --- a/tests/integration/expected/add_felt.hir +++ b/tests/integration/expected/add_felt.hir @@ -2,14 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @add_felt { public builtin.function @entrypoint(v0: felt, v1: felt) -> felt { ^block4(v0: felt, v1: felt): - v3 = hir.exec @root_ns:root@1.0.0/add_felt/intrinsics::felt::add(v0, v1) : felt - builtin.ret v3; - }; - - private builtin.function @intrinsics::felt::add(v4: felt, v5: felt) -> felt { - ^block6(v4: felt, v5: felt): - v6 = arith.add v4, v5 : felt #[overflow = unchecked]; - builtin.ret v6; + v5 = arith.add v0, v1 : felt #[overflow = unchecked]; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/add_felt.masm b/tests/integration/expected/add_felt.masm index a874a030f..ff3f5b6ac 100644 --- a/tests/integration/expected/add_felt.masm +++ b/tests/integration/expected/add_felt.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,19 +10,11 @@ proc init mem_store.278528 end -# mod root_ns:root@1.0.0::add_felt +# mod ::"root_ns:root@1.0.0"::add_felt +@locals("2") @callconv("C") pub proc entrypoint(felt, felt) -> felt - trace.240 - nop - exec.::root_ns:root@1.0.0::add_felt::intrinsics::felt::add - trace.252 - nop -end - -@callconv("C") -proc intrinsics::felt::add(felt, felt) -> felt add end diff --git a/tests/integration/expected/add_i128.hir b/tests/integration/expected/add_i128.hir index 04c58d6eb..68e771ccf 100644 --- a/tests/integration/expected/add_i128.hir +++ b/tests/integration/expected/add_i128.hir @@ -2,24 +2,35 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_c232a9b0045c768c9a1fca4d8a419280b591a50dcbebe88fe280529cdd423ec0 { public builtin.function @entrypoint(v0: i32, v1: i64, v2: i64, v3: i64, v4: i64) { ^block6(v0: i32, v1: i64, v2: i64, v3: i64, v4: i64): - v6 = arith.join v1, v2 : i128; - v5 = arith.join v3, v4 : i128; - v7 = arith.add v5, v6 : i128 #[overflow = wrapping]; - v8, v9 = arith.split v7 : i64, i64; - v11 = arith.constant 8 : u32; - v10 = hir.bitcast v0 : u32; - v12 = arith.add v10, v11 : u32 #[overflow = checked]; - v21 = arith.constant 8 : u32; - v14 = arith.mod v12, v21 : u32; - hir.assertz v14 #[code = 250]; - v15 = hir.int_to_ptr v12 : ptr; - hir.store v15, v8; - v16 = hir.bitcast v0 : u32; - v20 = arith.constant 8 : u32; - v18 = arith.mod v16, v20 : u32; - hir.assertz v18 #[code = 250]; - v19 = hir.int_to_ptr v16 : ptr; - hir.store v19, v9; + hir.store_local v0 #[local = lv0]; + hir.store_local v1 #[local = lv1]; + hir.store_local v2 #[local = lv2]; + v7 = hir.load_local : i64 #[local = lv1]; + v8 = hir.load_local : i64 #[local = lv2]; + v10 = arith.join v7, v8 : i128; + v9 = arith.join v3, v4 : i128; + v11 = arith.add v9, v10 : i128 #[overflow = wrapping]; + v12, v13 = arith.split v11 : i64, i64; + hir.store_local v12 #[local = lv1]; + hir.store_local v13 #[local = lv2]; + v14 = hir.load_local : i32 #[local = lv0]; + v15 = hir.load_local : i64 #[local = lv1]; + v28 = arith.constant 8 : u32; + v16 = hir.bitcast v14 : u32; + v18 = arith.add v16, v28 : u32 #[overflow = checked]; + v32 = arith.constant 8 : u32; + v20 = arith.mod v18, v32 : u32; + hir.assertz v20 #[code = 250]; + v21 = hir.int_to_ptr v18 : ptr; + hir.store v21, v15; + v22 = hir.load_local : i32 #[local = lv0]; + v23 = hir.load_local : i64 #[local = lv2]; + v24 = hir.bitcast v22 : u32; + v31 = arith.constant 8 : u32; + v26 = arith.mod v24, v31 : u32; + hir.assertz v26 #[code = 250]; + v27 = hir.int_to_ptr v24 : ptr; + hir.store v27, v23; builtin.ret ; }; diff --git a/tests/integration/expected/add_i128.masm b/tests/integration/expected/add_i128.masm index 900face52..029facf41 100644 --- a/tests/integration/expected/add_i128.masm +++ b/tests/integration/expected/add_i128.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,24 +16,107 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_c232a9b0045c768c9a1fca4d8a419280b591a50dcbebe88fe280529cdd423ec0 +# mod ::"root_ns:root@1.0.0"::test_rust_c232a9b0045c768c9a1fca4d8a419280b591a50dcbebe88fe280529cdd423ec0 +@locals("9") @callconv("C") pub proc entrypoint(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) - movdn.4 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + movdn.7 + movdn.7 + movdn.7 + movdn.7 movup.3 movup.3 - movup.6 - movup.6 - movup.8 - movup.8 trace.240 nop exec.::intrinsics::i128::add trace.252 nop + locaddr.1 + push.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 push.8 - dup.5 + movup.3 add u32assert push.8 @@ -51,6 +134,23 @@ pub proc entrypoint(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 movup.2 push.8 dup.1 diff --git a/tests/integration/expected/add_i16.hir b/tests/integration/expected/add_i16.hir index 2e660c575..13eff2811 100644 --- a/tests/integration/expected/add_i16.hir +++ b/tests/integration/expected/add_i16.hir @@ -2,9 +2,9 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_06c525756fe79253a5d667de4160df5c89e45269648c98bb21fd9430caec0b19 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.add v1, v0 : i32 #[overflow = wrapping]; - v4 = arith.sext v3 : i32; - builtin.ret v4; + v5 = arith.add v1, v0 : i32 #[overflow = wrapping]; + v6 = arith.sext v5 : i32; + builtin.ret v6; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/add_i16.masm b/tests/integration/expected/add_i16.masm index 01c03e416..853632cd5 100644 --- a/tests/integration/expected/add_i16.masm +++ b/tests/integration/expected/add_i16.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_06c525756fe79253a5d667de4160df5c89e45269648c98bb21fd9430caec0b19 +# mod ::"root_ns:root@1.0.0"::test_rust_06c525756fe79253a5d667de4160df5c89e45269648c98bb21fd9430caec0b19 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32wrapping_add diff --git a/tests/integration/expected/add_i32.hir b/tests/integration/expected/add_i32.hir index e22813949..3401f6606 100644 --- a/tests/integration/expected/add_i32.hir +++ b/tests/integration/expected/add_i32.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_e52816950d9b2deff10441c5aff28d88268e921c4c01a207c8743d871bd3a69f { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.add v1, v0 : i32 #[overflow = wrapping]; - builtin.ret v3; + v5 = arith.add v1, v0 : i32 #[overflow = wrapping]; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/add_i32.masm b/tests/integration/expected/add_i32.masm index a6bb1271f..aea0c6426 100644 --- a/tests/integration/expected/add_i32.masm +++ b/tests/integration/expected/add_i32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_e52816950d9b2deff10441c5aff28d88268e921c4c01a207c8743d871bd3a69f +# mod ::"root_ns:root@1.0.0"::test_rust_e52816950d9b2deff10441c5aff28d88268e921c4c01a207c8743d871bd3a69f +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32wrapping_add diff --git a/tests/integration/expected/add_i64.hir b/tests/integration/expected/add_i64.hir index ff9baea92..e866333d5 100644 --- a/tests/integration/expected/add_i64.hir +++ b/tests/integration/expected/add_i64.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_cc1ebe8ed410a033febcc7c6a7e1b2473b2337e0dff32b08d3c91be5bbc2cc0a { public builtin.function @entrypoint(v0: i64, v1: i64) -> i64 { ^block6(v0: i64, v1: i64): - v3 = arith.add v1, v0 : i64 #[overflow = wrapping]; - builtin.ret v3; + v5 = arith.add v1, v0 : i64 #[overflow = wrapping]; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/add_i64.masm b/tests/integration/expected/add_i64.masm index 315c42e67..c29115397 100644 --- a/tests/integration/expected/add_i64.masm +++ b/tests/integration/expected/add_i64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,13 +16,14 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_cc1ebe8ed410a033febcc7c6a7e1b2473b2337e0dff32b08d3c91be5bbc2cc0a +# mod ::"root_ns:root@1.0.0"::test_rust_cc1ebe8ed410a033febcc7c6a7e1b2473b2337e0dff32b08d3c91be5bbc2cc0a +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] trace.240 nop - exec.::std::math::u64::wrapping_add + exec.::miden::core::math::u64::wrapping_add trace.252 nop end diff --git a/tests/integration/expected/add_i8.hir b/tests/integration/expected/add_i8.hir index a07babb0c..4d336c544 100644 --- a/tests/integration/expected/add_i8.hir +++ b/tests/integration/expected/add_i8.hir @@ -2,9 +2,9 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_62ba1afb3113b5a2557098b909eff557cd716bf21b07843db3bfb765ff41e9f7 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.add v1, v0 : i32 #[overflow = wrapping]; - v4 = arith.sext v3 : i32; - builtin.ret v4; + v5 = arith.add v1, v0 : i32 #[overflow = wrapping]; + v6 = arith.sext v5 : i32; + builtin.ret v6; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/add_i8.masm b/tests/integration/expected/add_i8.masm index 8435cf793..9bc4bdc6e 100644 --- a/tests/integration/expected/add_i8.masm +++ b/tests/integration/expected/add_i8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_62ba1afb3113b5a2557098b909eff557cd716bf21b07843db3bfb765ff41e9f7 +# mod ::"root_ns:root@1.0.0"::test_rust_62ba1afb3113b5a2557098b909eff557cd716bf21b07843db3bfb765ff41e9f7 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32wrapping_add diff --git a/tests/integration/expected/add_u128.hir b/tests/integration/expected/add_u128.hir index 9d3556c70..b90470021 100644 --- a/tests/integration/expected/add_u128.hir +++ b/tests/integration/expected/add_u128.hir @@ -2,24 +2,35 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_08840461ad34cd3a46fc6a8d8f1a1282c51e37f56df328c1bc8d26d8c7a38f10 { public builtin.function @entrypoint(v0: i32, v1: i64, v2: i64, v3: i64, v4: i64) { ^block6(v0: i32, v1: i64, v2: i64, v3: i64, v4: i64): - v6 = arith.join v1, v2 : i128; - v5 = arith.join v3, v4 : i128; - v7 = arith.add v5, v6 : i128 #[overflow = wrapping]; - v8, v9 = arith.split v7 : i64, i64; - v11 = arith.constant 8 : u32; - v10 = hir.bitcast v0 : u32; - v12 = arith.add v10, v11 : u32 #[overflow = checked]; - v21 = arith.constant 8 : u32; - v14 = arith.mod v12, v21 : u32; - hir.assertz v14 #[code = 250]; - v15 = hir.int_to_ptr v12 : ptr; - hir.store v15, v8; - v16 = hir.bitcast v0 : u32; - v20 = arith.constant 8 : u32; - v18 = arith.mod v16, v20 : u32; - hir.assertz v18 #[code = 250]; - v19 = hir.int_to_ptr v16 : ptr; - hir.store v19, v9; + hir.store_local v0 #[local = lv0]; + hir.store_local v1 #[local = lv1]; + hir.store_local v2 #[local = lv2]; + v7 = hir.load_local : i64 #[local = lv1]; + v8 = hir.load_local : i64 #[local = lv2]; + v10 = arith.join v7, v8 : i128; + v9 = arith.join v3, v4 : i128; + v11 = arith.add v9, v10 : i128 #[overflow = wrapping]; + v12, v13 = arith.split v11 : i64, i64; + hir.store_local v12 #[local = lv1]; + hir.store_local v13 #[local = lv2]; + v14 = hir.load_local : i32 #[local = lv0]; + v15 = hir.load_local : i64 #[local = lv1]; + v28 = arith.constant 8 : u32; + v16 = hir.bitcast v14 : u32; + v18 = arith.add v16, v28 : u32 #[overflow = checked]; + v32 = arith.constant 8 : u32; + v20 = arith.mod v18, v32 : u32; + hir.assertz v20 #[code = 250]; + v21 = hir.int_to_ptr v18 : ptr; + hir.store v21, v15; + v22 = hir.load_local : i32 #[local = lv0]; + v23 = hir.load_local : i64 #[local = lv2]; + v24 = hir.bitcast v22 : u32; + v31 = arith.constant 8 : u32; + v26 = arith.mod v24, v31 : u32; + hir.assertz v26 #[code = 250]; + v27 = hir.int_to_ptr v24 : ptr; + hir.store v27, v23; builtin.ret ; }; diff --git a/tests/integration/expected/add_u128.masm b/tests/integration/expected/add_u128.masm index 74f6bc9fa..c6de0f035 100644 --- a/tests/integration/expected/add_u128.masm +++ b/tests/integration/expected/add_u128.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,24 +16,107 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_08840461ad34cd3a46fc6a8d8f1a1282c51e37f56df328c1bc8d26d8c7a38f10 +# mod ::"root_ns:root@1.0.0"::test_rust_08840461ad34cd3a46fc6a8d8f1a1282c51e37f56df328c1bc8d26d8c7a38f10 +@locals("9") @callconv("C") pub proc entrypoint(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) - movdn.4 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + movdn.7 + movdn.7 + movdn.7 + movdn.7 movup.3 movup.3 - movup.6 - movup.6 - movup.8 - movup.8 trace.240 nop exec.::intrinsics::i128::add trace.252 nop + locaddr.1 + push.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 push.8 - dup.5 + movup.3 add u32assert push.8 @@ -51,6 +134,23 @@ pub proc entrypoint(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 movup.2 push.8 dup.1 diff --git a/tests/integration/expected/add_u16.hir b/tests/integration/expected/add_u16.hir index c01b147b4..81520de48 100644 --- a/tests/integration/expected/add_u16.hir +++ b/tests/integration/expected/add_u16.hir @@ -2,10 +2,10 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_41c5fa21fe36fdf84a953669187b56426048e7b2f08e8de91e3e989c579ed46f { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v4 = arith.constant 65535 : i32; - v3 = arith.add v1, v0 : i32 #[overflow = wrapping]; - v5 = arith.band v3, v4 : i32; - builtin.ret v5; + v8 = arith.constant 65535 : i32; + v5 = arith.add v1, v0 : i32 #[overflow = wrapping]; + v7 = arith.band v5, v8 : i32; + builtin.ret v7; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/add_u16.masm b/tests/integration/expected/add_u16.masm index dacb36b13..1345f7ba2 100644 --- a/tests/integration/expected/add_u16.masm +++ b/tests/integration/expected/add_u16.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_41c5fa21fe36fdf84a953669187b56426048e7b2f08e8de91e3e989c579ed46f +# mod ::"root_ns:root@1.0.0"::test_rust_41c5fa21fe36fdf84a953669187b56426048e7b2f08e8de91e3e989c579ed46f +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 push.65535 diff --git a/tests/integration/expected/add_u32.hir b/tests/integration/expected/add_u32.hir index 6ae425139..3c79afda0 100644 --- a/tests/integration/expected/add_u32.hir +++ b/tests/integration/expected/add_u32.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_2aac0275c4e31b615b4d6bf7d39869ccab374d5df702b3ef708ea7f981b4073c { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.add v1, v0 : i32 #[overflow = wrapping]; - builtin.ret v3; + v5 = arith.add v1, v0 : i32 #[overflow = wrapping]; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/add_u32.masm b/tests/integration/expected/add_u32.masm index fc6471bf9..e2762012c 100644 --- a/tests/integration/expected/add_u32.masm +++ b/tests/integration/expected/add_u32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_2aac0275c4e31b615b4d6bf7d39869ccab374d5df702b3ef708ea7f981b4073c +# mod ::"root_ns:root@1.0.0"::test_rust_2aac0275c4e31b615b4d6bf7d39869ccab374d5df702b3ef708ea7f981b4073c +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32wrapping_add diff --git a/tests/integration/expected/add_u64.hir b/tests/integration/expected/add_u64.hir index 9418ef14e..a9269afd2 100644 --- a/tests/integration/expected/add_u64.hir +++ b/tests/integration/expected/add_u64.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_2c24c814fbf0c5ee22a60f52279e8f7639d56708da347e071f1130dc19dc9c07 { public builtin.function @entrypoint(v0: i64, v1: i64) -> i64 { ^block6(v0: i64, v1: i64): - v3 = arith.add v1, v0 : i64 #[overflow = wrapping]; - builtin.ret v3; + v5 = arith.add v1, v0 : i64 #[overflow = wrapping]; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/add_u64.masm b/tests/integration/expected/add_u64.masm index b921264c1..45cd7efbf 100644 --- a/tests/integration/expected/add_u64.masm +++ b/tests/integration/expected/add_u64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,13 +16,14 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_2c24c814fbf0c5ee22a60f52279e8f7639d56708da347e071f1130dc19dc9c07 +# mod ::"root_ns:root@1.0.0"::test_rust_2c24c814fbf0c5ee22a60f52279e8f7639d56708da347e071f1130dc19dc9c07 +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] trace.240 nop - exec.::std::math::u64::wrapping_add + exec.::miden::core::math::u64::wrapping_add trace.252 nop end diff --git a/tests/integration/expected/add_u8.hir b/tests/integration/expected/add_u8.hir index 4e9cea572..43f4293bc 100644 --- a/tests/integration/expected/add_u8.hir +++ b/tests/integration/expected/add_u8.hir @@ -2,10 +2,10 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_9c74aa9695b645cec4339ff01ac3e35e31b39b1feb0dfeef6ee7c94789fbcfce { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v4 = arith.constant 255 : i32; - v3 = arith.add v1, v0 : i32 #[overflow = wrapping]; - v5 = arith.band v3, v4 : i32; - builtin.ret v5; + v8 = arith.constant 255 : i32; + v5 = arith.add v1, v0 : i32 #[overflow = wrapping]; + v7 = arith.band v5, v8 : i32; + builtin.ret v7; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/add_u8.masm b/tests/integration/expected/add_u8.masm index 34aeea1a4..5425920c2 100644 --- a/tests/integration/expected/add_u8.masm +++ b/tests/integration/expected/add_u8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_9c74aa9695b645cec4339ff01ac3e35e31b39b1feb0dfeef6ee7c94789fbcfce +# mod ::"root_ns:root@1.0.0"::test_rust_9c74aa9695b645cec4339ff01ac3e35e31b39b1feb0dfeef6ee7c94789fbcfce +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 push.255 diff --git a/tests/integration/expected/adv_load_preimage.hir b/tests/integration/expected/adv_load_preimage.hir index 19d4c66d9..bc7bf618c 100644 --- a/tests/integration/expected/adv_load_preimage.hir +++ b/tests/integration/expected/adv_load_preimage.hir @@ -2,256 +2,299 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @adv_load_preimage { private builtin.function @__rustc::__rust_alloc(v0: i32, v1: i32) -> i32 { ^block4(v0: i32, v1: i32): - v3 = arith.constant 1048576 : i32; - v4 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/::alloc(v3, v1, v0) : i32 - builtin.ret v4; + v579 = arith.constant 1048576 : i32; + v6 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/::alloc(v579, v1, v0) : i32 + builtin.ret v6; }; - private builtin.function @__rustc::__rust_alloc_zeroed(v5: i32, v6: i32) -> i32 { - ^block6(v5: i32, v6: i32): - v8 = arith.constant 1048576 : i32; - v9 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/::alloc(v8, v6, v5) : i32 - v514 = arith.constant 0 : i32; - v10 = arith.constant 0 : i32; - v11 = arith.eq v9, v10 : i1; - v12 = arith.zext v11 : u32; - v13 = hir.bitcast v12 : i32; - v15 = arith.neq v13, v514 : i1; - scf.if v15{ - ^block8: + private builtin.function @__rustc::__rust_alloc_zeroed(v7: i32, v8: i32) -> i32 { + ^block6(v7: i32, v8: i32): + hir.store_local v7 #[local = lv0]; + hir.store_local v8 #[local = lv1]; + v11 = hir.load_local : i32 #[local = lv1]; + v12 = hir.load_local : i32 #[local = lv0]; + v583 = arith.constant 1048576 : i32; + v13 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/::alloc(v583, v11, v12) : i32 + hir.store_local v13 #[local = lv1]; + v591 = arith.constant 0 : i32; + v586 = arith.constant 0 : i32; + v15 = arith.eq v13, v586 : i1; + v16 = arith.zext v15 : u32; + v17 = hir.bitcast v16 : i32; + v19 = arith.neq v17, v591 : i1; + scf.if v19{ + ^block69: scf.yield ; } else { ^block9: - v512 = arith.constant 0 : i32; - v513 = arith.constant 0 : i32; - v17 = arith.eq v5, v513 : i1; - v18 = arith.zext v17 : u32; - v19 = hir.bitcast v18 : i32; - v21 = arith.neq v19, v512 : i1; - scf.if v21{ - ^block75: + v20 = hir.load_local : i32 #[local = lv0]; + v589 = arith.constant 0 : i32; + v590 = arith.constant 0 : i32; + v22 = arith.eq v20, v590 : i1; + v23 = arith.zext v22 : u32; + v24 = hir.bitcast v23 : i32; + v26 = arith.neq v24, v589 : i1; + scf.if v26{ + ^block68: scf.yield ; } else { ^block10: - v506 = arith.constant 0 : u8; - v24 = hir.bitcast v5 : u32; - v25 = hir.bitcast v9 : u32; - v26 = hir.int_to_ptr v25 : ptr; - hir.mem_set v26, v24, v506; + v27 = hir.load_local : i32 #[local = lv1]; + v29 = hir.load_local : i32 #[local = lv0]; + v581 = arith.constant 0 : u8; + v31 = hir.bitcast v29 : u32; + v32 = hir.bitcast v27 : u32; + v33 = hir.int_to_ptr v32 : ptr; + hir.mem_set v33, v31, v581; scf.yield ; }; scf.yield ; }; - builtin.ret v9; + v34 = hir.load_local : i32 #[local = lv1]; + builtin.ret v34; }; - public builtin.function @entrypoint(v28: i32, v29: felt, v30: felt, v31: felt, v32: felt) { - ^block11(v28: i32, v29: felt, v30: felt, v31: felt, v32: felt): - v37 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v38 = hir.bitcast v37 : ptr; - v39 = hir.load v38 : i32; - v40 = arith.constant 16 : i32; - v41 = arith.sub v39, v40 : i32 #[overflow = wrapping]; - v42 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v43 = hir.bitcast v42 : ptr; - hir.store v43, v41; - v44 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::advice::adv_push_mapvaln(v32, v31, v30, v29) : felt - v45 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::as_u64(v44) : i64 - v47 = arith.constant 3 : i32; - v46 = arith.trunc v45 : i32; - v48 = arith.band v46, v47 : i32; - v49 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::from_u32(v48) : felt - v33 = arith.constant 0 : i32; - v51 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::from_u32(v33) : felt - hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::assert_eq(v49, v51) - v54 = arith.constant 2 : i64; - v56 = hir.cast v54 : u32; - v55 = hir.bitcast v45 : u64; - v57 = arith.shr v55, v56 : u64; - v58 = hir.bitcast v57 : i64; - v59 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::from_u64_unchecked(v58) : felt - v60 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::as_u64(v59) : i64 - v518 = arith.constant 2 : u32; - v61 = arith.trunc v60 : i32; - v64 = arith.shl v61, v518 : i32; - v559 = arith.constant 4 : i32; - v560 = arith.constant 0 : i32; - v52 = arith.constant 4 : i32; - v53 = arith.add v41, v52 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/adv_load_preimage/::try_allocate_in(v53, v64, v560, v559, v559) - v69 = arith.constant 8 : u32; - v68 = hir.bitcast v41 : u32; - v70 = arith.add v68, v69 : u32 #[overflow = checked]; - v71 = arith.constant 4 : u32; - v72 = arith.mod v70, v71 : u32; - hir.assertz v72 #[code = 250]; - v73 = hir.int_to_ptr v70 : ptr; - v74 = hir.load v73 : i32; - v558 = arith.constant 4 : u32; - v75 = hir.bitcast v41 : u32; - v77 = arith.add v75, v558 : u32 #[overflow = checked]; - v557 = arith.constant 4 : u32; - v79 = arith.mod v77, v557 : u32; - hir.assertz v79 #[code = 250]; - v80 = hir.int_to_ptr v77 : ptr; - v81 = hir.load v80 : i32; - v556 = arith.constant 0 : i32; - v82 = arith.constant 1 : i32; - v83 = arith.eq v81, v82 : i1; - v84 = arith.zext v83 : u32; - v85 = hir.bitcast v84 : i32; - v87 = arith.neq v85, v556 : i1; - v523 = scf.if v87 : u32 { + public builtin.function @entrypoint(v35: i32, v36: felt, v37: felt, v38: felt, v39: felt) { + ^block11(v35: i32, v36: felt, v37: felt, v38: felt, v39: felt): + hir.store_local v35 #[local = lv0]; + hir.store_local v36 #[local = lv1]; + hir.store_local v37 #[local = lv2]; + hir.store_local v38 #[local = lv3]; + hir.store_local v39 #[local = lv4]; + v40 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v41 = hir.bitcast v40 : ptr; + v42 = hir.load v41 : i32; + v619 = arith.constant 16 : i32; + v44 = arith.sub v42, v619 : i32 #[overflow = wrapping]; + hir.store_local v44 #[local = lv5]; + v45 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v46 = hir.bitcast v45 : ptr; + hir.store v46, v44; + v47 = hir.load_local : felt #[local = lv4]; + v48 = hir.load_local : felt #[local = lv3]; + v49 = hir.load_local : felt #[local = lv2]; + v50 = hir.load_local : felt #[local = lv1]; + v51 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::advice::adv_push_mapvaln(v47, v48, v49, v50) : felt + v52 = hir.cast v51 : i64; + v608 = arith.constant 0 : felt; + v618 = arith.constant 3 : i32; + v53 = arith.trunc v52 : i32; + v55 = arith.band v53, v618 : i32; + v56 = hir.bitcast v55 : felt; + hir.assert_eq v56, v608; + v59 = hir.load_local : i32 #[local = lv5]; + v615 = arith.constant 2 : i64; + v65 = hir.cast v615 : u32; + v64 = hir.bitcast v52 : u64; + v66 = arith.shr v64, v65 : u64; + v67 = hir.bitcast v66 : i64; + v68 = arith.trunc v67 : felt; + hir.store_local v68 #[local = lv7]; + v607 = arith.constant 2 : u32; + v69 = hir.cast v68 : i64; + v70 = arith.trunc v69 : i32; + v73 = arith.shl v70, v607 : i32; + hir.store_local v73 #[local = lv8]; + v682 = arith.constant 4 : i32; + v617 = arith.constant 0 : i32; + v642 = arith.constant 4 : i32; + v61 = arith.add v59, v642 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/adv_load_preimage/::try_allocate_in(v61, v73, v617, v682, v682) + v77 = hir.load_local : i32 #[local = lv5]; + v614 = arith.constant 8 : u32; + v78 = hir.bitcast v77 : u32; + v80 = arith.add v78, v614 : u32 #[overflow = checked]; + v613 = arith.constant 4 : u32; + v82 = arith.mod v80, v613 : u32; + hir.assertz v82 #[code = 250]; + v83 = hir.int_to_ptr v80 : ptr; + v84 = hir.load v83 : i32; + hir.store_local v84 #[local = lv9]; + v85 = hir.load_local : i32 #[local = lv5]; + v681 = arith.constant 4 : u32; + v86 = hir.bitcast v85 : u32; + v88 = arith.add v86, v681 : u32 #[overflow = checked]; + v680 = arith.constant 4 : u32; + v90 = arith.mod v88, v680 : u32; + hir.assertz v90 #[code = 250]; + v91 = hir.int_to_ptr v88 : ptr; + v92 = hir.load v91 : i32; + v679 = arith.constant 0 : i32; + v612 = arith.constant 1 : i32; + v94 = arith.eq v92, v612 : i1; + v95 = arith.zext v94 : u32; + v96 = hir.bitcast v95 : i32; + v98 = arith.neq v96, v679 : i1; + v647 = scf.if v98 : u32 { ^block14: - v178 = arith.constant 12 : u32; - v177 = hir.bitcast v41 : u32; - v179 = arith.add v177, v178 : u32 #[overflow = checked]; - v555 = arith.constant 4 : u32; - v181 = arith.mod v179, v555 : u32; - hir.assertz v181 #[code = 250]; - v182 = hir.int_to_ptr v179 : ptr; - v183 = hir.load v182 : i32; - hir.exec @root_ns:root@1.0.0/adv_load_preimage/alloc::raw_vec::handle_error(v74, v183) - v519 = arith.constant 0 : u32; - scf.yield v519; + v208 = hir.load_local : i32 #[local = lv9]; + v209 = hir.load_local : i32 #[local = lv5]; + v611 = arith.constant 12 : u32; + v210 = hir.bitcast v209 : u32; + v212 = arith.add v210, v611 : u32 #[overflow = checked]; + v678 = arith.constant 4 : u32; + v214 = arith.mod v212, v678 : u32; + hir.assertz v214 #[code = 250]; + v215 = hir.int_to_ptr v212 : ptr; + v216 = hir.load v215 : i32; + hir.exec @root_ns:root@1.0.0/adv_load_preimage/alloc::raw_vec::handle_error(v208, v216) + v643 = arith.constant 0 : u32; + scf.yield v643; } else { ^block15: - v554 = arith.constant 12 : u32; - v88 = hir.bitcast v41 : u32; - v90 = arith.add v88, v554 : u32 #[overflow = checked]; - v553 = arith.constant 4 : u32; - v92 = arith.mod v90, v553 : u32; - hir.assertz v92 #[code = 250]; - v93 = hir.int_to_ptr v90 : ptr; - v94 = hir.load v93 : i32; - v552 = arith.constant 2 : u32; - v96 = hir.bitcast v94 : u32; - v98 = arith.shr v96, v552 : u32; - v99 = hir.bitcast v98 : i32; - v100 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/std::mem::pipe_preimage_to_memory(v59, v99, v32, v31, v30, v29) : i32 - v551 = arith.constant 8 : u32; - v101 = hir.bitcast v28 : u32; - v103 = arith.add v101, v551 : u32 #[overflow = checked]; - v550 = arith.constant 4 : u32; - v105 = arith.mod v103, v550 : u32; + v99 = hir.load_local : felt #[local = lv7]; + v100 = hir.load_local : i32 #[local = lv5]; + v677 = arith.constant 12 : u32; + v101 = hir.bitcast v100 : u32; + v103 = arith.add v101, v677 : u32 #[overflow = checked]; + v676 = arith.constant 4 : u32; + v105 = arith.mod v103, v676 : u32; hir.assertz v105 #[code = 250]; v106 = hir.int_to_ptr v103 : ptr; - hir.store v106, v64; - v549 = arith.constant 4 : u32; - v107 = hir.bitcast v28 : u32; - v109 = arith.add v107, v549 : u32 #[overflow = checked]; - v548 = arith.constant 4 : u32; - v111 = arith.mod v109, v548 : u32; - hir.assertz v111 #[code = 250]; - v112 = hir.int_to_ptr v109 : ptr; - hir.store v112, v94; - v113 = hir.bitcast v28 : u32; - v547 = arith.constant 4 : u32; - v115 = arith.mod v113, v547 : u32; - hir.assertz v115 #[code = 250]; - v116 = hir.int_to_ptr v113 : ptr; - hir.store v116, v74; - v545 = arith.constant 0 : i32; - v546 = arith.constant 0 : i32; - v118 = arith.eq v64, v546 : i1; - v119 = arith.zext v118 : u32; - v120 = hir.bitcast v119 : i32; - v122 = arith.neq v120, v545 : i1; - v525 = scf.if v122 : u32 { - ^block80: - v544 = arith.constant 0 : u32; - scf.yield v544; + v107 = hir.load v106 : i32; + hir.store_local v107 #[local = lv10]; + v113 = hir.load_local : felt #[local = lv4]; + v114 = hir.load_local : felt #[local = lv3]; + v115 = hir.load_local : felt #[local = lv2]; + v116 = hir.load_local : felt #[local = lv1]; + v675 = arith.constant 2 : u32; + v109 = hir.bitcast v107 : u32; + v111 = arith.shr v109, v675 : u32; + v112 = hir.bitcast v111 : i32; + v117 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/miden::core::mem::pipe_preimage_to_memory(v99, v112, v113, v114, v115, v116) : i32 + v118 = hir.load_local : i32 #[local = lv0]; + v119 = hir.load_local : i32 #[local = lv8]; + v674 = arith.constant 8 : u32; + v120 = hir.bitcast v118 : u32; + v122 = arith.add v120, v674 : u32 #[overflow = checked]; + v673 = arith.constant 4 : u32; + v124 = arith.mod v122, v673 : u32; + hir.assertz v124 #[code = 250]; + v125 = hir.int_to_ptr v122 : ptr; + hir.store v125, v119; + v126 = hir.load_local : i32 #[local = lv0]; + v127 = hir.load_local : i32 #[local = lv10]; + v672 = arith.constant 4 : u32; + v128 = hir.bitcast v126 : u32; + v130 = arith.add v128, v672 : u32 #[overflow = checked]; + v671 = arith.constant 4 : u32; + v132 = arith.mod v130, v671 : u32; + hir.assertz v132 #[code = 250]; + v133 = hir.int_to_ptr v130 : ptr; + hir.store v133, v127; + v134 = hir.load_local : i32 #[local = lv0]; + v135 = hir.load_local : i32 #[local = lv9]; + v136 = hir.bitcast v134 : u32; + v670 = arith.constant 4 : u32; + v138 = arith.mod v136, v670 : u32; + hir.assertz v138 #[code = 250]; + v139 = hir.int_to_ptr v136 : ptr; + hir.store v139, v135; + v140 = hir.load_local : i32 #[local = lv8]; + v668 = arith.constant 0 : i32; + v669 = arith.constant 0 : i32; + v142 = arith.eq v140, v669 : i1; + v143 = arith.zext v142 : u32; + v144 = hir.bitcast v143 : i32; + v146 = arith.neq v144, v668 : i1; + v649 = scf.if v146 : u32 { + ^block74: + v667 = arith.constant 0 : u32; + scf.yield v667; } else { ^block16: - v123 = hir.bitcast v94 : u32; - v543 = arith.constant 4 : u32; - v125 = arith.mod v123, v543 : u32; - hir.assertz v125 #[code = 250]; - v126 = hir.int_to_ptr v123 : ptr; - v127 = hir.load v126 : felt; - v542 = arith.constant 1 : i32; - v129 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::from_u32(v542) : felt - hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::assert_eq(v127, v129) - v541 = arith.constant 4 : u32; - v130 = hir.bitcast v94 : u32; - v132 = arith.add v130, v541 : u32 #[overflow = checked]; - v540 = arith.constant 4 : u32; - v134 = arith.mod v132, v540 : u32; - hir.assertz v134 #[code = 250]; - v135 = hir.int_to_ptr v132 : ptr; - v136 = hir.load v135 : felt; - v62 = arith.constant 2 : i32; - v138 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::from_u32(v62) : felt - hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::assert_eq(v136, v138) - v539 = arith.constant 0 : i32; - v516 = arith.constant 5 : u32; - v140 = hir.bitcast v64 : u32; - v142 = arith.lte v140, v516 : i1; - v143 = arith.zext v142 : u32; - v144 = hir.bitcast v143 : i32; - v146 = arith.neq v144, v539 : i1; - v527 = scf.if v146 : u32 { - ^block79: - v538 = arith.constant 0 : u32; - scf.yield v538; + v147 = hir.load_local : i32 #[local = lv10]; + v148 = hir.bitcast v147 : u32; + v666 = arith.constant 4 : u32; + v150 = arith.mod v148, v666 : u32; + hir.assertz v150 #[code = 250]; + v151 = hir.int_to_ptr v148 : ptr; + v152 = hir.load v151 : felt; + v606 = arith.constant 1 : felt; + hir.assert_eq v152, v606; + v155 = hir.load_local : i32 #[local = lv10]; + v665 = arith.constant 4 : u32; + v156 = hir.bitcast v155 : u32; + v158 = arith.add v156, v665 : u32 #[overflow = checked]; + v664 = arith.constant 4 : u32; + v160 = arith.mod v158, v664 : u32; + hir.assertz v160 #[code = 250]; + v161 = hir.int_to_ptr v158 : ptr; + v162 = hir.load v161 : felt; + v605 = arith.constant 2 : felt; + hir.assert_eq v162, v605; + v165 = hir.load_local : i32 #[local = lv8]; + v663 = arith.constant 0 : i32; + v604 = arith.constant 5 : u32; + v167 = hir.bitcast v165 : u32; + v169 = arith.lte v167, v604 : i1; + v170 = arith.zext v169 : u32; + v171 = hir.bitcast v170 : i32; + v173 = arith.neq v171, v663 : i1; + v651 = scf.if v173 : u32 { + ^block73: + v662 = arith.constant 0 : u32; + scf.yield v662; } else { ^block17: - v148 = arith.constant 20 : u32; - v147 = hir.bitcast v94 : u32; - v149 = arith.add v147, v148 : u32 #[overflow = checked]; - v537 = arith.constant 4 : u32; - v151 = arith.mod v149, v537 : u32; - hir.assertz v151 #[code = 250]; - v152 = hir.int_to_ptr v149 : ptr; - v153 = hir.load v152 : felt; - v154 = arith.constant 6 : i32; - v155 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::from_u32(v154) : felt - hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::assert_eq(v153, v155) - v536 = arith.constant 0 : i32; - v515 = arith.constant 14 : u32; - v157 = hir.bitcast v64 : u32; - v159 = arith.lte v157, v515 : i1; - v160 = arith.zext v159 : u32; - v161 = hir.bitcast v160 : i32; - v163 = arith.neq v161, v536 : i1; - scf.if v163{ - ^block78: + v174 = hir.load_local : i32 #[local = lv10]; + v610 = arith.constant 20 : u32; + v175 = hir.bitcast v174 : u32; + v177 = arith.add v175, v610 : u32 #[overflow = checked]; + v661 = arith.constant 4 : u32; + v179 = arith.mod v177, v661 : u32; + hir.assertz v179 #[code = 250]; + v180 = hir.int_to_ptr v177 : ptr; + v181 = hir.load v180 : felt; + v603 = arith.constant 6 : felt; + hir.assert_eq v181, v603; + v184 = hir.load_local : i32 #[local = lv8]; + v660 = arith.constant 0 : i32; + v602 = arith.constant 14 : u32; + v186 = hir.bitcast v184 : u32; + v188 = arith.lte v186, v602 : i1; + v189 = arith.zext v188 : u32; + v190 = hir.bitcast v189 : i32; + v192 = arith.neq v190, v660 : i1; + scf.if v192{ + ^block72: scf.yield ; } else { ^block18: - v165 = arith.constant 56 : u32; - v164 = hir.bitcast v94 : u32; - v166 = arith.add v164, v165 : u32 #[overflow = checked]; - v535 = arith.constant 4 : u32; - v168 = arith.mod v166, v535 : u32; - hir.assertz v168 #[code = 250]; - v169 = hir.int_to_ptr v166 : ptr; - v170 = hir.load v169 : felt; - v171 = arith.constant 15 : i32; - v172 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::from_u32(v171) : felt - hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::assert_eq(v170, v172) - v534 = arith.constant 16 : i32; - v174 = arith.add v41, v534 : i32 #[overflow = wrapping]; - v175 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v176 = hir.bitcast v175 : ptr; - hir.store v176, v174; + v193 = hir.load_local : i32 #[local = lv10]; + v609 = arith.constant 56 : u32; + v194 = hir.bitcast v193 : u32; + v196 = arith.add v194, v609 : u32 #[overflow = checked]; + v659 = arith.constant 4 : u32; + v198 = arith.mod v196, v659 : u32; + hir.assertz v198 #[code = 250]; + v199 = hir.int_to_ptr v196 : ptr; + v200 = hir.load v199 : felt; + v601 = arith.constant 15 : felt; + hir.assert_eq v200, v601; + v203 = hir.load_local : i32 #[local = lv5]; + v658 = arith.constant 16 : i32; + v205 = arith.add v203, v658 : i32 #[overflow = wrapping]; + v206 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v207 = hir.bitcast v206 : ptr; + hir.store v207, v205; scf.yield ; }; - v521 = arith.constant 1 : u32; - v533 = arith.constant 0 : u32; - v531 = cf.select v163, v533, v521 : u32; - scf.yield v531; + v645 = arith.constant 1 : u32; + v657 = arith.constant 0 : u32; + v655 = cf.select v192, v657, v645 : u32; + scf.yield v655; }; - scf.yield v527; + scf.yield v651; }; - scf.yield v525; + scf.yield v649; }; - v532 = arith.constant 0 : u32; - v530 = arith.eq v523, v532 : i1; - cf.cond_br v530 ^block13, ^block82; + v656 = arith.constant 0 : u32; + v654 = arith.eq v647, v656 : i1; + cf.cond_br v654 ^block13, ^block76; ^block13: ub.unreachable ; - ^block82: + ^block76: builtin.ret ; }; @@ -260,480 +303,544 @@ builtin.component root_ns:root@1.0.0 { builtin.ret ; }; - private builtin.function @::alloc(v184: i32, v185: i32, v186: i32) -> i32 { - ^block21(v184: i32, v185: i32, v186: i32): - v189 = arith.constant 16 : i32; - v188 = arith.constant 0 : i32; - v562 = arith.constant 16 : u32; - v191 = hir.bitcast v185 : u32; - v193 = arith.gt v191, v562 : i1; - v194 = arith.zext v193 : u32; - v195 = hir.bitcast v194 : i32; - v197 = arith.neq v195, v188 : i1; - v198 = cf.select v197, v185, v189 : i32; - v602 = arith.constant 0 : i32; - v199 = arith.constant -1 : i32; - v200 = arith.add v198, v199 : i32 #[overflow = wrapping]; - v201 = arith.band v198, v200 : i32; - v203 = arith.neq v201, v602 : i1; - v571, v572 = scf.if v203 : i32, u32 { - ^block89: - v563 = arith.constant 0 : u32; - v567 = ub.poison i32 : i32; - scf.yield v567, v563; + private builtin.function @::alloc(v217: i32, v218: i32, v219: i32) -> i32 { + ^block21(v217: i32, v218: i32, v219: i32): + hir.store_local v217 #[local = lv0]; + hir.store_local v218 #[local = lv1]; + hir.store_local v219 #[local = lv2]; + v221 = hir.load_local : i32 #[local = lv1]; + v690 = arith.constant 16 : i32; + v689 = arith.constant 0 : i32; + v685 = arith.constant 16 : u32; + v225 = hir.bitcast v221 : u32; + v227 = arith.gt v225, v685 : i1; + v228 = arith.zext v227 : u32; + v229 = hir.bitcast v228 : i32; + v231 = arith.neq v229, v689 : i1; + v232 = cf.select v231, v221, v690 : i32; + hir.store_local v232 #[local = lv3]; + v233 = hir.load_local : i32 #[local = lv3]; + v733 = arith.constant 0 : i32; + v688 = arith.constant -1 : i32; + v235 = arith.add v233, v688 : i32 #[overflow = wrapping]; + v236 = arith.band v232, v235 : i32; + v238 = arith.neq v236, v733 : i1; + v711, v712 = scf.if v238 : i32, u32 { + ^block84: + v703 = arith.constant 0 : u32; + v707 = ub.poison i32 : i32; + scf.yield v707, v703; } else { ^block24: - v205 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/::max(v185, v198) : i32 - v601 = arith.constant 0 : i32; - v204 = arith.constant -2147483648 : i32; - v206 = arith.sub v204, v205 : i32 #[overflow = wrapping]; - v208 = hir.bitcast v206 : u32; - v207 = hir.bitcast v186 : u32; - v209 = arith.gt v207, v208 : i1; - v210 = arith.zext v209 : u32; - v211 = hir.bitcast v210 : i32; - v213 = arith.neq v211, v601 : i1; - v586 = scf.if v213 : i32 { - ^block88: - v600 = ub.poison i32 : i32; - scf.yield v600; + v239 = hir.load_local : i32 #[local = lv2]; + v241 = hir.load_local : i32 #[local = lv1]; + v242 = hir.load_local : i32 #[local = lv3]; + v243 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/::max(v241, v242) : i32 + hir.store_local v243 #[local = lv1]; + v732 = arith.constant 0 : i32; + v687 = arith.constant -2147483648 : i32; + v244 = arith.sub v687, v243 : i32 #[overflow = wrapping]; + v246 = hir.bitcast v244 : u32; + v245 = hir.bitcast v239 : u32; + v247 = arith.gt v245, v246 : i1; + v248 = arith.zext v247 : u32; + v249 = hir.bitcast v248 : i32; + v251 = arith.neq v249, v732 : i1; + v717 = scf.if v251 : i32 { + ^block83: + v731 = ub.poison i32 : i32; + scf.yield v731; } else { ^block25: - v598 = arith.constant 0 : i32; - v219 = arith.sub v598, v205 : i32 #[overflow = wrapping]; - v599 = arith.constant -1 : i32; - v215 = arith.add v186, v205 : i32 #[overflow = wrapping]; - v217 = arith.add v215, v599 : i32 #[overflow = wrapping]; - v220 = arith.band v217, v219 : i32; - v221 = hir.bitcast v184 : u32; - v222 = arith.constant 4 : u32; - v223 = arith.mod v221, v222 : u32; - hir.assertz v223 #[code = 250]; - v224 = hir.int_to_ptr v221 : ptr; - v225 = hir.load v224 : i32; - v597 = arith.constant 0 : i32; - v227 = arith.neq v225, v597 : i1; - scf.if v227{ - ^block87: + v730 = arith.constant 0 : i32; + hir.store_local v730 #[local = lv3]; + v253 = hir.load_local : i32 #[local = lv2]; + v254 = hir.load_local : i32 #[local = lv1]; + v728 = arith.constant 0 : i32; + v260 = arith.sub v728, v254 : i32 #[overflow = wrapping]; + v729 = arith.constant -1 : i32; + v255 = arith.add v253, v254 : i32 #[overflow = wrapping]; + v257 = arith.add v255, v729 : i32 #[overflow = wrapping]; + v261 = arith.band v257, v260 : i32; + hir.store_local v261 #[local = lv2]; + v262 = hir.load_local : i32 #[local = lv0]; + v263 = hir.bitcast v262 : u32; + v686 = arith.constant 4 : u32; + v265 = arith.mod v263, v686 : u32; + hir.assertz v265 #[code = 250]; + v266 = hir.int_to_ptr v263 : ptr; + v267 = hir.load v266 : i32; + v727 = arith.constant 0 : i32; + v269 = arith.neq v267, v727 : i1; + scf.if v269{ + ^block82: scf.yield ; } else { ^block27: - v228 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::mem::heap_base() : i32 - v229 = hir.mem_size : u32; - v235 = hir.bitcast v184 : u32; - v596 = arith.constant 4 : u32; - v237 = arith.mod v235, v596 : u32; - hir.assertz v237 #[code = 250]; - v595 = arith.constant 16 : u32; - v230 = hir.bitcast v229 : i32; - v233 = arith.shl v230, v595 : i32; - v234 = arith.add v228, v233 : i32 #[overflow = wrapping]; - v238 = hir.int_to_ptr v235 : ptr; - hir.store v238, v234; + v270 = hir.load_local : i32 #[local = lv0]; + v271 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::mem::heap_base() : i32 + v272 = hir.mem_size : u32; + v278 = hir.bitcast v270 : u32; + v726 = arith.constant 4 : u32; + v280 = arith.mod v278, v726 : u32; + hir.assertz v280 #[code = 250]; + v725 = arith.constant 16 : u32; + v273 = hir.bitcast v272 : i32; + v276 = arith.shl v273, v725 : i32; + v277 = arith.add v271, v276 : i32 #[overflow = wrapping]; + v281 = hir.int_to_ptr v278 : ptr; + hir.store v281, v277; scf.yield ; }; - v241 = hir.bitcast v184 : u32; - v594 = arith.constant 4 : u32; - v243 = arith.mod v241, v594 : u32; - hir.assertz v243 #[code = 250]; - v244 = hir.int_to_ptr v241 : ptr; - v245 = hir.load v244 : i32; - v592 = arith.constant 0 : i32; - v593 = arith.constant -1 : i32; - v247 = arith.bxor v245, v593 : i32; - v249 = hir.bitcast v247 : u32; - v248 = hir.bitcast v220 : u32; - v250 = arith.gt v248, v249 : i1; - v251 = arith.zext v250 : u32; - v252 = hir.bitcast v251 : i32; - v254 = arith.neq v252, v592 : i1; - v585 = scf.if v254 : i32 { - ^block28: - v591 = arith.constant 0 : i32; - scf.yield v591; + v282 = hir.load_local : i32 #[local = lv2]; + v283 = hir.load_local : i32 #[local = lv0]; + v284 = hir.bitcast v283 : u32; + v724 = arith.constant 4 : u32; + v286 = arith.mod v284, v724 : u32; + hir.assertz v286 #[code = 250]; + v287 = hir.int_to_ptr v284 : ptr; + v288 = hir.load v287 : i32; + hir.store_local v288 #[local = lv4]; + v722 = arith.constant 0 : i32; + v723 = arith.constant -1 : i32; + v290 = arith.bxor v288, v723 : i32; + v292 = hir.bitcast v290 : u32; + v291 = hir.bitcast v282 : u32; + v293 = arith.gt v291, v292 : i1; + v294 = arith.zext v293 : u32; + v295 = hir.bitcast v294 : i32; + v297 = arith.neq v295, v722 : i1; + scf.if v297{ + ^block81: + scf.yield ; } else { ^block29: - v256 = hir.bitcast v184 : u32; - v590 = arith.constant 4 : u32; - v258 = arith.mod v256, v590 : u32; - hir.assertz v258 #[code = 250]; - v255 = arith.add v245, v220 : i32 #[overflow = wrapping]; - v259 = hir.int_to_ptr v256 : ptr; - hir.store v259, v255; - v261 = arith.add v245, v205 : i32 #[overflow = wrapping]; - scf.yield v261; + v298 = hir.load_local : i32 #[local = lv0]; + v299 = hir.load_local : i32 #[local = lv4]; + v300 = hir.load_local : i32 #[local = lv2]; + v302 = hir.bitcast v298 : u32; + v721 = arith.constant 4 : u32; + v304 = arith.mod v302, v721 : u32; + hir.assertz v304 #[code = 250]; + v301 = arith.add v299, v300 : i32 #[overflow = wrapping]; + v305 = hir.int_to_ptr v302 : ptr; + hir.store v305, v301; + v306 = hir.load_local : i32 #[local = lv4]; + v307 = hir.load_local : i32 #[local = lv1]; + v308 = arith.add v306, v307 : i32 #[overflow = wrapping]; + hir.store_local v308 #[local = lv3]; + scf.yield ; }; - scf.yield v585; + v309 = hir.load_local : i32 #[local = lv3]; + scf.yield v309; }; - v568 = arith.constant 1 : u32; - v589 = arith.constant 0 : u32; - v587 = cf.select v213, v589, v568 : u32; - scf.yield v586, v587; + v708 = arith.constant 1 : u32; + v720 = arith.constant 0 : u32; + v718 = cf.select v251, v720, v708 : u32; + scf.yield v717, v718; }; - v588 = arith.constant 0 : u32; - v584 = arith.eq v572, v588 : i1; - cf.cond_br v584 ^block23, ^block91(v571); + v719 = arith.constant 0 : u32; + v716 = arith.eq v712, v719 : i1; + cf.cond_br v716 ^block23, ^block86(v711); ^block23: ub.unreachable ; - ^block91(v564: i32): - builtin.ret v564; + ^block86(v704: i32): + builtin.ret v704; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { ^block30: - v264 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v264; + v310 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v310; }; - private builtin.function @intrinsics::advice::adv_push_mapvaln(v266: felt, v267: felt, v268: felt, v269: felt) -> felt { - ^block34(v266: felt, v267: felt, v268: felt, v269: felt): - v270 = hir.exec @intrinsics/advice/adv_push_mapvaln(v266, v267, v268, v269) : felt - builtin.ret v270; + private builtin.function @intrinsics::advice::adv_push_mapvaln(v312: felt, v313: felt, v314: felt, v315: felt) -> felt { + ^block34(v312: felt, v313: felt, v314: felt, v315: felt): + v316 = hir.exec @intrinsics/advice/adv_push_mapvaln(v312, v313, v314, v315) : felt + builtin.ret v316; }; - private builtin.function @intrinsics::felt::as_u64(v272: felt) -> i64 { - ^block37(v272: felt): - v273 = hir.cast v272 : i64; - builtin.ret v273; + private builtin.function @miden::core::mem::pipe_preimage_to_memory(v318: felt, v319: i32, v320: felt, v321: felt, v322: felt, v323: felt) -> i32 { + ^block37(v318: felt, v319: i32, v320: felt, v321: felt, v322: felt, v323: felt): + v324 = hir.exec @miden/core/mem/pipe_preimage_to_memory(v318, v319, v320, v321, v322, v323) : i32 + builtin.ret v324; }; - private builtin.function @intrinsics::felt::assert_eq(v275: felt, v276: felt) { - ^block39(v275: felt, v276: felt): - hir.assert_eq v275, v276; - builtin.ret ; - }; - - private builtin.function @intrinsics::felt::from_u32(v277: i32) -> felt { - ^block41(v277: i32): - v278 = hir.bitcast v277 : felt; - builtin.ret v278; - }; - - private builtin.function @intrinsics::felt::from_u64_unchecked(v280: i64) -> felt { - ^block43(v280: i64): - v281 = hir.cast v280 : felt; - builtin.ret v281; - }; - - private builtin.function @std::mem::pipe_preimage_to_memory(v283: felt, v284: i32, v285: felt, v286: felt, v287: felt, v288: felt) -> i32 { - ^block45(v283: felt, v284: i32, v285: felt, v286: felt, v287: felt, v288: felt): - v289 = hir.exec @std/mem/pipe_preimage_to_memory(v283, v284, v285, v286, v287, v288) : i32 - builtin.ret v289; - }; - - private builtin.function @::alloc_impl(v291: i32, v292: i32, v293: i32, v294: i32) { - ^block49(v291: i32, v292: i32, v293: i32, v294: i32): - v618 = arith.constant 0 : i32; - v295 = arith.constant 0 : i32; - v296 = arith.eq v293, v295 : i1; - v297 = arith.zext v296 : u32; - v298 = hir.bitcast v297 : i32; - v300 = arith.neq v298, v618 : i1; - v614 = scf.if v300 : i32 { - ^block95: - scf.yield v292; + private builtin.function @::alloc_impl(v326: i32, v327: i32, v328: i32, v329: i32) { + ^block42(v326: i32, v327: i32, v328: i32, v329: i32): + hir.store_local v326 #[local = lv0]; + hir.store_local v327 #[local = lv1]; + hir.store_local v328 #[local = lv2]; + hir.store_local v329 #[local = lv3]; + v330 = hir.load_local : i32 #[local = lv2]; + v744 = arith.constant 0 : i32; + v739 = arith.constant 0 : i32; + v332 = arith.eq v330, v739 : i1; + v333 = arith.zext v332 : u32; + v334 = hir.bitcast v333 : i32; + v336 = arith.neq v334, v744 : i1; + scf.if v336{ + ^block89: + scf.yield ; } else { - ^block52: + ^block45: hir.exec @root_ns:root@1.0.0/adv_load_preimage/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v617 = arith.constant 0 : i32; - v302 = arith.neq v294, v617 : i1; - v613 = scf.if v302 : i32 { - ^block53: - v304 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/__rustc::__rust_alloc_zeroed(v293, v292) : i32 - scf.yield v304; + v337 = hir.load_local : i32 #[local = lv3]; + v743 = arith.constant 0 : i32; + v339 = arith.neq v337, v743 : i1; + scf.if v339{ + ^block46: + v343 = hir.load_local : i32 #[local = lv2]; + v344 = hir.load_local : i32 #[local = lv1]; + v345 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/__rustc::__rust_alloc_zeroed(v343, v344) : i32 + hir.store_local v345 #[local = lv1]; + scf.yield ; } else { - ^block54: - v303 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/__rustc::__rust_alloc(v293, v292) : i32 - scf.yield v303; + ^block47: + v340 = hir.load_local : i32 #[local = lv2]; + v341 = hir.load_local : i32 #[local = lv1]; + v342 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/__rustc::__rust_alloc(v340, v341) : i32 + hir.store_local v342 #[local = lv1]; + scf.yield ; }; - scf.yield v613; + scf.yield ; }; - v308 = arith.constant 4 : u32; - v307 = hir.bitcast v291 : u32; - v309 = arith.add v307, v308 : u32 #[overflow = checked]; - v616 = arith.constant 4 : u32; - v311 = arith.mod v309, v616 : u32; - hir.assertz v311 #[code = 250]; - v312 = hir.int_to_ptr v309 : ptr; - hir.store v312, v293; - v314 = hir.bitcast v291 : u32; - v615 = arith.constant 4 : u32; - v316 = arith.mod v314, v615 : u32; - hir.assertz v316 #[code = 250]; - v317 = hir.int_to_ptr v314 : ptr; - hir.store v317, v614; + v346 = hir.load_local : i32 #[local = lv0]; + v347 = hir.load_local : i32 #[local = lv2]; + v734 = arith.constant 4 : u32; + v348 = hir.bitcast v346 : u32; + v350 = arith.add v348, v734 : u32 #[overflow = checked]; + v742 = arith.constant 4 : u32; + v352 = arith.mod v350, v742 : u32; + hir.assertz v352 #[code = 250]; + v353 = hir.int_to_ptr v350 : ptr; + hir.store v353, v347; + v354 = hir.load_local : i32 #[local = lv0]; + v355 = hir.load_local : i32 #[local = lv1]; + v356 = hir.bitcast v354 : u32; + v741 = arith.constant 4 : u32; + v358 = arith.mod v356, v741 : u32; + hir.assertz v358 #[code = 250]; + v359 = hir.int_to_ptr v356 : ptr; + hir.store v359, v355; builtin.ret ; }; - private builtin.function @::allocate(v318: i32, v319: i32, v320: i32) { - ^block55(v318: i32, v319: i32, v320: i32): - v322 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v323 = hir.bitcast v322 : ptr; - v324 = hir.load v323 : i32; - v325 = arith.constant 16 : i32; - v326 = arith.sub v324, v325 : i32 #[overflow = wrapping]; - v327 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v328 = hir.bitcast v327 : ptr; - hir.store v328, v326; - v321 = arith.constant 0 : i32; - v329 = arith.constant 8 : i32; - v330 = arith.add v326, v329 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/adv_load_preimage/::alloc_impl(v330, v319, v320, v321) - v333 = arith.constant 12 : u32; - v332 = hir.bitcast v326 : u32; - v334 = arith.add v332, v333 : u32 #[overflow = checked]; - v335 = arith.constant 4 : u32; - v336 = arith.mod v334, v335 : u32; - hir.assertz v336 #[code = 250]; - v337 = hir.int_to_ptr v334 : ptr; - v338 = hir.load v337 : i32; - v340 = arith.constant 8 : u32; - v339 = hir.bitcast v326 : u32; - v341 = arith.add v339, v340 : u32 #[overflow = checked]; - v623 = arith.constant 4 : u32; - v343 = arith.mod v341, v623 : u32; - hir.assertz v343 #[code = 250]; - v344 = hir.int_to_ptr v341 : ptr; - v345 = hir.load v344 : i32; - v346 = hir.bitcast v318 : u32; - v622 = arith.constant 4 : u32; - v348 = arith.mod v346, v622 : u32; - hir.assertz v348 #[code = 250]; - v349 = hir.int_to_ptr v346 : ptr; - hir.store v349, v345; - v621 = arith.constant 4 : u32; - v350 = hir.bitcast v318 : u32; - v352 = arith.add v350, v621 : u32 #[overflow = checked]; - v620 = arith.constant 4 : u32; - v354 = arith.mod v352, v620 : u32; - hir.assertz v354 #[code = 250]; - v355 = hir.int_to_ptr v352 : ptr; - hir.store v355, v338; - v619 = arith.constant 16 : i32; - v357 = arith.add v326, v619 : i32 #[overflow = wrapping]; - v358 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v359 = hir.bitcast v358 : ptr; - hir.store v359, v357; + private builtin.function @::allocate(v360: i32, v361: i32, v362: i32) { + ^block48(v360: i32, v361: i32, v362: i32): + hir.store_local v360 #[local = lv0]; + hir.store_local v362 #[local = lv2]; + v363 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v364 = hir.bitcast v363 : ptr; + v365 = hir.load v364 : i32; + v750 = arith.constant 16 : i32; + v367 = arith.sub v365, v750 : i32 #[overflow = wrapping]; + hir.store_local v367 #[local = lv3]; + v368 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v369 = hir.bitcast v368 : ptr; + hir.store v369, v367; + v370 = hir.load_local : i32 #[local = lv3]; + v374 = hir.load_local : i32 #[local = lv2]; + v748 = arith.constant 0 : i32; + v749 = arith.constant 8 : i32; + v372 = arith.add v370, v749 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/adv_load_preimage/::alloc_impl(v372, v361, v374, v748) + v376 = hir.load_local : i32 #[local = lv3]; + v747 = arith.constant 12 : u32; + v377 = hir.bitcast v376 : u32; + v379 = arith.add v377, v747 : u32 #[overflow = checked]; + v746 = arith.constant 4 : u32; + v381 = arith.mod v379, v746 : u32; + hir.assertz v381 #[code = 250]; + v382 = hir.int_to_ptr v379 : ptr; + v383 = hir.load v382 : i32; + hir.store_local v383 #[local = lv2]; + v384 = hir.load_local : i32 #[local = lv0]; + v385 = hir.load_local : i32 #[local = lv3]; + v745 = arith.constant 8 : u32; + v386 = hir.bitcast v385 : u32; + v388 = arith.add v386, v745 : u32 #[overflow = checked]; + v760 = arith.constant 4 : u32; + v390 = arith.mod v388, v760 : u32; + hir.assertz v390 #[code = 250]; + v391 = hir.int_to_ptr v388 : ptr; + v392 = hir.load v391 : i32; + v393 = hir.bitcast v384 : u32; + v759 = arith.constant 4 : u32; + v395 = arith.mod v393, v759 : u32; + hir.assertz v395 #[code = 250]; + v396 = hir.int_to_ptr v393 : ptr; + hir.store v396, v392; + v397 = hir.load_local : i32 #[local = lv0]; + v398 = hir.load_local : i32 #[local = lv2]; + v758 = arith.constant 4 : u32; + v399 = hir.bitcast v397 : u32; + v401 = arith.add v399, v758 : u32 #[overflow = checked]; + v757 = arith.constant 4 : u32; + v403 = arith.mod v401, v757 : u32; + hir.assertz v403 #[code = 250]; + v404 = hir.int_to_ptr v401 : ptr; + hir.store v404, v398; + v405 = hir.load_local : i32 #[local = lv3]; + v756 = arith.constant 16 : i32; + v407 = arith.add v405, v756 : i32 #[overflow = wrapping]; + v408 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v409 = hir.bitcast v408 : ptr; + hir.store v409, v407; builtin.ret ; }; - private builtin.function @::try_allocate_in(v360: i32, v361: i32, v362: i32, v363: i32, v364: i32) { - ^block57(v360: i32, v361: i32, v362: i32, v363: i32, v364: i32): - v367 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v368 = hir.bitcast v367 : ptr; - v369 = hir.load v368 : i32; - v370 = arith.constant 16 : i32; - v371 = arith.sub v369, v370 : i32 #[overflow = wrapping]; - v372 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v373 = hir.bitcast v372 : ptr; - hir.store v373, v371; - v383 = hir.bitcast v361 : u32; - v384 = arith.zext v383 : u64; - v385 = hir.bitcast v384 : i64; - v365 = arith.constant 0 : i32; - v378 = arith.sub v365, v363 : i32 #[overflow = wrapping]; - v375 = arith.constant -1 : i32; - v374 = arith.add v363, v364 : i32 #[overflow = wrapping]; - v376 = arith.add v374, v375 : i32 #[overflow = wrapping]; - v379 = arith.band v376, v378 : i32; - v380 = hir.bitcast v379 : u32; - v381 = arith.zext v380 : u64; - v382 = hir.bitcast v381 : i64; - v386 = arith.mul v382, v385 : i64 #[overflow = wrapping]; - v726 = arith.constant 0 : i32; - v387 = arith.constant 32 : i64; - v389 = hir.cast v387 : u32; - v388 = hir.bitcast v386 : u64; - v390 = arith.shr v388, v389 : u64; - v391 = hir.bitcast v390 : i64; - v392 = arith.trunc v391 : i32; - v394 = arith.neq v392, v726 : i1; - v639, v640, v641, v642, v643, v644 = scf.if v394 : i32, i32, i32, i32, i32, u32 { - ^block98: - v624 = arith.constant 0 : u32; - v631 = ub.poison i32 : i32; - scf.yield v360, v371, v631, v631, v631, v624; + private builtin.function @::try_allocate_in(v410: i32, v411: i32, v412: i32, v413: i32, v414: i32) { + ^block50(v410: i32, v411: i32, v412: i32, v413: i32, v414: i32): + hir.store_local v410 #[local = lv0]; + hir.store_local v411 #[local = lv1]; + hir.store_local v412 #[local = lv2]; + hir.store_local v413 #[local = lv3]; + hir.store_local v414 #[local = lv4]; + v415 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v416 = hir.bitcast v415 : ptr; + v417 = hir.load v416 : i32; + v769 = arith.constant 16 : i32; + v419 = arith.sub v417, v769 : i32 #[overflow = wrapping]; + hir.store_local v419 #[local = lv5]; + v420 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v421 = hir.bitcast v420 : ptr; + hir.store v421, v419; + v422 = hir.load_local : i32 #[local = lv3]; + v423 = hir.load_local : i32 #[local = lv4]; + v434 = hir.load_local : i32 #[local = lv1]; + v435 = hir.bitcast v434 : u32; + v436 = arith.zext v435 : u64; + v437 = hir.bitcast v436 : i64; + v767 = arith.constant 0 : i32; + v429 = arith.sub v767, v422 : i32 #[overflow = wrapping]; + v768 = arith.constant -1 : i32; + v424 = arith.add v422, v423 : i32 #[overflow = wrapping]; + v426 = arith.add v424, v768 : i32 #[overflow = wrapping]; + v430 = arith.band v426, v429 : i32; + v431 = hir.bitcast v430 : u32; + v432 = arith.zext v431 : u64; + v433 = hir.bitcast v432 : i64; + v438 = arith.mul v433, v437 : i64 #[overflow = wrapping]; + hir.store_local v438 #[local = lv6]; + v837 = arith.constant 0 : i32; + v766 = arith.constant 32 : i64; + v441 = hir.cast v766 : u32; + v440 = hir.bitcast v438 : u64; + v442 = arith.shr v440, v441 : u64; + v443 = hir.bitcast v442 : i64; + v444 = arith.trunc v443 : i32; + v446 = arith.neq v444, v837 : i1; + v802 = scf.if v446 : u32 { + ^block92: + v798 = arith.constant 0 : u32; + scf.yield v798; } else { - ^block62: - v395 = arith.trunc v386 : i32; - v725 = arith.constant 0 : i32; - v396 = arith.constant -2147483648 : i32; - v397 = arith.sub v396, v363 : i32 #[overflow = wrapping]; - v399 = hir.bitcast v397 : u32; - v398 = hir.bitcast v395 : u32; - v400 = arith.lte v398, v399 : i1; - v401 = arith.zext v400 : u32; - v402 = hir.bitcast v401 : i32; - v404 = arith.neq v402, v725 : i1; - v687 = scf.if v404 : i32 { - ^block60: - v724 = arith.constant 0 : i32; - v415 = arith.neq v395, v724 : i1; - v686 = scf.if v415 : i32 { - ^block64: - v723 = arith.constant 0 : i32; - v431 = arith.neq v362, v723 : i1; - v685 = scf.if v431 : i32 { - ^block67: - v413 = arith.constant 1 : i32; - hir.exec @root_ns:root@1.0.0/adv_load_preimage/::alloc_impl(v371, v363, v395, v413) - v442 = hir.bitcast v371 : u32; - v483 = arith.constant 4 : u32; - v444 = arith.mod v442, v483 : u32; - hir.assertz v444 #[code = 250]; - v445 = hir.int_to_ptr v442 : ptr; - v446 = hir.load v445 : i32; - scf.yield v446; + ^block55: + v447 = hir.load_local : i64 #[local = lv6]; + v448 = arith.trunc v447 : i32; + hir.store_local v448 #[local = lv4]; + v450 = hir.load_local : i32 #[local = lv3]; + v836 = arith.constant 0 : i32; + v763 = arith.constant -2147483648 : i32; + v451 = arith.sub v763, v450 : i32 #[overflow = wrapping]; + v453 = hir.bitcast v451 : u32; + v452 = hir.bitcast v448 : u32; + v454 = arith.lte v452, v453 : i1; + v455 = arith.zext v454 : u32; + v456 = hir.bitcast v455 : i32; + v458 = arith.neq v456, v836 : i1; + scf.if v458{ + ^block53: + v468 = hir.load_local : i32 #[local = lv4]; + v835 = arith.constant 0 : i32; + v470 = arith.neq v468, v835 : i1; + scf.if v470{ + ^block57: + v488 = hir.load_local : i32 #[local = lv2]; + v834 = arith.constant 0 : i32; + v490 = arith.neq v488, v834 : i1; + scf.if v490{ + ^block60: + v504 = hir.load_local : i32 #[local = lv5]; + v505 = hir.load_local : i32 #[local = lv3]; + v506 = hir.load_local : i32 #[local = lv4]; + v783 = arith.constant 1 : i32; + hir.exec @root_ns:root@1.0.0/adv_load_preimage/::alloc_impl(v504, v505, v506, v783) + v508 = hir.load_local : i32 #[local = lv5]; + v509 = hir.bitcast v508 : u32; + v782 = arith.constant 4 : u32; + v511 = arith.mod v509, v782 : u32; + hir.assertz v511 #[code = 250]; + v512 = hir.int_to_ptr v509 : ptr; + v513 = hir.load v512 : i32; + hir.store_local v513 #[local = lv2]; + scf.yield ; } else { - ^block68: - v432 = arith.constant 8 : i32; - v433 = arith.add v371, v432 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/adv_load_preimage/::allocate(v433, v363, v395) - v417 = arith.constant 8 : u32; - v434 = hir.bitcast v371 : u32; - v436 = arith.add v434, v417 : u32 #[overflow = checked]; - v722 = arith.constant 4 : u32; - v438 = arith.mod v436, v722 : u32; - hir.assertz v438 #[code = 250]; - v439 = hir.int_to_ptr v436 : ptr; - v440 = hir.load v439 : i32; - scf.yield v440; + ^block61: + v491 = hir.load_local : i32 #[local = lv5]; + v494 = hir.load_local : i32 #[local = lv3]; + v495 = hir.load_local : i32 #[local = lv4]; + v761 = arith.constant 8 : i32; + v493 = arith.add v491, v761 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/adv_load_preimage/::allocate(v493, v494, v495) + v496 = hir.load_local : i32 #[local = lv5]; + v781 = arith.constant 8 : u32; + v497 = hir.bitcast v496 : u32; + v499 = arith.add v497, v781 : u32 #[overflow = checked]; + v833 = arith.constant 4 : u32; + v501 = arith.mod v499, v833 : u32; + hir.assertz v501 #[code = 250]; + v502 = hir.int_to_ptr v499 : ptr; + v503 = hir.load v502 : i32; + hir.store_local v503 #[local = lv2]; + scf.yield ; }; - v721 = arith.constant 0 : i32; - v449 = arith.neq v685, v721 : i1; - scf.if v449{ - ^block69: - v720 = arith.constant 8 : u32; - v466 = hir.bitcast v360 : u32; - v468 = arith.add v466, v720 : u32 #[overflow = checked]; - v719 = arith.constant 4 : u32; - v470 = arith.mod v468, v719 : u32; - hir.assertz v470 #[code = 250]; - v471 = hir.int_to_ptr v468 : ptr; - hir.store v471, v685; - v718 = arith.constant 4 : u32; - v473 = hir.bitcast v360 : u32; - v475 = arith.add v473, v718 : u32 #[overflow = checked]; - v717 = arith.constant 4 : u32; - v477 = arith.mod v475, v717 : u32; - hir.assertz v477 #[code = 250]; - v478 = hir.int_to_ptr v475 : ptr; - hir.store v478, v361; + v514 = hir.load_local : i32 #[local = lv2]; + v832 = arith.constant 0 : i32; + v516 = arith.neq v514, v832 : i1; + scf.if v516{ + ^block62: + v534 = hir.load_local : i32 #[local = lv0]; + v535 = hir.load_local : i32 #[local = lv2]; + v831 = arith.constant 8 : u32; + v536 = hir.bitcast v534 : u32; + v538 = arith.add v536, v831 : u32 #[overflow = checked]; + v830 = arith.constant 4 : u32; + v540 = arith.mod v538, v830 : u32; + hir.assertz v540 #[code = 250]; + v541 = hir.int_to_ptr v538 : ptr; + hir.store v541, v535; + v542 = hir.load_local : i32 #[local = lv0]; + v543 = hir.load_local : i32 #[local = lv1]; + v829 = arith.constant 4 : u32; + v544 = hir.bitcast v542 : u32; + v546 = arith.add v544, v829 : u32 #[overflow = checked]; + v828 = arith.constant 4 : u32; + v548 = arith.mod v546, v828 : u32; + hir.assertz v548 #[code = 250]; + v549 = hir.int_to_ptr v546 : ptr; + hir.store v549, v543; + v827 = arith.constant 0 : i32; + hir.store_local v827 #[local = lv3]; scf.yield ; } else { - ^block70: - v716 = arith.constant 8 : u32; - v452 = hir.bitcast v360 : u32; - v454 = arith.add v452, v716 : u32 #[overflow = checked]; - v715 = arith.constant 4 : u32; - v456 = arith.mod v454, v715 : u32; - hir.assertz v456 #[code = 250]; - v457 = hir.int_to_ptr v454 : ptr; - hir.store v457, v395; - v714 = arith.constant 4 : u32; - v459 = hir.bitcast v360 : u32; - v461 = arith.add v459, v714 : u32 #[overflow = checked]; - v713 = arith.constant 4 : u32; - v463 = arith.mod v461, v713 : u32; - hir.assertz v463 #[code = 250]; - v464 = hir.int_to_ptr v461 : ptr; - hir.store v464, v363; + ^block63: + v517 = hir.load_local : i32 #[local = lv0]; + v518 = hir.load_local : i32 #[local = lv4]; + v826 = arith.constant 8 : u32; + v519 = hir.bitcast v517 : u32; + v521 = arith.add v519, v826 : u32 #[overflow = checked]; + v825 = arith.constant 4 : u32; + v523 = arith.mod v521, v825 : u32; + hir.assertz v523 #[code = 250]; + v524 = hir.int_to_ptr v521 : ptr; + hir.store v524, v518; + v525 = hir.load_local : i32 #[local = lv0]; + v526 = hir.load_local : i32 #[local = lv3]; + v824 = arith.constant 4 : u32; + v527 = hir.bitcast v525 : u32; + v529 = arith.add v527, v824 : u32 #[overflow = checked]; + v823 = arith.constant 4 : u32; + v531 = arith.mod v529, v823 : u32; + hir.assertz v531 #[code = 250]; + v532 = hir.int_to_ptr v529 : ptr; + hir.store v532, v526; + v822 = arith.constant 1 : i32; + hir.store_local v822 #[local = lv3]; scf.yield ; }; - v711 = arith.constant 1 : i32; - v712 = arith.constant 0 : i32; - v684 = cf.select v449, v712, v711 : i32; - scf.yield v684; + scf.yield ; } else { - ^block65: - v710 = arith.constant 8 : u32; - v416 = hir.bitcast v360 : u32; - v418 = arith.add v416, v710 : u32 #[overflow = checked]; - v709 = arith.constant 4 : u32; - v420 = arith.mod v418, v709 : u32; - hir.assertz v420 #[code = 250]; - v421 = hir.int_to_ptr v418 : ptr; - hir.store v421, v363; - v708 = arith.constant 4 : u32; - v424 = hir.bitcast v360 : u32; - v426 = arith.add v424, v708 : u32 #[overflow = checked]; - v707 = arith.constant 4 : u32; - v428 = arith.mod v426, v707 : u32; - hir.assertz v428 #[code = 250]; - v706 = arith.constant 0 : i32; - v429 = hir.int_to_ptr v426 : ptr; - hir.store v429, v706; - v705 = arith.constant 0 : i32; - scf.yield v705; + ^block58: + v471 = hir.load_local : i32 #[local = lv0]; + v472 = hir.load_local : i32 #[local = lv3]; + v821 = arith.constant 8 : u32; + v473 = hir.bitcast v471 : u32; + v475 = arith.add v473, v821 : u32 #[overflow = checked]; + v820 = arith.constant 4 : u32; + v477 = arith.mod v475, v820 : u32; + hir.assertz v477 #[code = 250]; + v478 = hir.int_to_ptr v475 : ptr; + hir.store v478, v472; + v819 = arith.constant 0 : i32; + hir.store_local v819 #[local = lv3]; + v480 = hir.load_local : i32 #[local = lv0]; + v818 = arith.constant 4 : u32; + v482 = hir.bitcast v480 : u32; + v484 = arith.add v482, v818 : u32 #[overflow = checked]; + v817 = arith.constant 4 : u32; + v486 = arith.mod v484, v817 : u32; + hir.assertz v486 #[code = 250]; + v816 = arith.constant 0 : i32; + v487 = hir.int_to_ptr v484 : ptr; + hir.store v487, v816; + scf.yield ; }; - scf.yield v686; + scf.yield ; } else { - ^block63: - v704 = ub.poison i32 : i32; - scf.yield v704; + ^block56: + scf.yield ; }; - v699 = arith.constant 0 : u32; - v632 = arith.constant 1 : u32; - v692 = cf.select v404, v632, v699 : u32; - v700 = ub.poison i32 : i32; - v691 = cf.select v404, v371, v700 : i32; - v701 = ub.poison i32 : i32; - v690 = cf.select v404, v360, v701 : i32; - v702 = ub.poison i32 : i32; - v689 = cf.select v404, v702, v371 : i32; - v703 = ub.poison i32 : i32; - v688 = cf.select v404, v703, v360 : i32; - scf.yield v688, v689, v690, v687, v691, v692; + v815 = arith.constant 0 : u32; + v800 = arith.constant 1 : u32; + v808 = cf.select v458, v800, v815 : u32; + scf.yield v808; }; - v645, v646, v647 = scf.index_switch v644 : i32, i32, i32 + scf.index_switch v802 case 0 { - ^block61: - v698 = arith.constant 4 : u32; - v407 = hir.bitcast v639 : u32; - v409 = arith.add v407, v698 : u32 #[overflow = checked]; - v697 = arith.constant 4 : u32; - v411 = arith.mod v409, v697 : u32; - hir.assertz v411 #[code = 250]; - v696 = arith.constant 0 : i32; - v412 = hir.int_to_ptr v409 : ptr; - hir.store v412, v696; - v695 = arith.constant 1 : i32; - scf.yield v639, v695, v640; + ^block54: + v459 = hir.load_local : i32 #[local = lv0]; + v814 = arith.constant 4 : u32; + v461 = hir.bitcast v459 : u32; + v463 = arith.add v461, v814 : u32 #[overflow = checked]; + v813 = arith.constant 4 : u32; + v465 = arith.mod v463, v813 : u32; + hir.assertz v465 #[code = 250]; + v812 = arith.constant 0 : i32; + v466 = hir.int_to_ptr v463 : ptr; + hir.store v466, v812; + v811 = arith.constant 1 : i32; + hir.store_local v811 #[local = lv3]; + scf.yield ; } default { - ^block102: - scf.yield v641, v642, v643; + ^block96: + scf.yield ; }; - v482 = hir.bitcast v645 : u32; - v694 = arith.constant 4 : u32; - v484 = arith.mod v482, v694 : u32; - hir.assertz v484 #[code = 250]; - v485 = hir.int_to_ptr v482 : ptr; - hir.store v485, v646; - v693 = arith.constant 16 : i32; - v490 = arith.add v647, v693 : i32 #[overflow = wrapping]; - v491 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v492 = hir.bitcast v491 : ptr; - hir.store v492, v490; + v551 = hir.load_local : i32 #[local = lv0]; + v552 = hir.load_local : i32 #[local = lv3]; + v553 = hir.bitcast v551 : u32; + v810 = arith.constant 4 : u32; + v555 = arith.mod v553, v810 : u32; + hir.assertz v555 #[code = 250]; + v556 = hir.int_to_ptr v553 : ptr; + hir.store v556, v552; + v557 = hir.load_local : i32 #[local = lv5]; + v809 = arith.constant 16 : i32; + v559 = arith.add v557, v809 : i32 #[overflow = wrapping]; + v560 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v561 = hir.bitcast v560 : ptr; + hir.store v561, v559; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v493: i32, v494: i32) { - ^block71(v493: i32, v494: i32): + private builtin.function @alloc::raw_vec::handle_error(v562: i32, v563: i32) { + ^block64(v562: i32, v563: i32): ub.unreachable ; }; - private builtin.function @::max(v495: i32, v496: i32) -> i32 { - ^block73(v495: i32, v496: i32): - v503 = arith.constant 0 : i32; - v499 = hir.bitcast v496 : u32; - v498 = hir.bitcast v495 : u32; - v500 = arith.gt v498, v499 : i1; - v501 = arith.zext v500 : u32; - v502 = hir.bitcast v501 : i32; - v504 = arith.neq v502, v503 : i1; - v505 = cf.select v504, v495, v496 : i32; - builtin.ret v505; + private builtin.function @::max(v564: i32, v565: i32) -> i32 { + ^block66(v564: i32, v565: i32): + v838 = arith.constant 0 : i32; + v572 = hir.bitcast v565 : u32; + v571 = hir.bitcast v564 : u32; + v573 = arith.gt v571, v572 : i1; + v574 = arith.zext v573 : u32; + v575 = hir.bitcast v574 : i32; + v577 = arith.neq v575, v838 : i1; + v578 = cf.select v577, v564, v565 : i32; + builtin.ret v578; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/adv_load_preimage.masm b/tests/integration/expected/adv_load_preimage.masm index f23f95e02..b5a362ec2 100644 --- a/tests/integration/expected/adv_load_preimage.masm +++ b/tests/integration/expected/adv_load_preimage.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,8 +10,9 @@ proc init mem_store.278528 end -# mod root_ns:root@1.0.0::adv_load_preimage +# mod ::"root_ns:root@1.0.0"::adv_load_preimage +@locals("2") @callconv("C") proc __rustc::__rust_alloc(i32, i32) -> i32 push.1048576 @@ -19,44 +20,106 @@ proc __rustc::__rust_alloc(i32, i32) -> i32 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::::alloc + exec.::"root_ns:root@1.0.0"::adv_load_preimage::::alloc trace.252 nop end +@locals("2") @callconv("C") proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.1048576 - dup.1 - swap.2 - swap.3 + movup.2 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::::alloc + exec.::"root_ns:root@1.0.0"::adv_load_preimage::::alloc trace.252 nop + dup.0 + locaddr.1 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 - dup.2 + push.0 + movup.2 eq neq if.true - swap.1 - drop + nop else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.0 - dup.3 + movup.2 eq neq if.true - swap.1 - drop + nop else + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 + swap.1 movup.2 - dup.2 push.0 dup.2 push.0 @@ -98,10 +161,59 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 dropw end end + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("12") @callconv("C") pub proc entrypoint(i32, felt, felt, felt, felt) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1114112 u32divmod.4 swap.1 @@ -112,9 +224,16 @@ pub proc entrypoint(i32, felt, felt, felt, felt) nop push.16 u32wrapping_sub - push.1114112 - dup.1 + dup.0 + locaddr.5 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114112 u32divmod.4 swap.1 trace.240 @@ -122,40 +241,59 @@ pub proc entrypoint(i32, felt, felt, felt, felt) exec.::intrinsics::mem::store_sw trace.252 nop - dup.2 - dup.4 - dup.6 - dup.8 + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::advice::adv_push_mapvaln + exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.3 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::as_u64 + exec.::intrinsics::mem::load_felt trace.252 nop - push.3 - dup.2 - dup.2 - drop - u32and + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.1 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::from_u32 + exec.::"root_ns:root@1.0.0"::adv_load_preimage::"intrinsics::advice::adv_push_mapvaln" trace.252 nop + u32split + push.0 + push.3 + dup.3 + dup.3 + drop + u32and + assert_eq + locaddr.5 + push.0 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_sw trace.252 nop push.2 @@ -170,46 +308,63 @@ pub proc entrypoint(i32, felt, felt, felt, felt) push.4294967295 u32lte assert - movdn.2 + movup.3 + movup.3 movup.2 trace.240 nop - exec.::std::math::u64::shr - trace.252 - nop - trace.240 - nop - exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::from_u64_unchecked + exec.::miden::core::math::u64::shr trace.252 nop + mul.4294967296 + add dup.0 + locaddr.8 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::as_u64 + exec.::intrinsics::mem::store_felt trace.252 nop push.2 - movdn.2 + swap.1 + u32split drop swap.1 u32shl + dup.0 + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.4 push.0 push.4 - dup.5 + movup.4 u32wrapping_add - dup.3 - dup.3 + dup.2 swap.4 - swap.3 - swap.2 + swap.1 + trace.240 + nop + exec.::"root_ns:root@1.0.0"::adv_load_preimage::::try_allocate_in + trace.252 + nop + locaddr.5 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::::try_allocate_in + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.3 + swap.1 add u32assert push.4 @@ -225,8 +380,24 @@ pub proc entrypoint(i32, felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.10 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.4 + swap.1 add u32assert push.4 @@ -248,21 +419,24 @@ pub proc entrypoint(i32, felt, felt, felt, felt) eq neq if.true - movdn.2 - drop - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop + locaddr.10 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - movup.2 + swap.1 add u32assert push.4 @@ -281,13 +455,29 @@ pub proc entrypoint(i32, felt, felt, felt, felt) swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::alloc::raw_vec::handle_error + exec.::"root_ns:root@1.0.0"::adv_load_preimage::alloc::raw_vec::handle_error trace.252 nop push.0 else + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.4 + swap.1 add u32assert push.4 @@ -303,30 +493,80 @@ pub proc entrypoint(i32, felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop - push.2 - dup.1 - swap.1 - u32shr - movup.5 - swap.7 - movdn.5 - movup.3 - swap.9 - movdn.3 - movup.2 - swap.10 - movdn.2 + dup.0 + locaddr.11 + push.0 swap.1 - swap.8 - swap.4 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::std::mem::pipe_preimage_to_memory + exec.::intrinsics::mem::store_sw trace.252 nop - drop - push.8 - dup.1 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.2 + movup.5 + swap.1 + u32shr + movup.2 + swap.4 + movdn.2 + swap.1 + swap.5 + trace.240 + nop + exec.::"root_ns:root@1.0.0"::adv_load_preimage::"miden::core::mem::pipe_preimage_to_memory" + trace.252 + nop + drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + movup.2 add u32assert push.4 @@ -335,8 +575,6 @@ pub proc entrypoint(i32, felt, felt, felt, felt) u32mod u32assert assertz - dup.4 - swap.1 u32divmod.4 swap.1 trace.240 @@ -344,8 +582,24 @@ pub proc entrypoint(i32, felt, felt, felt, felt) exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.11 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + movup.2 add u32assert push.4 @@ -354,8 +608,6 @@ pub proc entrypoint(i32, felt, felt, felt, felt) u32mod u32assert assertz - dup.3 - swap.1 u32divmod.4 swap.1 trace.240 @@ -363,14 +615,29 @@ pub proc entrypoint(i32, felt, felt, felt, felt) exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.10 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 push.4 dup.1 swap.1 u32mod u32assert assertz - movup.4 - swap.1 u32divmod.4 swap.1 trace.240 @@ -378,18 +645,30 @@ pub proc entrypoint(i32, felt, felt, felt, felt) exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.0 - dup.4 + movup.2 eq neq if.true - drop - drop - drop push.0 else - dup.1 + locaddr.11 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -404,19 +683,17 @@ pub proc entrypoint(i32, felt, felt, felt, felt) trace.252 nop push.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::from_u32 - trace.252 - nop + assert_eq + locaddr.11 + push.0 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_sw trace.252 nop push.4 - dup.2 + swap.1 add u32assert push.4 @@ -433,31 +710,34 @@ pub proc entrypoint(i32, felt, felt, felt, felt) trace.252 nop push.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::from_u32 - trace.252 - nop + assert_eq + locaddr.9 + push.0 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_sw trace.252 nop push.0 push.5 - dup.4 + movup.2 swap.1 u32lte neq if.true - drop - drop - drop push.0 else + locaddr.11 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.20 - dup.2 + swap.1 add u32assert push.4 @@ -474,31 +754,35 @@ pub proc entrypoint(i32, felt, felt, felt, felt) trace.252 nop push.6 - trace.240 - nop - exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::from_u32 - trace.252 - nop + assert_eq + locaddr.9 + push.0 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_sw trace.252 nop push.0 push.14 - movup.4 + movup.2 swap.1 u32lte neq dup.0 if.true - movdn.2 - drop - drop + nop else + locaddr.11 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.56 - movup.3 + swap.1 add u32assert push.4 @@ -515,19 +799,16 @@ pub proc entrypoint(i32, felt, felt, felt, felt) trace.252 nop push.15 - trace.240 - nop - exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::from_u32 - trace.252 - nop + assert_eq + locaddr.5 + push.0 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_sw trace.252 nop push.16 - movup.2 u32wrapping_add push.1114112 u32divmod.4 @@ -562,87 +843,213 @@ proc __rustc::__rust_no_alloc_shim_is_unstable_v2( nop end +@locals("5") @callconv("C") proc ::alloc( i32, i32, i32 ) -> i32 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 push.0 push.16 - dup.4 + dup.3 swap.1 u32gt neq - dup.3 + movup.2 swap.1 cdrop + dup.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.4294967295 - dup.2 + movup.2 u32wrapping_add - dup.2 + movup.2 u32and neq if.true - dropw push.0 push.3735929054 else - movup.2 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + trace.240 + nop + exec.::"root_ns:root@1.0.0"::adv_load_preimage::::max + trace.252 + nop + dup.0 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::::max + exec.::intrinsics::mem::store_sw trace.252 nop push.0 push.2147483648 - dup.2 + movup.2 u32wrapping_sub - dup.4 + movup.2 swap.1 u32gt neq dup.0 if.true - movdn.3 - drop - drop - drop push.3735929054 else push.0 - dup.2 - u32wrapping_sub - push.4294967295 - movup.5 - dup.4 - u32wrapping_add - u32wrapping_add - u32and - dup.3 - push.4 - dup.1 + locaddr.3 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.1 push.0 - neq - if.true - nop - else - trace.240 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + dup.1 + u32wrapping_sub + push.4294967295 + movup.3 + movup.3 + u32wrapping_add + u32wrapping_add + u32and + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + neq + if.true + nop + else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::mem::heap_base + exec.::"root_ns:root@1.0.0"::adv_load_preimage::"intrinsics::mem::heap_base" trace.252 nop trace.240 @@ -650,7 +1057,7 @@ proc ::alloc( exec.::intrinsics::mem::memory_size trace.252 nop - dup.5 + movup.2 push.4 dup.1 swap.1 @@ -672,7 +1079,22 @@ proc ::alloc( trace.252 nop end - dup.3 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -686,31 +1108,58 @@ proc ::alloc( exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 push.4294967295 - dup.2 + movup.2 u32xor - dup.3 + movup.2 swap.1 u32gt neq if.true - drop - drop - movdn.2 - drop - drop - push.0 + nop else - movup.4 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 push.4 dup.1 swap.1 u32mod u32assert assertz - movup.2 - dup.2 + movdn.2 u32wrapping_add swap.1 u32divmod.4 @@ -720,9 +1169,40 @@ proc ::alloc( exec.::intrinsics::mem::store_sw trace.252 nop - movup.2 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop u32wrapping_add + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end push.1 push.0 @@ -763,45 +1243,22 @@ proc intrinsics::advice::adv_push_mapvaln(felt, felt, felt, felt) -> felt end @callconv("C") -proc intrinsics::felt::as_u64(felt) -> [u32; 2] - u32split -end - -@callconv("C") -proc intrinsics::felt::assert_eq(felt, felt) - assert_eq -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc intrinsics::felt::from_u64_unchecked([u32; 2]) -> felt - dup.1 - dup.1 - push.1 - push.4294967295 - trace.240 - nop - exec.::std::math::u64::lt - trace.252 - nop - assert - mul.4294967296 - add -end - -@callconv("C") -proc std::mem::pipe_preimage_to_memory(felt, i32, felt, felt, felt, felt) -> i32 +proc miden::core::mem::pipe_preimage_to_memory( + felt, + i32, + felt, + felt, + felt, + felt +) -> i32 trace.240 nop - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 nop end +@locals("4") @callconv("C") proc ::alloc_impl( i32, @@ -809,44 +1266,151 @@ proc ::alloc_impl( i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 push.0 - dup.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 eq neq if.true - movup.3 - drop - swap.1 + nop else trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::__rustc::__rust_no_alloc_shim_is_unstable_v2 + exec.::"root_ns:root@1.0.0"::adv_load_preimage::__rustc::__rust_no_alloc_shim_is_unstable_v2 + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.0 - movup.4 neq if.true + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + trace.240 + nop + exec.::"root_ns:root@1.0.0"::adv_load_preimage::__rustc::__rust_alloc_zeroed + trace.252 + nop + locaddr.1 + push.0 swap.1 - dup.2 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::__rustc::__rust_alloc_zeroed + exec.::intrinsics::mem::store_sw trace.252 nop else + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + trace.240 + nop + exec.::"root_ns:root@1.0.0"::adv_load_preimage::__rustc::__rust_alloc + trace.252 + nop + locaddr.1 + push.0 swap.1 - dup.2 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::__rustc::__rust_alloc + exec.::intrinsics::mem::store_sw trace.252 nop end end + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.2 + movup.2 add u32assert push.4 @@ -855,8 +1419,6 @@ proc ::alloc_impl( u32mod u32assert assertz - movup.3 - swap.1 u32divmod.4 swap.1 trace.240 @@ -864,6 +1426,22 @@ proc ::alloc_impl( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop swap.1 push.4 dup.1 @@ -880,12 +1458,30 @@ proc ::alloc_impl( nop end +@locals("4") @callconv("C") proc ::allocate( i32, i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + swap.1 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114112 u32divmod.4 swap.1 @@ -896,9 +1492,16 @@ proc ::allocate( nop push.16 u32wrapping_sub - push.1114112 - dup.1 + dup.0 + locaddr.3 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114112 u32divmod.4 swap.1 trace.240 @@ -906,24 +1509,44 @@ proc ::allocate( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.8 - dup.2 + movup.3 u32wrapping_add - movup.2 - swap.5 - movdn.2 swap.1 swap.3 - swap.4 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::::alloc_impl + exec.::"root_ns:root@1.0.0"::adv_load_preimage::"::alloc_impl" + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.12 - dup.2 + swap.1 add u32assert push.4 @@ -939,8 +1562,32 @@ proc ::allocate( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.3 + swap.1 add u32assert push.4 @@ -956,7 +1603,7 @@ proc ::allocate( exec.::intrinsics::mem::load_sw trace.252 nop - dup.2 + swap.1 push.4 dup.1 swap.1 @@ -970,6 +1617,22 @@ proc ::allocate( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 movup.2 add @@ -987,6 +1650,14 @@ proc ::allocate( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114112 @@ -999,6 +1670,7 @@ proc ::allocate( nop end +@locals("8") @callconv("C") proc ::try_allocate_in( i32, @@ -1007,6 +1679,46 @@ proc ::try_allocate_in( i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114112 u32divmod.4 swap.1 @@ -1017,9 +1729,16 @@ proc ::try_allocate_in( nop push.16 u32wrapping_sub - push.1114112 - dup.1 + dup.0 + locaddr.5 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114112 u32divmod.4 swap.1 trace.240 @@ -1027,14 +1746,37 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop - dup.2 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.0 - dup.7 + dup.4 u32wrapping_sub push.4294967295 - movup.9 - dup.9 + movup.5 + movup.5 u32wrapping_add u32wrapping_add u32and @@ -1044,6 +1786,18 @@ proc ::try_allocate_in( exec.::intrinsics::i64::wrapping_mul trace.252 nop + dup.1 + dup.1 + locaddr.6 + push.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop push.0 push.32 push.0 @@ -1057,64 +1811,118 @@ proc ::try_allocate_in( push.4294967295 u32lte assert - dup.3 - dup.3 + movup.3 + movup.3 movup.2 trace.240 nop - exec.::std::math::u64::shr + exec.::miden::core::math::u64::shr trace.252 nop drop neq if.true - drop - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop push.0 - push.3735929054 - dup.0 - dup.1 - swap.4 - swap.1 - swap.3 - swap.5 else + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 drop + dup.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.2147483648 - dup.7 + movup.2 u32wrapping_sub - dup.2 + movup.2 swap.1 u32lte neq dup.0 if.true + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 - dup.2 neq if.true + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 - movup.6 neq if.true + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.1 - dup.3 - dup.7 - dup.4 + movdn.3 swap.2 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::::alloc_impl + exec.::"root_ns:root@1.0.0"::adv_load_preimage::"::alloc_impl" + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop - dup.2 push.4 dup.1 swap.1 @@ -1128,20 +1936,59 @@ proc ::try_allocate_in( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop else + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.3 + movup.3 u32wrapping_add - dup.6 - dup.3 - swap.2 + movup.2 + swap.1 + trace.240 + nop + exec.::"root_ns:root@1.0.0"::adv_load_preimage::"::allocate" + trace.252 + nop + locaddr.5 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::::allocate + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.3 + swap.1 add u32assert push.4 @@ -1157,18 +2004,44 @@ proc ::try_allocate_in( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 - dup.1 neq - dup.0 if.true - movup.7 - movup.4 - drop - drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.5 + movup.2 add u32assert push.4 @@ -1177,8 +2050,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1186,8 +2057,24 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.4 + movup.2 add u32assert push.4 @@ -1196,8 +2083,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.5 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1205,13 +2090,34 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + push.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop else - movup.6 - movup.2 - drop - drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.5 + movup.2 add u32assert push.4 @@ -1220,8 +2126,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.3 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1229,8 +2133,24 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.4 + movup.2 add u32assert push.4 @@ -1239,8 +2159,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.5 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1248,22 +2166,35 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + push.1 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.1 - push.0 - movup.2 - cdrop else - movup.2 - swap.5 - movdn.2 - swap.4 + locaddr.0 + push.0 swap.1 - drop - drop - drop + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.1 + movup.2 add u32assert push.4 @@ -1272,8 +2203,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.4 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1281,8 +2210,25 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + push.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + swap.1 add u32assert push.4 @@ -1300,68 +2246,27 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop - push.0 - swap.1 - swap.3 - swap.2 - swap.1 end else - swap.1 - drop - movup.3 - drop - movup.3 - drop - movup.3 - drop - push.3735929054 + nop end push.0 push.1 - dup.3 - cdrop - push.3735929054 - dup.3 - dup.5 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.7 - swap.1 - cdrop - push.3735929054 - dup.5 - movup.2 - swap.7 - movdn.2 - cdrop - push.3735929054 movup.2 - swap.7 - movdn.2 - swap.1 - swap.5 cdrop - swap.1 - swap.5 - swap.4 - swap.2 - swap.3 - swap.1 end - movup.5 eq.0 if.true - movup.2 - drop - movup.2 - drop - movup.2 - drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + swap.1 add u32assert push.4 @@ -1380,11 +2285,34 @@ proc ::try_allocate_in( trace.252 nop push.1 + locaddr.3 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop else - drop - drop + nop end + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 push.4 dup.1 swap.1 @@ -1398,6 +2326,14 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114112 @@ -1410,6 +2346,7 @@ proc ::try_allocate_in( nop end +@locals("2") @callconv("C") proc alloc::raw_vec::handle_error(i32, i32) drop @@ -1418,6 +2355,7 @@ proc alloc::raw_vec::handle_error(i32, i32) assert end +@locals("2") @callconv("C") proc ::max( i32, diff --git a/tests/integration/expected/adv_load_preimage.wat b/tests/integration/expected/adv_load_preimage.wat index eae5f281d..4a368b6ce 100644 --- a/tests/integration/expected/adv_load_preimage.wat +++ b/tests/integration/expected/adv_load_preimage.wat @@ -102,7 +102,7 @@ local.get 3 local.get 2 local.get 1 - call $std::mem::pipe_preimage_to_memory + call $miden::core::mem::pipe_preimage_to_memory drop local.get 0 local.get 8 @@ -250,7 +250,7 @@ (func $intrinsics::felt::from_u64_unchecked (;10;) (type 9) (param i64) (result f32) unreachable ) - (func $std::mem::pipe_preimage_to_memory (;11;) (type 10) (param f32 i32 f32 f32 f32 f32) (result i32) + (func $miden::core::mem::pipe_preimage_to_memory (;11;) (type 10) (param f32 i32 f32 f32 f32 f32) (result i32) unreachable ) (func $::alloc_impl (;12;) (type 11) (param i32 i32 i32 i32) diff --git a/tests/integration/expected/and_bool.hir b/tests/integration/expected/and_bool.hir index be90eebfc..909de5a9c 100644 --- a/tests/integration/expected/and_bool.hir +++ b/tests/integration/expected/and_bool.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_f19303d702f807a0f2b8aebdfd8b2b6ae52ee927040711d5dfd94aac9e67f2c7 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.band v0, v1 : i32; - builtin.ret v3; + v5 = arith.band v0, v1 : i32; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/and_bool.masm b/tests/integration/expected/and_bool.masm index 218b104a1..f0b55898d 100644 --- a/tests/integration/expected/and_bool.masm +++ b/tests/integration/expected/and_bool.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_f19303d702f807a0f2b8aebdfd8b2b6ae52ee927040711d5dfd94aac9e67f2c7 +# mod ::"root_ns:root@1.0.0"::test_rust_f19303d702f807a0f2b8aebdfd8b2b6ae52ee927040711d5dfd94aac9e67f2c7 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32and diff --git a/tests/integration/expected/band_i16.hir b/tests/integration/expected/band_i16.hir index b87b3981d..65195cd63 100644 --- a/tests/integration/expected/band_i16.hir +++ b/tests/integration/expected/band_i16.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_34638703ab78fea8050898ab92e28a6a09cade611d4a9a3601c8667b275e57ee { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.band v1, v0 : i32; - builtin.ret v3; + v5 = arith.band v1, v0 : i32; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/band_i16.masm b/tests/integration/expected/band_i16.masm index a42dacd8f..4bff25577 100644 --- a/tests/integration/expected/band_i16.masm +++ b/tests/integration/expected/band_i16.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_34638703ab78fea8050898ab92e28a6a09cade611d4a9a3601c8667b275e57ee +# mod ::"root_ns:root@1.0.0"::test_rust_34638703ab78fea8050898ab92e28a6a09cade611d4a9a3601c8667b275e57ee +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32and diff --git a/tests/integration/expected/band_i32.hir b/tests/integration/expected/band_i32.hir index 6849cb6d7..aa0867b44 100644 --- a/tests/integration/expected/band_i32.hir +++ b/tests/integration/expected/band_i32.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_9ee88137407daefa6fa252f24e800d9fc4690951edfe7f8303f2f5225ed6eea3 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.band v1, v0 : i32; - builtin.ret v3; + v5 = arith.band v1, v0 : i32; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/band_i32.masm b/tests/integration/expected/band_i32.masm index 745ba7808..d1d9471ef 100644 --- a/tests/integration/expected/band_i32.masm +++ b/tests/integration/expected/band_i32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_9ee88137407daefa6fa252f24e800d9fc4690951edfe7f8303f2f5225ed6eea3 +# mod ::"root_ns:root@1.0.0"::test_rust_9ee88137407daefa6fa252f24e800d9fc4690951edfe7f8303f2f5225ed6eea3 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32and diff --git a/tests/integration/expected/band_i64.hir b/tests/integration/expected/band_i64.hir index 00f09d965..9df1f9d27 100644 --- a/tests/integration/expected/band_i64.hir +++ b/tests/integration/expected/band_i64.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_fdee33d480318f3f6165aabcaf90e290011f2d459d009ce9a6ea019e73b0e6b4 { public builtin.function @entrypoint(v0: i64, v1: i64) -> i64 { ^block6(v0: i64, v1: i64): - v3 = arith.band v1, v0 : i64; - builtin.ret v3; + v5 = arith.band v1, v0 : i64; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/band_i64.masm b/tests/integration/expected/band_i64.masm index b9bdfe325..9e08076bb 100644 --- a/tests/integration/expected/band_i64.masm +++ b/tests/integration/expected/band_i64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,13 +16,14 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_fdee33d480318f3f6165aabcaf90e290011f2d459d009ce9a6ea019e73b0e6b4 +# mod ::"root_ns:root@1.0.0"::test_rust_fdee33d480318f3f6165aabcaf90e290011f2d459d009ce9a6ea019e73b0e6b4 +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] trace.240 nop - exec.::std::math::u64::and + exec.::miden::core::math::u64::and trace.252 nop end diff --git a/tests/integration/expected/band_i8.hir b/tests/integration/expected/band_i8.hir index 260e18d96..7441aa3ed 100644 --- a/tests/integration/expected/band_i8.hir +++ b/tests/integration/expected/band_i8.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_a20ca31834cfb559286ab8bbb00ce2e657f38ec95d8459342621bc218581241d { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.band v1, v0 : i32; - builtin.ret v3; + v5 = arith.band v1, v0 : i32; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/band_i8.masm b/tests/integration/expected/band_i8.masm index 9c93cfd52..c8dd856a2 100644 --- a/tests/integration/expected/band_i8.masm +++ b/tests/integration/expected/band_i8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_a20ca31834cfb559286ab8bbb00ce2e657f38ec95d8459342621bc218581241d +# mod ::"root_ns:root@1.0.0"::test_rust_a20ca31834cfb559286ab8bbb00ce2e657f38ec95d8459342621bc218581241d +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32and diff --git a/tests/integration/expected/band_u16.hir b/tests/integration/expected/band_u16.hir index 06a9c7037..aa60b8324 100644 --- a/tests/integration/expected/band_u16.hir +++ b/tests/integration/expected/band_u16.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_41457a077e1338454c33613079552cd2abe9d4fd50975cf8d2d8d9ee664dfbb6 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.band v1, v0 : i32; - builtin.ret v3; + v5 = arith.band v1, v0 : i32; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/band_u16.masm b/tests/integration/expected/band_u16.masm index 6649c8583..dd308ac72 100644 --- a/tests/integration/expected/band_u16.masm +++ b/tests/integration/expected/band_u16.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_41457a077e1338454c33613079552cd2abe9d4fd50975cf8d2d8d9ee664dfbb6 +# mod ::"root_ns:root@1.0.0"::test_rust_41457a077e1338454c33613079552cd2abe9d4fd50975cf8d2d8d9ee664dfbb6 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32and diff --git a/tests/integration/expected/band_u32.hir b/tests/integration/expected/band_u32.hir index e7013bcf5..754802427 100644 --- a/tests/integration/expected/band_u32.hir +++ b/tests/integration/expected/band_u32.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_82d1878f26a40c75c635298e80f65f7a5aac492ad99eb90909a97ab273f4c1ad { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.band v1, v0 : i32; - builtin.ret v3; + v5 = arith.band v1, v0 : i32; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/band_u32.masm b/tests/integration/expected/band_u32.masm index 7949c1312..404175c2f 100644 --- a/tests/integration/expected/band_u32.masm +++ b/tests/integration/expected/band_u32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_82d1878f26a40c75c635298e80f65f7a5aac492ad99eb90909a97ab273f4c1ad +# mod ::"root_ns:root@1.0.0"::test_rust_82d1878f26a40c75c635298e80f65f7a5aac492ad99eb90909a97ab273f4c1ad +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32and diff --git a/tests/integration/expected/band_u64.hir b/tests/integration/expected/band_u64.hir index e93a29705..f5f063e3c 100644 --- a/tests/integration/expected/band_u64.hir +++ b/tests/integration/expected/band_u64.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_8509e2e84a91835b60f651a4adb33e43024ab7f31520e5ee5b5a97f181859a40 { public builtin.function @entrypoint(v0: i64, v1: i64) -> i64 { ^block6(v0: i64, v1: i64): - v3 = arith.band v1, v0 : i64; - builtin.ret v3; + v5 = arith.band v1, v0 : i64; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/band_u64.masm b/tests/integration/expected/band_u64.masm index d6c5ccba9..d3a26300e 100644 --- a/tests/integration/expected/band_u64.masm +++ b/tests/integration/expected/band_u64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,13 +16,14 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_8509e2e84a91835b60f651a4adb33e43024ab7f31520e5ee5b5a97f181859a40 +# mod ::"root_ns:root@1.0.0"::test_rust_8509e2e84a91835b60f651a4adb33e43024ab7f31520e5ee5b5a97f181859a40 +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] trace.240 nop - exec.::std::math::u64::and + exec.::miden::core::math::u64::and trace.252 nop end diff --git a/tests/integration/expected/band_u8.hir b/tests/integration/expected/band_u8.hir index a574b1c24..366254737 100644 --- a/tests/integration/expected/band_u8.hir +++ b/tests/integration/expected/band_u8.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_3be102ea36db2b23b9f6f0e34bfb210f4f562d75c14b2d53d64bdcc630a44aa6 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.band v1, v0 : i32; - builtin.ret v3; + v5 = arith.band v1, v0 : i32; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/band_u8.masm b/tests/integration/expected/band_u8.masm index c59aadff3..be5148c92 100644 --- a/tests/integration/expected/band_u8.masm +++ b/tests/integration/expected/band_u8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_3be102ea36db2b23b9f6f0e34bfb210f4f562d75c14b2d53d64bdcc630a44aa6 +# mod ::"root_ns:root@1.0.0"::test_rust_3be102ea36db2b23b9f6f0e34bfb210f4f562d75c14b2d53d64bdcc630a44aa6 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32and diff --git a/tests/integration/expected/bnot_bool.hir b/tests/integration/expected/bnot_bool.hir index bb2ea387a..eab22d03f 100644 --- a/tests/integration/expected/bnot_bool.hir +++ b/tests/integration/expected/bnot_bool.hir @@ -2,9 +2,9 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_77ff166ebf5be0d308b881f765d5f8ef913f838ea7e86a97499b030fa1c0f3f4 { public builtin.function @entrypoint(v0: i32) -> i32 { ^block6(v0: i32): - v2 = arith.constant 1 : i32; - v3 = arith.bxor v0, v2 : i32; - builtin.ret v3; + v5 = arith.constant 1 : i32; + v4 = arith.bxor v0, v5 : i32; + builtin.ret v4; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bnot_bool.masm b/tests/integration/expected/bnot_bool.masm index e7620b61c..24a51b6c4 100644 --- a/tests/integration/expected/bnot_bool.masm +++ b/tests/integration/expected/bnot_bool.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_77ff166ebf5be0d308b881f765d5f8ef913f838ea7e86a97499b030fa1c0f3f4 +# mod ::"root_ns:root@1.0.0"::test_rust_77ff166ebf5be0d308b881f765d5f8ef913f838ea7e86a97499b030fa1c0f3f4 +@locals("1") @callconv("C") pub proc entrypoint(i32) -> i32 push.1 diff --git a/tests/integration/expected/bnot_i16.hir b/tests/integration/expected/bnot_i16.hir index cc0fa22b0..0ff6ab89b 100644 --- a/tests/integration/expected/bnot_i16.hir +++ b/tests/integration/expected/bnot_i16.hir @@ -2,9 +2,9 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_e24d4ca783335c84dc5ae676aec479bda06baf4852fc00f30dac4021d07cf59f { public builtin.function @entrypoint(v0: i32) -> i32 { ^block6(v0: i32): - v2 = arith.constant -1 : i32; - v3 = arith.bxor v0, v2 : i32; - builtin.ret v3; + v5 = arith.constant -1 : i32; + v4 = arith.bxor v0, v5 : i32; + builtin.ret v4; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bnot_i16.masm b/tests/integration/expected/bnot_i16.masm index ac7f96e09..939a7c4f8 100644 --- a/tests/integration/expected/bnot_i16.masm +++ b/tests/integration/expected/bnot_i16.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_e24d4ca783335c84dc5ae676aec479bda06baf4852fc00f30dac4021d07cf59f +# mod ::"root_ns:root@1.0.0"::test_rust_e24d4ca783335c84dc5ae676aec479bda06baf4852fc00f30dac4021d07cf59f +@locals("1") @callconv("C") pub proc entrypoint(i32) -> i32 push.4294967295 diff --git a/tests/integration/expected/bnot_i32.hir b/tests/integration/expected/bnot_i32.hir index f9f44f0c2..48a9a8ac7 100644 --- a/tests/integration/expected/bnot_i32.hir +++ b/tests/integration/expected/bnot_i32.hir @@ -2,9 +2,9 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_0d63a98a6809a92584f1dbaab4dfd841caaf9cab88744275bd4ed034006fc6ed { public builtin.function @entrypoint(v0: i32) -> i32 { ^block6(v0: i32): - v2 = arith.constant -1 : i32; - v3 = arith.bxor v0, v2 : i32; - builtin.ret v3; + v5 = arith.constant -1 : i32; + v4 = arith.bxor v0, v5 : i32; + builtin.ret v4; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bnot_i32.masm b/tests/integration/expected/bnot_i32.masm index b44839e9a..a92c4c771 100644 --- a/tests/integration/expected/bnot_i32.masm +++ b/tests/integration/expected/bnot_i32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_0d63a98a6809a92584f1dbaab4dfd841caaf9cab88744275bd4ed034006fc6ed +# mod ::"root_ns:root@1.0.0"::test_rust_0d63a98a6809a92584f1dbaab4dfd841caaf9cab88744275bd4ed034006fc6ed +@locals("1") @callconv("C") pub proc entrypoint(i32) -> i32 push.4294967295 diff --git a/tests/integration/expected/bnot_i64.hir b/tests/integration/expected/bnot_i64.hir index 8b01cfe85..b8cbf6fb7 100644 --- a/tests/integration/expected/bnot_i64.hir +++ b/tests/integration/expected/bnot_i64.hir @@ -2,9 +2,9 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_b907170bd28f219043267cdd24dc67337632f05fcaab8f9a4efb14def28e8e3e { public builtin.function @entrypoint(v0: i64) -> i64 { ^block6(v0: i64): - v2 = arith.constant -1 : i64; - v3 = arith.bxor v0, v2 : i64; - builtin.ret v3; + v5 = arith.constant -1 : i64; + v4 = arith.bxor v0, v5 : i64; + builtin.ret v4; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bnot_i64.masm b/tests/integration/expected/bnot_i64.masm index 0d2acc101..1048fc139 100644 --- a/tests/integration/expected/bnot_i64.masm +++ b/tests/integration/expected/bnot_i64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,15 +16,16 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_b907170bd28f219043267cdd24dc67337632f05fcaab8f9a4efb14def28e8e3e +# mod ::"root_ns:root@1.0.0"::test_rust_b907170bd28f219043267cdd24dc67337632f05fcaab8f9a4efb14def28e8e3e +@locals("2") @callconv("C") pub proc entrypoint([u32; 2]) -> [u32; 2] push.4294967295 push.4294967295 trace.240 nop - exec.::std::math::u64::xor + exec.::miden::core::math::u64::xor trace.252 nop end diff --git a/tests/integration/expected/bnot_i8.hir b/tests/integration/expected/bnot_i8.hir index c08ec655d..2d80f8b91 100644 --- a/tests/integration/expected/bnot_i8.hir +++ b/tests/integration/expected/bnot_i8.hir @@ -2,9 +2,9 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_1f608e193c7b4c41422a7e789e491655410126a59a757a5572c1ed81892c7c0b { public builtin.function @entrypoint(v0: i32) -> i32 { ^block6(v0: i32): - v2 = arith.constant -1 : i32; - v3 = arith.bxor v0, v2 : i32; - builtin.ret v3; + v5 = arith.constant -1 : i32; + v4 = arith.bxor v0, v5 : i32; + builtin.ret v4; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bnot_i8.masm b/tests/integration/expected/bnot_i8.masm index ac85380ad..b7f20f6aa 100644 --- a/tests/integration/expected/bnot_i8.masm +++ b/tests/integration/expected/bnot_i8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_1f608e193c7b4c41422a7e789e491655410126a59a757a5572c1ed81892c7c0b +# mod ::"root_ns:root@1.0.0"::test_rust_1f608e193c7b4c41422a7e789e491655410126a59a757a5572c1ed81892c7c0b +@locals("1") @callconv("C") pub proc entrypoint(i32) -> i32 push.4294967295 diff --git a/tests/integration/expected/bnot_u16.hir b/tests/integration/expected/bnot_u16.hir index e42114ad2..43494cf68 100644 --- a/tests/integration/expected/bnot_u16.hir +++ b/tests/integration/expected/bnot_u16.hir @@ -2,9 +2,9 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_801b0e92eabaaba12053c65b60b81c5cb57e2d5bf386ab548321cf375005baea { public builtin.function @entrypoint(v0: i32) -> i32 { ^block6(v0: i32): - v2 = arith.constant 65535 : i32; - v3 = arith.bxor v0, v2 : i32; - builtin.ret v3; + v5 = arith.constant 65535 : i32; + v4 = arith.bxor v0, v5 : i32; + builtin.ret v4; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bnot_u16.masm b/tests/integration/expected/bnot_u16.masm index 2d5c95ac7..5bf4e3291 100644 --- a/tests/integration/expected/bnot_u16.masm +++ b/tests/integration/expected/bnot_u16.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_801b0e92eabaaba12053c65b60b81c5cb57e2d5bf386ab548321cf375005baea +# mod ::"root_ns:root@1.0.0"::test_rust_801b0e92eabaaba12053c65b60b81c5cb57e2d5bf386ab548321cf375005baea +@locals("1") @callconv("C") pub proc entrypoint(i32) -> i32 push.65535 diff --git a/tests/integration/expected/bnot_u32.hir b/tests/integration/expected/bnot_u32.hir index 2e7e8b4ce..0299962e0 100644 --- a/tests/integration/expected/bnot_u32.hir +++ b/tests/integration/expected/bnot_u32.hir @@ -2,9 +2,9 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_dc5405fd1533a0bda8a8715a70ef89a33300844687446825e2ae7bfc5a34655a { public builtin.function @entrypoint(v0: i32) -> i32 { ^block6(v0: i32): - v2 = arith.constant -1 : i32; - v3 = arith.bxor v0, v2 : i32; - builtin.ret v3; + v5 = arith.constant -1 : i32; + v4 = arith.bxor v0, v5 : i32; + builtin.ret v4; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bnot_u32.masm b/tests/integration/expected/bnot_u32.masm index 4ce9beb05..ce614197f 100644 --- a/tests/integration/expected/bnot_u32.masm +++ b/tests/integration/expected/bnot_u32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_dc5405fd1533a0bda8a8715a70ef89a33300844687446825e2ae7bfc5a34655a +# mod ::"root_ns:root@1.0.0"::test_rust_dc5405fd1533a0bda8a8715a70ef89a33300844687446825e2ae7bfc5a34655a +@locals("1") @callconv("C") pub proc entrypoint(i32) -> i32 push.4294967295 diff --git a/tests/integration/expected/bnot_u64.hir b/tests/integration/expected/bnot_u64.hir index fda914a88..0516335d1 100644 --- a/tests/integration/expected/bnot_u64.hir +++ b/tests/integration/expected/bnot_u64.hir @@ -2,9 +2,9 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_345f3c1e58fe5c9ef31421da6a362d9cadbf519ad68045840229e8b76f58a4f4 { public builtin.function @entrypoint(v0: i64) -> i64 { ^block6(v0: i64): - v2 = arith.constant -1 : i64; - v3 = arith.bxor v0, v2 : i64; - builtin.ret v3; + v5 = arith.constant -1 : i64; + v4 = arith.bxor v0, v5 : i64; + builtin.ret v4; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bnot_u64.masm b/tests/integration/expected/bnot_u64.masm index 466a668ac..de5ed12d2 100644 --- a/tests/integration/expected/bnot_u64.masm +++ b/tests/integration/expected/bnot_u64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,15 +16,16 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_345f3c1e58fe5c9ef31421da6a362d9cadbf519ad68045840229e8b76f58a4f4 +# mod ::"root_ns:root@1.0.0"::test_rust_345f3c1e58fe5c9ef31421da6a362d9cadbf519ad68045840229e8b76f58a4f4 +@locals("2") @callconv("C") pub proc entrypoint([u32; 2]) -> [u32; 2] push.4294967295 push.4294967295 trace.240 nop - exec.::std::math::u64::xor + exec.::miden::core::math::u64::xor trace.252 nop end diff --git a/tests/integration/expected/bnot_u8.hir b/tests/integration/expected/bnot_u8.hir index 70c972a4e..0432511f5 100644 --- a/tests/integration/expected/bnot_u8.hir +++ b/tests/integration/expected/bnot_u8.hir @@ -2,9 +2,9 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_5e3a237ba6b351b72bc4ac66517613ffe85ccd4b728c40b405f3a9ff93506063 { public builtin.function @entrypoint(v0: i32) -> i32 { ^block6(v0: i32): - v2 = arith.constant 255 : i32; - v3 = arith.bxor v0, v2 : i32; - builtin.ret v3; + v5 = arith.constant 255 : i32; + v4 = arith.bxor v0, v5 : i32; + builtin.ret v4; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bnot_u8.masm b/tests/integration/expected/bnot_u8.masm index b0764405f..8a64679e1 100644 --- a/tests/integration/expected/bnot_u8.masm +++ b/tests/integration/expected/bnot_u8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_5e3a237ba6b351b72bc4ac66517613ffe85ccd4b728c40b405f3a9ff93506063 +# mod ::"root_ns:root@1.0.0"::test_rust_5e3a237ba6b351b72bc4ac66517613ffe85ccd4b728c40b405f3a9ff93506063 +@locals("1") @callconv("C") pub proc entrypoint(i32) -> i32 push.255 diff --git a/tests/integration/expected/bor_i16.hir b/tests/integration/expected/bor_i16.hir index b88a40c89..a230c27a4 100644 --- a/tests/integration/expected/bor_i16.hir +++ b/tests/integration/expected/bor_i16.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_44e33b9e14fa2be1f40cdd20712edb995a941e3a1a153b46fb87e39dcbcdebc1 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.bor v1, v0 : i32; - builtin.ret v3; + v5 = arith.bor v1, v0 : i32; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bor_i16.masm b/tests/integration/expected/bor_i16.masm index 1dbf87d4e..b1e812e83 100644 --- a/tests/integration/expected/bor_i16.masm +++ b/tests/integration/expected/bor_i16.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_44e33b9e14fa2be1f40cdd20712edb995a941e3a1a153b46fb87e39dcbcdebc1 +# mod ::"root_ns:root@1.0.0"::test_rust_44e33b9e14fa2be1f40cdd20712edb995a941e3a1a153b46fb87e39dcbcdebc1 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32or diff --git a/tests/integration/expected/bor_i32.hir b/tests/integration/expected/bor_i32.hir index 3e1ad592f..1d20ddef5 100644 --- a/tests/integration/expected/bor_i32.hir +++ b/tests/integration/expected/bor_i32.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_e24b176dbd0fa5b54e01370fc307f6f1a06748cd8946e58e7d1469dceadc6d92 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.bor v1, v0 : i32; - builtin.ret v3; + v5 = arith.bor v1, v0 : i32; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bor_i32.masm b/tests/integration/expected/bor_i32.masm index 70a33561d..c95f5d1a9 100644 --- a/tests/integration/expected/bor_i32.masm +++ b/tests/integration/expected/bor_i32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_e24b176dbd0fa5b54e01370fc307f6f1a06748cd8946e58e7d1469dceadc6d92 +# mod ::"root_ns:root@1.0.0"::test_rust_e24b176dbd0fa5b54e01370fc307f6f1a06748cd8946e58e7d1469dceadc6d92 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32or diff --git a/tests/integration/expected/bor_i64.hir b/tests/integration/expected/bor_i64.hir index b5846fe74..5b1e9e33f 100644 --- a/tests/integration/expected/bor_i64.hir +++ b/tests/integration/expected/bor_i64.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_19d92981d2d7f148eaa97011bd0bd979fbc793cadadb334c67791824f38e7bf8 { public builtin.function @entrypoint(v0: i64, v1: i64) -> i64 { ^block6(v0: i64, v1: i64): - v3 = arith.bor v1, v0 : i64; - builtin.ret v3; + v5 = arith.bor v1, v0 : i64; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bor_i64.masm b/tests/integration/expected/bor_i64.masm index 8fd5c1cdb..bddf5ed89 100644 --- a/tests/integration/expected/bor_i64.masm +++ b/tests/integration/expected/bor_i64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,13 +16,14 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_19d92981d2d7f148eaa97011bd0bd979fbc793cadadb334c67791824f38e7bf8 +# mod ::"root_ns:root@1.0.0"::test_rust_19d92981d2d7f148eaa97011bd0bd979fbc793cadadb334c67791824f38e7bf8 +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] trace.240 nop - exec.::std::math::u64::or + exec.::miden::core::math::u64::or trace.252 nop end diff --git a/tests/integration/expected/bor_i8.hir b/tests/integration/expected/bor_i8.hir index 626375441..fc7232840 100644 --- a/tests/integration/expected/bor_i8.hir +++ b/tests/integration/expected/bor_i8.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_6b279a51e04f2b6fc0be10e9ad685e34fcfc2cbc2c726847699f4721f48e3713 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.bor v1, v0 : i32; - builtin.ret v3; + v5 = arith.bor v1, v0 : i32; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bor_i8.masm b/tests/integration/expected/bor_i8.masm index 8dbd5921e..6384496ef 100644 --- a/tests/integration/expected/bor_i8.masm +++ b/tests/integration/expected/bor_i8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_6b279a51e04f2b6fc0be10e9ad685e34fcfc2cbc2c726847699f4721f48e3713 +# mod ::"root_ns:root@1.0.0"::test_rust_6b279a51e04f2b6fc0be10e9ad685e34fcfc2cbc2c726847699f4721f48e3713 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32or diff --git a/tests/integration/expected/bor_u16.hir b/tests/integration/expected/bor_u16.hir index 81616803a..29d47fa47 100644 --- a/tests/integration/expected/bor_u16.hir +++ b/tests/integration/expected/bor_u16.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_fe8fe146eac1710c2c8529e4df4810118e471d0c279c48e765ff28ad800d1aab { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.bor v1, v0 : i32; - builtin.ret v3; + v5 = arith.bor v1, v0 : i32; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bor_u16.masm b/tests/integration/expected/bor_u16.masm index 0f94176f1..ec3c2efa4 100644 --- a/tests/integration/expected/bor_u16.masm +++ b/tests/integration/expected/bor_u16.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_fe8fe146eac1710c2c8529e4df4810118e471d0c279c48e765ff28ad800d1aab +# mod ::"root_ns:root@1.0.0"::test_rust_fe8fe146eac1710c2c8529e4df4810118e471d0c279c48e765ff28ad800d1aab +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32or diff --git a/tests/integration/expected/bor_u32.hir b/tests/integration/expected/bor_u32.hir index a6d8e5453..81d7eff4f 100644 --- a/tests/integration/expected/bor_u32.hir +++ b/tests/integration/expected/bor_u32.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_e3bb04a56c487ecfc0dd1c57e0d354745ffb321466dc47bd02d51513cc6980d1 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.bor v1, v0 : i32; - builtin.ret v3; + v5 = arith.bor v1, v0 : i32; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bor_u32.masm b/tests/integration/expected/bor_u32.masm index bd58a5089..8ff77058f 100644 --- a/tests/integration/expected/bor_u32.masm +++ b/tests/integration/expected/bor_u32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_e3bb04a56c487ecfc0dd1c57e0d354745ffb321466dc47bd02d51513cc6980d1 +# mod ::"root_ns:root@1.0.0"::test_rust_e3bb04a56c487ecfc0dd1c57e0d354745ffb321466dc47bd02d51513cc6980d1 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32or diff --git a/tests/integration/expected/bor_u64.hir b/tests/integration/expected/bor_u64.hir index 7ece8d747..a57680332 100644 --- a/tests/integration/expected/bor_u64.hir +++ b/tests/integration/expected/bor_u64.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_e8616ef7e15d87b491a1dbcccfe42b1dcb7a90b965c27549b2b5d9604d28acee { public builtin.function @entrypoint(v0: i64, v1: i64) -> i64 { ^block6(v0: i64, v1: i64): - v3 = arith.bor v1, v0 : i64; - builtin.ret v3; + v5 = arith.bor v1, v0 : i64; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bor_u64.masm b/tests/integration/expected/bor_u64.masm index 083fcafa8..5d4b9c8d6 100644 --- a/tests/integration/expected/bor_u64.masm +++ b/tests/integration/expected/bor_u64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,13 +16,14 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_e8616ef7e15d87b491a1dbcccfe42b1dcb7a90b965c27549b2b5d9604d28acee +# mod ::"root_ns:root@1.0.0"::test_rust_e8616ef7e15d87b491a1dbcccfe42b1dcb7a90b965c27549b2b5d9604d28acee +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] trace.240 nop - exec.::std::math::u64::or + exec.::miden::core::math::u64::or trace.252 nop end diff --git a/tests/integration/expected/bor_u8.hir b/tests/integration/expected/bor_u8.hir index f718c0dda..eb9639f58 100644 --- a/tests/integration/expected/bor_u8.hir +++ b/tests/integration/expected/bor_u8.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_a0d8359c86d6548c3cdc5448b2a38351e3498e1db98a8d3d4bbbc27afa05af09 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.bor v1, v0 : i32; - builtin.ret v3; + v5 = arith.bor v1, v0 : i32; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bor_u8.masm b/tests/integration/expected/bor_u8.masm index 244b827d4..a66e1f820 100644 --- a/tests/integration/expected/bor_u8.masm +++ b/tests/integration/expected/bor_u8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_a0d8359c86d6548c3cdc5448b2a38351e3498e1db98a8d3d4bbbc27afa05af09 +# mod ::"root_ns:root@1.0.0"::test_rust_a0d8359c86d6548c3cdc5448b2a38351e3498e1db98a8d3d4bbbc27afa05af09 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32or diff --git a/tests/integration/expected/bxor_i16.hir b/tests/integration/expected/bxor_i16.hir index e3abd4d5b..e70146624 100644 --- a/tests/integration/expected/bxor_i16.hir +++ b/tests/integration/expected/bxor_i16.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_cb1e0c1a18c279735e94c50dd925290caa430ac65188eb20eb437a4391d25640 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.bxor v1, v0 : i32; - builtin.ret v3; + v5 = arith.bxor v1, v0 : i32; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bxor_i16.masm b/tests/integration/expected/bxor_i16.masm index 4eea528bc..adc2f95ec 100644 --- a/tests/integration/expected/bxor_i16.masm +++ b/tests/integration/expected/bxor_i16.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_cb1e0c1a18c279735e94c50dd925290caa430ac65188eb20eb437a4391d25640 +# mod ::"root_ns:root@1.0.0"::test_rust_cb1e0c1a18c279735e94c50dd925290caa430ac65188eb20eb437a4391d25640 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32xor diff --git a/tests/integration/expected/bxor_i32.hir b/tests/integration/expected/bxor_i32.hir index 3ea8459ad..8328ddb78 100644 --- a/tests/integration/expected/bxor_i32.hir +++ b/tests/integration/expected/bxor_i32.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_1c4d375403281e14e710bf442e5556c06e5933dce447f206252657b1345611f0 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.bxor v1, v0 : i32; - builtin.ret v3; + v5 = arith.bxor v1, v0 : i32; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bxor_i32.masm b/tests/integration/expected/bxor_i32.masm index 3296b8b5d..aeaf6bde0 100644 --- a/tests/integration/expected/bxor_i32.masm +++ b/tests/integration/expected/bxor_i32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_1c4d375403281e14e710bf442e5556c06e5933dce447f206252657b1345611f0 +# mod ::"root_ns:root@1.0.0"::test_rust_1c4d375403281e14e710bf442e5556c06e5933dce447f206252657b1345611f0 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32xor diff --git a/tests/integration/expected/bxor_i64.hir b/tests/integration/expected/bxor_i64.hir index 757dac61d..e866d6249 100644 --- a/tests/integration/expected/bxor_i64.hir +++ b/tests/integration/expected/bxor_i64.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_bbe2169ccd3bb4080a705f38ed5ef633d3af9e172e8f9b41ae4ee10f8059e176 { public builtin.function @entrypoint(v0: i64, v1: i64) -> i64 { ^block6(v0: i64, v1: i64): - v3 = arith.bxor v1, v0 : i64; - builtin.ret v3; + v5 = arith.bxor v1, v0 : i64; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bxor_i64.masm b/tests/integration/expected/bxor_i64.masm index a4830ee6b..e57ca3b79 100644 --- a/tests/integration/expected/bxor_i64.masm +++ b/tests/integration/expected/bxor_i64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,13 +16,14 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_bbe2169ccd3bb4080a705f38ed5ef633d3af9e172e8f9b41ae4ee10f8059e176 +# mod ::"root_ns:root@1.0.0"::test_rust_bbe2169ccd3bb4080a705f38ed5ef633d3af9e172e8f9b41ae4ee10f8059e176 +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] trace.240 nop - exec.::std::math::u64::xor + exec.::miden::core::math::u64::xor trace.252 nop end diff --git a/tests/integration/expected/bxor_i8.hir b/tests/integration/expected/bxor_i8.hir index 17b9382d5..8b7e10636 100644 --- a/tests/integration/expected/bxor_i8.hir +++ b/tests/integration/expected/bxor_i8.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_da1dfc177b6a72c28237264497437ada8ba555111d180be7b99b1d60791da41c { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.bxor v1, v0 : i32; - builtin.ret v3; + v5 = arith.bxor v1, v0 : i32; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bxor_i8.masm b/tests/integration/expected/bxor_i8.masm index bd9bd9550..a8c1435b1 100644 --- a/tests/integration/expected/bxor_i8.masm +++ b/tests/integration/expected/bxor_i8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_da1dfc177b6a72c28237264497437ada8ba555111d180be7b99b1d60791da41c +# mod ::"root_ns:root@1.0.0"::test_rust_da1dfc177b6a72c28237264497437ada8ba555111d180be7b99b1d60791da41c +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32xor diff --git a/tests/integration/expected/bxor_u16.hir b/tests/integration/expected/bxor_u16.hir index ea63c1324..2855d0cfa 100644 --- a/tests/integration/expected/bxor_u16.hir +++ b/tests/integration/expected/bxor_u16.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_255d3558f03d3b3be3d933d40e9ae32b53db7dd904e40aafd5677d694056c91b { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.bxor v1, v0 : i32; - builtin.ret v3; + v5 = arith.bxor v1, v0 : i32; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bxor_u16.masm b/tests/integration/expected/bxor_u16.masm index ff8c7d983..75997a01e 100644 --- a/tests/integration/expected/bxor_u16.masm +++ b/tests/integration/expected/bxor_u16.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_255d3558f03d3b3be3d933d40e9ae32b53db7dd904e40aafd5677d694056c91b +# mod ::"root_ns:root@1.0.0"::test_rust_255d3558f03d3b3be3d933d40e9ae32b53db7dd904e40aafd5677d694056c91b +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32xor diff --git a/tests/integration/expected/bxor_u32.hir b/tests/integration/expected/bxor_u32.hir index 61ae370f7..9af565d82 100644 --- a/tests/integration/expected/bxor_u32.hir +++ b/tests/integration/expected/bxor_u32.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_b25131cea5088f57eb35dec78eb814ce753ab95c1f4faf8447870d9b6d1525dd { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.bxor v1, v0 : i32; - builtin.ret v3; + v5 = arith.bxor v1, v0 : i32; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bxor_u32.masm b/tests/integration/expected/bxor_u32.masm index 72a1e8e1a..afea49f3f 100644 --- a/tests/integration/expected/bxor_u32.masm +++ b/tests/integration/expected/bxor_u32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_b25131cea5088f57eb35dec78eb814ce753ab95c1f4faf8447870d9b6d1525dd +# mod ::"root_ns:root@1.0.0"::test_rust_b25131cea5088f57eb35dec78eb814ce753ab95c1f4faf8447870d9b6d1525dd +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32xor diff --git a/tests/integration/expected/bxor_u64.hir b/tests/integration/expected/bxor_u64.hir index 012ab5f74..8ecc97d35 100644 --- a/tests/integration/expected/bxor_u64.hir +++ b/tests/integration/expected/bxor_u64.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_ab1d59bc3952451e2ac6a22333bf5458760622594546976d2d1488d607497ae7 { public builtin.function @entrypoint(v0: i64, v1: i64) -> i64 { ^block6(v0: i64, v1: i64): - v3 = arith.bxor v1, v0 : i64; - builtin.ret v3; + v5 = arith.bxor v1, v0 : i64; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bxor_u64.masm b/tests/integration/expected/bxor_u64.masm index f08164607..9c6d78c54 100644 --- a/tests/integration/expected/bxor_u64.masm +++ b/tests/integration/expected/bxor_u64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,13 +16,14 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_ab1d59bc3952451e2ac6a22333bf5458760622594546976d2d1488d607497ae7 +# mod ::"root_ns:root@1.0.0"::test_rust_ab1d59bc3952451e2ac6a22333bf5458760622594546976d2d1488d607497ae7 +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] trace.240 nop - exec.::std::math::u64::xor + exec.::miden::core::math::u64::xor trace.252 nop end diff --git a/tests/integration/expected/bxor_u8.hir b/tests/integration/expected/bxor_u8.hir index b3dad1e8d..d7cf56d27 100644 --- a/tests/integration/expected/bxor_u8.hir +++ b/tests/integration/expected/bxor_u8.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_e442bdf6f0faa5b55270b06bb284534cce773aa9180fde57cdeeeddf42bb21e6 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.bxor v1, v0 : i32; - builtin.ret v3; + v5 = arith.bxor v1, v0 : i32; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/bxor_u8.masm b/tests/integration/expected/bxor_u8.masm index d5bb463bf..f9e2d6947 100644 --- a/tests/integration/expected/bxor_u8.masm +++ b/tests/integration/expected/bxor_u8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_e442bdf6f0faa5b55270b06bb284534cce773aa9180fde57cdeeeddf42bb21e6 +# mod ::"root_ns:root@1.0.0"::test_rust_e442bdf6f0faa5b55270b06bb284534cce773aa9180fde57cdeeeddf42bb21e6 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32xor diff --git a/tests/integration/expected/collatz.hir b/tests/integration/expected/collatz.hir index 2a3ebe965..5b6e988e7 100644 --- a/tests/integration/expected/collatz.hir +++ b/tests/integration/expected/collatz.hir @@ -2,48 +2,55 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @collatz { public builtin.function @entrypoint(v0: i32) -> i32 { ^block4(v0: i32): - v2 = arith.constant 0 : i32; - v59, v60, v61 = scf.while v0, v2 : i32, i32, i32 { - ^block17(v62: i32, v63: i32): - v76 = arith.constant 0 : i32; - v6 = arith.constant 1 : i32; - v7 = arith.neq v62, v6 : i1; - v8 = arith.zext v7 : u32; - v9 = hir.bitcast v8 : i32; - v11 = arith.neq v9, v76 : i1; - v67, v68 = scf.if v11 : i32, i32 { + hir.store_local v0 #[local = lv0]; + v36 = arith.constant 0 : i32; + hir.store_local v36 #[local = lv1]; + scf.while { + ^block6: + v4 = hir.load_local : i32 #[local = lv0]; + v57 = arith.constant 0 : i32; + v35 = arith.constant 1 : i32; + v6 = arith.neq v4, v35 : i1; + v7 = arith.zext v6 : u32; + v8 = hir.bitcast v7 : i32; + v10 = arith.neq v8, v57 : i1; + scf.if v10{ ^block8: - v72 = arith.constant 1 : i32; - v28 = arith.add v63, v72 : i32 #[overflow = wrapping]; - v36 = arith.constant 1 : u32; - v18 = hir.bitcast v62 : u32; - v20 = arith.shr v18, v36 : u32; - v21 = hir.bitcast v20 : i32; - v73 = arith.constant 1 : i32; - v13 = arith.constant 3 : i32; - v14 = arith.mul v62, v13 : i32 #[overflow = wrapping]; - v16 = arith.add v14, v73 : i32 #[overflow = wrapping]; - v74 = arith.constant 0 : i32; - v75 = arith.constant 1 : i32; - v23 = arith.band v62, v75 : i32; - v25 = arith.neq v23, v74 : i1; - v26 = cf.select v25, v16, v21 : i32; - scf.yield v26, v28; + v12 = hir.load_local : i32 #[local = lv0]; + v46 = arith.constant 1 : u32; + v19 = hir.bitcast v12 : u32; + v21 = arith.shr v19, v46 : u32; + v22 = hir.bitcast v21 : i32; + v54 = arith.constant 1 : i32; + v34 = arith.constant 3 : i32; + v14 = arith.mul v12, v34 : i32 #[overflow = wrapping]; + v16 = arith.add v14, v54 : i32 #[overflow = wrapping]; + v55 = arith.constant 0 : i32; + v56 = arith.constant 1 : i32; + v25 = arith.band v12, v56 : i32; + v27 = arith.neq v25, v55 : i1; + v28 = cf.select v27, v16, v22 : i32; + hir.store_local v28 #[local = lv0]; + v29 = hir.load_local : i32 #[local = lv1]; + v53 = arith.constant 1 : i32; + v31 = arith.add v29, v53 : i32 #[overflow = wrapping]; + hir.store_local v31 #[local = lv1]; + scf.yield ; } else { ^block16: - v37 = ub.poison i32 : i32; - scf.yield v37, v37; + scf.yield ; }; - v31 = arith.constant 0 : u32; - v71 = arith.constant 1 : u32; - v70 = cf.select v11, v71, v31 : u32; - v54 = arith.trunc v70 : i1; - scf.condition v54, v67, v68, v63; + v43 = arith.constant 0 : u32; + v52 = arith.constant 1 : u32; + v51 = cf.select v10, v52, v43 : u32; + v47 = arith.trunc v51 : i1; + scf.condition v47; } do { - ^block18(v64: i32, v65: i32, v66: i32): - scf.yield v64, v65; + ^block15: + scf.yield ; }; - builtin.ret v61; + v11 = hir.load_local : i32 #[local = lv1]; + builtin.ret v11; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/collatz.masm b/tests/integration/expected/collatz.masm index 1d10172b4..a323521a4 100644 --- a/tests/integration/expected/collatz.masm +++ b/tests/integration/expected/collatz.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,31 +10,60 @@ proc init mem_store.278528 end -# mod root_ns:root@1.0.0::collatz +# mod ::"root_ns:root@1.0.0"::collatz +@locals("2") @callconv("C") pub proc entrypoint(i32) -> i32 + locaddr.0 push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1 while.true + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.1 - dup.2 + movup.2 neq neq dup.0 if.true + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.1 - dup.3 - u32wrapping_add - push.1 - dup.3 + dup.1 swap.1 u32shr push.1 push.3 - dup.5 + dup.3 trace.240 nop exec.::intrinsics::i32::wrapping_mul @@ -43,31 +72,58 @@ pub proc entrypoint(i32) -> i32 u32wrapping_add push.0 push.1 - movup.6 + movup.4 u32and neq cdrop - else + locaddr.0 + push.0 swap.1 - drop - push.3735929054 - dup.0 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1 + u32wrapping_add + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + else + nop end push.0 push.1 - movup.4 + movup.2 cdrop push.1 u32and if.true - movup.2 - drop push.1 else push.0 end end - drop - drop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end diff --git a/tests/integration/expected/core::cmp::max_u8_u8.hir b/tests/integration/expected/core::cmp::max_u8_u8.hir index 2d17c0d5e..6063f2108 100644 --- a/tests/integration/expected/core::cmp::max_u8_u8.hir +++ b/tests/integration/expected/core::cmp::max_u8_u8.hir @@ -2,15 +2,15 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_adcf2f13ea1f22958c5a92d1674643acc093416b0b2de0fee390636adfcf090a { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v8 = arith.constant 0 : i32; - v4 = hir.bitcast v0 : u32; - v3 = hir.bitcast v1 : u32; - v5 = arith.gt v3, v4 : i1; - v6 = arith.zext v5 : u32; - v7 = hir.bitcast v6 : i32; - v9 = arith.neq v7, v8 : i1; - v10 = cf.select v9, v1, v0 : i32; - builtin.ret v10; + v15 = arith.constant 0 : i32; + v8 = hir.bitcast v0 : u32; + v7 = hir.bitcast v1 : u32; + v9 = arith.gt v7, v8 : i1; + v10 = arith.zext v9 : u32; + v11 = hir.bitcast v10 : i32; + v13 = arith.neq v11, v15 : i1; + v14 = cf.select v13, v1, v0 : i32; + builtin.ret v14; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/core::cmp::max_u8_u8.masm b/tests/integration/expected/core::cmp::max_u8_u8.masm index 915431ef4..9306dcf86 100644 --- a/tests/integration/expected/core::cmp::max_u8_u8.masm +++ b/tests/integration/expected/core::cmp::max_u8_u8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_adcf2f13ea1f22958c5a92d1674643acc093416b0b2de0fee390636adfcf090a +# mod ::"root_ns:root@1.0.0"::test_rust_adcf2f13ea1f22958c5a92d1674643acc093416b0b2de0fee390636adfcf090a +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 push.0 diff --git a/tests/integration/expected/core::cmp::min_i32_i32.hir b/tests/integration/expected/core::cmp::min_i32_i32.hir index 981d81a45..975cd8c32 100644 --- a/tests/integration/expected/core::cmp::min_i32_i32.hir +++ b/tests/integration/expected/core::cmp::min_i32_i32.hir @@ -2,13 +2,13 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_473cae57ec6aea1b2fa1e6ffdabf82016fbf6e38e3acdf12f2f612d1044a9d0c { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v6 = arith.constant 0 : i32; - v3 = arith.lt v1, v0 : i1; - v4 = arith.zext v3 : u32; - v5 = hir.bitcast v4 : i32; - v7 = arith.neq v5, v6 : i1; - v8 = cf.select v7, v1, v0 : i32; - builtin.ret v8; + v13 = arith.constant 0 : i32; + v7 = arith.lt v1, v0 : i1; + v8 = arith.zext v7 : u32; + v9 = hir.bitcast v8 : i32; + v11 = arith.neq v9, v13 : i1; + v12 = cf.select v11, v1, v0 : i32; + builtin.ret v12; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/core::cmp::min_i32_i32.masm b/tests/integration/expected/core::cmp::min_i32_i32.masm index b797a3b95..ddc924819 100644 --- a/tests/integration/expected/core::cmp::min_i32_i32.masm +++ b/tests/integration/expected/core::cmp::min_i32_i32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_473cae57ec6aea1b2fa1e6ffdabf82016fbf6e38e3acdf12f2f612d1044a9d0c +# mod ::"root_ns:root@1.0.0"::test_rust_473cae57ec6aea1b2fa1e6ffdabf82016fbf6e38e3acdf12f2f612d1044a9d0c +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 push.0 diff --git a/tests/integration/expected/core::cmp::min_u32_u32.hir b/tests/integration/expected/core::cmp::min_u32_u32.hir index 311f02e38..37a67638d 100644 --- a/tests/integration/expected/core::cmp::min_u32_u32.hir +++ b/tests/integration/expected/core::cmp::min_u32_u32.hir @@ -2,15 +2,15 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_d58f2727da94ef76690ba318a633249545f9e38779d69d96f04c561d52921cd4 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v8 = arith.constant 0 : i32; - v4 = hir.bitcast v0 : u32; - v3 = hir.bitcast v1 : u32; - v5 = arith.lt v3, v4 : i1; - v6 = arith.zext v5 : u32; - v7 = hir.bitcast v6 : i32; - v9 = arith.neq v7, v8 : i1; - v10 = cf.select v9, v1, v0 : i32; - builtin.ret v10; + v15 = arith.constant 0 : i32; + v8 = hir.bitcast v0 : u32; + v7 = hir.bitcast v1 : u32; + v9 = arith.lt v7, v8 : i1; + v10 = arith.zext v9 : u32; + v11 = hir.bitcast v10 : i32; + v13 = arith.neq v11, v15 : i1; + v14 = cf.select v13, v1, v0 : i32; + builtin.ret v14; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/core::cmp::min_u32_u32.masm b/tests/integration/expected/core::cmp::min_u32_u32.masm index 8d20e3f7b..cd6655ce7 100644 --- a/tests/integration/expected/core::cmp::min_u32_u32.masm +++ b/tests/integration/expected/core::cmp::min_u32_u32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_d58f2727da94ef76690ba318a633249545f9e38779d69d96f04c561d52921cd4 +# mod ::"root_ns:root@1.0.0"::test_rust_d58f2727da94ef76690ba318a633249545f9e38779d69d96f04c561d52921cd4 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 push.0 diff --git a/tests/integration/expected/core::cmp::min_u8_u8.hir b/tests/integration/expected/core::cmp::min_u8_u8.hir index 8819d5c98..e57717450 100644 --- a/tests/integration/expected/core::cmp::min_u8_u8.hir +++ b/tests/integration/expected/core::cmp::min_u8_u8.hir @@ -2,15 +2,15 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_86004120286ad9607be152901a86f66a999ee9dd70f4520b4ba4d6af29300327 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v8 = arith.constant 0 : i32; - v4 = hir.bitcast v0 : u32; - v3 = hir.bitcast v1 : u32; - v5 = arith.lt v3, v4 : i1; - v6 = arith.zext v5 : u32; - v7 = hir.bitcast v6 : i32; - v9 = arith.neq v7, v8 : i1; - v10 = cf.select v9, v1, v0 : i32; - builtin.ret v10; + v15 = arith.constant 0 : i32; + v8 = hir.bitcast v0 : u32; + v7 = hir.bitcast v1 : u32; + v9 = arith.lt v7, v8 : i1; + v10 = arith.zext v9 : u32; + v11 = hir.bitcast v10 : i32; + v13 = arith.neq v11, v15 : i1; + v14 = cf.select v13, v1, v0 : i32; + builtin.ret v14; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/core::cmp::min_u8_u8.masm b/tests/integration/expected/core::cmp::min_u8_u8.masm index da73e0439..ceb2d7f3a 100644 --- a/tests/integration/expected/core::cmp::min_u8_u8.masm +++ b/tests/integration/expected/core::cmp::min_u8_u8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_86004120286ad9607be152901a86f66a999ee9dd70f4520b4ba4d6af29300327 +# mod ::"root_ns:root@1.0.0"::test_rust_86004120286ad9607be152901a86f66a999ee9dd70f4520b4ba4d6af29300327 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 push.0 diff --git a/tests/integration/expected/div_felt.hir b/tests/integration/expected/div_felt.hir index 6f5ed64d0..2ee332e4f 100644 --- a/tests/integration/expected/div_felt.hir +++ b/tests/integration/expected/div_felt.hir @@ -2,14 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @div_felt { public builtin.function @entrypoint(v0: felt, v1: felt) -> felt { ^block4(v0: felt, v1: felt): - v3 = hir.exec @root_ns:root@1.0.0/div_felt/intrinsics::felt::div(v0, v1) : felt - builtin.ret v3; - }; - - private builtin.function @intrinsics::felt::div(v4: felt, v5: felt) -> felt { - ^block6(v4: felt, v5: felt): - v6 = arith.div v4, v5 : felt; - builtin.ret v6; + v5 = arith.div v0, v1 : felt; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/div_felt.masm b/tests/integration/expected/div_felt.masm index ffe319f53..c4c619d9d 100644 --- a/tests/integration/expected/div_felt.masm +++ b/tests/integration/expected/div_felt.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,19 +10,11 @@ proc init mem_store.278528 end -# mod root_ns:root@1.0.0::div_felt +# mod ::"root_ns:root@1.0.0"::div_felt +@locals("2") @callconv("C") pub proc entrypoint(felt, felt) -> felt - trace.240 - nop - exec.::root_ns:root@1.0.0::div_felt::intrinsics::felt::div - trace.252 - nop -end - -@callconv("C") -proc intrinsics::felt::div(felt, felt) -> felt swap.1 div end diff --git a/tests/integration/expected/eq_felt.hir b/tests/integration/expected/eq_felt.hir index 614267455..a7fd31c92 100644 --- a/tests/integration/expected/eq_felt.hir +++ b/tests/integration/expected/eq_felt.hir @@ -2,19 +2,13 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @eq_felt { public builtin.function @entrypoint(v0: felt, v1: felt) -> i32 { ^block4(v0: felt, v1: felt): - v3 = hir.exec @root_ns:root@1.0.0/eq_felt/intrinsics::felt::eq(v0, v1) : i32 - v4 = arith.constant 1 : i32; - v5 = arith.eq v3, v4 : i1; - v6 = arith.zext v5 : u32; - v7 = hir.bitcast v6 : i32; - builtin.ret v7; - }; - - private builtin.function @intrinsics::felt::eq(v8: felt, v9: felt) -> i32 { - ^block6(v8: felt, v9: felt): - v10 = arith.eq v8, v9 : i1; - v11 = hir.cast v10 : i32; - builtin.ret v11; + v11 = arith.constant 1 : i32; + v5 = arith.eq v0, v1 : i1; + v6 = hir.cast v5 : i32; + v8 = arith.eq v6, v11 : i1; + v9 = arith.zext v8 : u32; + v10 = hir.bitcast v9 : i32; + builtin.ret v10; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/eq_felt.masm b/tests/integration/expected/eq_felt.masm index 9dacb11d9..02cdc7915 100644 --- a/tests/integration/expected/eq_felt.masm +++ b/tests/integration/expected/eq_felt.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,21 +10,14 @@ proc init mem_store.278528 end -# mod root_ns:root@1.0.0::eq_felt +# mod ::"root_ns:root@1.0.0"::eq_felt +@locals("2") @callconv("C") pub proc entrypoint(felt, felt) -> i32 - trace.240 - nop - exec.::root_ns:root@1.0.0::eq_felt::intrinsics::felt::eq - trace.252 - nop push.1 + swap.2 eq -end - -@callconv("C") -proc intrinsics::felt::eq(felt, felt) -> i32 eq end diff --git a/tests/integration/expected/eq_i16.hir b/tests/integration/expected/eq_i16.hir index f32f14e5b..b891011ec 100644 --- a/tests/integration/expected/eq_i16.hir +++ b/tests/integration/expected/eq_i16.hir @@ -2,10 +2,10 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_517fb449f17b407495bba1888d666bc76885dc2541249b2f6cfe05173973099e { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.eq v0, v1 : i1; - v4 = arith.zext v3 : u32; - v5 = hir.bitcast v4 : i32; - builtin.ret v5; + v5 = arith.eq v0, v1 : i1; + v6 = arith.zext v5 : u32; + v7 = hir.bitcast v6 : i32; + builtin.ret v7; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/eq_i16.masm b/tests/integration/expected/eq_i16.masm index 37f9bf398..f68da6cfd 100644 --- a/tests/integration/expected/eq_i16.masm +++ b/tests/integration/expected/eq_i16.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_517fb449f17b407495bba1888d666bc76885dc2541249b2f6cfe05173973099e +# mod ::"root_ns:root@1.0.0"::test_rust_517fb449f17b407495bba1888d666bc76885dc2541249b2f6cfe05173973099e +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 eq diff --git a/tests/integration/expected/eq_i32.hir b/tests/integration/expected/eq_i32.hir index 732258bd3..344d3ed61 100644 --- a/tests/integration/expected/eq_i32.hir +++ b/tests/integration/expected/eq_i32.hir @@ -2,10 +2,10 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_3a92b0607377b819decb1029f8199a70990302e258cc8ee55f612c4d879c74f4 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.eq v0, v1 : i1; - v4 = arith.zext v3 : u32; - v5 = hir.bitcast v4 : i32; - builtin.ret v5; + v5 = arith.eq v0, v1 : i1; + v6 = arith.zext v5 : u32; + v7 = hir.bitcast v6 : i32; + builtin.ret v7; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/eq_i32.masm b/tests/integration/expected/eq_i32.masm index 987fcdfed..e8b0429e0 100644 --- a/tests/integration/expected/eq_i32.masm +++ b/tests/integration/expected/eq_i32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_3a92b0607377b819decb1029f8199a70990302e258cc8ee55f612c4d879c74f4 +# mod ::"root_ns:root@1.0.0"::test_rust_3a92b0607377b819decb1029f8199a70990302e258cc8ee55f612c4d879c74f4 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 eq diff --git a/tests/integration/expected/eq_i64.hir b/tests/integration/expected/eq_i64.hir index 6e102cfea..0c3b2c23c 100644 --- a/tests/integration/expected/eq_i64.hir +++ b/tests/integration/expected/eq_i64.hir @@ -2,10 +2,10 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_bcf098a70fb61198130acb429b0b2900b9c9d11c5cab0241410bb862be7ce2a8 { public builtin.function @entrypoint(v0: i64, v1: i64) -> i32 { ^block6(v0: i64, v1: i64): - v3 = arith.eq v0, v1 : i1; - v4 = arith.zext v3 : u32; - v5 = hir.bitcast v4 : i32; - builtin.ret v5; + v5 = arith.eq v0, v1 : i1; + v6 = arith.zext v5 : u32; + v7 = hir.bitcast v6 : i32; + builtin.ret v7; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/eq_i64.masm b/tests/integration/expected/eq_i64.masm index 84480b6c4..3b7223ea4 100644 --- a/tests/integration/expected/eq_i64.masm +++ b/tests/integration/expected/eq_i64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,13 +16,14 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_bcf098a70fb61198130acb429b0b2900b9c9d11c5cab0241410bb862be7ce2a8 +# mod ::"root_ns:root@1.0.0"::test_rust_bcf098a70fb61198130acb429b0b2900b9c9d11c5cab0241410bb862be7ce2a8 +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> i32 trace.240 nop - exec.::std::math::u64::eq + exec.::miden::core::math::u64::eq trace.252 nop end diff --git a/tests/integration/expected/eq_i8.hir b/tests/integration/expected/eq_i8.hir index 018131232..7cbce72e5 100644 --- a/tests/integration/expected/eq_i8.hir +++ b/tests/integration/expected/eq_i8.hir @@ -2,10 +2,10 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_c2c2ad0caabf21644314027afcbfb75555fa063ab09504517a70196ddd47c892 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.eq v0, v1 : i1; - v4 = arith.zext v3 : u32; - v5 = hir.bitcast v4 : i32; - builtin.ret v5; + v5 = arith.eq v0, v1 : i1; + v6 = arith.zext v5 : u32; + v7 = hir.bitcast v6 : i32; + builtin.ret v7; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/eq_i8.masm b/tests/integration/expected/eq_i8.masm index fc7e6b3f0..d135c722d 100644 --- a/tests/integration/expected/eq_i8.masm +++ b/tests/integration/expected/eq_i8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_c2c2ad0caabf21644314027afcbfb75555fa063ab09504517a70196ddd47c892 +# mod ::"root_ns:root@1.0.0"::test_rust_c2c2ad0caabf21644314027afcbfb75555fa063ab09504517a70196ddd47c892 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 eq diff --git a/tests/integration/expected/eq_u16.hir b/tests/integration/expected/eq_u16.hir index f89646369..43d3bc704 100644 --- a/tests/integration/expected/eq_u16.hir +++ b/tests/integration/expected/eq_u16.hir @@ -2,10 +2,10 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_5e53494a4e3a0adfb638a6e562baf4c446d2f54c63ea6d33dec923896f12cea8 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.eq v0, v1 : i1; - v4 = arith.zext v3 : u32; - v5 = hir.bitcast v4 : i32; - builtin.ret v5; + v5 = arith.eq v0, v1 : i1; + v6 = arith.zext v5 : u32; + v7 = hir.bitcast v6 : i32; + builtin.ret v7; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/eq_u16.masm b/tests/integration/expected/eq_u16.masm index 1cd5b3003..7dad16a32 100644 --- a/tests/integration/expected/eq_u16.masm +++ b/tests/integration/expected/eq_u16.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_5e53494a4e3a0adfb638a6e562baf4c446d2f54c63ea6d33dec923896f12cea8 +# mod ::"root_ns:root@1.0.0"::test_rust_5e53494a4e3a0adfb638a6e562baf4c446d2f54c63ea6d33dec923896f12cea8 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 eq diff --git a/tests/integration/expected/eq_u32.hir b/tests/integration/expected/eq_u32.hir index cc2791697..57b2ae51d 100644 --- a/tests/integration/expected/eq_u32.hir +++ b/tests/integration/expected/eq_u32.hir @@ -2,10 +2,10 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_528be949250a0d0dcd9cd0e4c74a012863f8f305b2ac8043a575d81640315ac0 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.eq v0, v1 : i1; - v4 = arith.zext v3 : u32; - v5 = hir.bitcast v4 : i32; - builtin.ret v5; + v5 = arith.eq v0, v1 : i1; + v6 = arith.zext v5 : u32; + v7 = hir.bitcast v6 : i32; + builtin.ret v7; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/eq_u32.masm b/tests/integration/expected/eq_u32.masm index f541edde3..0ff5f35f7 100644 --- a/tests/integration/expected/eq_u32.masm +++ b/tests/integration/expected/eq_u32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_528be949250a0d0dcd9cd0e4c74a012863f8f305b2ac8043a575d81640315ac0 +# mod ::"root_ns:root@1.0.0"::test_rust_528be949250a0d0dcd9cd0e4c74a012863f8f305b2ac8043a575d81640315ac0 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 eq diff --git a/tests/integration/expected/eq_u64.hir b/tests/integration/expected/eq_u64.hir index f52b6774a..90a246d82 100644 --- a/tests/integration/expected/eq_u64.hir +++ b/tests/integration/expected/eq_u64.hir @@ -2,10 +2,10 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_90e3e1f038c3b9b7ba2a8c0e9313f59dc3bc3f54fe235a4c5c325df06e46d3b0 { public builtin.function @entrypoint(v0: i64, v1: i64) -> i32 { ^block6(v0: i64, v1: i64): - v3 = arith.eq v0, v1 : i1; - v4 = arith.zext v3 : u32; - v5 = hir.bitcast v4 : i32; - builtin.ret v5; + v5 = arith.eq v0, v1 : i1; + v6 = arith.zext v5 : u32; + v7 = hir.bitcast v6 : i32; + builtin.ret v7; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/eq_u64.masm b/tests/integration/expected/eq_u64.masm index 5e8532b76..0180ba3e1 100644 --- a/tests/integration/expected/eq_u64.masm +++ b/tests/integration/expected/eq_u64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,13 +16,14 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_90e3e1f038c3b9b7ba2a8c0e9313f59dc3bc3f54fe235a4c5c325df06e46d3b0 +# mod ::"root_ns:root@1.0.0"::test_rust_90e3e1f038c3b9b7ba2a8c0e9313f59dc3bc3f54fe235a4c5c325df06e46d3b0 +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> i32 trace.240 nop - exec.::std::math::u64::eq + exec.::miden::core::math::u64::eq trace.252 nop end diff --git a/tests/integration/expected/eq_u8.hir b/tests/integration/expected/eq_u8.hir index fdc063bb6..05552cc87 100644 --- a/tests/integration/expected/eq_u8.hir +++ b/tests/integration/expected/eq_u8.hir @@ -2,10 +2,10 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_909444ffebd8fe6b867a4d7833f385ece2e4ae4363fd04241342e9bef1affc93 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.eq v0, v1 : i1; - v4 = arith.zext v3 : u32; - v5 = hir.bitcast v4 : i32; - builtin.ret v5; + v5 = arith.eq v0, v1 : i1; + v6 = arith.zext v5 : u32; + v7 = hir.bitcast v6 : i32; + builtin.ret v7; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/eq_u8.masm b/tests/integration/expected/eq_u8.masm index 15b3e6c7d..87243baf3 100644 --- a/tests/integration/expected/eq_u8.masm +++ b/tests/integration/expected/eq_u8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_909444ffebd8fe6b867a4d7833f385ece2e4ae4363fd04241342e9bef1affc93 +# mod ::"root_ns:root@1.0.0"::test_rust_909444ffebd8fe6b867a4d7833f385ece2e4ae4363fd04241342e9bef1affc93 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 eq diff --git a/tests/integration/expected/examples/auth_component_no_auth.hir b/tests/integration/expected/examples/auth_component_no_auth.hir index cfbba0dea..b0fc2c8df 100644 --- a/tests/integration/expected/examples/auth_component_no_auth.hir +++ b/tests/integration/expected/examples/auth_component_no_auth.hir @@ -12,449 +12,262 @@ builtin.component miden:auth-component-no-auth/auth-component-no-auth@0.1.0 { private builtin.function @miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure(v0: felt, v1: felt, v2: felt, v3: felt) { ^block9(v0: felt, v1: felt, v2: felt, v3: felt): - v5 = builtin.global_symbol @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/__stack_pointer : ptr - v6 = hir.bitcast v5 : ptr; - v7 = hir.load v6 : i32; - v8 = arith.constant 64 : i32; - v9 = arith.sub v7, v8 : i32 #[overflow = wrapping]; - v10 = builtin.global_symbol @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/__stack_pointer : ptr - v11 = hir.bitcast v10 : ptr; - hir.store v11, v9; + v4 = builtin.global_symbol @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/__stack_pointer : ptr + v5 = hir.bitcast v4 : ptr; + v6 = hir.load v5 : i32; + v184 = arith.constant 16 : i32; + v8 = arith.sub v6, v184 : i32 #[overflow = wrapping]; + hir.store_local v8 #[local = lv4]; + v9 = builtin.global_symbol @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/__stack_pointer : ptr + v10 = hir.bitcast v9 : ptr; + hir.store v10, v8; hir.exec @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/wit_bindgen::rt::run_ctors_once() - v12 = arith.constant 32 : i32; - v13 = arith.add v9, v12 : i32 #[overflow = wrapping]; - hir.exec @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/miden::active_account::get_initial_commitment(v13) - v15 = arith.constant 40 : u32; - v14 = hir.bitcast v9 : u32; - v16 = arith.add v14, v15 : u32 #[overflow = checked]; - v17 = arith.constant 8 : u32; - v18 = arith.mod v16, v17 : u32; - hir.assertz v18 #[code = 250]; - v19 = hir.int_to_ptr v16 : ptr; - v20 = hir.load v19 : i64; - v22 = arith.constant 56 : u32; - v21 = hir.bitcast v9 : u32; - v23 = arith.add v21, v22 : u32 #[overflow = checked]; - v384 = arith.constant 8 : u32; - v25 = arith.mod v23, v384 : u32; + v11 = hir.load_local : i32 #[local = lv4]; + hir.exec @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/miden::protocol::active_account::get_initial_commitment(v11) + v12 = hir.load_local : i32 #[local = lv4]; + v183 = arith.constant 8 : u32; + v13 = hir.bitcast v12 : u32; + v15 = arith.add v13, v183 : u32 #[overflow = checked]; + v182 = arith.constant 4 : u32; + v17 = arith.mod v15, v182 : u32; + hir.assertz v17 #[code = 250]; + v18 = hir.int_to_ptr v15 : ptr; + v19 = hir.load v18 : felt; + hir.store_local v19 #[local = lv5]; + v20 = hir.load_local : i32 #[local = lv4]; + v234 = arith.constant 4 : u32; + v21 = hir.bitcast v20 : u32; + v23 = arith.add v21, v234 : u32 #[overflow = checked]; + v233 = arith.constant 4 : u32; + v25 = arith.mod v23, v233 : u32; hir.assertz v25 #[code = 250]; - v26 = hir.int_to_ptr v23 : ptr; - hir.store v26, v20; - v28 = arith.constant 32 : u32; - v27 = hir.bitcast v9 : u32; - v29 = arith.add v27, v28 : u32 #[overflow = checked]; - v383 = arith.constant 8 : u32; - v31 = arith.mod v29, v383 : u32; + v26 = hir.int_to_ptr v23 : ptr; + v27 = hir.load v26 : felt; + hir.store_local v27 #[local = lv6]; + v28 = hir.load_local : i32 #[local = lv4]; + v29 = hir.bitcast v28 : u32; + v232 = arith.constant 4 : u32; + v31 = arith.mod v29, v232 : u32; hir.assertz v31 #[code = 250]; - v32 = hir.int_to_ptr v29 : ptr; - v33 = hir.load v32 : i64; - v35 = arith.constant 48 : u32; - v34 = hir.bitcast v9 : u32; - v36 = arith.add v34, v35 : u32 #[overflow = checked]; - v382 = arith.constant 8 : u32; - v38 = arith.mod v36, v382 : u32; - hir.assertz v38 #[code = 250]; - v39 = hir.int_to_ptr v36 : ptr; - hir.store v39, v33; - v40 = arith.constant 48 : i32; - v41 = arith.add v9, v40 : i32 #[overflow = wrapping]; - hir.exec @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/::reverse(v9, v41) - v381 = arith.constant 32 : i32; - v43 = arith.add v9, v381 : i32 #[overflow = wrapping]; - hir.exec @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/miden::active_account::compute_commitment(v43) - v380 = arith.constant 40 : u32; - v44 = hir.bitcast v9 : u32; - v46 = arith.add v44, v380 : u32 #[overflow = checked]; - v379 = arith.constant 8 : u32; - v48 = arith.mod v46, v379 : u32; + v32 = hir.int_to_ptr v29 : ptr; + v33 = hir.load v32 : felt; + hir.store_local v33 #[local = lv7]; + v34 = hir.load_local : i32 #[local = lv4]; + v181 = arith.constant 12 : u32; + v35 = hir.bitcast v34 : u32; + v37 = arith.add v35, v181 : u32 #[overflow = checked]; + v231 = arith.constant 4 : u32; + v39 = arith.mod v37, v231 : u32; + hir.assertz v39 #[code = 250]; + v40 = hir.int_to_ptr v37 : ptr; + v41 = hir.load v40 : felt; + hir.store_local v41 #[local = lv8]; + v42 = hir.load_local : i32 #[local = lv4]; + hir.exec @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/miden::protocol::active_account::compute_commitment(v42) + v43 = hir.load_local : i32 #[local = lv4]; + v230 = arith.constant 8 : u32; + v44 = hir.bitcast v43 : u32; + v46 = arith.add v44, v230 : u32 #[overflow = checked]; + v229 = arith.constant 4 : u32; + v48 = arith.mod v46, v229 : u32; hir.assertz v48 #[code = 250]; - v49 = hir.int_to_ptr v46 : ptr; - v50 = hir.load v49 : i64; - v378 = arith.constant 56 : u32; - v51 = hir.bitcast v9 : u32; - v53 = arith.add v51, v378 : u32 #[overflow = checked]; - v377 = arith.constant 8 : u32; - v55 = arith.mod v53, v377 : u32; - hir.assertz v55 #[code = 250]; - v56 = hir.int_to_ptr v53 : ptr; - hir.store v56, v50; - v376 = arith.constant 32 : u32; - v57 = hir.bitcast v9 : u32; - v59 = arith.add v57, v376 : u32 #[overflow = checked]; - v375 = arith.constant 8 : u32; - v61 = arith.mod v59, v375 : u32; - hir.assertz v61 #[code = 250]; - v62 = hir.int_to_ptr v59 : ptr; - v63 = hir.load v62 : i64; - v374 = arith.constant 48 : u32; - v64 = hir.bitcast v9 : u32; - v66 = arith.add v64, v374 : u32 #[overflow = checked]; - v373 = arith.constant 8 : u32; - v68 = arith.mod v66, v373 : u32; - hir.assertz v68 #[code = 250]; - v69 = hir.int_to_ptr v66 : ptr; - hir.store v69, v63; - v372 = arith.constant 48 : i32; - v73 = arith.add v9, v372 : i32 #[overflow = wrapping]; - v70 = arith.constant 16 : i32; - v71 = arith.add v9, v70 : i32 #[overflow = wrapping]; - hir.exec @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/::reverse(v71, v73) - v75 = arith.constant 16 : u32; - v74 = hir.bitcast v9 : u32; - v76 = arith.add v74, v75 : u32 #[overflow = checked]; - v77 = arith.constant 4 : u32; - v78 = arith.mod v76, v77 : u32; - hir.assertz v78 #[code = 250]; - v79 = hir.int_to_ptr v76 : ptr; - v80 = hir.load v79 : felt; - v81 = hir.bitcast v9 : u32; - v371 = arith.constant 4 : u32; - v83 = arith.mod v81, v371 : u32; - hir.assertz v83 #[code = 250]; - v84 = hir.int_to_ptr v81 : ptr; - v85 = hir.load v84 : felt; - v86 = hir.exec @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/intrinsics::felt::eq(v80, v85) : i32 - v4 = arith.constant 0 : i32; - v87 = arith.constant 1 : i32; - v88 = arith.neq v86, v87 : i1; - v89 = arith.zext v88 : u32; - v90 = hir.bitcast v89 : i32; - v92 = arith.neq v90, v4 : i1; - v327, v328, v329 = scf.if v92 : i32, i32, u32 { - ^block43: - v318 = arith.constant 0 : u32; - v322 = ub.poison i32 : i32; - scf.yield v9, v322, v318; + v49 = hir.int_to_ptr v46 : ptr; + v50 = hir.load v49 : felt; + hir.store_local v50 #[local = lv9]; + v51 = hir.load_local : i32 #[local = lv4]; + v228 = arith.constant 4 : u32; + v52 = hir.bitcast v51 : u32; + v54 = arith.add v52, v228 : u32 #[overflow = checked]; + v227 = arith.constant 4 : u32; + v56 = arith.mod v54, v227 : u32; + hir.assertz v56 #[code = 250]; + v57 = hir.int_to_ptr v54 : ptr; + v58 = hir.load v57 : felt; + hir.store_local v58 #[local = lv10]; + v59 = hir.load_local : i32 #[local = lv4]; + v60 = hir.bitcast v59 : u32; + v226 = arith.constant 4 : u32; + v62 = arith.mod v60, v226 : u32; + hir.assertz v62 #[code = 250]; + v63 = hir.int_to_ptr v60 : ptr; + v64 = hir.load v63 : felt; + hir.store_local v64 #[local = lv11]; + v65 = hir.load_local : i32 #[local = lv4]; + v225 = arith.constant 12 : u32; + v66 = hir.bitcast v65 : u32; + v68 = arith.add v66, v225 : u32 #[overflow = checked]; + v224 = arith.constant 4 : u32; + v70 = arith.mod v68, v224 : u32; + hir.assertz v70 #[code = 250]; + v71 = hir.int_to_ptr v68 : ptr; + v72 = hir.load v71 : felt; + v73 = hir.load_local : felt #[local = lv8]; + v179 = arith.constant 0 : i32; + v180 = arith.constant 1 : i32; + v74 = arith.eq v72, v73 : i1; + v75 = hir.cast v74 : i32; + v77 = arith.neq v75, v180 : i1; + v78 = arith.zext v77 : u32; + v79 = hir.bitcast v78 : i32; + v81 = arith.neq v79, v179 : i1; + v207 = scf.if v81 : u32 { + ^block36: + v203 = arith.constant 0 : u32; + scf.yield v203; } else { ^block13: - v94 = arith.constant 20 : u32; - v93 = hir.bitcast v9 : u32; - v95 = arith.add v93, v94 : u32 #[overflow = checked]; - v370 = arith.constant 4 : u32; - v97 = arith.mod v95, v370 : u32; - hir.assertz v97 #[code = 250]; - v98 = hir.int_to_ptr v95 : ptr; - v99 = hir.load v98 : felt; - v369 = arith.constant 4 : u32; - v100 = hir.bitcast v9 : u32; - v102 = arith.add v100, v369 : u32 #[overflow = checked]; - v368 = arith.constant 4 : u32; - v104 = arith.mod v102, v368 : u32; - hir.assertz v104 #[code = 250]; - v105 = hir.int_to_ptr v102 : ptr; - v106 = hir.load v105 : felt; - v107 = hir.exec @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/intrinsics::felt::eq(v99, v106) : i32 - v366 = arith.constant 0 : i32; - v367 = arith.constant 1 : i32; - v109 = arith.neq v107, v367 : i1; - v110 = arith.zext v109 : u32; - v111 = hir.bitcast v110 : i32; - v113 = arith.neq v111, v366 : i1; - v334, v335, v336 = scf.if v113 : i32, i32, u32 { - ^block42: - v364 = arith.constant 0 : u32; - v365 = ub.poison i32 : i32; - scf.yield v9, v365, v364; + v82 = hir.load_local : felt #[local = lv9]; + v83 = hir.load_local : felt #[local = lv5]; + v222 = arith.constant 0 : i32; + v223 = arith.constant 1 : i32; + v84 = arith.eq v82, v83 : i1; + v85 = hir.cast v84 : i32; + v87 = arith.neq v85, v223 : i1; + v88 = arith.zext v87 : u32; + v89 = hir.bitcast v88 : i32; + v91 = arith.neq v89, v222 : i1; + v209 = scf.if v91 : u32 { + ^block35: + v221 = arith.constant 0 : u32; + scf.yield v221; } else { ^block14: - v115 = arith.constant 24 : u32; - v114 = hir.bitcast v9 : u32; - v116 = arith.add v114, v115 : u32 #[overflow = checked]; - v363 = arith.constant 4 : u32; - v118 = arith.mod v116, v363 : u32; - hir.assertz v118 #[code = 250]; - v119 = hir.int_to_ptr v116 : ptr; - v120 = hir.load v119 : felt; - v362 = arith.constant 8 : u32; - v121 = hir.bitcast v9 : u32; - v123 = arith.add v121, v362 : u32 #[overflow = checked]; - v361 = arith.constant 4 : u32; - v125 = arith.mod v123, v361 : u32; - hir.assertz v125 #[code = 250]; - v126 = hir.int_to_ptr v123 : ptr; - v127 = hir.load v126 : felt; - v128 = hir.exec @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/intrinsics::felt::eq(v120, v127) : i32 - v359 = arith.constant 0 : i32; - v360 = arith.constant 1 : i32; - v130 = arith.neq v128, v360 : i1; - v131 = arith.zext v130 : u32; - v132 = hir.bitcast v131 : i32; - v134 = arith.neq v132, v359 : i1; - v340, v341, v342 = scf.if v134 : i32, i32, u32 { - ^block41: - v357 = arith.constant 0 : u32; - v358 = ub.poison i32 : i32; - scf.yield v9, v358, v357; + v92 = hir.load_local : felt #[local = lv10]; + v93 = hir.load_local : felt #[local = lv6]; + v219 = arith.constant 0 : i32; + v220 = arith.constant 1 : i32; + v94 = arith.eq v92, v93 : i1; + v95 = hir.cast v94 : i32; + v97 = arith.neq v95, v220 : i1; + v98 = arith.zext v97 : u32; + v99 = hir.bitcast v98 : i32; + v101 = arith.neq v99, v219 : i1; + v211 = scf.if v101 : u32 { + ^block34: + v218 = arith.constant 0 : u32; + scf.yield v218; } else { ^block15: - v136 = arith.constant 28 : u32; - v135 = hir.bitcast v9 : u32; - v137 = arith.add v135, v136 : u32 #[overflow = checked]; - v356 = arith.constant 4 : u32; - v139 = arith.mod v137, v356 : u32; - hir.assertz v139 #[code = 250]; - v140 = hir.int_to_ptr v137 : ptr; - v141 = hir.load v140 : felt; - v143 = arith.constant 12 : u32; - v142 = hir.bitcast v9 : u32; - v144 = arith.add v142, v143 : u32 #[overflow = checked]; - v355 = arith.constant 4 : u32; - v146 = arith.mod v144, v355 : u32; - hir.assertz v146 #[code = 250]; - v147 = hir.int_to_ptr v144 : ptr; - v148 = hir.load v147 : felt; - v149 = hir.exec @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/intrinsics::felt::eq(v141, v148) : i32 - v353 = arith.constant 0 : i32; - v354 = arith.constant 1 : i32; - v151 = arith.eq v149, v354 : i1; - v152 = arith.zext v151 : u32; - v153 = hir.bitcast v152 : i32; - v155 = arith.neq v153, v353 : i1; - v350 = arith.constant 0 : u32; - v323 = arith.constant 1 : u32; - v348 = cf.select v155, v323, v350 : u32; - v351 = ub.poison i32 : i32; - v347 = cf.select v155, v9, v351 : i32; - v352 = ub.poison i32 : i32; - v346 = cf.select v155, v352, v9 : i32; - scf.yield v346, v347, v348; + v102 = hir.load_local : felt #[local = lv11]; + v103 = hir.load_local : felt #[local = lv7]; + v215 = arith.constant 0 : u32; + v205 = arith.constant 1 : u32; + v216 = arith.constant 0 : i32; + v217 = arith.constant 1 : i32; + v104 = arith.eq v102, v103 : i1; + v105 = hir.cast v104 : i32; + v107 = arith.eq v105, v217 : i1; + v108 = arith.zext v107 : u32; + v109 = hir.bitcast v108 : i32; + v111 = arith.neq v109, v216 : i1; + v213 = cf.select v111, v205, v215 : u32; + scf.yield v213; }; - scf.yield v340, v341, v342; + scf.yield v211; }; - scf.yield v334, v335, v336; + scf.yield v209; }; - v330 = scf.index_switch v329 : i32 + scf.index_switch v207 case 0 { ^block12: - v156 = hir.exec @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/miden::native_account::incr_nonce() : felt - scf.yield v327; + v112 = hir.exec @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/miden::protocol::native_account::incr_nonce() : felt + scf.yield ; } default { - ^block47: - scf.yield v328; + ^block40: + scf.yield ; }; - v349 = arith.constant 64 : i32; - v160 = arith.add v330, v349 : i32 #[overflow = wrapping]; - v161 = builtin.global_symbol @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/__stack_pointer : ptr - v162 = hir.bitcast v161 : ptr; - hir.store v162, v160; + v113 = hir.load_local : i32 #[local = lv4]; + v214 = arith.constant 16 : i32; + v115 = arith.add v113, v214 : i32 #[overflow = wrapping]; + v116 = builtin.global_symbol @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/__stack_pointer : ptr + v117 = hir.bitcast v116 : ptr; + hir.store v117, v115; builtin.ret ; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block17: - v164 = builtin.global_symbol @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/GOT.data.internal.__memory_base : ptr - v165 = hir.bitcast v164 : ptr; - v166 = hir.load v165 : i32; - v167 = arith.constant 1048584 : i32; - v168 = arith.add v166, v167 : i32 #[overflow = wrapping]; - v169 = hir.bitcast v168 : u32; - v170 = hir.int_to_ptr v169 : ptr; - v171 = hir.load v170 : u8; - v163 = arith.constant 0 : i32; - v172 = arith.zext v171 : u32; - v173 = hir.bitcast v172 : i32; - v175 = arith.neq v173, v163 : i1; - scf.if v175{ + v118 = builtin.global_symbol @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/GOT.data.internal.__memory_base : ptr + v119 = hir.bitcast v118 : ptr; + v120 = hir.load v119 : i32; + v239 = arith.constant 1048584 : i32; + v122 = arith.add v120, v239 : i32 #[overflow = wrapping]; + v123 = hir.bitcast v122 : u32; + v124 = hir.int_to_ptr v123 : ptr; + v125 = hir.load v124 : u8; + v238 = arith.constant 0 : i32; + v126 = arith.zext v125 : u32; + v127 = hir.bitcast v126 : i32; + v129 = arith.neq v127, v238 : i1; + scf.if v129{ ^block19: scf.yield ; } else { ^block20: - v176 = builtin.global_symbol @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/GOT.data.internal.__memory_base : ptr - v177 = hir.bitcast v176 : ptr; - v178 = hir.load v177 : i32; + v130 = builtin.global_symbol @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/GOT.data.internal.__memory_base : ptr + v131 = hir.bitcast v130 : ptr; + v132 = hir.load v131 : i32; + hir.store_local v132 #[local = lv0]; hir.exec @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/__wasm_call_ctors() - v386 = arith.constant 1 : u8; - v388 = arith.constant 1048584 : i32; - v180 = arith.add v178, v388 : i32 #[overflow = wrapping]; - v184 = hir.bitcast v180 : u32; - v185 = hir.int_to_ptr v184 : ptr; - hir.store v185, v386; + v133 = hir.load_local : i32 #[local = lv0]; + v237 = arith.constant 1 : u8; + v242 = arith.constant 1048584 : i32; + v135 = arith.add v133, v242 : i32 #[overflow = wrapping]; + v139 = hir.bitcast v135 : u32; + v140 = hir.int_to_ptr v139 : ptr; + hir.store v140, v237; scf.yield ; }; builtin.ret ; }; - private builtin.function @::reverse(v186: i32, v187: i32) { - ^block21(v186: i32, v187: i32): - v190 = builtin.global_symbol @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/__stack_pointer : ptr - v191 = hir.bitcast v190 : ptr; - v192 = hir.load v191 : i32; - v193 = arith.constant 16 : i32; - v194 = arith.sub v192, v193 : i32 #[overflow = wrapping]; - v196 = arith.constant 8 : u32; - v195 = hir.bitcast v187 : u32; - v197 = arith.add v195, v196 : u32 #[overflow = checked]; - v475 = arith.constant 8 : u32; - v199 = arith.mod v197, v475 : u32; - hir.assertz v199 #[code = 250]; - v200 = hir.int_to_ptr v197 : ptr; - v201 = hir.load v200 : i64; - v474 = arith.constant 8 : u32; - v202 = hir.bitcast v194 : u32; - v204 = arith.add v202, v474 : u32 #[overflow = checked]; - v205 = arith.constant 4 : u32; - v206 = arith.mod v204, v205 : u32; - hir.assertz v206 #[code = 250]; - v207 = hir.int_to_ptr v204 : ptr; - hir.store v207, v201; - v208 = hir.bitcast v187 : u32; - v473 = arith.constant 8 : u32; - v210 = arith.mod v208, v473 : u32; - hir.assertz v210 #[code = 250]; - v211 = hir.int_to_ptr v208 : ptr; - v212 = hir.load v211 : i64; - v213 = hir.bitcast v194 : u32; - v472 = arith.constant 4 : u32; - v215 = arith.mod v213, v472 : u32; - hir.assertz v215 #[code = 250]; - v216 = hir.int_to_ptr v213 : ptr; - hir.store v216, v212; - v217 = arith.constant 12 : i32; - v218 = arith.add v194, v217 : i32 #[overflow = wrapping]; - v188 = arith.constant 0 : i32; - v443, v444, v445, v446, v447, v448 = scf.while v188, v194, v218, v186 : i32, i32, i32, i32, i32, i32 { - ^block58(v449: i32, v450: i32, v451: i32, v452: i32): - v471 = arith.constant 0 : i32; - v221 = arith.constant 8 : i32; - v222 = arith.eq v449, v221 : i1; - v223 = arith.zext v222 : u32; - v224 = hir.bitcast v223 : i32; - v226 = arith.neq v224, v471 : i1; - v437, v438 = scf.if v226 : i32, i32 { - ^block57: - v397 = ub.poison i32 : i32; - scf.yield v397, v397; - } else { - ^block26: - v228 = arith.add v450, v449 : i32 #[overflow = wrapping]; - v229 = hir.bitcast v228 : u32; - v470 = arith.constant 4 : u32; - v231 = arith.mod v229, v470 : u32; - hir.assertz v231 #[code = 250]; - v232 = hir.int_to_ptr v229 : ptr; - v233 = hir.load v232 : felt; - v235 = hir.bitcast v451 : u32; - v469 = arith.constant 4 : u32; - v237 = arith.mod v235, v469 : u32; - hir.assertz v237 #[code = 250]; - v238 = hir.int_to_ptr v235 : ptr; - v239 = hir.load v238 : i32; - v240 = hir.bitcast v228 : u32; - v468 = arith.constant 4 : u32; - v242 = arith.mod v240, v468 : u32; - hir.assertz v242 #[code = 250]; - v243 = hir.int_to_ptr v240 : ptr; - hir.store v243, v239; - v244 = hir.bitcast v451 : u32; - v467 = arith.constant 4 : u32; - v246 = arith.mod v244, v467 : u32; - hir.assertz v246 #[code = 250]; - v247 = hir.int_to_ptr v244 : ptr; - hir.store v247, v233; - v250 = arith.constant -4 : i32; - v251 = arith.add v451, v250 : i32 #[overflow = wrapping]; - v248 = arith.constant 4 : i32; - v249 = arith.add v449, v248 : i32 #[overflow = wrapping]; - scf.yield v249, v251; - }; - v465 = ub.poison i32 : i32; - v440 = cf.select v226, v465, v452 : i32; - v466 = ub.poison i32 : i32; - v439 = cf.select v226, v466, v450 : i32; - v396 = arith.constant 1 : u32; - v389 = arith.constant 0 : u32; - v442 = cf.select v226, v389, v396 : u32; - v430 = arith.trunc v442 : i1; - scf.condition v430, v437, v439, v438, v440, v450, v452; - } do { - ^block59(v453: i32, v454: i32, v455: i32, v456: i32, v457: i32, v458: i32): - scf.yield v453, v454, v455, v456; - }; - v464 = arith.constant 8 : u32; - v253 = hir.bitcast v447 : u32; - v255 = arith.add v253, v464 : u32 #[overflow = checked]; - v463 = arith.constant 4 : u32; - v257 = arith.mod v255, v463 : u32; - hir.assertz v257 #[code = 250]; - v258 = hir.int_to_ptr v255 : ptr; - v259 = hir.load v258 : i64; - v462 = arith.constant 8 : u32; - v260 = hir.bitcast v448 : u32; - v262 = arith.add v260, v462 : u32 #[overflow = checked]; - v461 = arith.constant 8 : u32; - v264 = arith.mod v262, v461 : u32; - hir.assertz v264 #[code = 250]; - v265 = hir.int_to_ptr v262 : ptr; - hir.store v265, v259; - v266 = hir.bitcast v447 : u32; - v460 = arith.constant 4 : u32; - v268 = arith.mod v266, v460 : u32; - hir.assertz v268 #[code = 250]; - v269 = hir.int_to_ptr v266 : ptr; - v270 = hir.load v269 : i64; - v271 = hir.bitcast v448 : u32; - v459 = arith.constant 8 : u32; - v273 = arith.mod v271, v459 : u32; - hir.assertz v273 #[code = 250]; - v274 = hir.int_to_ptr v271 : ptr; - hir.store v274, v270; - builtin.ret ; - }; - - private builtin.function @intrinsics::felt::eq(v275: felt, v276: felt) -> i32 { - ^block27(v275: felt, v276: felt): - v277 = arith.eq v275, v276 : i1; - v278 = hir.cast v277 : i32; - builtin.ret v278; - }; - - private builtin.function @miden::active_account::compute_commitment(v280: i32) { - ^block29(v280: i32): - v281, v282, v283, v284 = hir.exec @miden/active_account/compute_commitment() : felt, felt, felt, felt - v285 = hir.bitcast v280 : u32; - v286 = hir.int_to_ptr v285 : ptr; - hir.store v286, v281; - v287 = arith.constant 4 : u32; - v288 = arith.add v285, v287 : u32 #[overflow = checked]; - v289 = hir.int_to_ptr v288 : ptr; - hir.store v289, v282; - v290 = arith.constant 8 : u32; - v291 = arith.add v285, v290 : u32 #[overflow = checked]; - v292 = hir.int_to_ptr v291 : ptr; - hir.store v292, v283; - v293 = arith.constant 12 : u32; - v294 = arith.add v285, v293 : u32 #[overflow = checked]; - v295 = hir.int_to_ptr v294 : ptr; - hir.store v295, v284; + private builtin.function @miden::protocol::active_account::compute_commitment(v141: i32) { + ^block21(v141: i32): + v142, v143, v144, v145 = hir.exec @miden/protocol/active_account/compute_commitment() : felt, felt, felt, felt + v146 = hir.bitcast v141 : u32; + v147 = hir.int_to_ptr v146 : ptr; + hir.store v147, v142; + v245 = arith.constant 4 : u32; + v149 = arith.add v146, v245 : u32 #[overflow = checked]; + v150 = hir.int_to_ptr v149 : ptr; + hir.store v150, v143; + v244 = arith.constant 8 : u32; + v152 = arith.add v146, v244 : u32 #[overflow = checked]; + v153 = hir.int_to_ptr v152 : ptr; + hir.store v153, v144; + v243 = arith.constant 12 : u32; + v155 = arith.add v146, v243 : u32 #[overflow = checked]; + v156 = hir.int_to_ptr v155 : ptr; + hir.store v156, v145; builtin.ret ; }; - private builtin.function @miden::active_account::get_initial_commitment(v296: i32) { - ^block33(v296: i32): - v297, v298, v299, v300 = hir.exec @miden/active_account/get_initial_commitment() : felt, felt, felt, felt - v301 = hir.bitcast v296 : u32; - v302 = hir.int_to_ptr v301 : ptr; - hir.store v302, v297; - v303 = arith.constant 4 : u32; - v304 = arith.add v301, v303 : u32 #[overflow = checked]; - v305 = hir.int_to_ptr v304 : ptr; - hir.store v305, v298; - v306 = arith.constant 8 : u32; - v307 = arith.add v301, v306 : u32 #[overflow = checked]; - v308 = hir.int_to_ptr v307 : ptr; - hir.store v308, v299; - v309 = arith.constant 12 : u32; - v310 = arith.add v301, v309 : u32 #[overflow = checked]; - v311 = hir.int_to_ptr v310 : ptr; - hir.store v311, v300; + private builtin.function @miden::protocol::active_account::get_initial_commitment(v157: i32) { + ^block26(v157: i32): + v158, v159, v160, v161 = hir.exec @miden/protocol/active_account/get_initial_commitment() : felt, felt, felt, felt + v162 = hir.bitcast v157 : u32; + v163 = hir.int_to_ptr v162 : ptr; + hir.store v163, v158; + v248 = arith.constant 4 : u32; + v165 = arith.add v162, v248 : u32 #[overflow = checked]; + v166 = hir.int_to_ptr v165 : ptr; + hir.store v166, v159; + v247 = arith.constant 8 : u32; + v168 = arith.add v162, v247 : u32 #[overflow = checked]; + v169 = hir.int_to_ptr v168 : ptr; + hir.store v169, v160; + v246 = arith.constant 12 : u32; + v171 = arith.add v162, v246 : u32 #[overflow = checked]; + v172 = hir.int_to_ptr v171 : ptr; + hir.store v172, v161; builtin.ret ; }; - private builtin.function @miden::native_account::incr_nonce() -> felt { - ^block35: - v312 = hir.exec @miden/native_account/incr_nonce() : felt - builtin.ret v312; + private builtin.function @miden::protocol::native_account::incr_nonce() -> felt { + ^block28: + v173 = hir.exec @miden/protocol/native_account/incr_nonce() : felt + builtin.ret v173; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -468,9 +281,9 @@ builtin.component miden:auth-component-no-auth/auth-component-no-auth@0.1.0 { builtin.segment @1048576 = 0x0000000100000001; }; - public builtin.function @auth__procedure(v314: felt, v315: felt, v316: felt, v317: felt) { - ^block38(v314: felt, v315: felt, v316: felt, v317: felt): - hir.exec @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure(v314, v315, v316, v317) + public builtin.function @auth__procedure(v175: felt, v176: felt, v177: felt, v178: felt) { + ^block31(v175: felt, v176: felt, v177: felt, v178: felt): + hir.exec @miden:auth-component-no-auth/auth-component-no-auth@0.1.0/auth_component_no_auth/miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure(v175, v176, v177, v178) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/examples/auth_component_no_auth.masm b/tests/integration/expected/examples/auth_component_no_auth.masm index 4ab35ddef..16715d167 100644 --- a/tests/integration/expected/examples/auth_component_no_auth.masm +++ b/tests/integration/expected/examples/auth_component_no_auth.masm @@ -1,14 +1,14 @@ -# mod miden:auth-component-no-auth/auth-component-no-auth@0.1.0 +# mod ::"miden:auth-component-no-auth/auth-component-no-auth@0.1.0" @callconv("canon-lift") pub proc auth__procedure(felt, felt, felt, felt) - exec.::miden:auth-component-no-auth/auth-component-no-auth@0.1.0::init + exec."miden:auth-component-no-auth/auth-component-no-auth@0.1.0"::init trace.240 nop - exec.::miden:auth-component-no-auth/auth-component-no-auth@0.1.0::auth_component_no_auth::miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure + exec.::"miden:auth-component-no-auth/auth-component-no-auth@0.1.0"::auth_component_no_auth::"miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -21,7 +21,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -32,7 +32,7 @@ proc init mem_store.278537 end -# mod miden:auth-component-no-auth/auth-component-no-auth@0.1.0::auth_component_no_auth +# mod ::"miden:auth-component-no-auth/auth-component-no-auth@0.1.0"::auth_component_no_auth @callconv("C") proc __wasm_call_ctors( @@ -48,6 +48,7 @@ proc auth_component_no_auth::bindings::__link_custom_section_describing_imports( nop end +@locals("12") @callconv("C") proc miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure( felt, @@ -67,11 +68,18 @@ proc miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure( exec.::intrinsics::mem::load_sw trace.252 nop - push.64 + push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.4 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -81,40 +89,35 @@ proc miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure( nop trace.240 nop - exec.::miden:auth-component-no-auth/auth-component-no-auth@0.1.0::auth_component_no_auth::wit_bindgen::rt::run_ctors_once + exec.::"miden:auth-component-no-auth/auth-component-no-auth@0.1.0"::auth_component_no_auth::wit_bindgen::rt::run_ctors_once trace.252 nop - push.32 - dup.1 - u32wrapping_add + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:auth-component-no-auth/auth-component-no-auth@0.1.0::auth_component_no_auth::miden::active_account::get_initial_commitment + exec.::intrinsics::mem::load_sw trace.252 nop - push.40 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::"miden:auth-component-no-auth/auth-component-no-auth@0.1.0"::auth_component_no_auth::"miden::protocol::active_account::get_initial_commitment" + trace.252 + nop + locaddr.4 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + push.8 swap.1 - push.56 - dup.3 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -122,36 +125,32 @@ proc miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop - push.32 - dup.1 - add - u32assert - push.8 - dup.1 + locaddr.5 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + push.4 swap.1 - push.48 - dup.3 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -159,35 +158,28 @@ proc miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop - push.48 - dup.1 - u32wrapping_add - dup.1 + locaddr.6 + push.0 + swap.1 trace.240 nop - exec.::miden:auth-component-no-auth/auth-component-no-auth@0.1.0::auth_component_no_auth::::reverse + exec.::intrinsics::mem::store_felt trace.252 nop - push.32 - dup.1 - u32wrapping_add + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:auth-component-no-auth/auth-component-no-auth@0.1.0::auth_component_no_auth::miden::active_account::compute_commitment + exec.::intrinsics::mem::load_sw trace.252 nop - push.40 - dup.1 - add - u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -197,15 +189,30 @@ proc miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure( swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.7 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 swap.1 - push.56 - dup.3 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -213,18 +220,45 @@ proc miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop - push.32 - dup.1 + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:auth-component-no-auth/auth-component-no-auth@0.1.0"::auth_component_no_auth::"miden::protocol::active_account::compute_commitment" + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -234,15 +268,30 @@ proc miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure( swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 swap.1 - push.48 - dup.3 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -250,28 +299,27 @@ proc miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop - push.48 - dup.1 - u32wrapping_add - push.16 - dup.2 - u32wrapping_add + locaddr.10 + push.0 + swap.1 trace.240 nop - exec.::miden:auth-component-no-auth/auth-component-no-auth@0.1.0::auth_component_no_auth::::reverse + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - dup.1 - add - u32assert push.4 dup.1 swap.1 @@ -285,7 +333,26 @@ proc miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure( exec.::intrinsics::mem::load_felt trace.252 nop - dup.1 + locaddr.11 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + swap.1 + add + u32assert push.4 dup.1 swap.1 @@ -299,201 +366,125 @@ proc miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.8 + push.0 swap.1 trace.240 nop - exec.::miden:auth-component-no-auth/auth-component-no-auth@0.1.0::auth_component_no_auth::intrinsics::felt::eq + exec.::intrinsics::mem::load_felt trace.252 nop push.0 push.1 - movup.2 + movup.3 + movup.3 + eq neq neq if.true push.0 - push.3735929054 - movup.2 else - push.20 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.9 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_felt trace.252 nop - push.4 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.5 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - trace.240 - nop - exec.::miden:auth-component-no-auth/auth-component-no-auth@0.1.0::auth_component_no_auth::intrinsics::felt::eq - trace.252 - nop push.0 push.1 - movup.2 + movup.3 + movup.3 + eq neq neq if.true push.0 - push.3735929054 - movup.2 else - push.24 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.10 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_felt trace.252 nop - push.8 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.6 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - trace.240 - nop - exec.::miden:auth-component-no-auth/auth-component-no-auth@0.1.0::auth_component_no_auth::intrinsics::felt::eq - trace.252 - nop push.0 push.1 - movup.2 + movup.3 + movup.3 + eq neq neq if.true push.0 - push.3735929054 - movup.2 else - push.28 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.11 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_felt trace.252 nop - push.12 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.7 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - trace.240 - nop - exec.::miden:auth-component-no-auth/auth-component-no-auth@0.1.0::auth_component_no_auth::intrinsics::felt::eq - trace.252 - nop push.0 push.1 - movup.2 - eq - neq push.0 push.1 - dup.2 - cdrop - push.3735929054 - dup.2 - dup.4 - swap.1 - cdrop - push.3735929054 - movup.2 - swap.4 - movdn.2 - swap.1 - swap.3 + movup.5 + movup.5 + eq + eq + neq cdrop end end end - movup.2 eq.0 if.true - swap.1 - drop trace.240 nop - exec.::miden:auth-component-no-auth/auth-component-no-auth@0.1.0::auth_component_no_auth::miden::native_account::incr_nonce + exec.::"miden:auth-component-no-auth/auth-component-no-auth@0.1.0"::auth_component_no_auth::"miden::protocol::native_account::incr_nonce" trace.252 nop drop else - drop + nop end - push.64 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 u32wrapping_add push.1114144 u32divmod.4 @@ -505,6 +496,7 @@ proc miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure( nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -546,9 +538,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop trace.240 nop - exec.::miden:auth-component-no-auth/auth-component-no-auth@0.1.0::auth_component_no_auth::__wasm_call_ctors + exec.::"miden:auth-component-no-auth/auth-component-no-auth@0.1.0"::auth_component_no_auth::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -580,292 +588,10 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.4 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop -end - -@callconv("C") -proc intrinsics::felt::eq(felt, felt) -> i32 - eq -end - -@callconv("C") -proc miden::active_account::compute_commitment(i32) +proc miden::protocol::active_account::compute_commitment(i32) trace.240 nop - exec.::miden::active_account::compute_commitment + exec.::miden::protocol::active_account::compute_commitment trace.252 nop movup.4 @@ -918,10 +644,10 @@ proc miden::active_account::compute_commitment(i32) end @callconv("C") -proc miden::active_account::get_initial_commitment(i32) +proc miden::protocol::active_account::get_initial_commitment(i32) trace.240 nop - exec.::miden::active_account::get_initial_commitment + exec.::miden::protocol::active_account::get_initial_commitment trace.252 nop movup.4 @@ -974,12 +700,12 @@ proc miden::active_account::get_initial_commitment(i32) end @callconv("C") -proc miden::native_account::incr_nonce( +proc miden::protocol::native_account::incr_nonce( ) -> felt trace.240 nop - exec.::miden::native_account::incr_nonce + exec.::miden::protocol::native_account::incr_nonce trace.252 nop end diff --git a/tests/integration/expected/examples/auth_component_no_auth.wat b/tests/integration/expected/examples/auth_component_no_auth.wat index e272f897f..f3e2ed388 100644 --- a/tests/integration/expected/examples/auth_component_no_auth.wat +++ b/tests/integration/expected/examples/auth_component_no_auth.wat @@ -12,10 +12,9 @@ (core module $main (;0;) (type (;0;) (func)) (type (;1;) (func (param f32 f32 f32 f32))) - (type (;2;) (func (param i32 i32))) - (type (;3;) (func (param f32 f32) (result i32))) - (type (;4;) (func (param i32))) - (type (;5;) (func (result f32))) + (type (;2;) (func (param f32 f32) (result i32))) + (type (;3;) (func (param i32))) + (type (;4;) (func (result f32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -26,89 +25,71 @@ (func $__wasm_call_ctors (;0;) (type 0)) (func $auth_component_no_auth::bindings::__link_custom_section_describing_imports (;1;) (type 0)) (func $miden:auth-component-no-auth/auth-component-no-auth@0.1.0#auth-procedure (;2;) (type 1) (param f32 f32 f32 f32) - (local i32) + (local i32 f32 f32 f32 f32 f32 f32 f32) global.get $__stack_pointer - i32.const 64 + i32.const 16 i32.sub local.tee 4 global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once local.get 4 - i32.const 32 - i32.add - call $miden::active_account::get_initial_commitment - local.get 4 - local.get 4 - i64.load offset=40 - i64.store offset=56 + call $miden::protocol::active_account::get_initial_commitment local.get 4 + f32.load offset=8 + local.set 5 local.get 4 - i64.load offset=32 - i64.store offset=48 - local.get 4 - local.get 4 - i32.const 48 - i32.add - call $::reverse - local.get 4 - i32.const 32 - i32.add - call $miden::active_account::compute_commitment + f32.load offset=4 + local.set 6 local.get 4 + f32.load + local.set 7 local.get 4 - i64.load offset=40 - i64.store offset=56 + f32.load offset=12 + local.set 8 local.get 4 + call $miden::protocol::active_account::compute_commitment local.get 4 - i64.load offset=32 - i64.store offset=48 + f32.load offset=8 + local.set 9 local.get 4 - i32.const 16 - i32.add + f32.load offset=4 + local.set 10 local.get 4 - i32.const 48 - i32.add - call $::reverse + f32.load + local.set 11 block ;; label = @1 block ;; label = @2 local.get 4 - f32.load offset=16 - local.get 4 - f32.load + f32.load offset=12 + local.get 8 call $intrinsics::felt::eq i32.const 1 i32.ne br_if 0 (;@2;) - local.get 4 - f32.load offset=20 - local.get 4 - f32.load offset=4 + local.get 9 + local.get 5 call $intrinsics::felt::eq i32.const 1 i32.ne br_if 0 (;@2;) - local.get 4 - f32.load offset=24 - local.get 4 - f32.load offset=8 + local.get 10 + local.get 6 call $intrinsics::felt::eq i32.const 1 i32.ne br_if 0 (;@2;) - local.get 4 - f32.load offset=28 - local.get 4 - f32.load offset=12 + local.get 11 + local.get 7 call $intrinsics::felt::eq i32.const 1 i32.eq br_if 1 (;@1;) end - call $miden::native_account::incr_nonce + call $miden::protocol::native_account::incr_nonce drop end local.get 4 - i32.const 64 + i32.const 16 i32.add global.set $__stack_pointer ) @@ -130,78 +111,20 @@ i32.store8 end ) - (func $::reverse (;4;) (type 2) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store - ) - (func $intrinsics::felt::eq (;5;) (type 3) (param f32 f32) (result i32) + (func $intrinsics::felt::eq (;4;) (type 2) (param f32 f32) (result i32) unreachable ) - (func $miden::active_account::compute_commitment (;6;) (type 4) (param i32) + (func $miden::protocol::active_account::compute_commitment (;5;) (type 3) (param i32) unreachable ) - (func $miden::active_account::get_initial_commitment (;7;) (type 4) (param i32) + (func $miden::protocol::active_account::get_initial_commitment (;6;) (type 3) (param i32) unreachable ) - (func $miden::native_account::incr_nonce (;8;) (type 5) (result f32) + (func $miden::protocol::native_account::incr_nonce (;7;) (type 4) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "-auth-component-no-auth\01\0b0.1.0\01\01") + (@custom "rodata,miden_account" (after data) "-auth-component-no-auth\01\0b0.1.0\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/examples/auth_component_rpo_falcon512.hir b/tests/integration/expected/examples/auth_component_rpo_falcon512.hir index bc8ffaab5..6c9f23081 100644 --- a/tests/integration/expected/examples/auth_component_rpo_falcon512.hir +++ b/tests/integration/expected/examples/auth_component_rpo_falcon512.hir @@ -12,959 +12,813 @@ builtin.component miden:auth-component-rpo-falcon512/auth-component-rpo-falcon51 private builtin.function @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth-procedure(v0: felt, v1: felt, v2: felt, v3: felt) { ^block9(v0: felt, v1: felt, v2: felt, v3: felt): - v10 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr - v11 = hir.bitcast v10 : ptr; - v12 = hir.load v11 : i32; - v13 = arith.constant 160 : i32; - v14 = arith.sub v12, v13 : i32 #[overflow = wrapping]; - v15 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr - v16 = hir.bitcast v15 : ptr; - hir.store v16, v14; + v4 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr + v5 = hir.bitcast v4 : ptr; + v6 = hir.load v5 : i32; + v678 = arith.constant 112 : i32; + v8 = arith.sub v6, v678 : i32 #[overflow = wrapping]; + hir.store_local v8 #[local = lv4]; + v9 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr + v10 = hir.bitcast v9 : ptr; + hir.store v10, v8; hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/wit_bindgen::rt::run_ctors_once() - v17 = hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden_base_sys::bindings::tx::get_block_number() : felt - v18 = hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden::native_account::incr_nonce() : felt - v19 = arith.constant 144 : i32; - v20 = arith.add v14, v19 : i32 #[overflow = wrapping]; - hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden::native_account::compute_delta_commitment(v20) - v22 = arith.constant 152 : u32; - v21 = hir.bitcast v14 : u32; - v23 = arith.add v21, v22 : u32 #[overflow = checked]; - v24 = arith.constant 8 : u32; - v25 = arith.mod v23, v24 : u32; + v677 = arith.constant 7925067551181273379 : i64; + v12 = arith.trunc v677 : felt; + hir.store_local v12 #[local = lv5]; + v676 = arith.constant 6106832419007247715 : i64; + v14 = arith.trunc v676 : felt; + hir.store_local v14 #[local = lv6]; + v15 = hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden_base_sys::bindings::tx::get_block_number() : felt + hir.store_local v15 #[local = lv7]; + v16 = hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden::protocol::native_account::incr_nonce() : felt + hir.store_local v16 #[local = lv8]; + v17 = hir.load_local : i32 #[local = lv4]; + v675 = arith.constant 32 : i32; + v19 = arith.add v17, v675 : i32 #[overflow = wrapping]; + hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden::protocol::native_account::compute_delta_commitment(v19) + v20 = hir.load_local : i32 #[local = lv4]; + v674 = arith.constant 40 : u32; + v21 = hir.bitcast v20 : u32; + v23 = arith.add v21, v674 : u32 #[overflow = checked]; + v673 = arith.constant 8 : u32; + v25 = arith.mod v23, v673 : u32; hir.assertz v25 #[code = 250]; v26 = hir.int_to_ptr v23 : ptr; v27 = hir.load v26 : i64; - v29 = arith.constant 56 : u32; - v28 = hir.bitcast v14 : u32; - v30 = arith.add v28, v29 : u32 #[overflow = checked]; - v935 = arith.constant 8 : u32; - v32 = arith.mod v30, v935 : u32; - hir.assertz v32 #[code = 250]; - v33 = hir.int_to_ptr v30 : ptr; - hir.store v33, v27; - v35 = arith.constant 144 : u32; - v34 = hir.bitcast v14 : u32; - v36 = arith.add v34, v35 : u32 #[overflow = checked]; - v934 = arith.constant 8 : u32; - v38 = arith.mod v36, v934 : u32; - hir.assertz v38 #[code = 250]; - v39 = hir.int_to_ptr v36 : ptr; - v40 = hir.load v39 : i64; - v42 = arith.constant 48 : u32; - v41 = hir.bitcast v14 : u32; - v43 = arith.add v41, v42 : u32 #[overflow = checked]; - v933 = arith.constant 8 : u32; - v45 = arith.mod v43, v933 : u32; - hir.assertz v45 #[code = 250]; - v46 = hir.int_to_ptr v43 : ptr; - hir.store v46, v40; - v47 = arith.constant 48 : i32; - v48 = arith.add v14, v47 : i32 #[overflow = wrapping]; - hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/::reverse(v14, v48) - v49 = arith.constant 16 : i32; - v50 = arith.add v14, v49 : i32 #[overflow = wrapping]; - hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden_base_sys::bindings::tx::get_input_notes_commitment(v50) - v51 = arith.constant 32 : i32; - v52 = arith.add v14, v51 : i32 #[overflow = wrapping]; - hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden_base_sys::bindings::tx::get_output_notes_commitment(v52) - v4 = arith.constant 0 : i32; - v55 = hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/intrinsics::felt::from_u32(v4) : felt - v932 = arith.constant 0 : i32; - v57 = hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/intrinsics::felt::from_u32(v932) : felt - v61 = arith.constant 24 : u32; - v60 = hir.bitcast v14 : u32; - v62 = arith.add v60, v61 : u32 #[overflow = checked]; - v931 = arith.constant 8 : u32; - v64 = arith.mod v62, v931 : u32; - hir.assertz v64 #[code = 250]; - v65 = hir.int_to_ptr v62 : ptr; - v66 = hir.load v65 : i64; - v58 = arith.constant 72 : i32; - v59 = arith.add v14, v58 : i32 #[overflow = wrapping]; - v67 = hir.bitcast v59 : u32; - v930 = arith.constant 8 : u32; - v69 = arith.mod v67, v930 : u32; - hir.assertz v69 #[code = 250]; - v70 = hir.int_to_ptr v67 : ptr; - hir.store v70, v66; - v74 = arith.constant 40 : u32; - v73 = hir.bitcast v14 : u32; - v75 = arith.add v73, v74 : u32 #[overflow = checked]; - v929 = arith.constant 8 : u32; - v77 = arith.mod v75, v929 : u32; - hir.assertz v77 #[code = 250]; - v78 = hir.int_to_ptr v75 : ptr; - v79 = hir.load v78 : i64; - v71 = arith.constant 88 : i32; - v72 = arith.add v14, v71 : i32 #[overflow = wrapping]; - v80 = hir.bitcast v72 : u32; - v928 = arith.constant 8 : u32; - v82 = arith.mod v80, v928 : u32; - hir.assertz v82 #[code = 250]; - v83 = hir.int_to_ptr v80 : ptr; - hir.store v83, v79; - v927 = arith.constant 8 : u32; - v84 = hir.bitcast v14 : u32; - v86 = arith.add v84, v927 : u32 #[overflow = checked]; - v926 = arith.constant 8 : u32; - v88 = arith.mod v86, v926 : u32; - hir.assertz v88 #[code = 250]; - v89 = hir.int_to_ptr v86 : ptr; - v90 = hir.load v89 : i64; - v925 = arith.constant 56 : u32; - v91 = hir.bitcast v14 : u32; - v93 = arith.add v91, v925 : u32 #[overflow = checked]; - v924 = arith.constant 8 : u32; - v95 = arith.mod v93, v924 : u32; + hir.store_local v27 #[local = lv9]; + v28 = hir.load_local : i32 #[local = lv4]; + v672 = arith.constant 32 : u32; + v29 = hir.bitcast v28 : u32; + v31 = arith.add v29, v672 : u32 #[overflow = checked]; + v808 = arith.constant 8 : u32; + v33 = arith.mod v31, v808 : u32; + hir.assertz v33 #[code = 250]; + v34 = hir.int_to_ptr v31 : ptr; + v35 = hir.load v34 : i64; + hir.store_local v35 #[local = lv10]; + v36 = hir.load_local : i32 #[local = lv4]; + hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden_base_sys::bindings::tx::get_input_notes_commitment(v36) + v37 = hir.load_local : i32 #[local = lv4]; + v671 = arith.constant 16 : i32; + v39 = arith.add v37, v671 : i32 #[overflow = wrapping]; + hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden_base_sys::bindings::tx::get_output_notes_commitment(v39) + v670 = arith.constant 0 : i32; + hir.store_local v670 #[local = lv11]; + v648 = arith.constant 0 : felt; + hir.store_local v648 #[local = lv12]; + v807 = arith.constant 0 : felt; + hir.store_local v807 #[local = lv13]; + v45 = hir.load_local : i32 #[local = lv4]; + v806 = arith.constant 8 : u32; + v49 = hir.bitcast v45 : u32; + v51 = arith.add v49, v806 : u32 #[overflow = checked]; + v805 = arith.constant 8 : u32; + v53 = arith.mod v51, v805 : u32; + hir.assertz v53 #[code = 250]; + v54 = hir.int_to_ptr v51 : ptr; + v55 = hir.load v54 : i64; + v669 = arith.constant 56 : i32; + v47 = arith.add v45, v669 : i32 #[overflow = wrapping]; + v56 = hir.bitcast v47 : u32; + v804 = arith.constant 8 : u32; + v58 = arith.mod v56, v804 : u32; + hir.assertz v58 #[code = 250]; + v59 = hir.int_to_ptr v56 : ptr; + hir.store v59, v55; + v60 = hir.load_local : i32 #[local = lv4]; + v667 = arith.constant 24 : u32; + v64 = hir.bitcast v60 : u32; + v66 = arith.add v64, v667 : u32 #[overflow = checked]; + v803 = arith.constant 8 : u32; + v68 = arith.mod v66, v803 : u32; + hir.assertz v68 #[code = 250]; + v69 = hir.int_to_ptr v66 : ptr; + v70 = hir.load v69 : i64; + v668 = arith.constant 72 : i32; + v62 = arith.add v60, v668 : i32 #[overflow = wrapping]; + v71 = hir.bitcast v62 : u32; + v802 = arith.constant 8 : u32; + v73 = arith.mod v71, v802 : u32; + hir.assertz v73 #[code = 250]; + v74 = hir.int_to_ptr v71 : ptr; + hir.store v74, v70; + v75 = hir.load_local : i32 #[local = lv4]; + v76 = hir.load_local : i64 #[local = lv10]; + v642, v643 = arith.split v76 : felt, felt; + v801 = arith.constant 40 : u32; + v80 = hir.bitcast v75 : u32; + v82 = arith.add v80, v801 : u32 #[overflow = checked]; + v800 = arith.constant 8 : u32; + v84 = arith.mod v82, v800 : u32; + hir.assertz v84 #[code = 250]; + v644 = arith.join v643, v642 : i64; + v85 = hir.int_to_ptr v82 : ptr; + hir.store v85, v644; + v86 = hir.load_local : i32 #[local = lv4]; + v87 = hir.load_local : i64 #[local = lv9]; + v639, v640 = arith.split v87 : felt, felt; + v799 = arith.constant 32 : u32; + v91 = hir.bitcast v86 : u32; + v93 = arith.add v91, v799 : u32 #[overflow = checked]; + v798 = arith.constant 8 : u32; + v95 = arith.mod v93, v798 : u32; hir.assertz v95 #[code = 250]; + v641 = arith.join v640, v639 : i64; v96 = hir.int_to_ptr v93 : ptr; - hir.store v96, v90; - v97 = hir.bitcast v14 : u32; - v923 = arith.constant 8 : u32; - v99 = arith.mod v97, v923 : u32; - hir.assertz v99 #[code = 250]; - v100 = hir.int_to_ptr v97 : ptr; - v101 = hir.load v100 : i64; - v922 = arith.constant 48 : u32; - v102 = hir.bitcast v14 : u32; - v104 = arith.add v102, v922 : u32 #[overflow = checked]; - v921 = arith.constant 8 : u32; - v106 = arith.mod v104, v921 : u32; - hir.assertz v106 #[code = 250]; - v107 = hir.int_to_ptr v104 : ptr; - hir.store v107, v101; - v109 = arith.constant 16 : u32; - v108 = hir.bitcast v14 : u32; - v110 = arith.add v108, v109 : u32 #[overflow = checked]; - v920 = arith.constant 8 : u32; - v112 = arith.mod v110, v920 : u32; - hir.assertz v112 #[code = 250]; - v113 = hir.int_to_ptr v110 : ptr; - v114 = hir.load v113 : i64; - v116 = arith.constant 64 : u32; - v115 = hir.bitcast v14 : u32; - v117 = arith.add v115, v116 : u32 #[overflow = checked]; - v919 = arith.constant 8 : u32; - v119 = arith.mod v117, v919 : u32; - hir.assertz v119 #[code = 250]; - v120 = hir.int_to_ptr v117 : ptr; - hir.store v120, v114; - v122 = arith.constant 32 : u32; - v121 = hir.bitcast v14 : u32; - v123 = arith.add v121, v122 : u32 #[overflow = checked]; - v918 = arith.constant 8 : u32; - v125 = arith.mod v123, v918 : u32; - hir.assertz v125 #[code = 250]; - v126 = hir.int_to_ptr v123 : ptr; - v127 = hir.load v126 : i64; - v129 = arith.constant 80 : u32; - v128 = hir.bitcast v14 : u32; - v130 = arith.add v128, v129 : u32 #[overflow = checked]; - v917 = arith.constant 8 : u32; - v132 = arith.mod v130, v917 : u32; - hir.assertz v132 #[code = 250]; - v133 = hir.int_to_ptr v130 : ptr; - hir.store v133, v127; - v135 = arith.constant 108 : u32; - v134 = hir.bitcast v14 : u32; - v136 = arith.add v134, v135 : u32 #[overflow = checked]; - v137 = arith.constant 4 : u32; - v138 = arith.mod v136, v137 : u32; - hir.assertz v138 #[code = 250]; - v139 = hir.int_to_ptr v136 : ptr; - hir.store v139, v18; - v141 = arith.constant 104 : u32; - v140 = hir.bitcast v14 : u32; - v142 = arith.add v140, v141 : u32 #[overflow = checked]; - v916 = arith.constant 4 : u32; - v144 = arith.mod v142, v916 : u32; - hir.assertz v144 #[code = 250]; - v145 = hir.int_to_ptr v142 : ptr; - hir.store v145, v17; - v147 = arith.constant 100 : u32; - v146 = hir.bitcast v14 : u32; - v148 = arith.add v146, v147 : u32 #[overflow = checked]; - v915 = arith.constant 4 : u32; - v150 = arith.mod v148, v915 : u32; - hir.assertz v150 #[code = 250]; - v151 = hir.int_to_ptr v148 : ptr; - hir.store v151, v57; - v153 = arith.constant 96 : u32; - v152 = hir.bitcast v14 : u32; - v154 = arith.add v152, v153 : u32 #[overflow = checked]; - v914 = arith.constant 4 : u32; - v156 = arith.mod v154, v914 : u32; - hir.assertz v156 #[code = 250]; - v157 = hir.int_to_ptr v154 : ptr; - hir.store v157, v55; - v913 = arith.constant 0 : i32; - v159 = hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/intrinsics::felt::from_u32(v913) : felt - v912 = arith.constant 0 : i32; - v161 = hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/intrinsics::felt::from_u32(v912) : felt - hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/intrinsics::felt::assert_eq(v159, v161) - v731 = arith.constant 2 : u32; - v911 = arith.constant 48 : i32; - v163 = arith.add v14, v911 : i32 #[overflow = wrapping]; + hir.store v96, v641; + v97 = hir.load_local : i32 #[local = lv4]; + v99 = hir.bitcast v97 : u32; + v797 = arith.constant 8 : u32; + v101 = arith.mod v99, v797 : u32; + hir.assertz v101 #[code = 250]; + v102 = hir.int_to_ptr v99 : ptr; + v103 = hir.load v102 : i64; + v666 = arith.constant 48 : u32; + v104 = hir.bitcast v97 : u32; + v106 = arith.add v104, v666 : u32 #[overflow = checked]; + v796 = arith.constant 8 : u32; + v108 = arith.mod v106, v796 : u32; + hir.assertz v108 #[code = 250]; + v109 = hir.int_to_ptr v106 : ptr; + hir.store v109, v103; + v110 = hir.load_local : i32 #[local = lv4]; + v665 = arith.constant 16 : u32; + v112 = hir.bitcast v110 : u32; + v114 = arith.add v112, v665 : u32 #[overflow = checked]; + v795 = arith.constant 8 : u32; + v116 = arith.mod v114, v795 : u32; + hir.assertz v116 #[code = 250]; + v117 = hir.int_to_ptr v114 : ptr; + v118 = hir.load v117 : i64; + v664 = arith.constant 64 : u32; + v119 = hir.bitcast v110 : u32; + v121 = arith.add v119, v664 : u32 #[overflow = checked]; + v794 = arith.constant 8 : u32; + v123 = arith.mod v121, v794 : u32; + hir.assertz v123 #[code = 250]; + v124 = hir.int_to_ptr v121 : ptr; + hir.store v124, v118; + v125 = hir.load_local : i32 #[local = lv4]; + v126 = hir.load_local : felt #[local = lv8]; + v663 = arith.constant 92 : u32; + v127 = hir.bitcast v125 : u32; + v129 = arith.add v127, v663 : u32 #[overflow = checked]; + v662 = arith.constant 4 : u32; + v131 = arith.mod v129, v662 : u32; + hir.assertz v131 #[code = 250]; + v132 = hir.int_to_ptr v129 : ptr; + hir.store v132, v126; + v133 = hir.load_local : i32 #[local = lv4]; + v134 = hir.load_local : felt #[local = lv7]; + v661 = arith.constant 88 : u32; + v135 = hir.bitcast v133 : u32; + v137 = arith.add v135, v661 : u32 #[overflow = checked]; + v793 = arith.constant 4 : u32; + v139 = arith.mod v137, v793 : u32; + hir.assertz v139 #[code = 250]; + v140 = hir.int_to_ptr v137 : ptr; + hir.store v140, v134; + v141 = hir.load_local : i32 #[local = lv4]; + v142 = hir.load_local : felt #[local = lv13]; + v660 = arith.constant 84 : u32; + v143 = hir.bitcast v141 : u32; + v145 = arith.add v143, v660 : u32 #[overflow = checked]; + v792 = arith.constant 4 : u32; + v147 = arith.mod v145, v792 : u32; + hir.assertz v147 #[code = 250]; + v148 = hir.int_to_ptr v145 : ptr; + hir.store v148, v142; + v149 = hir.load_local : i32 #[local = lv4]; + v150 = hir.load_local : felt #[local = lv12]; + v659 = arith.constant 80 : u32; + v151 = hir.bitcast v149 : u32; + v153 = arith.add v151, v659 : u32 #[overflow = checked]; + v791 = arith.constant 4 : u32; + v155 = arith.mod v153, v791 : u32; + hir.assertz v155 #[code = 250]; + v156 = hir.int_to_ptr v153 : ptr; + hir.store v156, v150; + v790 = arith.constant 0 : felt; + hir.assert_eq v790, v790; + v161 = hir.load_local : i32 #[local = lv4]; + v647 = arith.constant 2 : u32; + v789 = arith.constant 32 : i32; + v163 = arith.add v161, v789 : i32 #[overflow = wrapping]; v165 = hir.bitcast v163 : u32; - v167 = arith.shr v165, v731 : u32; + v167 = arith.shr v165, v647 : u32; v168 = hir.bitcast v167 : i32; - v171 = arith.constant 128 : i32; - v172 = arith.add v14, v171 : i32 #[overflow = wrapping]; - v910 = arith.constant 16 : i32; - v170 = arith.add v168, v910 : i32 #[overflow = wrapping]; - hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/std::crypto::hashes::rpo::hash_memory_words(v168, v170, v172) - v174 = arith.constant 136 : u32; - v173 = hir.bitcast v14 : u32; - v175 = arith.add v173, v174 : u32 #[overflow = checked]; - v909 = arith.constant 8 : u32; - v177 = arith.mod v175, v909 : u32; - hir.assertz v177 #[code = 250]; - v178 = hir.int_to_ptr v175 : ptr; - v179 = hir.load v178 : i64; - v908 = arith.constant 152 : u32; - v180 = hir.bitcast v14 : u32; - v182 = arith.add v180, v908 : u32 #[overflow = checked]; - v907 = arith.constant 8 : u32; - v184 = arith.mod v182, v907 : u32; - hir.assertz v184 #[code = 250]; - v185 = hir.int_to_ptr v182 : ptr; - hir.store v185, v179; - v187 = arith.constant 128 : u32; - v186 = hir.bitcast v14 : u32; - v188 = arith.add v186, v187 : u32 #[overflow = checked]; - v906 = arith.constant 8 : u32; - v190 = arith.mod v188, v906 : u32; - hir.assertz v190 #[code = 250]; - v191 = hir.int_to_ptr v188 : ptr; - v192 = hir.load v191 : i64; - v905 = arith.constant 144 : u32; - v193 = hir.bitcast v14 : u32; - v195 = arith.add v193, v905 : u32 #[overflow = checked]; - v904 = arith.constant 8 : u32; - v197 = arith.mod v195, v904 : u32; - hir.assertz v197 #[code = 250]; - v198 = hir.int_to_ptr v195 : ptr; - hir.store v198, v192; - v903 = arith.constant 144 : i32; - v202 = arith.add v14, v903 : i32 #[overflow = wrapping]; - v199 = arith.constant 112 : i32; - v200 = arith.add v14, v199 : i32 #[overflow = wrapping]; - hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/::reverse(v200, v202) - v204 = arith.constant 112 : u32; - v203 = hir.bitcast v14 : u32; - v205 = arith.add v203, v204 : u32 #[overflow = checked]; - v902 = arith.constant 4 : u32; - v207 = arith.mod v205, v902 : u32; - hir.assertz v207 #[code = 250]; - v208 = hir.int_to_ptr v205 : ptr; - v209 = hir.load v208 : felt; - v211 = arith.constant 116 : u32; - v210 = hir.bitcast v14 : u32; - v212 = arith.add v210, v211 : u32 #[overflow = checked]; - v901 = arith.constant 4 : u32; - v214 = arith.mod v212, v901 : u32; - hir.assertz v214 #[code = 250]; - v215 = hir.int_to_ptr v212 : ptr; - v216 = hir.load v215 : felt; - v218 = arith.constant 120 : u32; - v217 = hir.bitcast v14 : u32; - v219 = arith.add v217, v218 : u32 #[overflow = checked]; - v900 = arith.constant 4 : u32; - v221 = arith.mod v219, v900 : u32; - hir.assertz v221 #[code = 250]; - v222 = hir.int_to_ptr v219 : ptr; - v223 = hir.load v222 : felt; - v225 = arith.constant 124 : u32; - v224 = hir.bitcast v14 : u32; - v226 = arith.add v224, v225 : u32 #[overflow = checked]; - v899 = arith.constant 4 : u32; - v228 = arith.mod v226, v899 : u32; - hir.assertz v228 #[code = 250]; - v229 = hir.int_to_ptr v226 : ptr; - v230 = hir.load v229 : felt; - v231 = arith.constant 96 : i32; - v232 = arith.add v14, v231 : i32 #[overflow = wrapping]; - v898 = arith.constant 0 : i32; - v829, v830, v831, v832, v833, v834, v835, v836, v837, v838, v839, v840 = scf.while v898, v14, v232, v230, v223, v216, v209 : i32, i32, i32, felt, felt, felt, felt, i32, felt, felt, felt, felt { - ^block86(v841: i32, v842: i32, v843: i32, v844: felt, v845: felt, v846: felt, v847: felt): - v896 = arith.constant 0 : i32; - v897 = arith.constant 32 : i32; - v235 = arith.eq v841, v897 : i1; - v236 = arith.zext v235 : u32; - v237 = hir.bitcast v236 : i32; - v239 = arith.neq v237, v896 : i1; - v820, v821 = scf.if v239 : i32, i32 { - ^block85: - v743 = ub.poison i32 : i32; - scf.yield v743, v743; + hir.store_local v168 #[local = lv14]; + v169 = hir.load_local : i32 #[local = lv14]; + v172 = hir.load_local : i32 #[local = lv4]; + v657 = arith.constant 96 : i32; + v174 = arith.add v172, v657 : i32 #[overflow = wrapping]; + v788 = arith.constant 16 : i32; + v171 = arith.add v169, v788 : i32 #[overflow = wrapping]; + hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden::core::crypto::hashes::rpo256::hash_words(v168, v171, v174) + v175 = hir.load_local : i32 #[local = lv4]; + v656 = arith.constant 108 : u32; + v176 = hir.bitcast v175 : u32; + v178 = arith.add v176, v656 : u32 #[overflow = checked]; + v787 = arith.constant 4 : u32; + v180 = arith.mod v178, v787 : u32; + hir.assertz v180 #[code = 250]; + v181 = hir.int_to_ptr v178 : ptr; + v182 = hir.load v181 : felt; + hir.store_local v182 #[local = lv7]; + v183 = hir.load_local : i32 #[local = lv4]; + v655 = arith.constant 104 : u32; + v184 = hir.bitcast v183 : u32; + v186 = arith.add v184, v655 : u32 #[overflow = checked]; + v786 = arith.constant 4 : u32; + v188 = arith.mod v186, v786 : u32; + hir.assertz v188 #[code = 250]; + v189 = hir.int_to_ptr v186 : ptr; + v190 = hir.load v189 : felt; + hir.store_local v190 #[local = lv8]; + v191 = hir.load_local : i32 #[local = lv4]; + v654 = arith.constant 100 : u32; + v192 = hir.bitcast v191 : u32; + v194 = arith.add v192, v654 : u32 #[overflow = checked]; + v785 = arith.constant 4 : u32; + v196 = arith.mod v194, v785 : u32; + hir.assertz v196 #[code = 250]; + v197 = hir.int_to_ptr v194 : ptr; + v198 = hir.load v197 : felt; + hir.store_local v198 #[local = lv12]; + v199 = hir.load_local : i32 #[local = lv4]; + v653 = arith.constant 96 : u32; + v200 = hir.bitcast v199 : u32; + v202 = arith.add v200, v653 : u32 #[overflow = checked]; + v784 = arith.constant 4 : u32; + v204 = arith.mod v202, v784 : u32; + hir.assertz v204 #[code = 250]; + v205 = hir.int_to_ptr v202 : ptr; + v206 = hir.load v205 : felt; + hir.store_local v206 #[local = lv13]; + v207 = hir.load_local : i32 #[local = lv4]; + v652 = arith.constant 80 : i32; + v209 = arith.add v207, v652 : i32 #[overflow = wrapping]; + hir.store_local v209 #[local = lv15]; + v210 = hir.load_local : i32 #[local = lv4]; + v783 = arith.constant 32 : i32; + v212 = arith.add v210, v783 : i32 #[overflow = wrapping]; + hir.store_local v212 #[local = lv16]; + scf.while { + ^block12: + v213 = hir.load_local : i32 #[local = lv11]; + v782 = arith.constant 0 : i32; + v658 = arith.constant 2 : i32; + v215 = arith.eq v213, v658 : i1; + v216 = arith.zext v215 : u32; + v217 = hir.bitcast v216 : i32; + v219 = arith.neq v217, v782 : i1; + scf.if v219{ + ^block77: + scf.yield ; } else { ^block14: - v282 = arith.constant 4 : i32; - v895 = arith.constant 48 : i32; - v242 = arith.add v842, v895 : i32 #[overflow = wrapping]; - v243 = arith.add v242, v841 : i32 #[overflow = wrapping]; - hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/core::ptr::swap_nonoverlapping_bytes::swap_nonoverlapping_chunks::<4>(v243, v843, v282) - v248 = arith.constant -16 : i32; - v249 = arith.add v843, v248 : i32 #[overflow = wrapping]; - v894 = arith.constant 16 : i32; - v247 = arith.add v841, v894 : i32 #[overflow = wrapping]; - scf.yield v247, v249; + v781 = arith.constant 0 : i32; + hir.store_local v781 #[local = lv14]; + scf.while { + ^block16: + v221 = hir.load_local : i32 #[local = lv14]; + v779 = arith.constant 0 : i32; + v780 = arith.constant 16 : i32; + v223 = arith.eq v221, v780 : i1; + v224 = arith.zext v223 : u32; + v225 = hir.bitcast v224 : i32; + v227 = arith.neq v225, v779 : i1; + scf.if v227{ + ^block78: + scf.yield ; + } else { + ^block18: + v228 = hir.load_local : i32 #[local = lv16]; + v229 = hir.load_local : i32 #[local = lv14]; + v230 = arith.add v228, v229 : i32 #[overflow = wrapping]; + v231 = hir.bitcast v230 : u32; + v778 = arith.constant 4 : u32; + v233 = arith.mod v231, v778 : u32; + hir.assertz v233 #[code = 250]; + v234 = hir.int_to_ptr v231 : ptr; + v235 = hir.load v234 : i32; + v237 = hir.load_local : i32 #[local = lv15]; + v238 = hir.load_local : i32 #[local = lv14]; + v239 = arith.add v237, v238 : i32 #[overflow = wrapping]; + v240 = hir.bitcast v239 : u32; + v777 = arith.constant 4 : u32; + v242 = arith.mod v240, v777 : u32; + hir.assertz v242 #[code = 250]; + v243 = hir.int_to_ptr v240 : ptr; + v244 = hir.load v243 : i32; + v245 = hir.bitcast v230 : u32; + v776 = arith.constant 4 : u32; + v247 = arith.mod v245, v776 : u32; + hir.assertz v247 #[code = 250]; + v248 = hir.int_to_ptr v245 : ptr; + hir.store v248, v244; + v251 = hir.bitcast v239 : u32; + v775 = arith.constant 4 : u32; + v253 = arith.mod v251, v775 : u32; + hir.assertz v253 #[code = 250]; + v254 = hir.int_to_ptr v251 : ptr; + hir.store v254, v235; + v255 = hir.load_local : i32 #[local = lv14]; + v679 = arith.constant 4 : i32; + v257 = arith.add v255, v679 : i32 #[overflow = wrapping]; + hir.store_local v257 #[local = lv14]; + scf.yield ; + }; + v738 = arith.constant 1 : u32; + v735 = arith.constant 0 : u32; + v748 = cf.select v227, v735, v738 : u32; + v742 = arith.trunc v748 : i1; + scf.condition v742; + } do { + ^block76: + scf.yield ; + }; + v258 = hir.load_local : i32 #[local = lv15]; + v650 = arith.constant -16 : i32; + v260 = arith.add v258, v650 : i32 #[overflow = wrapping]; + hir.store_local v260 #[local = lv15]; + v261 = hir.load_local : i32 #[local = lv16]; + v774 = arith.constant 16 : i32; + v263 = arith.add v261, v774 : i32 #[overflow = wrapping]; + hir.store_local v263 #[local = lv16]; + v264 = hir.load_local : i32 #[local = lv11]; + v649 = arith.constant 1 : i32; + v266 = arith.add v264, v649 : i32 #[overflow = wrapping]; + hir.store_local v266 #[local = lv11]; + scf.yield ; }; - v890 = ub.poison felt : felt; - v826 = cf.select v239, v890, v847 : felt; - v891 = ub.poison felt : felt; - v825 = cf.select v239, v891, v846 : felt; - v892 = ub.poison felt : felt; - v824 = cf.select v239, v892, v845 : felt; - v744 = ub.poison felt : felt; - v823 = cf.select v239, v744, v844 : felt; - v893 = ub.poison i32 : i32; - v822 = cf.select v239, v893, v842 : i32; - v742 = arith.constant 1 : u32; - v732 = arith.constant 0 : u32; - v828 = cf.select v239, v732, v742 : u32; - v810 = arith.trunc v828 : i1; - scf.condition v810, v820, v822, v821, v823, v824, v825, v826, v842, v844, v845, v846, v847; + v772 = arith.constant 1 : u32; + v773 = arith.constant 0 : u32; + v750 = cf.select v219, v773, v772 : u32; + v739 = arith.trunc v750 : i1; + scf.condition v739; } do { - ^block87(v848: i32, v849: i32, v850: i32, v851: felt, v852: felt, v853: felt, v854: felt, v855: i32, v856: felt, v857: felt, v858: felt, v859: felt): - scf.yield v848, v849, v850, v851, v852, v853, v854; + ^block71: + scf.yield ; }; - v252 = arith.constant 156 : u32; - v251 = hir.bitcast v836 : u32; - v253 = arith.add v251, v252 : u32 #[overflow = checked]; - v889 = arith.constant 4 : u32; - v255 = arith.mod v253, v889 : u32; - hir.assertz v255 #[code = 250]; - v256 = hir.int_to_ptr v253 : ptr; - hir.store v256, v837; - v888 = arith.constant 152 : u32; - v258 = hir.bitcast v836 : u32; - v260 = arith.add v258, v888 : u32 #[overflow = checked]; - v887 = arith.constant 4 : u32; - v262 = arith.mod v260, v887 : u32; - hir.assertz v262 #[code = 250]; - v263 = hir.int_to_ptr v260 : ptr; - hir.store v263, v838; - v266 = arith.constant 148 : u32; - v265 = hir.bitcast v836 : u32; - v267 = arith.add v265, v266 : u32 #[overflow = checked]; - v886 = arith.constant 4 : u32; - v269 = arith.mod v267, v886 : u32; - hir.assertz v269 #[code = 250]; - v270 = hir.int_to_ptr v267 : ptr; - hir.store v270, v839; - v885 = arith.constant 144 : u32; - v272 = hir.bitcast v836 : u32; - v274 = arith.add v272, v885 : u32 #[overflow = checked]; - v884 = arith.constant 4 : u32; - v276 = arith.mod v274, v884 : u32; - hir.assertz v276 #[code = 250]; - v277 = hir.int_to_ptr v274 : ptr; - hir.store v277, v840; - v881 = arith.constant 4 : i32; - v882 = arith.constant 48 : i32; - v281 = arith.add v836, v882 : i32 #[overflow = wrapping]; - v883 = arith.constant 144 : i32; - v279 = arith.add v836, v883 : i32 #[overflow = wrapping]; - hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden_stdlib_sys::intrinsics::advice::adv_insert(v279, v281, v881) - v880 = arith.constant 0 : i32; - v284 = hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/>::from(v880) : felt - v879 = arith.constant 128 : i32; - v286 = arith.add v836, v879 : i32 #[overflow = wrapping]; - hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden::active_account::get_item(v284, v286) - v878 = arith.constant 136 : u32; - v287 = hir.bitcast v836 : u32; - v289 = arith.add v287, v878 : u32 #[overflow = checked]; - v877 = arith.constant 8 : u32; - v291 = arith.mod v289, v877 : u32; - hir.assertz v291 #[code = 250]; - v292 = hir.int_to_ptr v289 : ptr; - v293 = hir.load v292 : i64; - v876 = arith.constant 152 : u32; - v294 = hir.bitcast v836 : u32; - v296 = arith.add v294, v876 : u32 #[overflow = checked]; - v875 = arith.constant 8 : u32; - v298 = arith.mod v296, v875 : u32; - hir.assertz v298 #[code = 250]; - v299 = hir.int_to_ptr v296 : ptr; - hir.store v299, v293; - v874 = arith.constant 128 : u32; - v300 = hir.bitcast v836 : u32; - v302 = arith.add v300, v874 : u32 #[overflow = checked]; - v873 = arith.constant 8 : u32; - v304 = arith.mod v302, v873 : u32; - hir.assertz v304 #[code = 250]; - v305 = hir.int_to_ptr v302 : ptr; - v306 = hir.load v305 : i64; - v872 = arith.constant 144 : u32; - v307 = hir.bitcast v836 : u32; - v309 = arith.add v307, v872 : u32 #[overflow = checked]; - v871 = arith.constant 8 : u32; - v311 = arith.mod v309, v871 : u32; - hir.assertz v311 #[code = 250]; - v312 = hir.int_to_ptr v309 : ptr; - hir.store v312, v306; - v869 = arith.constant 144 : i32; - v316 = arith.add v836, v869 : i32 #[overflow = wrapping]; - v870 = arith.constant 112 : i32; - v314 = arith.add v836, v870 : i32 #[overflow = wrapping]; - hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/::reverse(v314, v316) - v868 = arith.constant 124 : u32; - v317 = hir.bitcast v836 : u32; - v319 = arith.add v317, v868 : u32 #[overflow = checked]; - v867 = arith.constant 4 : u32; - v321 = arith.mod v319, v867 : u32; - hir.assertz v321 #[code = 250]; - v322 = hir.int_to_ptr v319 : ptr; - v323 = hir.load v322 : felt; - v866 = arith.constant 120 : u32; - v324 = hir.bitcast v836 : u32; - v326 = arith.add v324, v866 : u32 #[overflow = checked]; - v865 = arith.constant 4 : u32; - v328 = arith.mod v326, v865 : u32; + v267 = hir.load_local : i32 #[local = lv4]; + v268 = hir.load_local : felt #[local = lv13]; + v771 = arith.constant 108 : u32; + v269 = hir.bitcast v267 : u32; + v271 = arith.add v269, v771 : u32 #[overflow = checked]; + v770 = arith.constant 4 : u32; + v273 = arith.mod v271, v770 : u32; + hir.assertz v273 #[code = 250]; + v274 = hir.int_to_ptr v271 : ptr; + hir.store v274, v268; + v275 = hir.load_local : i32 #[local = lv4]; + v276 = hir.load_local : felt #[local = lv12]; + v769 = arith.constant 104 : u32; + v277 = hir.bitcast v275 : u32; + v279 = arith.add v277, v769 : u32 #[overflow = checked]; + v768 = arith.constant 4 : u32; + v281 = arith.mod v279, v768 : u32; + hir.assertz v281 #[code = 250]; + v282 = hir.int_to_ptr v279 : ptr; + hir.store v282, v276; + v283 = hir.load_local : i32 #[local = lv4]; + v284 = hir.load_local : felt #[local = lv8]; + v767 = arith.constant 100 : u32; + v285 = hir.bitcast v283 : u32; + v287 = arith.add v285, v767 : u32 #[overflow = checked]; + v766 = arith.constant 4 : u32; + v289 = arith.mod v287, v766 : u32; + hir.assertz v289 #[code = 250]; + v290 = hir.int_to_ptr v287 : ptr; + hir.store v290, v284; + v291 = hir.load_local : i32 #[local = lv4]; + v292 = hir.load_local : felt #[local = lv7]; + v765 = arith.constant 96 : u32; + v293 = hir.bitcast v291 : u32; + v295 = arith.add v293, v765 : u32 #[overflow = checked]; + v764 = arith.constant 4 : u32; + v297 = arith.mod v295, v764 : u32; + hir.assertz v297 #[code = 250]; + v298 = hir.int_to_ptr v295 : ptr; + hir.store v298, v292; + v299 = hir.load_local : i32 #[local = lv4]; + v761 = arith.constant 4 : i32; + v762 = arith.constant 32 : i32; + v304 = arith.add v299, v762 : i32 #[overflow = wrapping]; + v763 = arith.constant 96 : i32; + v301 = arith.add v299, v763 : i32 #[overflow = wrapping]; + hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden_stdlib_sys::intrinsics::advice::adv_insert(v301, v304, v761) + v306 = hir.load_local : felt #[local = lv6]; + v307 = hir.load_local : felt #[local = lv5]; + v308 = hir.load_local : i32 #[local = lv4]; + v760 = arith.constant 96 : i32; + v310 = arith.add v308, v760 : i32 #[overflow = wrapping]; + hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden::protocol::active_account::get_item(v306, v307, v310) + v311 = hir.load_local : felt #[local = lv13]; + v312 = hir.load_local : felt #[local = lv12]; + v313 = hir.load_local : felt #[local = lv8]; + v314 = hir.load_local : felt #[local = lv7]; + v315 = hir.load_local : i32 #[local = lv4]; + v759 = arith.constant 96 : u32; + v316 = hir.bitcast v315 : u32; + v318 = arith.add v316, v759 : u32 #[overflow = checked]; + v758 = arith.constant 4 : u32; + v320 = arith.mod v318, v758 : u32; + hir.assertz v320 #[code = 250]; + v321 = hir.int_to_ptr v318 : ptr; + v322 = hir.load v321 : felt; + hir.store_local v322 #[local = lv5]; + v323 = hir.load_local : i32 #[local = lv4]; + v757 = arith.constant 100 : u32; + v324 = hir.bitcast v323 : u32; + v326 = arith.add v324, v757 : u32 #[overflow = checked]; + v756 = arith.constant 4 : u32; + v328 = arith.mod v326, v756 : u32; hir.assertz v328 #[code = 250]; v329 = hir.int_to_ptr v326 : ptr; v330 = hir.load v329 : felt; - v864 = arith.constant 116 : u32; - v331 = hir.bitcast v836 : u32; - v333 = arith.add v331, v864 : u32 #[overflow = checked]; - v863 = arith.constant 4 : u32; - v335 = arith.mod v333, v863 : u32; - hir.assertz v335 #[code = 250]; - v336 = hir.int_to_ptr v333 : ptr; - v337 = hir.load v336 : felt; - v862 = arith.constant 112 : u32; - v338 = hir.bitcast v836 : u32; - v340 = arith.add v338, v862 : u32 #[overflow = checked]; - v861 = arith.constant 4 : u32; - v342 = arith.mod v340, v861 : u32; - hir.assertz v342 #[code = 250]; - v343 = hir.int_to_ptr v340 : ptr; - v344 = hir.load v343 : felt; - hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/intrinsics::advice::emit_falcon_sig_to_stack(v837, v838, v839, v840, v323, v330, v337, v344) - hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/std::crypto::dsa::rpo_falcon512::verify(v323, v330, v337, v344, v837, v838, v839, v840) - v860 = arith.constant 160 : i32; - v346 = arith.add v836, v860 : i32 #[overflow = wrapping]; - v347 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr - v348 = hir.bitcast v347 : ptr; - hir.store v348, v346; + hir.store_local v330 #[local = lv6]; + v331 = hir.load_local : i32 #[local = lv4]; + v755 = arith.constant 104 : u32; + v332 = hir.bitcast v331 : u32; + v334 = arith.add v332, v755 : u32 #[overflow = checked]; + v754 = arith.constant 4 : u32; + v336 = arith.mod v334, v754 : u32; + hir.assertz v336 #[code = 250]; + v337 = hir.int_to_ptr v334 : ptr; + v338 = hir.load v337 : felt; + hir.store_local v338 #[local = lv20]; + v339 = hir.load_local : i32 #[local = lv4]; + v753 = arith.constant 108 : u32; + v340 = hir.bitcast v339 : u32; + v342 = arith.add v340, v753 : u32 #[overflow = checked]; + v752 = arith.constant 4 : u32; + v344 = arith.mod v342, v752 : u32; + hir.assertz v344 #[code = 250]; + v345 = hir.int_to_ptr v342 : ptr; + v346 = hir.load v345 : felt; + hir.store_local v346 #[local = lv21]; + hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/intrinsics::advice::emit_falcon_sig_to_stack(v311, v312, v313, v314, v322, v330, v338, v346) + v347 = hir.load_local : felt #[local = lv5]; + v348 = hir.load_local : felt #[local = lv6]; + v349 = hir.load_local : felt #[local = lv20]; + v350 = hir.load_local : felt #[local = lv21]; + v351 = hir.load_local : felt #[local = lv13]; + v352 = hir.load_local : felt #[local = lv12]; + v353 = hir.load_local : felt #[local = lv8]; + v354 = hir.load_local : felt #[local = lv7]; + hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden::core::crypto::dsa::falcon512rpo::verify(v347, v348, v349, v350, v351, v352, v353, v354) + v355 = hir.load_local : i32 #[local = lv4]; + v751 = arith.constant 112 : i32; + v357 = arith.add v355, v751 : i32 #[overflow = wrapping]; + v358 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr + v359 = hir.bitcast v358 : ptr; + hir.store v359, v357; builtin.ret ; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { - ^block15: - v350 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/GOT.data.internal.__memory_base : ptr - v351 = hir.bitcast v350 : ptr; - v352 = hir.load v351 : i32; - v353 = arith.constant 1048584 : i32; - v354 = arith.add v352, v353 : i32 #[overflow = wrapping]; - v355 = hir.bitcast v354 : u32; - v356 = hir.int_to_ptr v355 : ptr; - v357 = hir.load v356 : u8; - v349 = arith.constant 0 : i32; - v358 = arith.zext v357 : u32; - v359 = hir.bitcast v358 : i32; - v361 = arith.neq v359, v349 : i1; - scf.if v361{ - ^block17: + ^block19: + v360 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/GOT.data.internal.__memory_base : ptr + v361 = hir.bitcast v360 : ptr; + v362 = hir.load v361 : i32; + v813 = arith.constant 1048584 : i32; + v364 = arith.add v362, v813 : i32 #[overflow = wrapping]; + v365 = hir.bitcast v364 : u32; + v366 = hir.int_to_ptr v365 : ptr; + v367 = hir.load v366 : u8; + v812 = arith.constant 0 : i32; + v368 = arith.zext v367 : u32; + v369 = hir.bitcast v368 : i32; + v371 = arith.neq v369, v812 : i1; + scf.if v371{ + ^block21: scf.yield ; } else { - ^block18: - v362 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/GOT.data.internal.__memory_base : ptr - v363 = hir.bitcast v362 : ptr; - v364 = hir.load v363 : i32; + ^block22: + v372 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/GOT.data.internal.__memory_base : ptr + v373 = hir.bitcast v372 : ptr; + v374 = hir.load v373 : i32; + hir.store_local v374 #[local = lv0]; hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__wasm_call_ctors() - v937 = arith.constant 1 : u8; - v939 = arith.constant 1048584 : i32; - v366 = arith.add v364, v939 : i32 #[overflow = wrapping]; - v370 = hir.bitcast v366 : u32; - v371 = hir.int_to_ptr v370 : ptr; - hir.store v371, v937; + v375 = hir.load_local : i32 #[local = lv0]; + v811 = arith.constant 1 : u8; + v816 = arith.constant 1048584 : i32; + v377 = arith.add v375, v816 : i32 #[overflow = wrapping]; + v381 = hir.bitcast v377 : u32; + v382 = hir.int_to_ptr v381 : ptr; + hir.store v382, v811; scf.yield ; }; builtin.ret ; }; private builtin.function @miden_base_sys::bindings::tx::get_block_number() -> felt { - ^block19: - v373 = hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden::tx::get_block_number() : felt - builtin.ret v373; + ^block23: + v384 = hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden::protocol::tx::get_block_number() : felt + builtin.ret v384; }; - private builtin.function @miden_base_sys::bindings::tx::get_input_notes_commitment(v374: i32) { - ^block21(v374: i32): - v376 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr - v377 = hir.bitcast v376 : ptr; - v378 = hir.load v377 : i32; - v379 = arith.constant 32 : i32; - v380 = arith.sub v378, v379 : i32 #[overflow = wrapping]; - v381 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr - v382 = hir.bitcast v381 : ptr; - hir.store v382, v380; - hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden::tx::get_input_notes_commitment(v380) - v384 = arith.constant 8 : u32; - v383 = hir.bitcast v380 : u32; - v385 = arith.add v383, v384 : u32 #[overflow = checked]; - v944 = arith.constant 8 : u32; - v387 = arith.mod v385, v944 : u32; - hir.assertz v387 #[code = 250]; - v388 = hir.int_to_ptr v385 : ptr; - v389 = hir.load v388 : i64; - v391 = arith.constant 24 : u32; - v390 = hir.bitcast v380 : u32; - v392 = arith.add v390, v391 : u32 #[overflow = checked]; - v943 = arith.constant 8 : u32; - v394 = arith.mod v392, v943 : u32; - hir.assertz v394 #[code = 250]; - v395 = hir.int_to_ptr v392 : ptr; - hir.store v395, v389; - v396 = hir.bitcast v380 : u32; - v942 = arith.constant 8 : u32; - v398 = arith.mod v396, v942 : u32; + private builtin.function @miden_base_sys::bindings::tx::get_input_notes_commitment(v385: i32) { + ^block25(v385: i32): + hir.store_local v385 #[local = lv0]; + v386 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr + v387 = hir.bitcast v386 : ptr; + v388 = hir.load v387 : i32; + v824 = arith.constant 16 : i32; + v390 = arith.sub v388, v824 : i32 #[overflow = wrapping]; + hir.store_local v390 #[local = lv1]; + v391 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr + v392 = hir.bitcast v391 : ptr; + hir.store v392, v390; + v393 = hir.load_local : i32 #[local = lv1]; + hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden::protocol::tx::get_input_notes_commitment(v393) + v394 = hir.load_local : i32 #[local = lv0]; + v395 = hir.load_local : i32 #[local = lv1]; + v396 = hir.bitcast v395 : u32; + v823 = arith.constant 8 : u32; + v398 = arith.mod v396, v823 : u32; hir.assertz v398 #[code = 250]; v399 = hir.int_to_ptr v396 : ptr; v400 = hir.load v399 : i64; - v402 = arith.constant 16 : u32; - v401 = hir.bitcast v380 : u32; - v403 = arith.add v401, v402 : u32 #[overflow = checked]; - v941 = arith.constant 8 : u32; - v405 = arith.mod v403, v941 : u32; - hir.assertz v405 #[code = 250]; - v406 = hir.int_to_ptr v403 : ptr; - hir.store v406, v400; - v407 = arith.constant 16 : i32; - v408 = arith.add v380, v407 : i32 #[overflow = wrapping]; - hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/::reverse(v374, v408) - v940 = arith.constant 32 : i32; - v410 = arith.add v380, v940 : i32 #[overflow = wrapping]; - v411 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr - v412 = hir.bitcast v411 : ptr; - hir.store v412, v410; + v820, v821 = arith.split v400 : felt, felt; + v836 = arith.constant 8 : u32; + v404 = hir.bitcast v394 : u32; + v406 = arith.add v404, v836 : u32 #[overflow = checked]; + v835 = arith.constant 8 : u32; + v408 = arith.mod v406, v835 : u32; + hir.assertz v408 #[code = 250]; + v822 = arith.join v821, v820 : i64; + v409 = hir.int_to_ptr v406 : ptr; + hir.store v409, v822; + v410 = hir.load_local : i32 #[local = lv0]; + v411 = hir.load_local : i32 #[local = lv1]; + v834 = arith.constant 8 : u32; + v412 = hir.bitcast v411 : u32; + v414 = arith.add v412, v834 : u32 #[overflow = checked]; + v833 = arith.constant 8 : u32; + v416 = arith.mod v414, v833 : u32; + hir.assertz v416 #[code = 250]; + v417 = hir.int_to_ptr v414 : ptr; + v418 = hir.load v417 : i64; + v817, v818 = arith.split v418 : felt, felt; + v422 = hir.bitcast v410 : u32; + v832 = arith.constant 8 : u32; + v424 = arith.mod v422, v832 : u32; + hir.assertz v424 #[code = 250]; + v819 = arith.join v818, v817 : i64; + v425 = hir.int_to_ptr v422 : ptr; + hir.store v425, v819; + v426 = hir.load_local : i32 #[local = lv1]; + v831 = arith.constant 16 : i32; + v428 = arith.add v426, v831 : i32 #[overflow = wrapping]; + v429 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr + v430 = hir.bitcast v429 : ptr; + hir.store v430, v428; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::tx::get_output_notes_commitment(v413: i32) { - ^block23(v413: i32): - v415 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr - v416 = hir.bitcast v415 : ptr; - v417 = hir.load v416 : i32; - v418 = arith.constant 32 : i32; - v419 = arith.sub v417, v418 : i32 #[overflow = wrapping]; - v420 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr - v421 = hir.bitcast v420 : ptr; - hir.store v421, v419; - hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden::tx::get_output_notes_commitment(v419) - v423 = arith.constant 8 : u32; - v422 = hir.bitcast v419 : u32; - v424 = arith.add v422, v423 : u32 #[overflow = checked]; - v949 = arith.constant 8 : u32; - v426 = arith.mod v424, v949 : u32; - hir.assertz v426 #[code = 250]; - v427 = hir.int_to_ptr v424 : ptr; - v428 = hir.load v427 : i64; - v430 = arith.constant 24 : u32; - v429 = hir.bitcast v419 : u32; - v431 = arith.add v429, v430 : u32 #[overflow = checked]; - v948 = arith.constant 8 : u32; - v433 = arith.mod v431, v948 : u32; - hir.assertz v433 #[code = 250]; - v434 = hir.int_to_ptr v431 : ptr; - hir.store v434, v428; - v435 = hir.bitcast v419 : u32; - v947 = arith.constant 8 : u32; - v437 = arith.mod v435, v947 : u32; - hir.assertz v437 #[code = 250]; - v438 = hir.int_to_ptr v435 : ptr; - v439 = hir.load v438 : i64; - v441 = arith.constant 16 : u32; - v440 = hir.bitcast v419 : u32; - v442 = arith.add v440, v441 : u32 #[overflow = checked]; - v946 = arith.constant 8 : u32; - v444 = arith.mod v442, v946 : u32; + private builtin.function @miden_base_sys::bindings::tx::get_output_notes_commitment(v431: i32) { + ^block27(v431: i32): + hir.store_local v431 #[local = lv0]; + v432 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr + v433 = hir.bitcast v432 : ptr; + v434 = hir.load v433 : i32; + v844 = arith.constant 16 : i32; + v436 = arith.sub v434, v844 : i32 #[overflow = wrapping]; + hir.store_local v436 #[local = lv1]; + v437 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr + v438 = hir.bitcast v437 : ptr; + hir.store v438, v436; + v439 = hir.load_local : i32 #[local = lv1]; + hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden::protocol::tx::get_output_notes_commitment(v439) + v440 = hir.load_local : i32 #[local = lv0]; + v441 = hir.load_local : i32 #[local = lv1]; + v442 = hir.bitcast v441 : u32; + v843 = arith.constant 8 : u32; + v444 = arith.mod v442, v843 : u32; hir.assertz v444 #[code = 250]; v445 = hir.int_to_ptr v442 : ptr; - hir.store v445, v439; - v446 = arith.constant 16 : i32; - v447 = arith.add v419, v446 : i32 #[overflow = wrapping]; - hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/::reverse(v413, v447) - v945 = arith.constant 32 : i32; - v449 = arith.add v419, v945 : i32 #[overflow = wrapping]; - v450 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr - v451 = hir.bitcast v450 : ptr; - hir.store v451, v449; - builtin.ret ; - }; - - private builtin.function @core::ptr::swap_nonoverlapping_bytes::swap_nonoverlapping_chunks::<4>(v452: i32, v453: i32, v454: i32) { - ^block25(v452: i32, v453: i32, v454: i32): - v964, v965, v966 = scf.while v454, v452, v453 : i32, i32, i32 { - ^block28(v456: i32, v463: i32, v467: i32): - v985 = arith.constant 0 : i32; - v455 = arith.constant 0 : i32; - v458 = arith.eq v456, v455 : i1; - v459 = arith.zext v458 : u32; - v460 = hir.bitcast v459 : i32; - v462 = arith.neq v460, v985 : i1; - v979, v980, v981 = scf.if v462 : i32, i32, i32 { - ^block96: - v957 = ub.poison i32 : i32; - scf.yield v957, v957, v957; - } else { - ^block30: - v464 = hir.bitcast v463 : u32; - v465 = hir.int_to_ptr v464 : ptr; - v466 = hir.load v465 : i32; - v468 = hir.bitcast v467 : u32; - v469 = hir.int_to_ptr v468 : ptr; - v470 = hir.load v469 : i32; - v471 = hir.bitcast v463 : u32; - v472 = hir.int_to_ptr v471 : ptr; - hir.store v472, v470; - v473 = hir.bitcast v467 : u32; - v474 = hir.int_to_ptr v473 : ptr; - hir.store v474, v466; - v984 = arith.constant 4 : i32; - v478 = arith.add v467, v984 : i32 #[overflow = wrapping]; - v477 = arith.constant 4 : i32; - v480 = arith.add v463, v477 : i32 #[overflow = wrapping]; - v475 = arith.constant -1 : i32; - v476 = arith.add v456, v475 : i32 #[overflow = wrapping]; - scf.yield v476, v480, v478; - }; - v956 = arith.constant 1 : u32; - v950 = arith.constant 0 : u32; - v983 = cf.select v462, v950, v956 : u32; - v973 = arith.trunc v983 : i1; - scf.condition v973, v979, v980, v981; - } do { - ^block95(v970: i32, v971: i32, v972: i32): - scf.yield v970, v971, v972; - }; + v446 = hir.load v445 : i64; + v840, v841 = arith.split v446 : felt, felt; + v856 = arith.constant 8 : u32; + v450 = hir.bitcast v440 : u32; + v452 = arith.add v450, v856 : u32 #[overflow = checked]; + v855 = arith.constant 8 : u32; + v454 = arith.mod v452, v855 : u32; + hir.assertz v454 #[code = 250]; + v842 = arith.join v841, v840 : i64; + v455 = hir.int_to_ptr v452 : ptr; + hir.store v455, v842; + v456 = hir.load_local : i32 #[local = lv0]; + v457 = hir.load_local : i32 #[local = lv1]; + v854 = arith.constant 8 : u32; + v458 = hir.bitcast v457 : u32; + v460 = arith.add v458, v854 : u32 #[overflow = checked]; + v853 = arith.constant 8 : u32; + v462 = arith.mod v460, v853 : u32; + hir.assertz v462 #[code = 250]; + v463 = hir.int_to_ptr v460 : ptr; + v464 = hir.load v463 : i64; + v837, v838 = arith.split v464 : felt, felt; + v468 = hir.bitcast v456 : u32; + v852 = arith.constant 8 : u32; + v470 = arith.mod v468, v852 : u32; + hir.assertz v470 #[code = 250]; + v839 = arith.join v838, v837 : i64; + v471 = hir.int_to_ptr v468 : ptr; + hir.store v471, v839; + v472 = hir.load_local : i32 #[local = lv1]; + v851 = arith.constant 16 : i32; + v474 = arith.add v472, v851 : i32 #[overflow = wrapping]; + v475 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr + v476 = hir.bitcast v475 : ptr; + hir.store v476, v474; builtin.ret ; }; - private builtin.function @::reverse(v481: i32, v482: i32) { - ^block31(v481: i32, v482: i32): - v485 = builtin.global_symbol @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/__stack_pointer : ptr - v486 = hir.bitcast v485 : ptr; - v487 = hir.load v486 : i32; - v488 = arith.constant 16 : i32; - v489 = arith.sub v487, v488 : i32 #[overflow = wrapping]; - v491 = arith.constant 8 : u32; - v490 = hir.bitcast v482 : u32; - v492 = arith.add v490, v491 : u32 #[overflow = checked]; - v1072 = arith.constant 8 : u32; - v494 = arith.mod v492, v1072 : u32; - hir.assertz v494 #[code = 250]; - v495 = hir.int_to_ptr v492 : ptr; - v496 = hir.load v495 : i64; - v1071 = arith.constant 8 : u32; - v497 = hir.bitcast v489 : u32; - v499 = arith.add v497, v1071 : u32 #[overflow = checked]; - v500 = arith.constant 4 : u32; - v501 = arith.mod v499, v500 : u32; + private builtin.function @miden_stdlib_sys::intrinsics::advice::adv_insert(v477: i32, v478: i32, v479: i32) { + ^block29(v477: i32, v478: i32, v479: i32): + hir.store_local v477 #[local = lv0]; + v480 = hir.load_local : i32 #[local = lv0]; + v862 = arith.constant 12 : u32; + v481 = hir.bitcast v480 : u32; + v483 = arith.add v481, v862 : u32 #[overflow = checked]; + v861 = arith.constant 4 : u32; + v485 = arith.mod v483, v861 : u32; + hir.assertz v485 #[code = 250]; + v486 = hir.int_to_ptr v483 : ptr; + v487 = hir.load v486 : felt; + v488 = hir.load_local : i32 #[local = lv0]; + v860 = arith.constant 8 : u32; + v489 = hir.bitcast v488 : u32; + v491 = arith.add v489, v860 : u32 #[overflow = checked]; + v872 = arith.constant 4 : u32; + v493 = arith.mod v491, v872 : u32; + hir.assertz v493 #[code = 250]; + v494 = hir.int_to_ptr v491 : ptr; + v495 = hir.load v494 : felt; + v496 = hir.load_local : i32 #[local = lv0]; + v871 = arith.constant 4 : u32; + v497 = hir.bitcast v496 : u32; + v499 = arith.add v497, v871 : u32 #[overflow = checked]; + v870 = arith.constant 4 : u32; + v501 = arith.mod v499, v870 : u32; hir.assertz v501 #[code = 250]; - v502 = hir.int_to_ptr v499 : ptr; - hir.store v502, v496; - v503 = hir.bitcast v482 : u32; - v1070 = arith.constant 8 : u32; - v505 = arith.mod v503, v1070 : u32; - hir.assertz v505 #[code = 250]; - v506 = hir.int_to_ptr v503 : ptr; - v507 = hir.load v506 : i64; - v508 = hir.bitcast v489 : u32; - v1069 = arith.constant 4 : u32; - v510 = arith.mod v508, v1069 : u32; - hir.assertz v510 #[code = 250]; - v511 = hir.int_to_ptr v508 : ptr; - hir.store v511, v507; - v512 = arith.constant 12 : i32; - v513 = arith.add v489, v512 : i32 #[overflow = wrapping]; - v483 = arith.constant 0 : i32; - v1040, v1041, v1042, v1043, v1044, v1045 = scf.while v483, v489, v513, v481 : i32, i32, i32, i32, i32, i32 { - ^block104(v1046: i32, v1047: i32, v1048: i32, v1049: i32): - v1068 = arith.constant 0 : i32; - v516 = arith.constant 8 : i32; - v517 = arith.eq v1046, v516 : i1; - v518 = arith.zext v517 : u32; - v519 = hir.bitcast v518 : i32; - v521 = arith.neq v519, v1068 : i1; - v1034, v1035 = scf.if v521 : i32, i32 { - ^block103: - v994 = ub.poison i32 : i32; - scf.yield v994, v994; - } else { - ^block36: - v523 = arith.add v1047, v1046 : i32 #[overflow = wrapping]; - v524 = hir.bitcast v523 : u32; - v1067 = arith.constant 4 : u32; - v526 = arith.mod v524, v1067 : u32; - hir.assertz v526 #[code = 250]; - v527 = hir.int_to_ptr v524 : ptr; - v528 = hir.load v527 : felt; - v530 = hir.bitcast v1048 : u32; - v1066 = arith.constant 4 : u32; - v532 = arith.mod v530, v1066 : u32; - hir.assertz v532 #[code = 250]; - v533 = hir.int_to_ptr v530 : ptr; - v534 = hir.load v533 : i32; - v535 = hir.bitcast v523 : u32; - v1065 = arith.constant 4 : u32; - v537 = arith.mod v535, v1065 : u32; - hir.assertz v537 #[code = 250]; - v538 = hir.int_to_ptr v535 : ptr; - hir.store v538, v534; - v539 = hir.bitcast v1048 : u32; - v1064 = arith.constant 4 : u32; - v541 = arith.mod v539, v1064 : u32; - hir.assertz v541 #[code = 250]; - v542 = hir.int_to_ptr v539 : ptr; - hir.store v542, v528; - v545 = arith.constant -4 : i32; - v546 = arith.add v1048, v545 : i32 #[overflow = wrapping]; - v543 = arith.constant 4 : i32; - v544 = arith.add v1046, v543 : i32 #[overflow = wrapping]; - scf.yield v544, v546; - }; - v1062 = ub.poison i32 : i32; - v1037 = cf.select v521, v1062, v1049 : i32; - v1063 = ub.poison i32 : i32; - v1036 = cf.select v521, v1063, v1047 : i32; - v993 = arith.constant 1 : u32; - v986 = arith.constant 0 : u32; - v1039 = cf.select v521, v986, v993 : u32; - v1027 = arith.trunc v1039 : i1; - scf.condition v1027, v1034, v1036, v1035, v1037, v1047, v1049; - } do { - ^block105(v1050: i32, v1051: i32, v1052: i32, v1053: i32, v1054: i32, v1055: i32): - scf.yield v1050, v1051, v1052, v1053; - }; - v1061 = arith.constant 8 : u32; - v548 = hir.bitcast v1044 : u32; - v550 = arith.add v548, v1061 : u32 #[overflow = checked]; - v1060 = arith.constant 4 : u32; - v552 = arith.mod v550, v1060 : u32; - hir.assertz v552 #[code = 250]; - v553 = hir.int_to_ptr v550 : ptr; - v554 = hir.load v553 : i64; - v1059 = arith.constant 8 : u32; - v555 = hir.bitcast v1045 : u32; - v557 = arith.add v555, v1059 : u32 #[overflow = checked]; - v1058 = arith.constant 8 : u32; - v559 = arith.mod v557, v1058 : u32; - hir.assertz v559 #[code = 250]; - v560 = hir.int_to_ptr v557 : ptr; - hir.store v560, v554; - v561 = hir.bitcast v1044 : u32; - v1057 = arith.constant 4 : u32; - v563 = arith.mod v561, v1057 : u32; - hir.assertz v563 #[code = 250]; - v564 = hir.int_to_ptr v561 : ptr; - v565 = hir.load v564 : i64; - v566 = hir.bitcast v1045 : u32; - v1056 = arith.constant 8 : u32; - v568 = arith.mod v566, v1056 : u32; - hir.assertz v568 #[code = 250]; - v569 = hir.int_to_ptr v566 : ptr; - hir.store v569, v565; - builtin.ret ; - }; - - private builtin.function @miden_stdlib_sys::intrinsics::advice::adv_insert(v570: i32, v571: i32, v572: i32) { - ^block37(v570: i32, v571: i32, v572: i32): - v574 = arith.constant 12 : u32; - v573 = hir.bitcast v570 : u32; - v575 = arith.add v573, v574 : u32 #[overflow = checked]; - v576 = arith.constant 4 : u32; - v577 = arith.mod v575, v576 : u32; - hir.assertz v577 #[code = 250]; - v578 = hir.int_to_ptr v575 : ptr; - v579 = hir.load v578 : felt; - v581 = arith.constant 8 : u32; - v580 = hir.bitcast v570 : u32; - v582 = arith.add v580, v581 : u32 #[overflow = checked]; - v1079 = arith.constant 4 : u32; - v584 = arith.mod v582, v1079 : u32; - hir.assertz v584 #[code = 250]; - v585 = hir.int_to_ptr v582 : ptr; - v586 = hir.load v585 : felt; - v1078 = arith.constant 4 : u32; - v587 = hir.bitcast v570 : u32; - v589 = arith.add v587, v1078 : u32 #[overflow = checked]; - v1077 = arith.constant 4 : u32; - v591 = arith.mod v589, v1077 : u32; - hir.assertz v591 #[code = 250]; - v592 = hir.int_to_ptr v589 : ptr; - v593 = hir.load v592 : felt; - v594 = hir.bitcast v570 : u32; - v1076 = arith.constant 4 : u32; - v596 = arith.mod v594, v1076 : u32; - hir.assertz v596 #[code = 250]; - v597 = hir.int_to_ptr v594 : ptr; - v598 = hir.load v597 : felt; - v1074 = arith.constant 2 : u32; - v600 = hir.bitcast v571 : u32; - v602 = arith.shr v600, v1074 : u32; - v603 = hir.bitcast v602 : i32; - v1075 = arith.constant 2 : u32; - v606 = arith.shl v572, v1075 : i32; - v607 = arith.add v603, v606 : i32 #[overflow = wrapping]; - hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/intrinsics::advice::adv_insert_mem(v579, v586, v593, v598, v603, v607) - builtin.ret ; - }; - - private builtin.function @>::from(v608: i32) -> felt { - ^block39(v608: i32): - v610 = arith.constant 255 : i32; - v611 = arith.band v608, v610 : i32; - v612 = hir.bitcast v611 : felt; - builtin.ret v612; - }; - - private builtin.function @intrinsics::advice::adv_insert_mem(v613: felt, v614: felt, v615: felt, v616: felt, v617: i32, v618: i32) { - ^block41(v613: felt, v614: felt, v615: felt, v616: felt, v617: i32, v618: i32): - hir.exec @intrinsics/advice/adv_insert_mem(v613, v614, v615, v616, v617, v618) + v502 = hir.int_to_ptr v499 : ptr; + v503 = hir.load v502 : felt; + v504 = hir.load_local : i32 #[local = lv0]; + v505 = hir.bitcast v504 : u32; + v869 = arith.constant 4 : u32; + v507 = arith.mod v505, v869 : u32; + hir.assertz v507 #[code = 250]; + v508 = hir.int_to_ptr v505 : ptr; + v509 = hir.load v508 : felt; + v859 = arith.constant 2 : u32; + v512 = hir.bitcast v478 : u32; + v514 = arith.shr v512, v859 : u32; + v515 = hir.bitcast v514 : i32; + hir.store_local v515 #[local = lv0]; + v516 = hir.load_local : i32 #[local = lv0]; + v868 = arith.constant 2 : u32; + v520 = arith.shl v479, v868 : i32; + v521 = arith.add v516, v520 : i32 #[overflow = wrapping]; + hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/intrinsics::advice::adv_insert_mem(v487, v495, v503, v509, v515, v521) builtin.ret ; }; - private builtin.function @intrinsics::advice::emit_falcon_sig_to_stack(v619: felt, v620: felt, v621: felt, v622: felt, v623: felt, v624: felt, v625: felt, v626: felt) { - ^block45(v619: felt, v620: felt, v621: felt, v622: felt, v623: felt, v624: felt, v625: felt, v626: felt): - hir.exec @intrinsics/advice/emit_falcon_sig_to_stack(v619, v620, v621, v622, v623, v624, v625, v626) + private builtin.function @intrinsics::advice::adv_insert_mem(v522: felt, v523: felt, v524: felt, v525: felt, v526: i32, v527: i32) { + ^block31(v522: felt, v523: felt, v524: felt, v525: felt, v526: i32, v527: i32): + hir.exec @intrinsics/advice/adv_insert_mem(v522, v523, v524, v525, v526, v527) builtin.ret ; }; - private builtin.function @intrinsics::felt::assert_eq(v627: felt, v628: felt) { - ^block47(v627: felt, v628: felt): - hir.assert_eq v627, v628; + private builtin.function @intrinsics::advice::emit_falcon_sig_to_stack(v528: felt, v529: felt, v530: felt, v531: felt, v532: felt, v533: felt, v534: felt, v535: felt) { + ^block35(v528: felt, v529: felt, v530: felt, v531: felt, v532: felt, v533: felt, v534: felt, v535: felt): + hir.exec @intrinsics/advice/emit_falcon_sig_to_stack(v528, v529, v530, v531, v532, v533, v534, v535) builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v629: i32) -> felt { - ^block49(v629: i32): - v630 = hir.bitcast v629 : felt; - builtin.ret v630; - }; - - private builtin.function @std::crypto::dsa::rpo_falcon512::verify(v632: felt, v633: felt, v634: felt, v635: felt, v636: felt, v637: felt, v638: felt, v639: felt) { - ^block51(v632: felt, v633: felt, v634: felt, v635: felt, v636: felt, v637: felt, v638: felt, v639: felt): - hir.exec @std/crypto/dsa/rpo_falcon512/verify(v632, v633, v634, v635, v636, v637, v638, v639) + private builtin.function @miden::core::crypto::dsa::falcon512rpo::verify(v536: felt, v537: felt, v538: felt, v539: felt, v540: felt, v541: felt, v542: felt, v543: felt) { + ^block37(v536: felt, v537: felt, v538: felt, v539: felt, v540: felt, v541: felt, v542: felt, v543: felt): + hir.exec @miden/core/crypto/dsa/falcon512rpo/verify(v536, v537, v538, v539, v540, v541, v542, v543) builtin.ret ; }; - private builtin.function @std::crypto::hashes::rpo::hash_memory_words(v640: i32, v641: i32, v642: i32) { - ^block57(v640: i32, v641: i32, v642: i32): - v643, v644, v645, v646 = hir.exec @std/crypto/hashes/rpo/hash_memory_words(v640, v641) : felt, felt, felt, felt - v647 = hir.bitcast v642 : u32; - v648 = hir.int_to_ptr v647 : ptr; - hir.store v648, v643; - v649 = arith.constant 4 : u32; - v650 = arith.add v647, v649 : u32 #[overflow = checked]; - v651 = hir.int_to_ptr v650 : ptr; - hir.store v651, v644; - v652 = arith.constant 8 : u32; - v653 = arith.add v647, v652 : u32 #[overflow = checked]; - v654 = hir.int_to_ptr v653 : ptr; - hir.store v654, v645; - v655 = arith.constant 12 : u32; - v656 = arith.add v647, v655 : u32 #[overflow = checked]; - v657 = hir.int_to_ptr v656 : ptr; - hir.store v657, v646; + private builtin.function @miden::core::crypto::hashes::rpo256::hash_words(v544: i32, v545: i32, v546: i32) { + ^block44(v544: i32, v545: i32, v546: i32): + v547, v548, v549, v550 = hir.exec @miden/core/crypto/hashes/rpo256/hash_words(v544, v545) : felt, felt, felt, felt + v551 = hir.bitcast v546 : u32; + v552 = hir.int_to_ptr v551 : ptr; + hir.store v552, v547; + v875 = arith.constant 4 : u32; + v554 = arith.add v551, v875 : u32 #[overflow = checked]; + v555 = hir.int_to_ptr v554 : ptr; + hir.store v555, v548; + v874 = arith.constant 8 : u32; + v557 = arith.add v551, v874 : u32 #[overflow = checked]; + v558 = hir.int_to_ptr v557 : ptr; + hir.store v558, v549; + v873 = arith.constant 12 : u32; + v560 = arith.add v551, v873 : u32 #[overflow = checked]; + v561 = hir.int_to_ptr v560 : ptr; + hir.store v561, v550; builtin.ret ; }; - private builtin.function @miden::active_account::get_item(v658: felt, v659: i32) { - ^block61(v658: felt, v659: i32): - v660, v661, v662, v663 = hir.exec @miden/active_account/get_item(v658) : felt, felt, felt, felt - v664 = hir.bitcast v659 : u32; - v665 = hir.int_to_ptr v664 : ptr; - hir.store v665, v660; - v666 = arith.constant 4 : u32; - v667 = arith.add v664, v666 : u32 #[overflow = checked]; - v668 = hir.int_to_ptr v667 : ptr; - hir.store v668, v661; - v669 = arith.constant 8 : u32; - v670 = arith.add v664, v669 : u32 #[overflow = checked]; - v671 = hir.int_to_ptr v670 : ptr; - hir.store v671, v662; - v672 = arith.constant 12 : u32; - v673 = arith.add v664, v672 : u32 #[overflow = checked]; - v674 = hir.int_to_ptr v673 : ptr; - hir.store v674, v663; + private builtin.function @miden::protocol::active_account::get_item(v562: felt, v563: felt, v564: i32) { + ^block48(v562: felt, v563: felt, v564: i32): + v565, v566, v567, v568 = hir.exec @miden/protocol/active_account/get_item(v562, v563) : felt, felt, felt, felt + v569 = hir.bitcast v564 : u32; + v570 = hir.int_to_ptr v569 : ptr; + hir.store v570, v565; + v878 = arith.constant 4 : u32; + v572 = arith.add v569, v878 : u32 #[overflow = checked]; + v573 = hir.int_to_ptr v572 : ptr; + hir.store v573, v566; + v877 = arith.constant 8 : u32; + v575 = arith.add v569, v877 : u32 #[overflow = checked]; + v576 = hir.int_to_ptr v575 : ptr; + hir.store v576, v567; + v876 = arith.constant 12 : u32; + v578 = arith.add v569, v876 : u32 #[overflow = checked]; + v579 = hir.int_to_ptr v578 : ptr; + hir.store v579, v568; builtin.ret ; }; - private builtin.function @miden::native_account::compute_delta_commitment(v675: i32) { - ^block65(v675: i32): - v676, v677, v678, v679 = hir.exec @miden/native_account/compute_delta_commitment() : felt, felt, felt, felt - v680 = hir.bitcast v675 : u32; - v681 = hir.int_to_ptr v680 : ptr; - hir.store v681, v676; - v682 = arith.constant 4 : u32; - v683 = arith.add v680, v682 : u32 #[overflow = checked]; - v684 = hir.int_to_ptr v683 : ptr; - hir.store v684, v677; - v685 = arith.constant 8 : u32; - v686 = arith.add v680, v685 : u32 #[overflow = checked]; - v687 = hir.int_to_ptr v686 : ptr; - hir.store v687, v678; - v688 = arith.constant 12 : u32; - v689 = arith.add v680, v688 : u32 #[overflow = checked]; - v690 = hir.int_to_ptr v689 : ptr; - hir.store v690, v679; + private builtin.function @miden::protocol::native_account::compute_delta_commitment(v580: i32) { + ^block52(v580: i32): + v581, v582, v583, v584 = hir.exec @miden/protocol/native_account/compute_delta_commitment() : felt, felt, felt, felt + v585 = hir.bitcast v580 : u32; + v586 = hir.int_to_ptr v585 : ptr; + hir.store v586, v581; + v881 = arith.constant 4 : u32; + v588 = arith.add v585, v881 : u32 #[overflow = checked]; + v589 = hir.int_to_ptr v588 : ptr; + hir.store v589, v582; + v880 = arith.constant 8 : u32; + v591 = arith.add v585, v880 : u32 #[overflow = checked]; + v592 = hir.int_to_ptr v591 : ptr; + hir.store v592, v583; + v879 = arith.constant 12 : u32; + v594 = arith.add v585, v879 : u32 #[overflow = checked]; + v595 = hir.int_to_ptr v594 : ptr; + hir.store v595, v584; builtin.ret ; }; - private builtin.function @miden::native_account::incr_nonce() -> felt { - ^block68: - v691 = hir.exec @miden/native_account/incr_nonce() : felt - builtin.ret v691; + private builtin.function @miden::protocol::native_account::incr_nonce() -> felt { + ^block55: + v596 = hir.exec @miden/protocol/native_account/incr_nonce() : felt + builtin.ret v596; }; - private builtin.function @miden::tx::get_block_number() -> felt { - ^block70: - v693 = hir.exec @miden/tx/get_block_number() : felt - builtin.ret v693; + private builtin.function @miden::protocol::tx::get_block_number() -> felt { + ^block57: + v598 = hir.exec @miden/protocol/tx/get_block_number() : felt + builtin.ret v598; }; - private builtin.function @miden::tx::get_input_notes_commitment(v695: i32) { - ^block73(v695: i32): - v696, v697, v698, v699 = hir.exec @miden/tx/get_input_notes_commitment() : felt, felt, felt, felt - v700 = hir.bitcast v695 : u32; - v701 = hir.int_to_ptr v700 : ptr; - hir.store v701, v696; - v702 = arith.constant 4 : u32; - v703 = arith.add v700, v702 : u32 #[overflow = checked]; - v704 = hir.int_to_ptr v703 : ptr; - hir.store v704, v697; - v705 = arith.constant 8 : u32; - v706 = arith.add v700, v705 : u32 #[overflow = checked]; - v707 = hir.int_to_ptr v706 : ptr; - hir.store v707, v698; - v708 = arith.constant 12 : u32; - v709 = arith.add v700, v708 : u32 #[overflow = checked]; - v710 = hir.int_to_ptr v709 : ptr; - hir.store v710, v699; + private builtin.function @miden::protocol::tx::get_input_notes_commitment(v600: i32) { + ^block60(v600: i32): + v601, v602, v603, v604 = hir.exec @miden/protocol/tx/get_input_notes_commitment() : felt, felt, felt, felt + v605 = hir.bitcast v600 : u32; + v606 = hir.int_to_ptr v605 : ptr; + hir.store v606, v601; + v884 = arith.constant 4 : u32; + v608 = arith.add v605, v884 : u32 #[overflow = checked]; + v609 = hir.int_to_ptr v608 : ptr; + hir.store v609, v602; + v883 = arith.constant 8 : u32; + v611 = arith.add v605, v883 : u32 #[overflow = checked]; + v612 = hir.int_to_ptr v611 : ptr; + hir.store v612, v603; + v882 = arith.constant 12 : u32; + v614 = arith.add v605, v882 : u32 #[overflow = checked]; + v615 = hir.int_to_ptr v614 : ptr; + hir.store v615, v604; builtin.ret ; }; - private builtin.function @miden::tx::get_output_notes_commitment(v711: i32) { - ^block75(v711: i32): - v712, v713, v714, v715 = hir.exec @miden/tx/get_output_notes_commitment() : felt, felt, felt, felt - v716 = hir.bitcast v711 : u32; - v717 = hir.int_to_ptr v716 : ptr; - hir.store v717, v712; - v718 = arith.constant 4 : u32; - v719 = arith.add v716, v718 : u32 #[overflow = checked]; - v720 = hir.int_to_ptr v719 : ptr; - hir.store v720, v713; - v721 = arith.constant 8 : u32; - v722 = arith.add v716, v721 : u32 #[overflow = checked]; - v723 = hir.int_to_ptr v722 : ptr; - hir.store v723, v714; - v724 = arith.constant 12 : u32; - v725 = arith.add v716, v724 : u32 #[overflow = checked]; - v726 = hir.int_to_ptr v725 : ptr; - hir.store v726, v715; + private builtin.function @miden::protocol::tx::get_output_notes_commitment(v616: i32) { + ^block62(v616: i32): + v617, v618, v619, v620 = hir.exec @miden/protocol/tx/get_output_notes_commitment() : felt, felt, felt, felt + v621 = hir.bitcast v616 : u32; + v622 = hir.int_to_ptr v621 : ptr; + hir.store v622, v617; + v887 = arith.constant 4 : u32; + v624 = arith.add v621, v887 : u32 #[overflow = checked]; + v625 = hir.int_to_ptr v624 : ptr; + hir.store v625, v618; + v886 = arith.constant 8 : u32; + v627 = arith.add v621, v886 : u32 #[overflow = checked]; + v628 = hir.int_to_ptr v627 : ptr; + hir.store v628, v619; + v885 = arith.constant 12 : u32; + v630 = arith.add v621, v885 : u32 #[overflow = checked]; + v631 = hir.int_to_ptr v630 : ptr; + hir.store v631, v620; builtin.ret ; }; @@ -979,9 +833,9 @@ builtin.component miden:auth-component-rpo-falcon512/auth-component-rpo-falcon51 builtin.segment @1048576 = 0x0000000100000001; }; - public builtin.function @auth__procedure(v727: felt, v728: felt, v729: felt, v730: felt) { - ^block77(v727: felt, v728: felt, v729: felt, v730: felt): - hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth-procedure(v727, v728, v729, v730) + public builtin.function @auth__procedure(v632: felt, v633: felt, v634: felt, v635: felt) { + ^block64(v632: felt, v633: felt, v634: felt, v635: felt): + hir.exec @miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0/auth_component_rpo_falcon512/miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth-procedure(v632, v633, v634, v635) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/examples/auth_component_rpo_falcon512.masm b/tests/integration/expected/examples/auth_component_rpo_falcon512.masm index 590535035..6c8d402c1 100644 --- a/tests/integration/expected/examples/auth_component_rpo_falcon512.masm +++ b/tests/integration/expected/examples/auth_component_rpo_falcon512.masm @@ -1,14 +1,14 @@ -# mod miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0 +# mod ::"miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0" @callconv("canon-lift") pub proc auth__procedure(felt, felt, felt, felt) - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::init + exec."miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0"::init trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth-procedure + exec.::"miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0"::auth_component_rpo_falcon512::"miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth-procedure" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -21,7 +21,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -32,7 +32,7 @@ proc init mem_store.278537 end -# mod miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512 +# mod ::"miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0"::auth_component_rpo_falcon512 @callconv("C") proc __wasm_call_ctors( @@ -48,6 +48,7 @@ proc auth_component_rpo_falcon512::bindings::__link_custom_section_describing_im nop end +@locals("24") @callconv("C") proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth-procedure( felt, @@ -67,11 +68,18 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::load_sw trace.252 nop - push.160 + push.112 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.4 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -81,29 +89,84 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- nop trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::wit_bindgen::rt::run_ctors_once + exec.::"miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0"::auth_component_rpo_falcon512::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.4045568291 + push.1845198578 + mul.4294967296 + add + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.3452188003 + push.1421857722 + mul.4294967296 + add + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + trace.240 + nop + exec.::"miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0"::auth_component_rpo_falcon512::miden_base_sys::bindings::tx::get_block_number + trace.252 + nop + locaddr.7 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + trace.240 + nop + exec.::"miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0"::auth_component_rpo_falcon512::"miden::protocol::native_account::incr_nonce" trace.252 nop + locaddr.8 + push.0 + swap.1 trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden_base_sys::bindings::tx::get_block_number + exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden::native_account::incr_nonce + exec.::intrinsics::mem::load_sw trace.252 nop - push.144 - dup.3 + push.32 u32wrapping_add trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden::native_account::compute_delta_commitment + exec.::"miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0"::auth_component_rpo_falcon512::"miden::protocol::native_account::compute_delta_commitment" + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop - push.152 - dup.3 + push.40 + swap.1 add u32assert push.8 @@ -120,17 +183,8 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- trace.252 nop swap.1 - push.56 - dup.5 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.9 + push.0 swap.1 movup.2 movdn.3 @@ -139,8 +193,16 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_dw trace.252 nop - push.144 - dup.3 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + swap.1 add u32assert push.8 @@ -157,17 +219,8 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- trace.252 nop swap.1 - push.48 - dup.5 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.11 + push.0 swap.1 movup.2 movdn.3 @@ -176,45 +229,71 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_dw trace.252 nop - push.48 - dup.3 - u32wrapping_add - dup.3 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0"::auth_component_rpo_falcon512::miden_base_sys::bindings::tx::get_input_notes_commitment + trace.252 + nop + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::::reverse + exec.::intrinsics::mem::load_sw trace.252 nop push.16 - dup.3 u32wrapping_add trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden_base_sys::bindings::tx::get_input_notes_commitment + exec.::"miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0"::auth_component_rpo_falcon512::miden_base_sys::bindings::tx::get_output_notes_commitment trace.252 nop - push.32 - dup.3 - u32wrapping_add + push.0 + locaddr.13 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + locaddr.14 + push.0 + swap.1 trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden_base_sys::bindings::tx::get_output_notes_commitment + exec.::intrinsics::mem::store_felt trace.252 nop push.0 + locaddr.15 + push.0 + swap.1 trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.4 push.0 + swap.1 trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop - push.24 - dup.5 + push.8 + dup.1 add u32assert push.8 @@ -231,8 +310,8 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- trace.252 nop swap.1 - push.72 - dup.7 + push.56 + movup.3 u32wrapping_add push.8 dup.1 @@ -249,8 +328,16 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_dw trace.252 nop - push.40 - dup.5 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.24 + dup.1 add u32assert push.8 @@ -267,8 +354,8 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- trace.252 nop swap.1 - push.88 - dup.7 + push.72 + movup.3 u32wrapping_add push.8 dup.1 @@ -285,17 +372,16 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_dw trace.252 nop - push.8 - dup.5 - add - u32assert - push.8 - dup.1 + locaddr.4 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.11 + push.0 swap.1 trace.240 nop @@ -303,8 +389,8 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- trace.252 nop swap.1 - push.56 - dup.7 + push.40 + movup.3 add u32assert push.8 @@ -313,6 +399,8 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -322,14 +410,16 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_dw trace.252 nop - dup.4 - push.8 - dup.1 + locaddr.4 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.9 + push.0 swap.1 trace.240 nop @@ -337,8 +427,8 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- trace.252 nop swap.1 - push.48 - dup.7 + push.32 + movup.3 add u32assert push.8 @@ -347,6 +437,8 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -356,10 +448,15 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_dw trace.252 nop - push.16 - dup.5 - add - u32assert + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.0 push.8 dup.1 swap.1 @@ -374,8 +471,8 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- trace.252 nop swap.1 - push.64 - dup.7 + push.48 + movup.3 add u32assert push.8 @@ -393,8 +490,16 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_dw trace.252 nop - push.32 - dup.5 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + dup.1 add u32assert push.8 @@ -411,8 +516,8 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- trace.252 nop swap.1 - push.80 - dup.7 + push.64 + movup.3 add u32assert push.8 @@ -430,27 +535,24 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_dw trace.252 nop - push.108 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.3 + locaddr.4 + push.0 swap.1 - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.8 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_felt trace.252 nop - push.104 - dup.4 + push.92 + movup.2 add u32assert push.4 @@ -459,8 +561,6 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- u32mod u32assert assertz - movup.3 - swap.1 u32divmod.4 swap.1 trace.240 @@ -468,25 +568,24 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_felt trace.252 nop - push.100 - dup.3 - add - u32assert - push.4 - dup.1 + locaddr.4 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.7 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_felt trace.252 nop - push.96 - dup.2 + push.88 + movup.2 add u32assert push.4 @@ -502,47 +601,27 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.4 push.0 + swap.1 trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.15 push.0 - trace.240 - nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::intrinsics::felt::from_u32 - trace.252 - nop swap.1 trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_felt trace.252 nop - push.2 - push.48 - dup.2 - u32wrapping_add - swap.1 - u32shr - push.128 - dup.2 - u32wrapping_add - push.16 - dup.2 - u32wrapping_add + push.84 movup.2 - trace.240 - nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::std::crypto::hashes::rpo::hash_memory_words - trace.252 - nop - push.136 - dup.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -552,34 +631,30 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.4 + push.0 swap.1 - push.152 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.14 + push.0 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop - push.128 - dup.1 + push.80 + movup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -589,42 +664,72 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_felt trace.252 nop + push.0 + dup.0 + assert_eq + locaddr.4 + push.0 swap.1 - push.144 - dup.3 - add - u32assert - push.8 - dup.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.2 + push.32 + movup.2 + u32wrapping_add swap.1 - u32mod - u32assert - assertz - u32divmod.4 + u32shr + dup.0 + locaddr.16 + push.0 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop - push.144 - dup.1 + locaddr.16 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.96 u32wrapping_add - push.112 - dup.2 + push.16 + movup.2 u32wrapping_add + movup.2 trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::::reverse + exec.::"miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0"::auth_component_rpo_falcon512::"miden::core::crypto::hashes::rpo256::hash_words" trace.252 nop - push.112 - dup.1 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.108 + swap.1 add u32assert push.4 @@ -640,8 +745,24 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::load_felt trace.252 nop - push.116 - dup.2 + locaddr.7 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.104 + swap.1 add u32assert push.4 @@ -657,8 +778,24 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::load_felt trace.252 nop - push.120 - dup.3 + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.100 + swap.1 add u32assert push.4 @@ -674,8 +811,24 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::load_felt trace.252 nop - push.124 - dup.4 + locaddr.14 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.96 + swap.1 add u32assert push.4 @@ -691,118 +844,335 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::load_felt trace.252 nop - push.96 - dup.5 + locaddr.15 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.80 u32wrapping_add + locaddr.17 push.0 - movup.6 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_add + locaddr.18 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1 while.true + locaddr.13 push.0 - push.32 - dup.2 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.2 + movup.2 eq neq dup.0 if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 + nop else - push.4 - push.48 - dup.4 - u32wrapping_add - dup.3 - u32wrapping_add - dup.5 + push.0 + locaddr.16 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1 + while.true + locaddr.16 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.16 + movup.2 + eq + neq + dup.0 + if.true + nop + else + locaddr.18 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.16 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.17 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.16 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.16 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + u32wrapping_add + locaddr.16 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + push.1 + push.0 + movup.2 + cdrop + push.1 + u32and + if.true + push.1 + else + push.0 + end + end + locaddr.17 + push.0 swap.1 trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::core::ptr::swap_nonoverlapping_bytes::swap_nonoverlapping_chunks::<4> + exec.::intrinsics::mem::load_sw trace.252 nop push.4294967280 - movup.4 u32wrapping_add + locaddr.17 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.18 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - movup.3 u32wrapping_add + locaddr.18 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.13 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1 + u32wrapping_add + locaddr.13 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.3735929054 - dup.3 - dup.9 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.9 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.5 - dup.9 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.6 - dup.9 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.7 - dup.9 - swap.2 - swap.1 - cdrop push.1 push.0 - movup.9 + movup.2 cdrop push.1 u32and - movup.3 - swap.5 - swap.7 - movdn.3 - swap.1 - swap.2 - swap.4 - swap.6 - swap.1 if.true - movup.7 - drop - movup.7 - drop - movup.7 - drop - movup.7 - drop - movup.7 - drop push.1 else push.0 end end - drop - drop - drop - drop - drop - drop - drop - push.156 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.15 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.108 + movup.2 + add + u32assert + push.4 dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.14 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.104 + movup.2 add u32assert push.4 @@ -811,8 +1181,6 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- u32mod u32assert assertz - dup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -820,27 +1188,24 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_felt trace.252 nop - push.152 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - dup.3 + locaddr.4 + push.0 swap.1 - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.8 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_felt trace.252 nop - push.148 - dup.1 + push.100 + movup.2 add u32assert push.4 @@ -849,8 +1214,6 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- u32mod u32assert assertz - dup.4 - swap.1 u32divmod.4 swap.1 trace.240 @@ -858,8 +1221,24 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_felt trace.252 nop - push.144 - dup.1 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.7 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.96 + movup.2 add u32assert push.4 @@ -868,8 +1247,6 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- u32mod u32assert assertz - dup.5 - swap.1 u32divmod.4 swap.1 trace.240 @@ -877,56 +1254,103 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - push.48 + push.32 dup.2 u32wrapping_add - push.144 - dup.3 + push.96 + movup.3 u32wrapping_add trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden_stdlib_sys::intrinsics::advice::adv_insert + exec.::"miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0"::auth_component_rpo_falcon512::miden_stdlib_sys::intrinsics::advice::adv_insert trace.252 nop + locaddr.6 push.0 + swap.1 trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::>::from + exec.::intrinsics::mem::load_felt trace.252 nop - push.128 - dup.2 + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.96 u32wrapping_add + swap.2 + trace.240 + nop + exec.::"miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0"::auth_component_rpo_falcon512::"miden::protocol::active_account::get_item" + trace.252 + nop + locaddr.15 + push.0 swap.1 trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden::active_account::get_item + exec.::intrinsics::mem::load_felt trace.252 nop - push.136 - dup.1 - add - u32assert - push.8 - dup.1 + locaddr.14 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.8 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.7 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop + push.96 swap.1 - push.152 - dup.3 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -934,36 +1358,33 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop - push.128 - dup.1 - add - u32assert - push.8 - dup.1 + dup.0 + locaddr.5 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + push.100 swap.1 - push.144 - dup.3 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -971,26 +1392,30 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop - push.144 - dup.1 - u32wrapping_add - push.112 - dup.2 - u32wrapping_add + dup.0 + locaddr.6 + push.0 + swap.1 trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::::reverse + exec.::intrinsics::mem::store_felt trace.252 nop - push.124 - dup.1 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.104 + swap.1 add u32assert push.4 @@ -1006,8 +1431,25 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::load_felt trace.252 nop - push.120 - dup.2 + dup.0 + locaddr.22 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.108 + swap.1 add u32assert push.4 @@ -1023,69 +1465,118 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- exec.::intrinsics::mem::load_felt trace.252 nop - push.116 - dup.3 - add - u32assert - push.4 - dup.1 + dup.0 + locaddr.23 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + movup.3 + swap.4 + movdn.3 + movup.2 + swap.5 + movdn.2 + swap.1 + swap.6 + swap.1 + swap.7 + trace.240 + nop + exec.::"miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0"::auth_component_rpo_falcon512::"intrinsics::advice::emit_falcon_sig_to_stack" + trace.252 + nop + locaddr.5 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_felt trace.252 nop - push.112 - dup.4 - add - u32assert - push.4 - dup.1 + locaddr.6 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.22 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.23 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.15 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.14 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.8 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_felt trace.252 nop - dup.0 - dup.2 - dup.4 - dup.6 - dup.12 - dup.12 - dup.12 - dup.12 + locaddr.7 + push.0 + swap.1 trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::intrinsics::advice::emit_falcon_sig_to_stack + exec.::intrinsics::mem::load_felt trace.252 nop - movup.4 - swap.8 - swap.7 - swap.6 + movup.3 + swap.4 + movdn.3 + movup.2 swap.5 - movdn.4 + movdn.2 swap.1 - swap.2 + swap.6 + swap.1 + swap.7 + trace.240 + nop + exec.::"miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0"::auth_component_rpo_falcon512::"miden::core::crypto::dsa::falcon512rpo::verify" + trace.252 + nop + locaddr.4 + push.0 swap.1 - swap.3 trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::std::crypto::dsa::rpo_falcon512::verify + exec.::intrinsics::mem::load_sw trace.252 nop - push.160 + push.112 u32wrapping_add push.1114144 u32divmod.4 @@ -1097,6 +1588,7 @@ proc miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth- nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -1138,9 +1630,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0"::auth_component_rpo_falcon512::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -1177,15 +1685,24 @@ proc miden_base_sys::bindings::tx::get_block_number( ) -> felt trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden::tx::get_block_number + exec.::"miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0"::auth_component_rpo_falcon512::"miden::protocol::tx::get_block_number" trace.252 nop end +@locals("2") @callconv("C") proc miden_base_sys::bindings::tx::get_input_notes_commitment( i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -1194,11 +1711,18 @@ proc miden_base_sys::bindings::tx::get_input_notes_commitment( exec.::intrinsics::mem::load_sw trace.252 nop - push.32 + push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.1 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1206,50 +1730,35 @@ proc miden_base_sys::bindings::tx::get_input_notes_commitment( exec.::intrinsics::mem::store_sw trace.252 nop - dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden::tx::get_input_notes_commitment + exec.::"miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0"::auth_component_rpo_falcon512::"miden::protocol::tx::get_input_notes_commitment" trace.252 nop - push.8 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.1 + push.0 swap.1 - push.24 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - dup.0 push.8 dup.1 swap.1 @@ -1264,8 +1773,8 @@ proc miden_base_sys::bindings::tx::get_input_notes_commitment( trace.252 nop swap.1 - push.16 - dup.3 + push.8 + movup.3 add u32assert push.8 @@ -1274,6 +1783,8 @@ proc miden_base_sys::bindings::tx::get_input_notes_commitment( u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -1283,59 +1794,24 @@ proc miden_base_sys::bindings::tx::get_input_notes_commitment( exec.::intrinsics::mem::store_dw trace.252 nop - push.16 - dup.1 - u32wrapping_add - movup.2 - trace.240 - nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::::reverse - trace.252 - nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc miden_base_sys::bindings::tx::get_output_notes_commitment( - i32 -) - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.32 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.0 - trace.240 - nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::miden::tx::get_output_notes_commitment + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.1 + swap.1 add u32assert push.8 @@ -1352,16 +1828,15 @@ proc miden_base_sys::bindings::tx::get_output_notes_commitment( trace.252 nop swap.1 - push.24 - dup.3 - add - u32assert + movup.2 push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -1371,150 +1846,39 @@ proc miden_base_sys::bindings::tx::get_output_notes_commitment( exec.::intrinsics::mem::store_dw trace.252 nop - dup.0 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.16 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.1 + push.0 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop push.16 - dup.1 - u32wrapping_add - movup.2 - trace.240 - nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::::reverse - trace.252 - nop - push.32 u32wrapping_add push.1114144 u32divmod.4 swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc core::ptr::swap_nonoverlapping_bytes::swap_nonoverlapping_chunks::<4>( - i32, - i32, - i32 -) - movup.2 - push.1 - while.true - push.0 - push.0 - dup.2 - eq - neq - dup.0 - if.true - movdn.3 - drop - drop - drop - push.3735929054 - dup.0 - dup.1 - swap.2 - else - dup.2 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.4 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.4 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - movup.4 - u32wrapping_add - push.4 - movup.4 - u32wrapping_add - push.4294967295 - movup.4 - u32wrapping_add - end - push.1 - push.0 - movup.5 - cdrop - push.1 - u32and - if.true - push.1 - else - push.0 - end - end - drop - drop - drop + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end +@locals("2") @callconv("C") -proc ::reverse( - i32, +proc miden_base_sys::bindings::tx::get_output_notes_commitment( i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -1525,44 +1889,52 @@ proc ::reverse( nop push.16 u32wrapping_sub - push.8 - dup.3 - add - u32assert - push.8 - dup.1 + dup.0 + locaddr.1 + push.0 swap.1 - u32mod - u32assert - assertz + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 swap.1 - push.8 - dup.3 - add - u32assert - push.4 - dup.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0"::auth_component_rpo_falcon512::"miden::protocol::tx::get_output_notes_commitment" + trace.252 + nop + locaddr.0 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - movup.2 push.8 dup.1 swap.1 @@ -1577,13 +1949,18 @@ proc ::reverse( trace.252 nop swap.1 - dup.2 - push.4 + push.8 + movup.3 + add + u32assert + push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -1593,136 +1970,27 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - push.12 - dup.1 - u32wrapping_add + locaddr.0 push.0 - movup.2 swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.1 + swap.1 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod @@ -1736,16 +2004,15 @@ proc ::reverse( trace.252 nop swap.1 - push.8 - dup.4 - add - u32assert + movup.2 push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -1755,46 +2022,51 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop - swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.16 + u32wrapping_add + push.1114144 u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop end +@locals("3") @callconv("C") proc miden_stdlib_sys::intrinsics::advice::adv_insert( i32, i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.1 + swap.1 add u32assert push.4 @@ -1810,8 +2082,16 @@ proc miden_stdlib_sys::intrinsics::advice::adv_insert( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.2 + swap.1 add u32assert push.4 @@ -1827,8 +2107,16 @@ proc miden_stdlib_sys::intrinsics::advice::adv_insert( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.3 + swap.1 add u32assert push.4 @@ -1844,7 +2132,14 @@ proc miden_stdlib_sys::intrinsics::advice::adv_insert( exec.::intrinsics::mem::load_felt trace.252 nop - movup.3 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -1862,11 +2157,27 @@ proc miden_stdlib_sys::intrinsics::advice::adv_insert( movup.5 swap.1 u32shr + dup.0 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.2 - movup.6 + movup.7 swap.1 u32shl - dup.1 u32wrapping_add movup.2 swap.3 @@ -1877,19 +2188,11 @@ proc miden_stdlib_sys::intrinsics::advice::adv_insert( swap.5 trace.240 nop - exec.::miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0::auth_component_rpo_falcon512::intrinsics::advice::adv_insert_mem + exec.::"miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0"::auth_component_rpo_falcon512::"intrinsics::advice::adv_insert_mem" trace.252 nop end -@callconv("C") -proc >::from( - i32 -) -> felt - push.255 - u32and -end - @callconv("C") proc intrinsics::advice::adv_insert_mem(felt, felt, felt, felt, i32, i32) trace.240 @@ -1918,17 +2221,7 @@ proc intrinsics::advice::emit_falcon_sig_to_stack( end @callconv("C") -proc intrinsics::felt::assert_eq(felt, felt) - assert_eq -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc std::crypto::dsa::rpo_falcon512::verify( +proc miden::core::crypto::dsa::falcon512rpo::verify( felt, felt, felt, @@ -1940,16 +2233,16 @@ proc std::crypto::dsa::rpo_falcon512::verify( ) trace.240 nop - exec.::std::crypto::dsa::rpo_falcon512::verify + exec.::miden::core::crypto::dsa::falcon512rpo::verify trace.252 nop end @callconv("C") -proc std::crypto::hashes::rpo::hash_memory_words(i32, i32, i32) +proc miden::core::crypto::hashes::rpo256::hash_words(i32, i32, i32) trace.240 nop - exec.::std::crypto::hashes::rpo::hash_memory_words + exec.::miden::core::crypto::hashes::rpo256::hash_words trace.252 nop movup.4 @@ -2002,10 +2295,10 @@ proc std::crypto::hashes::rpo::hash_memory_words(i32, i32, i32) end @callconv("C") -proc miden::active_account::get_item(felt, i32) +proc miden::protocol::active_account::get_item(felt, felt, i32) trace.240 nop - exec.::miden::active_account::get_item + exec.::miden::protocol::active_account::get_item trace.252 nop movup.4 @@ -2058,10 +2351,10 @@ proc miden::active_account::get_item(felt, i32) end @callconv("C") -proc miden::native_account::compute_delta_commitment(i32) +proc miden::protocol::native_account::compute_delta_commitment(i32) trace.240 nop - exec.::miden::native_account::compute_delta_commitment + exec.::miden::protocol::native_account::compute_delta_commitment trace.252 nop movup.4 @@ -2114,32 +2407,32 @@ proc miden::native_account::compute_delta_commitment(i32) end @callconv("C") -proc miden::native_account::incr_nonce( +proc miden::protocol::native_account::incr_nonce( ) -> felt trace.240 nop - exec.::miden::native_account::incr_nonce + exec.::miden::protocol::native_account::incr_nonce trace.252 nop end @callconv("C") -proc miden::tx::get_block_number( +proc miden::protocol::tx::get_block_number( ) -> felt trace.240 nop - exec.::miden::tx::get_block_number + exec.::miden::protocol::tx::get_block_number trace.252 nop end @callconv("C") -proc miden::tx::get_input_notes_commitment(i32) +proc miden::protocol::tx::get_input_notes_commitment(i32) trace.240 nop - exec.::miden::tx::get_input_notes_commitment + exec.::miden::protocol::tx::get_input_notes_commitment trace.252 nop movup.4 @@ -2192,10 +2485,10 @@ proc miden::tx::get_input_notes_commitment(i32) end @callconv("C") -proc miden::tx::get_output_notes_commitment(i32) +proc miden::protocol::tx::get_output_notes_commitment(i32) trace.240 nop - exec.::miden::tx::get_output_notes_commitment + exec.::miden::protocol::tx::get_output_notes_commitment trace.252 nop movup.4 diff --git a/tests/integration/expected/examples/auth_component_rpo_falcon512.wat b/tests/integration/expected/examples/auth_component_rpo_falcon512.wat index 691eae441..2d6a2bcd3 100644 --- a/tests/integration/expected/examples/auth_component_rpo_falcon512.wat +++ b/tests/integration/expected/examples/auth_component_rpo_falcon512.wat @@ -15,12 +15,12 @@ (type (;2;) (func (result f32))) (type (;3;) (func (param i32))) (type (;4;) (func (param i32 i32 i32))) - (type (;5;) (func (param i32 i32))) - (type (;6;) (func (param i32) (result f32))) - (type (;7;) (func (param f32 f32 f32 f32 i32 i32))) - (type (;8;) (func (param f32 f32 f32 f32 f32 f32 f32 f32))) - (type (;9;) (func (param f32 f32))) - (type (;10;) (func (param f32 i32))) + (type (;5;) (func (param f32 f32 f32 f32 i32 i32))) + (type (;6;) (func (param f32 f32 f32 f32 f32 f32 f32 f32))) + (type (;7;) (func (param f32 f32))) + (type (;8;) (func (param i32) (result f32))) + (type (;9;) (func (param i64) (result f32))) + (type (;10;) (func (param f32 f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -31,66 +31,69 @@ (func $__wasm_call_ctors (;0;) (type 0)) (func $auth_component_rpo_falcon512::bindings::__link_custom_section_describing_imports (;1;) (type 0)) (func $miden:auth-component-rpo-falcon512/auth-component-rpo-falcon512@0.1.0#auth-procedure (;2;) (type 1) (param f32 f32 f32 f32) - (local i32 f32 f32 i32 f32 f32 i32 f32 f32 f32 f32) + (local i32 f32 f32 f32 f32 i64 i64 i32 f32 f32 i32 i32 i32 i32 i32 i32 f32 f32) global.get $__stack_pointer - i32.const 160 + i32.const 112 i32.sub local.tee 4 global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once - call $miden_base_sys::bindings::tx::get_block_number + i64.const 7925067551181273379 + call $intrinsics::felt::from_u64_unchecked local.set 5 - call $miden::native_account::incr_nonce + i64.const 6106832419007247715 + call $intrinsics::felt::from_u64_unchecked local.set 6 + call $miden_base_sys::bindings::tx::get_block_number + local.set 7 + call $miden::protocol::native_account::incr_nonce + local.set 8 local.get 4 - i32.const 144 + i32.const 32 i32.add - call $miden::native_account::compute_delta_commitment - local.get 4 - local.get 4 - i64.load offset=152 - i64.store offset=56 - local.get 4 - local.get 4 - i64.load offset=144 - i64.store offset=48 + call $miden::protocol::native_account::compute_delta_commitment local.get 4 + i64.load offset=40 + local.set 9 local.get 4 - i32.const 48 - i32.add - call $::reverse + i64.load offset=32 + local.set 10 local.get 4 - i32.const 16 - i32.add call $miden_base_sys::bindings::tx::get_input_notes_commitment local.get 4 - i32.const 32 + i32.const 16 i32.add call $miden_base_sys::bindings::tx::get_output_notes_commitment i32.const 0 - local.set 7 + local.set 11 i32.const 0 call $intrinsics::felt::from_u32 - local.set 8 + local.set 12 i32.const 0 call $intrinsics::felt::from_u32 - local.set 9 + local.set 13 local.get 4 - i32.const 72 + i32.const 56 i32.add local.get 4 - i64.load offset=24 + i64.load offset=8 i64.store local.get 4 - i32.const 88 + i32.const 72 i32.add local.get 4 - i64.load offset=40 + i64.load offset=24 i64.store local.get 4 + local.get 10 + i64.const 32 + i64.rotl + i64.store offset=40 local.get 4 - i64.load offset=8 - i64.store offset=56 + local.get 9 + i64.const 32 + i64.rotl + i64.store offset=32 local.get 4 local.get 4 i64.load @@ -100,164 +103,161 @@ i64.load offset=16 i64.store offset=64 local.get 4 + local.get 8 + f32.store offset=92 local.get 4 - i64.load offset=32 - i64.store offset=80 - local.get 4 - local.get 6 - f32.store offset=108 - local.get 4 - local.get 5 - f32.store offset=104 + local.get 7 + f32.store offset=88 local.get 4 - local.get 9 - f32.store offset=100 + local.get 13 + f32.store offset=84 local.get 4 - local.get 8 - f32.store offset=96 + local.get 12 + f32.store offset=80 i32.const 0 call $intrinsics::felt::from_u32 i32.const 0 call $intrinsics::felt::from_u32 call $intrinsics::felt::assert_eq local.get 4 - i32.const 48 + i32.const 32 i32.add i32.const 2 i32.shr_u - local.tee 10 - local.get 10 + local.tee 14 + local.get 14 i32.const 16 i32.add local.get 4 - i32.const 128 + i32.const 96 i32.add - call $std::crypto::hashes::rpo::hash_memory_words + call $miden::core::crypto::hashes::rpo256::hash_words local.get 4 + f32.load offset=108 + local.set 7 local.get 4 - i64.load offset=136 - i64.store offset=152 - local.get 4 + f32.load offset=104 + local.set 8 local.get 4 - i64.load offset=128 - i64.store offset=144 + f32.load offset=100 + local.set 12 local.get 4 - i32.const 112 - i32.add + f32.load offset=96 + local.set 13 local.get 4 - i32.const 144 + i32.const 80 i32.add - call $::reverse + local.set 15 local.get 4 - f32.load offset=112 - local.set 5 - local.get 4 - f32.load offset=116 - local.set 6 - local.get 4 - f32.load offset=120 - local.set 8 - local.get 4 - f32.load offset=124 - local.set 9 - local.get 4 - i32.const 96 + i32.const 32 i32.add - local.set 10 + local.set 16 block ;; label = @1 loop ;; label = @2 - local.get 7 - i32.const 32 + local.get 11 + i32.const 2 i32.eq br_if 1 (;@1;) - local.get 4 - i32.const 48 - i32.add - local.get 7 + i32.const 0 + local.set 14 + block ;; label = @3 + loop ;; label = @4 + local.get 14 + i32.const 16 + i32.eq + br_if 1 (;@3;) + local.get 16 + local.get 14 + i32.add + local.tee 17 + i32.load + local.set 18 + local.get 17 + local.get 15 + local.get 14 + i32.add + local.tee 19 + i32.load + i32.store + local.get 19 + local.get 18 + i32.store + local.get 14 + i32.const 4 + i32.add + local.set 14 + br 0 (;@4;) + end + end + local.get 15 + i32.const -16 i32.add - local.get 10 - i32.const 4 - call $core::ptr::swap_nonoverlapping_bytes::swap_nonoverlapping_chunks::<4> - local.get 7 + local.set 15 + local.get 16 i32.const 16 i32.add - local.set 7 - local.get 10 - i32.const -16 + local.set 16 + local.get 11 + i32.const 1 i32.add - local.set 10 + local.set 11 br 0 (;@2;) end end local.get 4 - local.get 9 - f32.store offset=156 + local.get 13 + f32.store offset=108 local.get 4 - local.get 8 - f32.store offset=152 + local.get 12 + f32.store offset=104 local.get 4 - local.get 6 - f32.store offset=148 + local.get 8 + f32.store offset=100 local.get 4 - local.get 5 - f32.store offset=144 + local.get 7 + f32.store offset=96 local.get 4 - i32.const 144 + i32.const 96 i32.add local.get 4 - i32.const 48 + i32.const 32 i32.add i32.const 4 call $miden_stdlib_sys::intrinsics::advice::adv_insert - i32.const 0 - call $>::from - local.get 4 - i32.const 128 - i32.add - call $miden::active_account::get_item - local.get 4 - local.get 4 - i64.load offset=136 - i64.store offset=152 - local.get 4 - local.get 4 - i64.load offset=128 - i64.store offset=144 - local.get 4 - i32.const 112 - i32.add + local.get 6 + local.get 5 local.get 4 - i32.const 144 + i32.const 96 i32.add - call $::reverse - local.get 9 + call $miden::protocol::active_account::get_item + local.get 13 + local.get 12 local.get 8 - local.get 6 - local.get 5 + local.get 7 local.get 4 - f32.load offset=124 - local.tee 11 + f32.load offset=96 + local.tee 5 local.get 4 - f32.load offset=120 - local.tee 12 + f32.load offset=100 + local.tee 6 local.get 4 - f32.load offset=116 - local.tee 13 + f32.load offset=104 + local.tee 20 local.get 4 - f32.load offset=112 - local.tee 14 + f32.load offset=108 + local.tee 21 call $intrinsics::advice::emit_falcon_sig_to_stack - local.get 11 - local.get 12 + local.get 5 + local.get 6 + local.get 20 + local.get 21 local.get 13 - local.get 14 - local.get 9 + local.get 12 local.get 8 - local.get 6 - local.get 5 - call $std::crypto::dsa::rpo_falcon512::verify + local.get 7 + call $miden::core::crypto::dsa::falcon512rpo::verify local.get 4 - i32.const 160 + i32.const 112 i32.add global.set $__stack_pointer ) @@ -280,154 +280,61 @@ end ) (func $miden_base_sys::bindings::tx::get_block_number (;4;) (type 2) (result f32) - call $miden::tx::get_block_number + call $miden::protocol::tx::get_block_number ) (func $miden_base_sys::bindings::tx::get_input_notes_commitment (;5;) (type 3) (param i32) (local i32) global.get $__stack_pointer - i32.const 32 + i32.const 16 i32.sub local.tee 1 global.set $__stack_pointer local.get 1 - call $miden::tx::get_input_notes_commitment - local.get 1 - local.get 1 - i64.load offset=8 - i64.store offset=24 - local.get 1 + call $miden::protocol::tx::get_input_notes_commitment + local.get 0 local.get 1 i64.load - i64.store offset=16 + i64.const 32 + i64.rotl + i64.store offset=8 local.get 0 local.get 1 - i32.const 16 - i32.add - call $::reverse + i64.load offset=8 + i64.const 32 + i64.rotl + i64.store local.get 1 - i32.const 32 + i32.const 16 i32.add global.set $__stack_pointer ) (func $miden_base_sys::bindings::tx::get_output_notes_commitment (;6;) (type 3) (param i32) (local i32) global.get $__stack_pointer - i32.const 32 + i32.const 16 i32.sub local.tee 1 global.set $__stack_pointer local.get 1 - call $miden::tx::get_output_notes_commitment - local.get 1 - local.get 1 - i64.load offset=8 - i64.store offset=24 - local.get 1 + call $miden::protocol::tx::get_output_notes_commitment + local.get 0 local.get 1 i64.load - i64.store offset=16 + i64.const 32 + i64.rotl + i64.store offset=8 local.get 0 local.get 1 - i32.const 16 - i32.add - call $::reverse - local.get 1 - i32.const 32 - i32.add - global.set $__stack_pointer - ) - (func $core::ptr::swap_nonoverlapping_bytes::swap_nonoverlapping_chunks::<4> (;7;) (type 4) (param i32 i32 i32) - (local i32) - block ;; label = @1 - loop ;; label = @2 - local.get 2 - i32.eqz - br_if 1 (;@1;) - local.get 0 - i32.load align=1 - local.set 3 - local.get 0 - local.get 1 - i32.load align=1 - i32.store align=1 - local.get 1 - local.get 3 - i32.store align=1 - local.get 2 - i32.const -1 - i32.add - local.set 2 - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 0 - i32.const 4 - i32.add - local.set 0 - br 0 (;@2;) - end - end - ) - (func $::reverse (;8;) (type 5) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 + i64.const 32 + i64.rotl + i64.store local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 + i32.const 16 i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store + global.set $__stack_pointer ) - (func $miden_stdlib_sys::intrinsics::advice::adv_insert (;9;) (type 4) (param i32 i32 i32) + (func $miden_stdlib_sys::intrinsics::advice::adv_insert (;7;) (type 4) (param i32 i32 i32) local.get 0 f32.load offset=12 local.get 0 @@ -447,50 +354,47 @@ i32.add call $intrinsics::advice::adv_insert_mem ) - (func $>::from (;10;) (type 6) (param i32) (result f32) - local.get 0 - i32.const 255 - i32.and - f32.reinterpret_i32 + (func $intrinsics::advice::adv_insert_mem (;8;) (type 5) (param f32 f32 f32 f32 i32 i32) + unreachable ) - (func $intrinsics::advice::adv_insert_mem (;11;) (type 7) (param f32 f32 f32 f32 i32 i32) + (func $intrinsics::advice::emit_falcon_sig_to_stack (;9;) (type 6) (param f32 f32 f32 f32 f32 f32 f32 f32) unreachable ) - (func $intrinsics::advice::emit_falcon_sig_to_stack (;12;) (type 8) (param f32 f32 f32 f32 f32 f32 f32 f32) + (func $intrinsics::felt::assert_eq (;10;) (type 7) (param f32 f32) unreachable ) - (func $intrinsics::felt::assert_eq (;13;) (type 9) (param f32 f32) + (func $intrinsics::felt::from_u32 (;11;) (type 8) (param i32) (result f32) unreachable ) - (func $intrinsics::felt::from_u32 (;14;) (type 6) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;12;) (type 9) (param i64) (result f32) unreachable ) - (func $std::crypto::dsa::rpo_falcon512::verify (;15;) (type 8) (param f32 f32 f32 f32 f32 f32 f32 f32) + (func $miden::core::crypto::dsa::falcon512rpo::verify (;13;) (type 6) (param f32 f32 f32 f32 f32 f32 f32 f32) unreachable ) - (func $std::crypto::hashes::rpo::hash_memory_words (;16;) (type 4) (param i32 i32 i32) + (func $miden::core::crypto::hashes::rpo256::hash_words (;14;) (type 4) (param i32 i32 i32) unreachable ) - (func $miden::active_account::get_item (;17;) (type 10) (param f32 i32) + (func $miden::protocol::active_account::get_item (;15;) (type 10) (param f32 f32 i32) unreachable ) - (func $miden::native_account::compute_delta_commitment (;18;) (type 3) (param i32) + (func $miden::protocol::native_account::compute_delta_commitment (;16;) (type 3) (param i32) unreachable ) - (func $miden::native_account::incr_nonce (;19;) (type 2) (result f32) + (func $miden::protocol::native_account::incr_nonce (;17;) (type 2) (result f32) unreachable ) - (func $miden::tx::get_block_number (;20;) (type 2) (result f32) + (func $miden::protocol::tx::get_block_number (;18;) (type 2) (result f32) unreachable ) - (func $miden::tx::get_input_notes_commitment (;21;) (type 3) (param i32) + (func $miden::protocol::tx::get_input_notes_commitment (;19;) (type 3) (param i32) unreachable ) - (func $miden::tx::get_output_notes_commitment (;22;) (type 3) (param i32) + (func $miden::protocol::tx::get_output_notes_commitment (;20;) (type 3) (param i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "9auth-component-rpo-falcon512\01\0b0.1.0\01\03\00\00\00!owner_public_key\01!owner public key9auth::rpo_falcon512::pub_key\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "9auth-component-rpo-falcon512\01\0b0.1.0\01\01\00Fmiden::component::miden_auth_component_rpo_falcon512::owner_public_key\00\01!owner public key\00]miden::standards::auth::falcon512_rpo::pub_key\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/examples/basic_wallet.hir b/tests/integration/expected/examples/basic_wallet.hir index 5c9789f2e..268dcfe02 100644 --- a/tests/integration/expected/examples/basic_wallet.hir +++ b/tests/integration/expected/examples/basic_wallet.hir @@ -12,471 +12,454 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { private builtin.function @miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt) { ^block9(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt): - v6 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr - v7 = hir.bitcast v6 : ptr; - v8 = hir.load v7 : i32; - v9 = arith.constant 32 : i32; - v10 = arith.sub v8, v9 : i32 #[overflow = wrapping]; - v11 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr - v12 = hir.bitcast v11 : ptr; - hir.store v12, v10; + hir.store_local v0 #[local = lv0]; + hir.store_local v1 #[local = lv1]; + hir.store_local v2 #[local = lv2]; + hir.store_local v3 #[local = lv3]; + hir.store_local v4 #[local = lv4]; + v5 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr + v6 = hir.bitcast v5 : ptr; + v7 = hir.load v6 : i32; + v373 = arith.constant 32 : i32; + v9 = arith.sub v7, v373 : i32 #[overflow = wrapping]; + hir.store_local v9 #[local = lv5]; + v10 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr + v11 = hir.bitcast v10 : ptr; + hir.store v11, v9; hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/wit_bindgen::rt::run_ctors_once() - v14 = arith.constant 12 : u32; - v13 = hir.bitcast v10 : u32; - v15 = arith.add v13, v14 : u32 #[overflow = checked]; - v16 = arith.constant 4 : u32; - v17 = arith.mod v15, v16 : u32; - hir.assertz v17 #[code = 250]; - v18 = hir.int_to_ptr v15 : ptr; - hir.store v18, v3; - v20 = arith.constant 8 : u32; - v19 = hir.bitcast v10 : u32; - v21 = arith.add v19, v20 : u32 #[overflow = checked]; - v376 = arith.constant 4 : u32; - v23 = arith.mod v21, v376 : u32; - hir.assertz v23 #[code = 250]; - v24 = hir.int_to_ptr v21 : ptr; - hir.store v24, v2; - v375 = arith.constant 4 : u32; - v25 = hir.bitcast v10 : u32; - v27 = arith.add v25, v375 : u32 #[overflow = checked]; - v374 = arith.constant 4 : u32; - v29 = arith.mod v27, v374 : u32; - hir.assertz v29 #[code = 250]; - v30 = hir.int_to_ptr v27 : ptr; - hir.store v30, v1; - v31 = hir.bitcast v10 : u32; - v373 = arith.constant 4 : u32; - v33 = arith.mod v31, v373 : u32; - hir.assertz v33 #[code = 250]; - v34 = hir.int_to_ptr v31 : ptr; - hir.store v34, v0; - v35 = arith.constant 16 : i32; - v36 = arith.add v10, v35 : i32 #[overflow = wrapping]; - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden_base_sys::bindings::native_account::remove_asset(v36, v10) - v372 = arith.constant 16 : i32; - v38 = arith.add v10, v372 : i32 #[overflow = wrapping]; - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden_base_sys::bindings::output_note::add_asset(v38, v4) - v371 = arith.constant 32 : i32; - v40 = arith.add v10, v371 : i32 #[overflow = wrapping]; - v41 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr - v42 = hir.bitcast v41 : ptr; - hir.store v42, v40; - builtin.ret ; - }; - - private builtin.function @miden:basic-wallet/basic-wallet@0.1.0#receive-asset(v43: felt, v44: felt, v45: felt, v46: felt) { - ^block11(v43: felt, v44: felt, v45: felt, v46: felt): - v48 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr - v49 = hir.bitcast v48 : ptr; - v50 = hir.load v49 : i32; - v51 = arith.constant 32 : i32; - v52 = arith.sub v50, v51 : i32 #[overflow = wrapping]; + v12 = hir.load_local : i32 #[local = lv5]; + v13 = hir.load_local : felt #[local = lv3]; + v372 = arith.constant 12 : u32; + v14 = hir.bitcast v12 : u32; + v16 = arith.add v14, v372 : u32 #[overflow = checked]; + v371 = arith.constant 4 : u32; + v18 = arith.mod v16, v371 : u32; + hir.assertz v18 #[code = 250]; + v19 = hir.int_to_ptr v16 : ptr; + hir.store v19, v13; + v20 = hir.load_local : i32 #[local = lv5]; + v21 = hir.load_local : felt #[local = lv2]; + v370 = arith.constant 8 : u32; + v22 = hir.bitcast v20 : u32; + v24 = arith.add v22, v370 : u32 #[overflow = checked]; + v385 = arith.constant 4 : u32; + v26 = arith.mod v24, v385 : u32; + hir.assertz v26 #[code = 250]; + v27 = hir.int_to_ptr v24 : ptr; + hir.store v27, v21; + v28 = hir.load_local : i32 #[local = lv5]; + v29 = hir.load_local : felt #[local = lv1]; + v384 = arith.constant 4 : u32; + v30 = hir.bitcast v28 : u32; + v32 = arith.add v30, v384 : u32 #[overflow = checked]; + v383 = arith.constant 4 : u32; + v34 = arith.mod v32, v383 : u32; + hir.assertz v34 #[code = 250]; + v35 = hir.int_to_ptr v32 : ptr; + hir.store v35, v29; + v36 = hir.load_local : i32 #[local = lv5]; + v37 = hir.load_local : felt #[local = lv0]; + v38 = hir.bitcast v36 : u32; + v382 = arith.constant 4 : u32; + v40 = arith.mod v38, v382 : u32; + hir.assertz v40 #[code = 250]; + v41 = hir.int_to_ptr v38 : ptr; + hir.store v41, v37; + v42 = hir.load_local : i32 #[local = lv5]; + v369 = arith.constant 16 : i32; + v44 = arith.add v42, v369 : i32 #[overflow = wrapping]; + hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden_base_sys::bindings::native_account::remove_asset(v44, v42) + v46 = hir.load_local : i32 #[local = lv5]; + v49 = hir.load_local : felt #[local = lv4]; + v381 = arith.constant 16 : i32; + v48 = arith.add v46, v381 : i32 #[overflow = wrapping]; + hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden_base_sys::bindings::output_note::add_asset(v48, v49) + v50 = hir.load_local : i32 #[local = lv5]; + v380 = arith.constant 32 : i32; + v52 = arith.add v50, v380 : i32 #[overflow = wrapping]; v53 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr v54 = hir.bitcast v53 : ptr; hir.store v54, v52; + builtin.ret ; + }; + + private builtin.function @miden:basic-wallet/basic-wallet@0.1.0#receive-asset(v55: felt, v56: felt, v57: felt, v58: felt) { + ^block11(v55: felt, v56: felt, v57: felt, v58: felt): + hir.store_local v55 #[local = lv0]; + hir.store_local v56 #[local = lv1]; + hir.store_local v57 #[local = lv2]; + hir.store_local v58 #[local = lv3]; + v59 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr + v60 = hir.bitcast v59 : ptr; + v61 = hir.load v60 : i32; + v390 = arith.constant 32 : i32; + v63 = arith.sub v61, v390 : i32 #[overflow = wrapping]; + hir.store_local v63 #[local = lv4]; + v64 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr + v65 = hir.bitcast v64 : ptr; + hir.store v65, v63; hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/wit_bindgen::rt::run_ctors_once() - v56 = arith.constant 12 : u32; - v55 = hir.bitcast v52 : u32; - v57 = arith.add v55, v56 : u32 #[overflow = checked]; - v58 = arith.constant 4 : u32; - v59 = arith.mod v57, v58 : u32; - hir.assertz v59 #[code = 250]; - v60 = hir.int_to_ptr v57 : ptr; - hir.store v60, v46; - v62 = arith.constant 8 : u32; - v61 = hir.bitcast v52 : u32; - v63 = arith.add v61, v62 : u32 #[overflow = checked]; - v381 = arith.constant 4 : u32; - v65 = arith.mod v63, v381 : u32; - hir.assertz v65 #[code = 250]; - v66 = hir.int_to_ptr v63 : ptr; - hir.store v66, v45; - v380 = arith.constant 4 : u32; - v67 = hir.bitcast v52 : u32; - v69 = arith.add v67, v380 : u32 #[overflow = checked]; - v379 = arith.constant 4 : u32; - v71 = arith.mod v69, v379 : u32; - hir.assertz v71 #[code = 250]; - v72 = hir.int_to_ptr v69 : ptr; - hir.store v72, v44; - v73 = hir.bitcast v52 : u32; - v378 = arith.constant 4 : u32; - v75 = arith.mod v73, v378 : u32; - hir.assertz v75 #[code = 250]; - v76 = hir.int_to_ptr v73 : ptr; - hir.store v76, v43; - v77 = arith.constant 16 : i32; - v78 = arith.add v52, v77 : i32 #[overflow = wrapping]; - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden_base_sys::bindings::native_account::add_asset(v78, v52) - v377 = arith.constant 32 : i32; - v80 = arith.add v52, v377 : i32 #[overflow = wrapping]; - v81 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr - v82 = hir.bitcast v81 : ptr; - hir.store v82, v80; + v66 = hir.load_local : i32 #[local = lv4]; + v67 = hir.load_local : felt #[local = lv3]; + v389 = arith.constant 12 : u32; + v68 = hir.bitcast v66 : u32; + v70 = arith.add v68, v389 : u32 #[overflow = checked]; + v388 = arith.constant 4 : u32; + v72 = arith.mod v70, v388 : u32; + hir.assertz v72 #[code = 250]; + v73 = hir.int_to_ptr v70 : ptr; + hir.store v73, v67; + v74 = hir.load_local : i32 #[local = lv4]; + v75 = hir.load_local : felt #[local = lv2]; + v387 = arith.constant 8 : u32; + v76 = hir.bitcast v74 : u32; + v78 = arith.add v76, v387 : u32 #[overflow = checked]; + v400 = arith.constant 4 : u32; + v80 = arith.mod v78, v400 : u32; + hir.assertz v80 #[code = 250]; + v81 = hir.int_to_ptr v78 : ptr; + hir.store v81, v75; + v82 = hir.load_local : i32 #[local = lv4]; + v83 = hir.load_local : felt #[local = lv1]; + v399 = arith.constant 4 : u32; + v84 = hir.bitcast v82 : u32; + v86 = arith.add v84, v399 : u32 #[overflow = checked]; + v398 = arith.constant 4 : u32; + v88 = arith.mod v86, v398 : u32; + hir.assertz v88 #[code = 250]; + v89 = hir.int_to_ptr v86 : ptr; + hir.store v89, v83; + v90 = hir.load_local : i32 #[local = lv4]; + v91 = hir.load_local : felt #[local = lv0]; + v92 = hir.bitcast v90 : u32; + v397 = arith.constant 4 : u32; + v94 = arith.mod v92, v397 : u32; + hir.assertz v94 #[code = 250]; + v95 = hir.int_to_ptr v92 : ptr; + hir.store v95, v91; + v96 = hir.load_local : i32 #[local = lv4]; + v386 = arith.constant 16 : i32; + v98 = arith.add v96, v386 : i32 #[overflow = wrapping]; + hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden_base_sys::bindings::native_account::add_asset(v98, v96) + v100 = hir.load_local : i32 #[local = lv4]; + v396 = arith.constant 32 : i32; + v102 = arith.add v100, v396 : i32 #[overflow = wrapping]; + v103 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr + v104 = hir.bitcast v103 : ptr; + hir.store v104, v102; builtin.ret ; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block13: - v84 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/GOT.data.internal.__memory_base : ptr - v85 = hir.bitcast v84 : ptr; - v86 = hir.load v85 : i32; - v87 = arith.constant 1048584 : i32; - v88 = arith.add v86, v87 : i32 #[overflow = wrapping]; - v89 = hir.bitcast v88 : u32; - v90 = hir.int_to_ptr v89 : ptr; - v91 = hir.load v90 : u8; - v83 = arith.constant 0 : i32; - v92 = arith.zext v91 : u32; - v93 = hir.bitcast v92 : i32; - v95 = arith.neq v93, v83 : i1; - scf.if v95{ + v105 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/GOT.data.internal.__memory_base : ptr + v106 = hir.bitcast v105 : ptr; + v107 = hir.load v106 : i32; + v405 = arith.constant 1048584 : i32; + v109 = arith.add v107, v405 : i32 #[overflow = wrapping]; + v110 = hir.bitcast v109 : u32; + v111 = hir.int_to_ptr v110 : ptr; + v112 = hir.load v111 : u8; + v404 = arith.constant 0 : i32; + v113 = arith.zext v112 : u32; + v114 = hir.bitcast v113 : i32; + v116 = arith.neq v114, v404 : i1; + scf.if v116{ ^block15: scf.yield ; } else { ^block16: - v96 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/GOT.data.internal.__memory_base : ptr - v97 = hir.bitcast v96 : ptr; - v98 = hir.load v97 : i32; + v117 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/GOT.data.internal.__memory_base : ptr + v118 = hir.bitcast v117 : ptr; + v119 = hir.load v118 : i32; + hir.store_local v119 #[local = lv0]; hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__wasm_call_ctors() - v383 = arith.constant 1 : u8; - v385 = arith.constant 1048584 : i32; - v100 = arith.add v98, v385 : i32 #[overflow = wrapping]; - v104 = hir.bitcast v100 : u32; - v105 = hir.int_to_ptr v104 : ptr; - hir.store v105, v383; + v120 = hir.load_local : i32 #[local = lv0]; + v403 = arith.constant 1 : u8; + v408 = arith.constant 1048584 : i32; + v122 = arith.add v120, v408 : i32 #[overflow = wrapping]; + v126 = hir.bitcast v122 : u32; + v127 = hir.int_to_ptr v126 : ptr; + hir.store v127, v403; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::output_note::add_asset(v106: i32, v107: felt) { - ^block17(v106: i32, v107: felt): - v109 = arith.constant 12 : u32; - v108 = hir.bitcast v106 : u32; - v110 = arith.add v108, v109 : u32 #[overflow = checked]; - v111 = arith.constant 4 : u32; - v112 = arith.mod v110, v111 : u32; - hir.assertz v112 #[code = 250]; - v113 = hir.int_to_ptr v110 : ptr; - v114 = hir.load v113 : felt; - v116 = arith.constant 8 : u32; - v115 = hir.bitcast v106 : u32; - v117 = arith.add v115, v116 : u32 #[overflow = checked]; - v389 = arith.constant 4 : u32; - v119 = arith.mod v117, v389 : u32; - hir.assertz v119 #[code = 250]; - v120 = hir.int_to_ptr v117 : ptr; - v121 = hir.load v120 : felt; - v388 = arith.constant 4 : u32; - v122 = hir.bitcast v106 : u32; - v124 = arith.add v122, v388 : u32 #[overflow = checked]; - v387 = arith.constant 4 : u32; - v126 = arith.mod v124, v387 : u32; - hir.assertz v126 #[code = 250]; - v127 = hir.int_to_ptr v124 : ptr; - v128 = hir.load v127 : felt; - v129 = hir.bitcast v106 : u32; - v386 = arith.constant 4 : u32; - v131 = arith.mod v129, v386 : u32; - hir.assertz v131 #[code = 250]; - v132 = hir.int_to_ptr v129 : ptr; - v133 = hir.load v132 : felt; - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden::output_note::add_asset(v114, v121, v128, v133, v107) - builtin.ret ; - }; - - private builtin.function @miden_base_sys::bindings::native_account::remove_asset(v134: i32, v135: i32) { - ^block19(v134: i32, v135: i32): - v137 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr - v138 = hir.bitcast v137 : ptr; - v139 = hir.load v138 : i32; - v140 = arith.constant 32 : i32; - v141 = arith.sub v139, v140 : i32 #[overflow = wrapping]; - v142 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr - v143 = hir.bitcast v142 : ptr; - hir.store v143, v141; - v145 = arith.constant 12 : u32; - v144 = hir.bitcast v135 : u32; - v146 = arith.add v144, v145 : u32 #[overflow = checked]; - v147 = arith.constant 4 : u32; - v148 = arith.mod v146, v147 : u32; - hir.assertz v148 #[code = 250]; - v149 = hir.int_to_ptr v146 : ptr; - v150 = hir.load v149 : felt; - v152 = arith.constant 8 : u32; - v151 = hir.bitcast v135 : u32; - v153 = arith.add v151, v152 : u32 #[overflow = checked]; - v399 = arith.constant 4 : u32; - v155 = arith.mod v153, v399 : u32; - hir.assertz v155 #[code = 250]; - v156 = hir.int_to_ptr v153 : ptr; - v157 = hir.load v156 : felt; - v398 = arith.constant 4 : u32; - v158 = hir.bitcast v135 : u32; - v160 = arith.add v158, v398 : u32 #[overflow = checked]; - v397 = arith.constant 4 : u32; - v162 = arith.mod v160, v397 : u32; - hir.assertz v162 #[code = 250]; - v163 = hir.int_to_ptr v160 : ptr; - v164 = hir.load v163 : felt; - v165 = hir.bitcast v135 : u32; - v396 = arith.constant 4 : u32; - v167 = arith.mod v165, v396 : u32; - hir.assertz v167 #[code = 250]; - v168 = hir.int_to_ptr v165 : ptr; - v169 = hir.load v168 : felt; - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden::native_account::remove_asset(v150, v157, v164, v169, v141) - v395 = arith.constant 8 : u32; - v170 = hir.bitcast v141 : u32; - v172 = arith.add v170, v395 : u32 #[overflow = checked]; - v394 = arith.constant 8 : u32; - v174 = arith.mod v172, v394 : u32; - hir.assertz v174 #[code = 250]; - v175 = hir.int_to_ptr v172 : ptr; - v176 = hir.load v175 : i64; - v178 = arith.constant 24 : u32; - v177 = hir.bitcast v141 : u32; - v179 = arith.add v177, v178 : u32 #[overflow = checked]; - v393 = arith.constant 8 : u32; - v181 = arith.mod v179, v393 : u32; - hir.assertz v181 #[code = 250]; - v182 = hir.int_to_ptr v179 : ptr; - hir.store v182, v176; - v183 = hir.bitcast v141 : u32; - v392 = arith.constant 8 : u32; - v185 = arith.mod v183, v392 : u32; - hir.assertz v185 #[code = 250]; - v186 = hir.int_to_ptr v183 : ptr; - v187 = hir.load v186 : i64; - v189 = arith.constant 16 : u32; - v188 = hir.bitcast v141 : u32; - v190 = arith.add v188, v189 : u32 #[overflow = checked]; - v391 = arith.constant 8 : u32; - v192 = arith.mod v190, v391 : u32; - hir.assertz v192 #[code = 250]; - v193 = hir.int_to_ptr v190 : ptr; - hir.store v193, v187; - v194 = arith.constant 16 : i32; - v195 = arith.add v141, v194 : i32 #[overflow = wrapping]; - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/::reverse(v134, v195) - v390 = arith.constant 32 : i32; - v197 = arith.add v141, v390 : i32 #[overflow = wrapping]; - v198 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr - v199 = hir.bitcast v198 : ptr; - hir.store v199, v197; + private builtin.function @miden_base_sys::bindings::output_note::add_asset(v128: i32, v129: felt) { + ^block17(v128: i32, v129: felt): + hir.store_local v128 #[local = lv0]; + v130 = hir.load_local : i32 #[local = lv0]; + v411 = arith.constant 12 : u32; + v131 = hir.bitcast v130 : u32; + v133 = arith.add v131, v411 : u32 #[overflow = checked]; + v410 = arith.constant 4 : u32; + v135 = arith.mod v133, v410 : u32; + hir.assertz v135 #[code = 250]; + v136 = hir.int_to_ptr v133 : ptr; + v137 = hir.load v136 : felt; + v138 = hir.load_local : i32 #[local = lv0]; + v409 = arith.constant 8 : u32; + v139 = hir.bitcast v138 : u32; + v141 = arith.add v139, v409 : u32 #[overflow = checked]; + v419 = arith.constant 4 : u32; + v143 = arith.mod v141, v419 : u32; + hir.assertz v143 #[code = 250]; + v144 = hir.int_to_ptr v141 : ptr; + v145 = hir.load v144 : felt; + v146 = hir.load_local : i32 #[local = lv0]; + v418 = arith.constant 4 : u32; + v147 = hir.bitcast v146 : u32; + v149 = arith.add v147, v418 : u32 #[overflow = checked]; + v417 = arith.constant 4 : u32; + v151 = arith.mod v149, v417 : u32; + hir.assertz v151 #[code = 250]; + v152 = hir.int_to_ptr v149 : ptr; + v153 = hir.load v152 : felt; + v154 = hir.load_local : i32 #[local = lv0]; + v155 = hir.bitcast v154 : u32; + v416 = arith.constant 4 : u32; + v157 = arith.mod v155, v416 : u32; + hir.assertz v157 #[code = 250]; + v158 = hir.int_to_ptr v155 : ptr; + v159 = hir.load v158 : felt; + hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden::protocol::output_note::add_asset(v137, v145, v153, v159, v129) builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::native_account::add_asset(v200: i32, v201: i32) { - ^block21(v200: i32, v201: i32): - v203 = arith.constant 12 : u32; - v202 = hir.bitcast v201 : u32; - v204 = arith.add v202, v203 : u32 #[overflow = checked]; - v205 = arith.constant 4 : u32; - v206 = arith.mod v204, v205 : u32; - hir.assertz v206 #[code = 250]; - v207 = hir.int_to_ptr v204 : ptr; - v208 = hir.load v207 : felt; - v210 = arith.constant 8 : u32; - v209 = hir.bitcast v201 : u32; - v211 = arith.add v209, v210 : u32 #[overflow = checked]; - v403 = arith.constant 4 : u32; - v213 = arith.mod v211, v403 : u32; - hir.assertz v213 #[code = 250]; - v214 = hir.int_to_ptr v211 : ptr; - v215 = hir.load v214 : felt; - v402 = arith.constant 4 : u32; - v216 = hir.bitcast v201 : u32; - v218 = arith.add v216, v402 : u32 #[overflow = checked]; - v401 = arith.constant 4 : u32; - v220 = arith.mod v218, v401 : u32; - hir.assertz v220 #[code = 250]; - v221 = hir.int_to_ptr v218 : ptr; - v222 = hir.load v221 : felt; - v223 = hir.bitcast v201 : u32; - v400 = arith.constant 4 : u32; - v225 = arith.mod v223, v400 : u32; - hir.assertz v225 #[code = 250]; - v226 = hir.int_to_ptr v223 : ptr; - v227 = hir.load v226 : felt; - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden::native_account::add_asset(v208, v215, v222, v227, v200) + private builtin.function @miden_base_sys::bindings::native_account::remove_asset(v161: i32, v162: i32) { + ^block19(v161: i32, v162: i32): + hir.store_local v161 #[local = lv0]; + hir.store_local v162 #[local = lv1]; + v163 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr + v164 = hir.bitcast v163 : ptr; + v165 = hir.load v164 : i32; + v429 = arith.constant 16 : i32; + v167 = arith.sub v165, v429 : i32 #[overflow = wrapping]; + hir.store_local v167 #[local = lv2]; + v168 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr + v169 = hir.bitcast v168 : ptr; + hir.store v169, v167; + v170 = hir.load_local : i32 #[local = lv1]; + v428 = arith.constant 12 : u32; + v171 = hir.bitcast v170 : u32; + v173 = arith.add v171, v428 : u32 #[overflow = checked]; + v427 = arith.constant 4 : u32; + v175 = arith.mod v173, v427 : u32; + hir.assertz v175 #[code = 250]; + v176 = hir.int_to_ptr v173 : ptr; + v177 = hir.load v176 : felt; + v178 = hir.load_local : i32 #[local = lv1]; + v426 = arith.constant 8 : u32; + v179 = hir.bitcast v178 : u32; + v181 = arith.add v179, v426 : u32 #[overflow = checked]; + v451 = arith.constant 4 : u32; + v183 = arith.mod v181, v451 : u32; + hir.assertz v183 #[code = 250]; + v184 = hir.int_to_ptr v181 : ptr; + v185 = hir.load v184 : felt; + v186 = hir.load_local : i32 #[local = lv1]; + v450 = arith.constant 4 : u32; + v187 = hir.bitcast v186 : u32; + v189 = arith.add v187, v450 : u32 #[overflow = checked]; + v449 = arith.constant 4 : u32; + v191 = arith.mod v189, v449 : u32; + hir.assertz v191 #[code = 250]; + v192 = hir.int_to_ptr v189 : ptr; + v193 = hir.load v192 : felt; + v194 = hir.load_local : i32 #[local = lv1]; + v195 = hir.bitcast v194 : u32; + v448 = arith.constant 4 : u32; + v197 = arith.mod v195, v448 : u32; + hir.assertz v197 #[code = 250]; + v198 = hir.int_to_ptr v195 : ptr; + v199 = hir.load v198 : felt; + v200 = hir.load_local : i32 #[local = lv2]; + hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden::protocol::native_account::remove_asset(v177, v185, v193, v199, v200) + v201 = hir.load_local : i32 #[local = lv0]; + v202 = hir.load_local : i32 #[local = lv2]; + v203 = hir.bitcast v202 : u32; + v447 = arith.constant 8 : u32; + v205 = arith.mod v203, v447 : u32; + hir.assertz v205 #[code = 250]; + v206 = hir.int_to_ptr v203 : ptr; + v207 = hir.load v206 : i64; + v423, v424 = arith.split v207 : felt, felt; + v446 = arith.constant 8 : u32; + v211 = hir.bitcast v201 : u32; + v213 = arith.add v211, v446 : u32 #[overflow = checked]; + v445 = arith.constant 8 : u32; + v215 = arith.mod v213, v445 : u32; + hir.assertz v215 #[code = 250]; + v425 = arith.join v424, v423 : i64; + v216 = hir.int_to_ptr v213 : ptr; + hir.store v216, v425; + v217 = hir.load_local : i32 #[local = lv0]; + v218 = hir.load_local : i32 #[local = lv2]; + v444 = arith.constant 8 : u32; + v219 = hir.bitcast v218 : u32; + v221 = arith.add v219, v444 : u32 #[overflow = checked]; + v443 = arith.constant 8 : u32; + v223 = arith.mod v221, v443 : u32; + hir.assertz v223 #[code = 250]; + v224 = hir.int_to_ptr v221 : ptr; + v225 = hir.load v224 : i64; + v420, v421 = arith.split v225 : felt, felt; + v229 = hir.bitcast v217 : u32; + v442 = arith.constant 8 : u32; + v231 = arith.mod v229, v442 : u32; + hir.assertz v231 #[code = 250]; + v422 = arith.join v421, v420 : i64; + v232 = hir.int_to_ptr v229 : ptr; + hir.store v232, v422; + v233 = hir.load_local : i32 #[local = lv2]; + v441 = arith.constant 16 : i32; + v235 = arith.add v233, v441 : i32 #[overflow = wrapping]; + v236 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr + v237 = hir.bitcast v236 : ptr; + hir.store v237, v235; builtin.ret ; }; - private builtin.function @::reverse(v228: i32, v229: i32) { - ^block23(v228: i32, v229: i32): - v232 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr - v233 = hir.bitcast v232 : ptr; - v234 = hir.load v233 : i32; - v235 = arith.constant 16 : i32; - v236 = arith.sub v234, v235 : i32 #[overflow = wrapping]; - v238 = arith.constant 8 : u32; - v237 = hir.bitcast v229 : u32; - v239 = arith.add v237, v238 : u32 #[overflow = checked]; - v490 = arith.constant 8 : u32; - v241 = arith.mod v239, v490 : u32; - hir.assertz v241 #[code = 250]; - v242 = hir.int_to_ptr v239 : ptr; - v243 = hir.load v242 : i64; - v489 = arith.constant 8 : u32; - v244 = hir.bitcast v236 : u32; - v246 = arith.add v244, v489 : u32 #[overflow = checked]; - v247 = arith.constant 4 : u32; - v248 = arith.mod v246, v247 : u32; - hir.assertz v248 #[code = 250]; - v249 = hir.int_to_ptr v246 : ptr; - hir.store v249, v243; - v250 = hir.bitcast v229 : u32; - v488 = arith.constant 8 : u32; - v252 = arith.mod v250, v488 : u32; + private builtin.function @miden_base_sys::bindings::native_account::add_asset(v238: i32, v239: i32) { + ^block21(v238: i32, v239: i32): + hir.store_local v238 #[local = lv0]; + hir.store_local v239 #[local = lv1]; + v240 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr + v241 = hir.bitcast v240 : ptr; + v242 = hir.load v241 : i32; + v461 = arith.constant 16 : i32; + v244 = arith.sub v242, v461 : i32 #[overflow = wrapping]; + hir.store_local v244 #[local = lv2]; + v245 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr + v246 = hir.bitcast v245 : ptr; + hir.store v246, v244; + v247 = hir.load_local : i32 #[local = lv1]; + v460 = arith.constant 12 : u32; + v248 = hir.bitcast v247 : u32; + v250 = arith.add v248, v460 : u32 #[overflow = checked]; + v459 = arith.constant 4 : u32; + v252 = arith.mod v250, v459 : u32; hir.assertz v252 #[code = 250]; - v253 = hir.int_to_ptr v250 : ptr; - v254 = hir.load v253 : i64; - v255 = hir.bitcast v236 : u32; - v487 = arith.constant 4 : u32; - v257 = arith.mod v255, v487 : u32; - hir.assertz v257 #[code = 250]; - v258 = hir.int_to_ptr v255 : ptr; - hir.store v258, v254; - v259 = arith.constant 12 : i32; - v260 = arith.add v236, v259 : i32 #[overflow = wrapping]; - v230 = arith.constant 0 : i32; - v458, v459, v460, v461, v462, v463 = scf.while v230, v236, v260, v228 : i32, i32, i32, i32, i32, i32 { - ^block50(v464: i32, v465: i32, v466: i32, v467: i32): - v486 = arith.constant 0 : i32; - v263 = arith.constant 8 : i32; - v264 = arith.eq v464, v263 : i1; - v265 = arith.zext v264 : u32; - v266 = hir.bitcast v265 : i32; - v268 = arith.neq v266, v486 : i1; - v452, v453 = scf.if v268 : i32, i32 { - ^block49: - v412 = ub.poison i32 : i32; - scf.yield v412, v412; - } else { - ^block28: - v270 = arith.add v465, v464 : i32 #[overflow = wrapping]; - v271 = hir.bitcast v270 : u32; - v485 = arith.constant 4 : u32; - v273 = arith.mod v271, v485 : u32; - hir.assertz v273 #[code = 250]; - v274 = hir.int_to_ptr v271 : ptr; - v275 = hir.load v274 : felt; - v277 = hir.bitcast v466 : u32; - v484 = arith.constant 4 : u32; - v279 = arith.mod v277, v484 : u32; - hir.assertz v279 #[code = 250]; - v280 = hir.int_to_ptr v277 : ptr; - v281 = hir.load v280 : i32; - v282 = hir.bitcast v270 : u32; - v483 = arith.constant 4 : u32; - v284 = arith.mod v282, v483 : u32; - hir.assertz v284 #[code = 250]; - v285 = hir.int_to_ptr v282 : ptr; - hir.store v285, v281; - v286 = hir.bitcast v466 : u32; - v482 = arith.constant 4 : u32; - v288 = arith.mod v286, v482 : u32; - hir.assertz v288 #[code = 250]; - v289 = hir.int_to_ptr v286 : ptr; - hir.store v289, v275; - v292 = arith.constant -4 : i32; - v293 = arith.add v466, v292 : i32 #[overflow = wrapping]; - v290 = arith.constant 4 : i32; - v291 = arith.add v464, v290 : i32 #[overflow = wrapping]; - scf.yield v291, v293; - }; - v480 = ub.poison i32 : i32; - v455 = cf.select v268, v480, v467 : i32; - v481 = ub.poison i32 : i32; - v454 = cf.select v268, v481, v465 : i32; - v411 = arith.constant 1 : u32; - v404 = arith.constant 0 : u32; - v457 = cf.select v268, v404, v411 : u32; - v445 = arith.trunc v457 : i1; - scf.condition v445, v452, v454, v453, v455, v465, v467; - } do { - ^block51(v468: i32, v469: i32, v470: i32, v471: i32, v472: i32, v473: i32): - scf.yield v468, v469, v470, v471; - }; + v253 = hir.int_to_ptr v250 : ptr; + v254 = hir.load v253 : felt; + v255 = hir.load_local : i32 #[local = lv1]; + v458 = arith.constant 8 : u32; + v256 = hir.bitcast v255 : u32; + v258 = arith.add v256, v458 : u32 #[overflow = checked]; + v483 = arith.constant 4 : u32; + v260 = arith.mod v258, v483 : u32; + hir.assertz v260 #[code = 250]; + v261 = hir.int_to_ptr v258 : ptr; + v262 = hir.load v261 : felt; + v263 = hir.load_local : i32 #[local = lv1]; + v482 = arith.constant 4 : u32; + v264 = hir.bitcast v263 : u32; + v266 = arith.add v264, v482 : u32 #[overflow = checked]; + v481 = arith.constant 4 : u32; + v268 = arith.mod v266, v481 : u32; + hir.assertz v268 #[code = 250]; + v269 = hir.int_to_ptr v266 : ptr; + v270 = hir.load v269 : felt; + v271 = hir.load_local : i32 #[local = lv1]; + v272 = hir.bitcast v271 : u32; + v480 = arith.constant 4 : u32; + v274 = arith.mod v272, v480 : u32; + hir.assertz v274 #[code = 250]; + v275 = hir.int_to_ptr v272 : ptr; + v276 = hir.load v275 : felt; + v277 = hir.load_local : i32 #[local = lv2]; + hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden::protocol::native_account::add_asset(v254, v262, v270, v276, v277) + v278 = hir.load_local : i32 #[local = lv0]; + v279 = hir.load_local : i32 #[local = lv2]; + v280 = hir.bitcast v279 : u32; v479 = arith.constant 8 : u32; - v295 = hir.bitcast v462 : u32; - v297 = arith.add v295, v479 : u32 #[overflow = checked]; - v478 = arith.constant 4 : u32; - v299 = arith.mod v297, v478 : u32; - hir.assertz v299 #[code = 250]; - v300 = hir.int_to_ptr v297 : ptr; - v301 = hir.load v300 : i64; + v282 = arith.mod v280, v479 : u32; + hir.assertz v282 #[code = 250]; + v283 = hir.int_to_ptr v280 : ptr; + v284 = hir.load v283 : i64; + v455, v456 = arith.split v284 : felt, felt; + v478 = arith.constant 8 : u32; + v288 = hir.bitcast v278 : u32; + v290 = arith.add v288, v478 : u32 #[overflow = checked]; v477 = arith.constant 8 : u32; - v302 = hir.bitcast v463 : u32; - v304 = arith.add v302, v477 : u32 #[overflow = checked]; + v292 = arith.mod v290, v477 : u32; + hir.assertz v292 #[code = 250]; + v457 = arith.join v456, v455 : i64; + v293 = hir.int_to_ptr v290 : ptr; + hir.store v293, v457; + v294 = hir.load_local : i32 #[local = lv0]; + v295 = hir.load_local : i32 #[local = lv2]; v476 = arith.constant 8 : u32; - v306 = arith.mod v304, v476 : u32; - hir.assertz v306 #[code = 250]; - v307 = hir.int_to_ptr v304 : ptr; - hir.store v307, v301; - v308 = hir.bitcast v462 : u32; - v475 = arith.constant 4 : u32; - v310 = arith.mod v308, v475 : u32; - hir.assertz v310 #[code = 250]; - v311 = hir.int_to_ptr v308 : ptr; - v312 = hir.load v311 : i64; - v313 = hir.bitcast v463 : u32; + v296 = hir.bitcast v295 : u32; + v298 = arith.add v296, v476 : u32 #[overflow = checked]; + v475 = arith.constant 8 : u32; + v300 = arith.mod v298, v475 : u32; + hir.assertz v300 #[code = 250]; + v301 = hir.int_to_ptr v298 : ptr; + v302 = hir.load v301 : i64; + v452, v453 = arith.split v302 : felt, felt; + v306 = hir.bitcast v294 : u32; v474 = arith.constant 8 : u32; - v315 = arith.mod v313, v474 : u32; - hir.assertz v315 #[code = 250]; - v316 = hir.int_to_ptr v313 : ptr; - hir.store v316, v312; + v308 = arith.mod v306, v474 : u32; + hir.assertz v308 #[code = 250]; + v454 = arith.join v453, v452 : i64; + v309 = hir.int_to_ptr v306 : ptr; + hir.store v309, v454; + v310 = hir.load_local : i32 #[local = lv2]; + v473 = arith.constant 16 : i32; + v312 = arith.add v310, v473 : i32 #[overflow = wrapping]; + v313 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr + v314 = hir.bitcast v313 : ptr; + hir.store v314, v312; builtin.ret ; }; - private builtin.function @miden::native_account::add_asset(v317: felt, v318: felt, v319: felt, v320: felt, v321: i32) { - ^block29(v317: felt, v318: felt, v319: felt, v320: felt, v321: i32): - v322, v323, v324, v325 = hir.exec @miden/native_account/add_asset(v317, v318, v319, v320) : felt, felt, felt, felt - v326 = hir.bitcast v321 : u32; - v327 = hir.int_to_ptr v326 : ptr; - hir.store v327, v322; - v328 = arith.constant 4 : u32; - v329 = arith.add v326, v328 : u32 #[overflow = checked]; - v330 = hir.int_to_ptr v329 : ptr; - hir.store v330, v323; - v331 = arith.constant 8 : u32; - v332 = arith.add v326, v331 : u32 #[overflow = checked]; - v333 = hir.int_to_ptr v332 : ptr; - hir.store v333, v324; - v334 = arith.constant 12 : u32; - v335 = arith.add v326, v334 : u32 #[overflow = checked]; - v336 = hir.int_to_ptr v335 : ptr; - hir.store v336, v325; + private builtin.function @miden::protocol::native_account::add_asset(v315: felt, v316: felt, v317: felt, v318: felt, v319: i32) { + ^block23(v315: felt, v316: felt, v317: felt, v318: felt, v319: i32): + v320, v321, v322, v323 = hir.exec @miden/protocol/native_account/add_asset(v315, v316, v317, v318) : felt, felt, felt, felt + v324 = hir.bitcast v319 : u32; + v325 = hir.int_to_ptr v324 : ptr; + hir.store v325, v320; + v486 = arith.constant 4 : u32; + v327 = arith.add v324, v486 : u32 #[overflow = checked]; + v328 = hir.int_to_ptr v327 : ptr; + hir.store v328, v321; + v485 = arith.constant 8 : u32; + v330 = arith.add v324, v485 : u32 #[overflow = checked]; + v331 = hir.int_to_ptr v330 : ptr; + hir.store v331, v322; + v484 = arith.constant 12 : u32; + v333 = arith.add v324, v484 : u32 #[overflow = checked]; + v334 = hir.int_to_ptr v333 : ptr; + hir.store v334, v323; builtin.ret ; }; - private builtin.function @miden::native_account::remove_asset(v337: felt, v338: felt, v339: felt, v340: felt, v341: i32) { - ^block33(v337: felt, v338: felt, v339: felt, v340: felt, v341: i32): - v342, v343, v344, v345 = hir.exec @miden/native_account/remove_asset(v337, v338, v339, v340) : felt, felt, felt, felt - v346 = hir.bitcast v341 : u32; - v347 = hir.int_to_ptr v346 : ptr; - hir.store v347, v342; - v348 = arith.constant 4 : u32; - v349 = arith.add v346, v348 : u32 #[overflow = checked]; - v350 = hir.int_to_ptr v349 : ptr; - hir.store v350, v343; - v351 = arith.constant 8 : u32; - v352 = arith.add v346, v351 : u32 #[overflow = checked]; - v353 = hir.int_to_ptr v352 : ptr; - hir.store v353, v344; - v354 = arith.constant 12 : u32; - v355 = arith.add v346, v354 : u32 #[overflow = checked]; - v356 = hir.int_to_ptr v355 : ptr; - hir.store v356, v345; + private builtin.function @miden::protocol::native_account::remove_asset(v335: felt, v336: felt, v337: felt, v338: felt, v339: i32) { + ^block28(v335: felt, v336: felt, v337: felt, v338: felt, v339: i32): + v340, v341, v342, v343 = hir.exec @miden/protocol/native_account/remove_asset(v335, v336, v337, v338) : felt, felt, felt, felt + v344 = hir.bitcast v339 : u32; + v345 = hir.int_to_ptr v344 : ptr; + hir.store v345, v340; + v489 = arith.constant 4 : u32; + v347 = arith.add v344, v489 : u32 #[overflow = checked]; + v348 = hir.int_to_ptr v347 : ptr; + hir.store v348, v341; + v488 = arith.constant 8 : u32; + v350 = arith.add v344, v488 : u32 #[overflow = checked]; + v351 = hir.int_to_ptr v350 : ptr; + hir.store v351, v342; + v487 = arith.constant 12 : u32; + v353 = arith.add v344, v487 : u32 #[overflow = checked]; + v354 = hir.int_to_ptr v353 : ptr; + hir.store v354, v343; builtin.ret ; }; - private builtin.function @miden::output_note::add_asset(v357: felt, v358: felt, v359: felt, v360: felt, v361: felt) { - ^block35(v357: felt, v358: felt, v359: felt, v360: felt, v361: felt): - hir.exec @miden/output_note/add_asset(v357, v358, v359, v360, v361) + private builtin.function @miden::protocol::output_note::add_asset(v355: felt, v356: felt, v357: felt, v358: felt, v359: felt) { + ^block30(v355: felt, v356: felt, v357: felt, v358: felt, v359: felt): + hir.exec @miden/protocol/output_note/add_asset(v355, v356, v357, v358, v359) builtin.ret ; }; @@ -491,15 +474,15 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { builtin.segment @1048576 = 0x0000000100000001; }; - public builtin.function @receive-asset(v362: felt, v363: felt, v364: felt, v365: felt) { - ^block38(v362: felt, v363: felt, v364: felt, v365: felt): - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden:basic-wallet/basic-wallet@0.1.0#receive-asset(v362, v363, v364, v365) + public builtin.function @receive-asset(v360: felt, v361: felt, v362: felt, v363: felt) { + ^block33(v360: felt, v361: felt, v362: felt, v363: felt): + hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden:basic-wallet/basic-wallet@0.1.0#receive-asset(v360, v361, v362, v363) builtin.ret ; }; - public builtin.function @move-asset-to-note(v366: felt, v367: felt, v368: felt, v369: felt, v370: felt) { - ^block40(v366: felt, v367: felt, v368: felt, v369: felt, v370: felt): - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note(v366, v367, v368, v369, v370) + public builtin.function @move-asset-to-note(v364: felt, v365: felt, v366: felt, v367: felt, v368: felt) { + ^block35(v364: felt, v365: felt, v366: felt, v367: felt, v368: felt): + hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note(v364, v365, v366, v367, v368) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/examples/basic_wallet.masm b/tests/integration/expected/examples/basic_wallet.masm index e97f30a45..90db09ee2 100644 --- a/tests/integration/expected/examples/basic_wallet.masm +++ b/tests/integration/expected/examples/basic_wallet.masm @@ -1,25 +1,25 @@ -# mod miden:basic-wallet/basic-wallet@0.1.0 +# mod ::"miden:basic-wallet/basic-wallet@0.1.0" @callconv("canon-lift") pub proc receive-asset(felt, felt, felt, felt) - exec.::miden:basic-wallet/basic-wallet@0.1.0::init + exec."miden:basic-wallet/basic-wallet@0.1.0"::init trace.240 nop - exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden:basic-wallet/basic-wallet@0.1.0#receive-asset + exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::"miden:basic-wallet/basic-wallet@0.1.0#receive-asset" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end @callconv("canon-lift") pub proc move-asset-to-note(felt, felt, felt, felt, felt) - exec.::miden:basic-wallet/basic-wallet@0.1.0::init + exec."miden:basic-wallet/basic-wallet@0.1.0"::init trace.240 nop - exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note + exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::"miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -32,7 +32,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -43,7 +43,7 @@ proc init mem_store.278537 end -# mod miden:basic-wallet/basic-wallet@0.1.0::basic_wallet +# mod ::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet @callconv("C") proc __wasm_call_ctors( @@ -59,6 +59,7 @@ proc basic_wallet::bindings::__link_custom_section_describing_imports( nop end +@locals("6") @callconv("C") proc miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note( felt, @@ -67,6 +68,46 @@ proc miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note( felt, felt ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -77,9 +118,16 @@ proc miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note( nop push.32 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.5 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -89,11 +137,27 @@ proc miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note( nop trace.240 nop - exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::wit_bindgen::rt::run_ctors_once + exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::wit_bindgen::rt::run_ctors_once + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt trace.252 nop push.12 - dup.1 + movup.2 add u32assert push.4 @@ -102,8 +166,6 @@ proc miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note( u32mod u32assert assertz - movup.5 - swap.1 u32divmod.4 swap.1 trace.240 @@ -111,8 +173,24 @@ proc miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note( exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.8 - dup.1 + movup.2 add u32assert push.4 @@ -121,8 +199,6 @@ proc miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note( u32mod u32assert assertz - movup.4 - swap.1 u32divmod.4 swap.1 trace.240 @@ -130,8 +206,24 @@ proc miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note( exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.4 - dup.1 + movup.2 add u32assert push.4 @@ -140,8 +232,6 @@ proc miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note( u32mod u32assert assertz - movup.3 - swap.1 u32divmod.4 swap.1 trace.240 @@ -149,15 +239,29 @@ proc miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note( exec.::intrinsics::mem::store_felt trace.252 nop - dup.0 + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.1 push.4 dup.1 swap.1 u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -165,24 +269,52 @@ proc miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note( exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 dup.1 u32wrapping_add - dup.1 + trace.240 + nop + exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::miden_base_sys::bindings::native_account::remove_asset + trace.252 + nop + locaddr.5 + push.0 swap.1 trace.240 nop - exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden_base_sys::bindings::native_account::remove_asset + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt trace.252 nop push.16 - dup.1 - u32wrapping_add movup.2 + u32wrapping_add + trace.240 + nop + exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::miden_base_sys::bindings::output_note::add_asset + trace.252 + nop + locaddr.5 + push.0 swap.1 trace.240 nop - exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden_base_sys::bindings::output_note::add_asset + exec.::intrinsics::mem::load_sw trace.252 nop push.32 @@ -197,8 +329,41 @@ proc miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note( nop end +@locals("5") @callconv("C") proc miden:basic-wallet/basic-wallet@0.1.0#receive-asset(felt, felt, felt, felt) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -209,9 +374,16 @@ proc miden:basic-wallet/basic-wallet@0.1.0#receive-asset(felt, felt, felt, felt) nop push.32 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.4 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -221,11 +393,27 @@ proc miden:basic-wallet/basic-wallet@0.1.0#receive-asset(felt, felt, felt, felt) nop trace.240 nop - exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::wit_bindgen::rt::run_ctors_once + exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::wit_bindgen::rt::run_ctors_once + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt trace.252 nop push.12 - dup.1 + movup.2 add u32assert push.4 @@ -234,8 +422,6 @@ proc miden:basic-wallet/basic-wallet@0.1.0#receive-asset(felt, felt, felt, felt) u32mod u32assert assertz - movup.5 - swap.1 u32divmod.4 swap.1 trace.240 @@ -243,8 +429,24 @@ proc miden:basic-wallet/basic-wallet@0.1.0#receive-asset(felt, felt, felt, felt) exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.8 - dup.1 + movup.2 add u32assert push.4 @@ -253,8 +455,6 @@ proc miden:basic-wallet/basic-wallet@0.1.0#receive-asset(felt, felt, felt, felt) u32mod u32assert assertz - movup.4 - swap.1 u32divmod.4 swap.1 trace.240 @@ -262,8 +462,24 @@ proc miden:basic-wallet/basic-wallet@0.1.0#receive-asset(felt, felt, felt, felt) exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.4 - dup.1 + movup.2 add u32assert push.4 @@ -272,8 +488,6 @@ proc miden:basic-wallet/basic-wallet@0.1.0#receive-asset(felt, felt, felt, felt) u32mod u32assert assertz - movup.3 - swap.1 u32divmod.4 swap.1 trace.240 @@ -281,15 +495,29 @@ proc miden:basic-wallet/basic-wallet@0.1.0#receive-asset(felt, felt, felt, felt) exec.::intrinsics::mem::store_felt trace.252 nop - dup.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.1 push.4 dup.1 swap.1 u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -297,14 +525,28 @@ proc miden:basic-wallet/basic-wallet@0.1.0#receive-asset(felt, felt, felt, felt) exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 dup.1 u32wrapping_add - dup.1 + trace.240 + nop + exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::miden_base_sys::bindings::native_account::add_asset + trace.252 + nop + locaddr.4 + push.0 swap.1 trace.240 nop - exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden_base_sys::bindings::native_account::add_asset + exec.::intrinsics::mem::load_sw trace.252 nop push.32 @@ -319,6 +561,7 @@ proc miden:basic-wallet/basic-wallet@0.1.0#receive-asset(felt, felt, felt, felt) nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -360,9 +603,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -393,13 +652,30 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("2") @callconv("C") proc miden_base_sys::bindings::output_note::add_asset( i32, felt ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.1 + swap.1 add u32assert push.4 @@ -415,8 +691,16 @@ proc miden_base_sys::bindings::output_note::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.2 + swap.1 add u32assert push.4 @@ -432,8 +716,16 @@ proc miden_base_sys::bindings::output_note::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.3 + swap.1 add u32assert push.4 @@ -449,7 +741,14 @@ proc miden_base_sys::bindings::output_note::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop - movup.3 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -467,16 +766,33 @@ proc miden_base_sys::bindings::output_note::add_asset( swap.2 trace.240 nop - exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden::output_note::add_asset + exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::"miden::protocol::output_note::add_asset" trace.252 nop end +@locals("3") @callconv("C") proc miden_base_sys::bindings::native_account::remove_asset( i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -485,11 +801,18 @@ proc miden_base_sys::bindings::native_account::remove_asset( exec.::intrinsics::mem::load_sw trace.252 nop - push.32 + push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.2 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -497,8 +820,16 @@ proc miden_base_sys::bindings::native_account::remove_asset( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.3 + swap.1 add u32assert push.4 @@ -514,8 +845,16 @@ proc miden_base_sys::bindings::native_account::remove_asset( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.4 + swap.1 add u32assert push.4 @@ -531,8 +870,16 @@ proc miden_base_sys::bindings::native_account::remove_asset( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.5 + swap.1 add u32assert push.4 @@ -545,39 +892,65 @@ proc miden_base_sys::bindings::native_account::remove_asset( swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + swap.3 + swap.1 + swap.4 + trace.240 + nop + exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::"miden::protocol::native_account::remove_asset" trace.252 nop - movup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::load_sw trace.252 nop - dup.4 - swap.1 - swap.3 + locaddr.2 + push.0 swap.1 - swap.4 trace.240 nop - exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden::native_account::remove_asset + exec.::intrinsics::mem::load_sw trace.252 nop push.8 dup.1 - add - u32assert - push.8 - dup.1 swap.1 u32mod u32assert @@ -590,8 +963,8 @@ proc miden_base_sys::bindings::native_account::remove_asset( trace.252 nop swap.1 - push.24 - dup.3 + push.8 + movup.3 add u32assert push.8 @@ -600,6 +973,8 @@ proc miden_base_sys::bindings::native_account::remove_asset( u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -609,7 +984,26 @@ proc miden_base_sys::bindings::native_account::remove_asset( exec.::intrinsics::mem::store_dw trace.252 nop - dup.0 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + swap.1 + add + u32assert push.8 dup.1 swap.1 @@ -624,16 +1018,15 @@ proc miden_base_sys::bindings::native_account::remove_asset( trace.252 nop swap.1 - push.16 - dup.3 - add - u32assert + movup.2 push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -643,16 +1036,15 @@ proc miden_base_sys::bindings::native_account::remove_asset( exec.::intrinsics::mem::store_dw trace.252 nop - push.16 - dup.1 - u32wrapping_add - movup.2 + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::::reverse + exec.::intrinsics::mem::load_sw trace.252 nop - push.32 + push.16 u32wrapping_add push.1114144 u32divmod.4 @@ -664,13 +1056,65 @@ proc miden_base_sys::bindings::native_account::remove_asset( nop end +@locals("3") @callconv("C") proc miden_base_sys::bindings::native_account::add_asset( i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + dup.0 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.2 + swap.1 add u32assert push.4 @@ -686,8 +1130,16 @@ proc miden_base_sys::bindings::native_account::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.3 + swap.1 add u32assert push.4 @@ -703,8 +1155,16 @@ proc miden_base_sys::bindings::native_account::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.4 + swap.1 add u32assert push.4 @@ -720,7 +1180,14 @@ proc miden_base_sys::bindings::native_account::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop - movup.4 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -734,34 +1201,39 @@ proc miden_base_sys::bindings::native_account::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop - movdn.3 - swap.2 + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden::native_account::add_asset + exec.::intrinsics::mem::load_sw trace.252 nop -end - -@callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 + swap.1 + swap.3 + swap.1 + swap.4 + trace.240 + nop + exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::"miden::protocol::native_account::add_asset" + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert push.8 dup.1 swap.1 @@ -777,15 +1249,17 @@ proc ::reverse( nop swap.1 push.8 - dup.3 + movup.3 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -795,167 +1269,27 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop push.8 - dup.1 + swap.1 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod @@ -969,16 +1303,15 @@ proc ::reverse( trace.252 nop swap.1 - push.8 - dup.4 - add - u32assert + movup.2 push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -988,43 +1321,31 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop - swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.16 + u32wrapping_add + push.1114144 u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop end @callconv("C") -proc miden::native_account::add_asset(felt, felt, felt, felt, i32) +proc miden::protocol::native_account::add_asset(felt, felt, felt, felt, i32) trace.240 nop - exec.::miden::native_account::add_asset + exec.::miden::protocol::native_account::add_asset trace.252 nop movup.4 @@ -1077,10 +1398,10 @@ proc miden::native_account::add_asset(felt, felt, felt, felt, i32) end @callconv("C") -proc miden::native_account::remove_asset(felt, felt, felt, felt, i32) +proc miden::protocol::native_account::remove_asset(felt, felt, felt, felt, i32) trace.240 nop - exec.::miden::native_account::remove_asset + exec.::miden::protocol::native_account::remove_asset trace.252 nop movup.4 @@ -1133,10 +1454,10 @@ proc miden::native_account::remove_asset(felt, felt, felt, felt, i32) end @callconv("C") -proc miden::output_note::add_asset(felt, felt, felt, felt, felt) +proc miden::protocol::output_note::add_asset(felt, felt, felt, felt, felt) trace.240 nop - exec.::miden::output_note::add_asset + exec.::miden::protocol::output_note::add_asset trace.252 nop end diff --git a/tests/integration/expected/examples/basic_wallet.wat b/tests/integration/expected/examples/basic_wallet.wat index 4969facfe..4779fec51 100644 --- a/tests/integration/expected/examples/basic_wallet.wat +++ b/tests/integration/expected/examples/basic_wallet.wat @@ -123,12 +123,12 @@ local.get 0 f32.load local.get 1 - call $miden::output_note::add_asset + call $miden::protocol::output_note::add_asset ) (func $miden_base_sys::bindings::native_account::remove_asset (;6;) (type 4) (param i32 i32) (local i32) global.get $__stack_pointer - i32.const 32 + i32.const 16 i32.sub local.tee 2 global.set $__stack_pointer @@ -141,26 +141,31 @@ local.get 1 f32.load local.get 2 - call $miden::native_account::remove_asset - local.get 2 - local.get 2 - i64.load offset=8 - i64.store offset=24 - local.get 2 + call $miden::protocol::native_account::remove_asset + local.get 0 local.get 2 i64.load - i64.store offset=16 + i64.const 32 + i64.rotl + i64.store offset=8 local.get 0 local.get 2 - i32.const 16 - i32.add - call $::reverse + i64.load offset=8 + i64.const 32 + i64.rotl + i64.store local.get 2 - i32.const 32 + i32.const 16 i32.add global.set $__stack_pointer ) (func $miden_base_sys::bindings::native_account::add_asset (;7;) (type 4) (param i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + global.set $__stack_pointer local.get 1 f32.load offset=12 local.get 1 @@ -169,78 +174,36 @@ f32.load offset=4 local.get 1 f32.load - local.get 0 - call $miden::native_account::add_asset - ) - (func $::reverse (;8;) (type 4) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end + call $miden::protocol::native_account::add_asset local.get 0 local.get 2 - i64.load offset=8 align=4 + i64.load + i64.const 32 + i64.rotl i64.store offset=8 local.get 0 local.get 2 - i64.load align=4 + i64.load offset=8 + i64.const 32 + i64.rotl i64.store + local.get 2 + i32.const 16 + i32.add + global.set $__stack_pointer ) - (func $miden::native_account::add_asset (;9;) (type 5) (param f32 f32 f32 f32 i32) + (func $miden::protocol::native_account::add_asset (;8;) (type 5) (param f32 f32 f32 f32 i32) unreachable ) - (func $miden::native_account::remove_asset (;10;) (type 5) (param f32 f32 f32 f32 i32) + (func $miden::protocol::native_account::remove_asset (;9;) (type 5) (param f32 f32 f32 f32 i32) unreachable ) - (func $miden::output_note::add_asset (;11;) (type 1) (param f32 f32 f32 f32 f32) + (func $miden::protocol::output_note::add_asset (;10;) (type 1) (param f32 f32 f32 f32 f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "\19basic_wallet\01\0b0.1.0\03\01\01\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "\19basic_wallet\01\0b0.1.0\03\01\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "asset" (type $asset (;1;))) (alias export $miden:base/core-types@1.0.0 "note-idx" (type $note-idx (;2;))) diff --git a/tests/integration/expected/examples/basic_wallet_tx_script.hir b/tests/integration/expected/examples/basic_wallet_tx_script.hir index 79297f75a..4064eb28d 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.hir +++ b/tests/integration/expected/examples/basic_wallet_tx_script.hir @@ -16,57 +16,66 @@ builtin.component miden:base/transaction-script@1.0.0 { v8 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr v9 = hir.bitcast v8 : ptr; v10 = hir.load v9 : i32; - v11 = arith.constant 1048616 : i32; - v12 = arith.add v10, v11 : i32 #[overflow = wrapping]; - v13 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc(v12, v6, v5) : i32 - builtin.ret v13; + v1049 = arith.constant 1048616 : i32; + v12 = arith.add v10, v1049 : i32 #[overflow = wrapping]; + v15 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc(v12, v6, v5) : i32 + builtin.ret v15; }; - private builtin.function @__rustc::__rust_dealloc(v14: i32, v15: i32, v16: i32) { - ^block12(v14: i32, v15: i32, v16: i32): + private builtin.function @__rustc::__rust_dealloc(v16: i32, v17: i32, v18: i32) { + ^block12(v16: i32, v17: i32, v18: i32): builtin.ret ; }; - private builtin.function @__rustc::__rust_alloc_zeroed(v17: i32, v18: i32) -> i32 { - ^block14(v17: i32, v18: i32): - v20 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v21 = hir.bitcast v20 : ptr; - v22 = hir.load v21 : i32; - v23 = arith.constant 1048616 : i32; - v24 = arith.add v22, v23 : i32 #[overflow = wrapping]; - v25 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc(v24, v18, v17) : i32 - v929 = arith.constant 0 : i32; - v26 = arith.constant 0 : i32; - v27 = arith.eq v25, v26 : i1; - v28 = arith.zext v27 : u32; - v29 = hir.bitcast v28 : i32; - v31 = arith.neq v29, v929 : i1; - scf.if v31{ - ^block16: + private builtin.function @__rustc::__rust_alloc_zeroed(v19: i32, v20: i32) -> i32 { + ^block14(v19: i32, v20: i32): + hir.store_local v19 #[local = lv0]; + hir.store_local v20 #[local = lv1]; + v22 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr + v23 = hir.bitcast v22 : ptr; + v24 = hir.load v23 : i32; + v27 = hir.load_local : i32 #[local = lv1]; + v28 = hir.load_local : i32 #[local = lv0]; + v1053 = arith.constant 1048616 : i32; + v26 = arith.add v24, v1053 : i32 #[overflow = wrapping]; + v29 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc(v26, v27, v28) : i32 + hir.store_local v29 #[local = lv1]; + v1061 = arith.constant 0 : i32; + v1056 = arith.constant 0 : i32; + v31 = arith.eq v29, v1056 : i1; + v32 = arith.zext v31 : u32; + v33 = hir.bitcast v32 : i32; + v35 = arith.neq v33, v1061 : i1; + scf.if v35{ + ^block122: scf.yield ; } else { ^block17: - v927 = arith.constant 0 : i32; - v928 = arith.constant 0 : i32; - v33 = arith.eq v17, v928 : i1; - v34 = arith.zext v33 : u32; - v35 = hir.bitcast v34 : i32; - v37 = arith.neq v35, v927 : i1; - scf.if v37{ - ^block128: + v36 = hir.load_local : i32 #[local = lv0]; + v1059 = arith.constant 0 : i32; + v1060 = arith.constant 0 : i32; + v38 = arith.eq v36, v1060 : i1; + v39 = arith.zext v38 : u32; + v40 = hir.bitcast v39 : i32; + v42 = arith.neq v40, v1059 : i1; + scf.if v42{ + ^block121: scf.yield ; } else { ^block18: - v921 = arith.constant 0 : u8; - v40 = hir.bitcast v17 : u32; - v41 = hir.bitcast v25 : u32; - v42 = hir.int_to_ptr v41 : ptr; - hir.mem_set v42, v40, v921; + v43 = hir.load_local : i32 #[local = lv1]; + v45 = hir.load_local : i32 #[local = lv0]; + v1051 = arith.constant 0 : u8; + v47 = hir.bitcast v45 : u32; + v48 = hir.bitcast v43 : u32; + v49 = hir.int_to_ptr v48 : ptr; + hir.mem_set v49, v47, v1051; scf.yield ; }; scf.yield ; }; - builtin.ret v25; + v50 = hir.load_local : i32 #[local = lv1]; + builtin.ret v50; }; private builtin.function @basic_wallet_tx_script::bindings::__link_custom_section_describing_imports() { @@ -74,50 +83,63 @@ builtin.component miden:base/transaction-script@1.0.0 { builtin.ret ; }; - private builtin.function @core::slice::index::slice_index_fail(v44: i32, v45: i32, v46: i32) { - ^block21(v44: i32, v45: i32, v46: i32): - v52 = arith.constant 0 : i32; - v48 = hir.bitcast v46 : u32; - v47 = hir.bitcast v44 : u32; - v49 = arith.gt v47, v48 : i1; - v50 = arith.zext v49 : u32; - v51 = hir.bitcast v50 : i32; - v53 = arith.neq v51, v52 : i1; - scf.if v53{ + private builtin.function @core::slice::index::slice_index_fail(v51: i32, v52: i32, v53: i32) { + ^block21(v51: i32, v52: i32, v53: i32): + hir.store_local v51 #[local = lv0]; + hir.store_local v52 #[local = lv1]; + hir.store_local v53 #[local = lv2]; + v54 = hir.load_local : i32 #[local = lv0]; + v55 = hir.load_local : i32 #[local = lv2]; + v1063 = arith.constant 0 : i32; + v57 = hir.bitcast v55 : u32; + v56 = hir.bitcast v54 : u32; + v58 = arith.gt v56, v57 : i1; + v59 = arith.zext v58 : u32; + v60 = hir.bitcast v59 : i32; + v62 = arith.neq v60, v1063 : i1; + scf.if v62{ ^block24: - v66 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v67 = hir.bitcast v66 : ptr; - v68 = hir.load v67 : i32; - v74 = arith.constant 1048600 : i32; - v70 = arith.add v68, v74 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::slice::index::slice_index_fail::do_panic::runtime(v44, v46, v70) + v79 = hir.load_local : i32 #[local = lv0]; + v80 = hir.load_local : i32 #[local = lv2]; + v81 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr + v82 = hir.bitcast v81 : ptr; + v83 = hir.load v82 : i32; + v1066 = arith.constant 1048600 : i32; + v85 = arith.add v83, v1066 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::slice::index::slice_index_fail::do_panic::runtime(v79, v80, v85) scf.yield ; } else { ^block25: - v933 = arith.constant 0 : i32; - v55 = hir.bitcast v46 : u32; - v54 = hir.bitcast v45 : u32; - v56 = arith.gt v54, v55 : i1; - v57 = arith.zext v56 : u32; - v58 = hir.bitcast v57 : i32; - v60 = arith.neq v58, v933 : i1; - scf.if v60{ + v63 = hir.load_local : i32 #[local = lv1]; + v64 = hir.load_local : i32 #[local = lv2]; + v1070 = arith.constant 0 : i32; + v66 = hir.bitcast v64 : u32; + v65 = hir.bitcast v63 : u32; + v67 = arith.gt v65, v66 : i1; + v68 = arith.zext v67 : u32; + v69 = hir.bitcast v68 : i32; + v71 = arith.neq v69, v1070 : i1; + scf.if v71{ ^block23: - v71 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v72 = hir.bitcast v71 : ptr; - v73 = hir.load v72 : i32; - v932 = arith.constant 1048600 : i32; - v75 = arith.add v73, v932 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::slice::index::slice_index_fail::do_panic::runtime(v45, v46, v75) + v86 = hir.load_local : i32 #[local = lv1]; + v87 = hir.load_local : i32 #[local = lv2]; + v88 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr + v89 = hir.bitcast v88 : ptr; + v90 = hir.load v89 : i32; + v1069 = arith.constant 1048600 : i32; + v92 = arith.add v90, v1069 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::slice::index::slice_index_fail::do_panic::runtime(v86, v87, v92) scf.yield ; } else { ^block26: - v61 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v62 = hir.bitcast v61 : ptr; - v63 = hir.load v62 : i32; - v931 = arith.constant 1048600 : i32; - v65 = arith.add v63, v931 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::slice::index::slice_index_fail::do_panic::runtime(v45, v46, v65) + v72 = hir.load_local : i32 #[local = lv1]; + v73 = hir.load_local : i32 #[local = lv2]; + v74 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr + v75 = hir.bitcast v74 : ptr; + v76 = hir.load v75 : i32; + v1068 = arith.constant 1048600 : i32; + v78 = arith.add v76, v1068 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::slice::index::slice_index_fail::do_panic::runtime(v72, v73, v78) scf.yield ; }; scf.yield ; @@ -125,411 +147,471 @@ builtin.component miden:base/transaction-script@1.0.0 { ub.unreachable ; }; - private builtin.function @ as core::ops::index::Index>>::index(v76: i32, v77: i32, v78: i32, v79: i32) { - ^block27(v76: i32, v77: i32, v78: i32, v79: i32): - v82 = arith.constant 8 : u32; - v81 = hir.bitcast v77 : u32; - v83 = arith.add v81, v82 : u32 #[overflow = checked]; - v84 = arith.constant 4 : u32; - v85 = arith.mod v83, v84 : u32; - hir.assertz v85 #[code = 250]; - v86 = hir.int_to_ptr v83 : ptr; - v87 = hir.load v86 : i32; - v80 = arith.constant 0 : i32; - v89 = hir.bitcast v87 : u32; - v88 = hir.bitcast v79 : u32; - v90 = arith.lte v88, v89 : i1; - v91 = arith.zext v90 : u32; - v92 = hir.bitcast v91 : i32; - v94 = arith.neq v92, v80 : i1; - cf.cond_br v94 ^block29, ^block30; + private builtin.function @ as core::ops::index::Index>>::index(v93: i32, v94: i32, v95: i32, v96: i32) { + ^block27(v93: i32, v94: i32, v95: i32, v96: i32): + hir.store_local v93 #[local = lv0]; + hir.store_local v94 #[local = lv1]; + hir.store_local v95 #[local = lv2]; + hir.store_local v96 #[local = lv3]; + v97 = hir.load_local : i32 #[local = lv3]; + v98 = hir.load_local : i32 #[local = lv1]; + v1075 = arith.constant 8 : u32; + v99 = hir.bitcast v98 : u32; + v101 = arith.add v99, v1075 : u32 #[overflow = checked]; + v1074 = arith.constant 4 : u32; + v103 = arith.mod v101, v1074 : u32; + hir.assertz v103 #[code = 250]; + v104 = hir.int_to_ptr v101 : ptr; + v105 = hir.load v104 : i32; + hir.store_local v105 #[local = lv4]; + v1073 = arith.constant 0 : i32; + v107 = hir.bitcast v105 : u32; + v106 = hir.bitcast v97 : u32; + v108 = arith.lte v106, v107 : i1; + v109 = arith.zext v108 : u32; + v110 = hir.bitcast v109 : i32; + v112 = arith.neq v110, v1073 : i1; + cf.cond_br v112 ^block29, ^block30; ^block29: - v940 = arith.constant 4 : u32; - v96 = hir.bitcast v76 : u32; - v98 = arith.add v96, v940 : u32 #[overflow = checked]; - v939 = arith.constant 4 : u32; - v100 = arith.mod v98, v939 : u32; - hir.assertz v100 #[code = 250]; - v95 = arith.sub v79, v78 : i32 #[overflow = wrapping]; - v101 = hir.int_to_ptr v98 : ptr; - hir.store v101, v95; - v938 = arith.constant 4 : u32; - v102 = hir.bitcast v77 : u32; - v104 = arith.add v102, v938 : u32 #[overflow = checked]; - v937 = arith.constant 4 : u32; - v106 = arith.mod v104, v937 : u32; - hir.assertz v106 #[code = 250]; - v107 = hir.int_to_ptr v104 : ptr; - v108 = hir.load v107 : i32; - v113 = hir.bitcast v76 : u32; - v936 = arith.constant 4 : u32; - v115 = arith.mod v113, v936 : u32; - hir.assertz v115 #[code = 250]; - v934 = arith.constant 2 : u32; - v111 = arith.shl v78, v934 : i32; - v112 = arith.add v108, v111 : i32 #[overflow = wrapping]; - v116 = hir.int_to_ptr v113 : ptr; - hir.store v116, v112; + v116 = hir.load_local : i32 #[local = lv0]; + v117 = hir.load_local : i32 #[local = lv3]; + v118 = hir.load_local : i32 #[local = lv2]; + v1086 = arith.constant 4 : u32; + v120 = hir.bitcast v116 : u32; + v122 = arith.add v120, v1086 : u32 #[overflow = checked]; + v1085 = arith.constant 4 : u32; + v124 = arith.mod v122, v1085 : u32; + hir.assertz v124 #[code = 250]; + v119 = arith.sub v117, v118 : i32 #[overflow = wrapping]; + v125 = hir.int_to_ptr v122 : ptr; + hir.store v125, v119; + v126 = hir.load_local : i32 #[local = lv0]; + v127 = hir.load_local : i32 #[local = lv1]; + v1084 = arith.constant 4 : u32; + v128 = hir.bitcast v127 : u32; + v130 = arith.add v128, v1084 : u32 #[overflow = checked]; + v1083 = arith.constant 4 : u32; + v132 = arith.mod v130, v1083 : u32; + hir.assertz v132 #[code = 250]; + v133 = hir.int_to_ptr v130 : ptr; + v134 = hir.load v133 : i32; + v135 = hir.load_local : i32 #[local = lv2]; + v140 = hir.bitcast v126 : u32; + v1082 = arith.constant 4 : u32; + v142 = arith.mod v140, v1082 : u32; + hir.assertz v142 #[code = 250]; + v1072 = arith.constant 2 : u32; + v138 = arith.shl v135, v1072 : i32; + v139 = arith.add v134, v138 : i32 #[overflow = wrapping]; + v143 = hir.int_to_ptr v140 : ptr; + hir.store v143, v139; builtin.ret ; ^block30: - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::slice::index::slice_index_fail(v78, v79, v87) + v113 = hir.load_local : i32 #[local = lv2]; + v114 = hir.load_local : i32 #[local = lv3]; + v115 = hir.load_local : i32 #[local = lv4]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::slice::index::slice_index_fail(v113, v114, v115) ub.unreachable ; }; - private builtin.function @miden:base/transaction-script@1.0.0#run(v117: felt, v118: felt, v119: felt, v120: felt) { - ^block31(v117: felt, v118: felt, v119: felt, v120: felt): - v125 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v126 = hir.bitcast v125 : ptr; - v127 = hir.load v126 : i32; - v128 = arith.constant 80 : i32; - v129 = arith.sub v127, v128 : i32 #[overflow = wrapping]; - v130 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v131 = hir.bitcast v130 : ptr; - hir.store v131, v129; + private builtin.function @miden:base/transaction-script@1.0.0#run(v144: felt, v145: felt, v146: felt, v147: felt) { + ^block31(v144: felt, v145: felt, v146: felt, v147: felt): + hir.store_local v144 #[local = lv0]; + hir.store_local v145 #[local = lv1]; + hir.store_local v146 #[local = lv2]; + hir.store_local v147 #[local = lv3]; + v148 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v149 = hir.bitcast v148 : ptr; + v150 = hir.load v149 : i32; + v1117 = arith.constant 80 : i32; + v152 = arith.sub v150, v1117 : i32 #[overflow = wrapping]; + hir.store_local v152 #[local = lv4]; + v153 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v154 = hir.bitcast v153 : ptr; + hir.store v154, v152; hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/wit_bindgen::rt::run_ctors_once() - v132 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::advice::adv_push_mapvaln(v120, v119, v118, v117) : felt - v133 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::as_u64(v132) : i64 - v135 = arith.constant 3 : i32; - v134 = arith.trunc v133 : i32; - v136 = arith.band v134, v135 : i32; - v137 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::from_u32(v136) : felt - v121 = arith.constant 0 : i32; - v139 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::from_u32(v121) : felt - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::assert_eq(v137, v139) - v142 = arith.constant 2 : i64; - v144 = hir.cast v142 : u32; - v143 = hir.bitcast v133 : u64; - v145 = arith.shr v143, v144 : u64; - v146 = hir.bitcast v145 : i64; - v147 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::from_u64_unchecked(v146) : felt - v148 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::as_u64(v147) : i64 - v942 = arith.constant 2 : u32; - v149 = arith.trunc v148 : i32; - v152 = arith.shl v149, v942 : i32; - v154 = arith.constant 4 : i32; - v1018 = arith.constant 0 : i32; - v140 = arith.constant 64 : i32; - v141 = arith.add v129, v140 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::try_allocate_in(v141, v152, v1018, v154, v154) - v157 = arith.constant 68 : u32; - v156 = hir.bitcast v129 : u32; - v158 = arith.add v156, v157 : u32 #[overflow = checked]; - v159 = arith.constant 4 : u32; - v160 = arith.mod v158, v159 : u32; - hir.assertz v160 #[code = 250]; - v161 = hir.int_to_ptr v158 : ptr; - v162 = hir.load v161 : i32; - v164 = arith.constant 64 : u32; - v163 = hir.bitcast v129 : u32; - v165 = arith.add v163, v164 : u32 #[overflow = checked]; - v1017 = arith.constant 4 : u32; - v167 = arith.mod v165, v1017 : u32; - hir.assertz v167 #[code = 250]; - v168 = hir.int_to_ptr v165 : ptr; - v169 = hir.load v168 : i32; - v1016 = arith.constant 0 : i32; - v170 = arith.constant 1 : i32; - v171 = arith.eq v169, v170 : i1; - v172 = arith.zext v171 : u32; - v173 = hir.bitcast v172 : i32; - v175 = arith.neq v173, v1016 : i1; - v947 = scf.if v175 : u32 { + v155 = hir.load_local : felt #[local = lv3]; + v156 = hir.load_local : felt #[local = lv2]; + v157 = hir.load_local : felt #[local = lv1]; + v158 = hir.load_local : felt #[local = lv0]; + v159 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::advice::adv_push_mapvaln(v155, v156, v157, v158) : felt + v160 = hir.cast v159 : i64; + v1091 = arith.constant 0 : felt; + v1116 = arith.constant 3 : i32; + v161 = arith.trunc v160 : i32; + v163 = arith.band v161, v1116 : i32; + v164 = hir.bitcast v163 : felt; + hir.assert_eq v164, v1091; + v167 = hir.load_local : i32 #[local = lv4]; + v1113 = arith.constant 2 : i64; + v173 = hir.cast v1113 : u32; + v172 = hir.bitcast v160 : u64; + v174 = arith.shr v172, v173 : u64; + v175 = hir.bitcast v174 : i64; + v176 = arith.trunc v175 : felt; + hir.store_local v176 #[local = lv6]; + v1090 = arith.constant 2 : u32; + v177 = hir.cast v176 : i64; + v178 = arith.trunc v177 : i32; + v181 = arith.shl v178, v1090 : i32; + hir.store_local v181 #[local = lv7]; + v1111 = arith.constant 4 : i32; + v1115 = arith.constant 0 : i32; + v1114 = arith.constant 64 : i32; + v169 = arith.add v167, v1114 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::try_allocate_in(v169, v181, v1115, v1111, v1111) + v185 = hir.load_local : i32 #[local = lv4]; + v1110 = arith.constant 68 : u32; + v186 = hir.bitcast v185 : u32; + v188 = arith.add v186, v1110 : u32 #[overflow = checked]; + v1109 = arith.constant 4 : u32; + v190 = arith.mod v188, v1109 : u32; + hir.assertz v190 #[code = 250]; + v191 = hir.int_to_ptr v188 : ptr; + v192 = hir.load v191 : i32; + hir.store_local v192 #[local = lv8]; + v193 = hir.load_local : i32 #[local = lv4]; + v1108 = arith.constant 64 : u32; + v194 = hir.bitcast v193 : u32; + v196 = arith.add v194, v1108 : u32 #[overflow = checked]; + v1238 = arith.constant 4 : u32; + v198 = arith.mod v196, v1238 : u32; + hir.assertz v198 #[code = 250]; + v199 = hir.int_to_ptr v196 : ptr; + v200 = hir.load v199 : i32; + v1237 = arith.constant 0 : i32; + v1107 = arith.constant 1 : i32; + v202 = arith.eq v200, v1107 : i1; + v203 = arith.zext v202 : u32; + v204 = hir.bitcast v203 : i32; + v206 = arith.neq v204, v1237 : i1; + v1174 = scf.if v206 : u32 { ^block34: - v387 = arith.constant 72 : u32; - v386 = hir.bitcast v129 : u32; - v388 = arith.add v386, v387 : u32 #[overflow = checked]; - v1015 = arith.constant 4 : u32; - v390 = arith.mod v388, v1015 : u32; - hir.assertz v390 #[code = 250]; - v391 = hir.int_to_ptr v388 : ptr; - v392 = hir.load v391 : i32; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::raw_vec::handle_error(v162, v392) - v943 = arith.constant 0 : u32; - scf.yield v943; + v447 = hir.load_local : i32 #[local = lv8]; + v448 = hir.load_local : i32 #[local = lv4]; + v1106 = arith.constant 72 : u32; + v449 = hir.bitcast v448 : u32; + v451 = arith.add v449, v1106 : u32 #[overflow = checked]; + v1236 = arith.constant 4 : u32; + v453 = arith.mod v451, v1236 : u32; + hir.assertz v453 #[code = 250]; + v454 = hir.int_to_ptr v451 : ptr; + v455 = hir.load v454 : i32; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::raw_vec::handle_error(v447, v455) + v1170 = arith.constant 0 : u32; + scf.yield v1170; } else { ^block35: - v1014 = arith.constant 72 : u32; - v176 = hir.bitcast v129 : u32; - v178 = arith.add v176, v1014 : u32 #[overflow = checked]; - v1013 = arith.constant 4 : u32; - v180 = arith.mod v178, v1013 : u32; - hir.assertz v180 #[code = 250]; - v181 = hir.int_to_ptr v178 : ptr; - v182 = hir.load v181 : i32; - v1012 = arith.constant 2 : u32; - v184 = hir.bitcast v182 : u32; - v186 = arith.shr v184, v1012 : u32; - v187 = hir.bitcast v186 : i32; - v188 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/std::mem::pipe_preimage_to_memory(v147, v187, v120, v119, v118, v117) : i32 - v190 = arith.constant 28 : u32; - v189 = hir.bitcast v129 : u32; - v191 = arith.add v189, v190 : u32 #[overflow = checked]; - v1011 = arith.constant 4 : u32; - v193 = arith.mod v191, v1011 : u32; - hir.assertz v193 #[code = 250]; - v194 = hir.int_to_ptr v191 : ptr; - hir.store v194, v152; - v196 = arith.constant 24 : u32; - v195 = hir.bitcast v129 : u32; - v197 = arith.add v195, v196 : u32 #[overflow = checked]; - v1010 = arith.constant 4 : u32; - v199 = arith.mod v197, v1010 : u32; - hir.assertz v199 #[code = 250]; - v200 = hir.int_to_ptr v197 : ptr; - hir.store v200, v182; - v202 = arith.constant 20 : u32; - v201 = hir.bitcast v129 : u32; - v203 = arith.add v201, v202 : u32 #[overflow = checked]; - v1009 = arith.constant 4 : u32; - v205 = arith.mod v203, v1009 : u32; - hir.assertz v205 #[code = 250]; - v206 = hir.int_to_ptr v203 : ptr; - hir.store v206, v162; - v1007 = arith.constant 0 : i32; - v1008 = arith.constant 0 : i32; - v208 = arith.eq v152, v1008 : i1; - v209 = arith.zext v208 : u32; - v210 = hir.bitcast v209 : i32; - v212 = arith.neq v210, v1007 : i1; - v949 = scf.if v212 : u32 { - ^block137: - v1006 = arith.constant 0 : u32; - scf.yield v1006; + v207 = hir.load_local : felt #[local = lv6]; + v208 = hir.load_local : i32 #[local = lv4]; + v1235 = arith.constant 72 : u32; + v209 = hir.bitcast v208 : u32; + v211 = arith.add v209, v1235 : u32 #[overflow = checked]; + v1234 = arith.constant 4 : u32; + v213 = arith.mod v211, v1234 : u32; + hir.assertz v213 #[code = 250]; + v214 = hir.int_to_ptr v211 : ptr; + v215 = hir.load v214 : i32; + hir.store_local v215 #[local = lv9]; + v221 = hir.load_local : felt #[local = lv3]; + v222 = hir.load_local : felt #[local = lv2]; + v223 = hir.load_local : felt #[local = lv1]; + v224 = hir.load_local : felt #[local = lv0]; + v1233 = arith.constant 2 : u32; + v217 = hir.bitcast v215 : u32; + v219 = arith.shr v217, v1233 : u32; + v220 = hir.bitcast v219 : i32; + v225 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden::core::mem::pipe_preimage_to_memory(v207, v220, v221, v222, v223, v224) : i32 + v226 = hir.load_local : i32 #[local = lv4]; + v227 = hir.load_local : i32 #[local = lv7]; + v1105 = arith.constant 28 : u32; + v228 = hir.bitcast v226 : u32; + v230 = arith.add v228, v1105 : u32 #[overflow = checked]; + v1232 = arith.constant 4 : u32; + v232 = arith.mod v230, v1232 : u32; + hir.assertz v232 #[code = 250]; + v233 = hir.int_to_ptr v230 : ptr; + hir.store v233, v227; + v234 = hir.load_local : i32 #[local = lv4]; + v235 = hir.load_local : i32 #[local = lv9]; + v1104 = arith.constant 24 : u32; + v236 = hir.bitcast v234 : u32; + v238 = arith.add v236, v1104 : u32 #[overflow = checked]; + v1231 = arith.constant 4 : u32; + v240 = arith.mod v238, v1231 : u32; + hir.assertz v240 #[code = 250]; + v241 = hir.int_to_ptr v238 : ptr; + hir.store v241, v235; + v242 = hir.load_local : i32 #[local = lv4]; + v243 = hir.load_local : i32 #[local = lv8]; + v1103 = arith.constant 20 : u32; + v244 = hir.bitcast v242 : u32; + v246 = arith.add v244, v1103 : u32 #[overflow = checked]; + v1230 = arith.constant 4 : u32; + v248 = arith.mod v246, v1230 : u32; + hir.assertz v248 #[code = 250]; + v249 = hir.int_to_ptr v246 : ptr; + hir.store v249, v243; + v250 = hir.load_local : i32 #[local = lv7]; + v1228 = arith.constant 0 : i32; + v1229 = arith.constant 0 : i32; + v252 = arith.eq v250, v1229 : i1; + v253 = arith.zext v252 : u32; + v254 = hir.bitcast v253 : i32; + v256 = arith.neq v254, v1228 : i1; + v1176 = scf.if v256 : u32 { + ^block131: + v1227 = arith.constant 0 : u32; + scf.yield v1227; } else { ^block36: - v214 = arith.constant 12 : u32; - v213 = hir.bitcast v182 : u32; - v215 = arith.add v213, v214 : u32 #[overflow = checked]; - v1005 = arith.constant 4 : u32; - v217 = arith.mod v215, v1005 : u32; - hir.assertz v217 #[code = 250]; - v218 = hir.int_to_ptr v215 : ptr; - v219 = hir.load v218 : felt; - v221 = arith.constant 8 : u32; - v220 = hir.bitcast v182 : u32; - v222 = arith.add v220, v221 : u32 #[overflow = checked]; - v1004 = arith.constant 4 : u32; - v224 = arith.mod v222, v1004 : u32; - hir.assertz v224 #[code = 250]; - v225 = hir.int_to_ptr v222 : ptr; - v226 = hir.load v225 : felt; - v1003 = arith.constant 4 : u32; - v227 = hir.bitcast v182 : u32; - v229 = arith.add v227, v1003 : u32 #[overflow = checked]; - v1002 = arith.constant 4 : u32; - v231 = arith.mod v229, v1002 : u32; - hir.assertz v231 #[code = 250]; - v232 = hir.int_to_ptr v229 : ptr; - v233 = hir.load v232 : felt; - v234 = hir.bitcast v182 : u32; - v1001 = arith.constant 4 : u32; - v236 = arith.mod v234, v1001 : u32; - hir.assertz v236 #[code = 250]; - v237 = hir.int_to_ptr v234 : ptr; - v238 = hir.load v237 : felt; - v999 = arith.constant 8 : i32; - v1000 = arith.constant 4 : i32; - v241 = arith.constant 20 : i32; - v242 = arith.add v129, v241 : i32 #[overflow = wrapping]; - v239 = arith.constant 8 : i32; - v240 = arith.add v129, v239 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::index::Index>>::index(v240, v242, v1000, v999) - v998 = arith.constant 12 : u32; - v245 = hir.bitcast v129 : u32; - v247 = arith.add v245, v998 : u32 #[overflow = checked]; - v997 = arith.constant 4 : u32; - v249 = arith.mod v247, v997 : u32; - hir.assertz v249 #[code = 250]; - v250 = hir.int_to_ptr v247 : ptr; - v251 = hir.load v250 : i32; - v995 = arith.constant 0 : i32; - v996 = arith.constant 4 : i32; - v253 = arith.neq v251, v996 : i1; - v254 = arith.zext v253 : u32; - v255 = hir.bitcast v254 : i32; - v257 = arith.neq v255, v995 : i1; - v951 = scf.if v257 : u32 { - ^block136: - v994 = arith.constant 0 : u32; - scf.yield v994; + v257 = hir.load_local : i32 #[local = lv9]; + v1226 = arith.constant 4 : u32; + v258 = hir.bitcast v257 : u32; + v260 = arith.add v258, v1226 : u32 #[overflow = checked]; + v1225 = arith.constant 4 : u32; + v262 = arith.mod v260, v1225 : u32; + hir.assertz v262 #[code = 250]; + v263 = hir.int_to_ptr v260 : ptr; + v264 = hir.load v263 : felt; + hir.store_local v264 #[local = lv0]; + v265 = hir.load_local : i32 #[local = lv9]; + v266 = hir.bitcast v265 : u32; + v1224 = arith.constant 4 : u32; + v268 = arith.mod v266, v1224 : u32; + hir.assertz v268 #[code = 250]; + v269 = hir.int_to_ptr v266 : ptr; + v270 = hir.load v269 : felt; + hir.store_local v270 #[local = lv1]; + v271 = hir.load_local : i32 #[local = lv4]; + v1100 = arith.constant 6 : i32; + v1112 = arith.constant 2 : i32; + v1101 = arith.constant 20 : i32; + v276 = arith.add v271, v1101 : i32 #[overflow = wrapping]; + v1102 = arith.constant 8 : i32; + v273 = arith.add v271, v1102 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::index::Index>>::index(v273, v276, v1112, v1100) + v279 = hir.load_local : i32 #[local = lv4]; + v1099 = arith.constant 12 : u32; + v280 = hir.bitcast v279 : u32; + v282 = arith.add v280, v1099 : u32 #[overflow = checked]; + v1223 = arith.constant 4 : u32; + v284 = arith.mod v282, v1223 : u32; + hir.assertz v284 #[code = 250]; + v285 = hir.int_to_ptr v282 : ptr; + v286 = hir.load v285 : i32; + v1221 = arith.constant 0 : i32; + v1222 = arith.constant 4 : i32; + v288 = arith.neq v286, v1222 : i1; + v289 = arith.zext v288 : u32; + v290 = hir.bitcast v289 : i32; + v292 = arith.neq v290, v1221 : i1; + v1178 = scf.if v292 : u32 { + ^block130: + v1220 = arith.constant 0 : u32; + scf.yield v1220; } else { ^block37: - v993 = arith.constant 8 : u32; - v262 = hir.bitcast v129 : u32; - v264 = arith.add v262, v993 : u32 #[overflow = checked]; - v992 = arith.constant 4 : u32; - v266 = arith.mod v264, v992 : u32; - hir.assertz v266 #[code = 250]; - v267 = hir.int_to_ptr v264 : ptr; - v268 = hir.load v267 : i32; - v991 = arith.constant 8 : i32; - v270 = arith.add v268, v991 : i32 #[overflow = wrapping]; - v271 = hir.bitcast v270 : u32; - v990 = arith.constant 4 : u32; - v273 = arith.mod v271, v990 : u32; - hir.assertz v273 #[code = 250]; - v274 = hir.int_to_ptr v271 : ptr; - v275 = hir.load v274 : i64; - v989 = arith.constant 8 : i32; - v258 = arith.constant 32 : i32; - v259 = arith.add v129, v258 : i32 #[overflow = wrapping]; - v261 = arith.add v259, v989 : i32 #[overflow = wrapping]; - v276 = hir.bitcast v261 : u32; - v988 = arith.constant 8 : u32; - v278 = arith.mod v276, v988 : u32; - hir.assertz v278 #[code = 250]; - v279 = hir.int_to_ptr v276 : ptr; - hir.store v279, v275; - v280 = hir.bitcast v268 : u32; - v987 = arith.constant 4 : u32; - v282 = arith.mod v280, v987 : u32; - hir.assertz v282 #[code = 250]; - v283 = hir.int_to_ptr v280 : ptr; - v284 = hir.load v283 : i64; - v286 = arith.constant 32 : u32; - v285 = hir.bitcast v129 : u32; - v287 = arith.add v285, v286 : u32 #[overflow = checked]; - v986 = arith.constant 8 : u32; - v289 = arith.mod v287, v986 : u32; - hir.assertz v289 #[code = 250]; - v290 = hir.int_to_ptr v287 : ptr; - hir.store v290, v284; - v984 = arith.constant 32 : i32; - v294 = arith.add v129, v984 : i32 #[overflow = wrapping]; - v985 = arith.constant 64 : i32; - v292 = arith.add v129, v985 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::from(v292, v294) - v983 = arith.constant 64 : i32; - v296 = arith.add v129, v983 : i32 #[overflow = wrapping]; - v297 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden_base_sys::bindings::output_note::create(v238, v233, v226, v219, v296) : felt - v301 = arith.constant 12 : i32; - v981 = arith.constant 8 : i32; - v982 = arith.constant 20 : i32; - v299 = arith.add v129, v982 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::index::Index>>::index(v129, v299, v981, v301) - v980 = arith.constant 4 : u32; - v302 = hir.bitcast v129 : u32; - v304 = arith.add v302, v980 : u32 #[overflow = checked]; - v979 = arith.constant 4 : u32; - v306 = arith.mod v304, v979 : u32; - hir.assertz v306 #[code = 250]; - v307 = hir.int_to_ptr v304 : ptr; - v308 = hir.load v307 : i32; - v977 = arith.constant 0 : i32; - v978 = arith.constant 4 : i32; - v310 = arith.neq v308, v978 : i1; - v311 = arith.zext v310 : u32; - v312 = hir.bitcast v311 : i32; - v314 = arith.neq v312, v977 : i1; - scf.if v314{ - ^block135: + v293 = hir.load_local : i32 #[local = lv4]; + v1097 = arith.constant 8 : u32; + v299 = hir.bitcast v293 : u32; + v301 = arith.add v299, v1097 : u32 #[overflow = checked]; + v1219 = arith.constant 4 : u32; + v303 = arith.mod v301, v1219 : u32; + hir.assertz v303 #[code = 250]; + v304 = hir.int_to_ptr v301 : ptr; + v305 = hir.load v304 : i32; + hir.store_local v305 #[local = lv9]; + v1218 = arith.constant 8 : i32; + v307 = arith.add v305, v1218 : i32 #[overflow = wrapping]; + v308 = hir.bitcast v307 : u32; + v1217 = arith.constant 4 : u32; + v310 = arith.mod v308, v1217 : u32; + hir.assertz v310 #[code = 250]; + v311 = hir.int_to_ptr v308 : ptr; + v312 = hir.load v311 : i64; + v1216 = arith.constant 8 : i32; + v1098 = arith.constant 32 : i32; + v295 = arith.add v293, v1098 : i32 #[overflow = wrapping]; + v297 = arith.add v295, v1216 : i32 #[overflow = wrapping]; + v313 = hir.bitcast v297 : u32; + v1215 = arith.constant 8 : u32; + v315 = arith.mod v313, v1215 : u32; + hir.assertz v315 #[code = 250]; + v316 = hir.int_to_ptr v313 : ptr; + hir.store v316, v312; + v317 = hir.load_local : i32 #[local = lv4]; + v318 = hir.load_local : i32 #[local = lv9]; + v319 = hir.bitcast v318 : u32; + v1214 = arith.constant 4 : u32; + v321 = arith.mod v319, v1214 : u32; + hir.assertz v321 #[code = 250]; + v322 = hir.int_to_ptr v319 : ptr; + v323 = hir.load v322 : i64; + v1096 = arith.constant 32 : u32; + v324 = hir.bitcast v317 : u32; + v326 = arith.add v324, v1096 : u32 #[overflow = checked]; + v1213 = arith.constant 8 : u32; + v328 = arith.mod v326, v1213 : u32; + hir.assertz v328 #[code = 250]; + v329 = hir.int_to_ptr v326 : ptr; + hir.store v329, v323; + v330 = hir.load_local : i32 #[local = lv4]; + v1211 = arith.constant 32 : i32; + v335 = arith.add v330, v1211 : i32 #[overflow = wrapping]; + v1212 = arith.constant 64 : i32; + v332 = arith.add v330, v1212 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::from(v332, v335) + v336 = hir.load_local : felt #[local = lv1]; + v337 = hir.load_local : felt #[local = lv0]; + v338 = hir.load_local : i32 #[local = lv4]; + v1210 = arith.constant 64 : i32; + v340 = arith.add v338, v1210 : i32 #[overflow = wrapping]; + v341 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden_base_sys::bindings::output_note::create(v336, v337, v340) : felt + hir.store_local v341 #[local = lv0]; + v342 = hir.load_local : i32 #[local = lv4]; + v1095 = arith.constant 10 : i32; + v1208 = arith.constant 6 : i32; + v1209 = arith.constant 20 : i32; + v345 = arith.add v342, v1209 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::index::Index>>::index(v342, v345, v1208, v1095) + v348 = hir.load_local : i32 #[local = lv4]; + v1207 = arith.constant 4 : u32; + v349 = hir.bitcast v348 : u32; + v351 = arith.add v349, v1207 : u32 #[overflow = checked]; + v1206 = arith.constant 4 : u32; + v353 = arith.mod v351, v1206 : u32; + hir.assertz v353 #[code = 250]; + v354 = hir.int_to_ptr v351 : ptr; + v355 = hir.load v354 : i32; + v1204 = arith.constant 0 : i32; + v1205 = arith.constant 4 : i32; + v357 = arith.neq v355, v1205 : i1; + v358 = arith.zext v357 : u32; + v359 = hir.bitcast v358 : i32; + v361 = arith.neq v359, v1204 : i1; + scf.if v361{ + ^block129: scf.yield ; } else { ^block38: - v319 = hir.bitcast v129 : u32; - v976 = arith.constant 4 : u32; - v321 = arith.mod v319, v976 : u32; - hir.assertz v321 #[code = 250]; - v322 = hir.int_to_ptr v319 : ptr; - v323 = hir.load v322 : i32; - v975 = arith.constant 8 : i32; - v325 = arith.add v323, v975 : i32 #[overflow = wrapping]; - v326 = hir.bitcast v325 : u32; - v974 = arith.constant 4 : u32; - v328 = arith.mod v326, v974 : u32; - hir.assertz v328 #[code = 250]; - v329 = hir.int_to_ptr v326 : ptr; - v330 = hir.load v329 : i64; - v973 = arith.constant 8 : i32; - v315 = arith.constant 48 : i32; - v316 = arith.add v129, v315 : i32 #[overflow = wrapping]; - v318 = arith.add v316, v973 : i32 #[overflow = wrapping]; - v331 = hir.bitcast v318 : u32; - v972 = arith.constant 8 : u32; - v333 = arith.mod v331, v972 : u32; - hir.assertz v333 #[code = 250]; - v334 = hir.int_to_ptr v331 : ptr; - hir.store v334, v330; - v335 = hir.bitcast v323 : u32; - v971 = arith.constant 4 : u32; - v337 = arith.mod v335, v971 : u32; - hir.assertz v337 #[code = 250]; - v338 = hir.int_to_ptr v335 : ptr; - v339 = hir.load v338 : i64; - v341 = arith.constant 48 : u32; - v340 = hir.bitcast v129 : u32; - v342 = arith.add v340, v341 : u32 #[overflow = checked]; - v970 = arith.constant 8 : u32; - v344 = arith.mod v342, v970 : u32; - hir.assertz v344 #[code = 250]; - v345 = hir.int_to_ptr v342 : ptr; - hir.store v345, v339; - v968 = arith.constant 48 : i32; - v349 = arith.add v129, v968 : i32 #[overflow = wrapping]; - v969 = arith.constant 64 : i32; - v347 = arith.add v129, v969 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::from(v347, v349) - v967 = arith.constant 64 : u32; - v350 = hir.bitcast v129 : u32; - v352 = arith.add v350, v967 : u32 #[overflow = checked]; - v966 = arith.constant 4 : u32; - v354 = arith.mod v352, v966 : u32; - hir.assertz v354 #[code = 250]; - v355 = hir.int_to_ptr v352 : ptr; - v356 = hir.load v355 : felt; - v965 = arith.constant 68 : u32; - v357 = hir.bitcast v129 : u32; - v359 = arith.add v357, v965 : u32 #[overflow = checked]; - v964 = arith.constant 4 : u32; - v361 = arith.mod v359, v964 : u32; - hir.assertz v361 #[code = 250]; - v362 = hir.int_to_ptr v359 : ptr; - v363 = hir.load v362 : felt; - v963 = arith.constant 72 : u32; - v364 = hir.bitcast v129 : u32; - v366 = arith.add v364, v963 : u32 #[overflow = checked]; - v962 = arith.constant 4 : u32; - v368 = arith.mod v366, v962 : u32; - hir.assertz v368 #[code = 250]; - v369 = hir.int_to_ptr v366 : ptr; - v370 = hir.load v369 : felt; - v372 = arith.constant 76 : u32; - v371 = hir.bitcast v129 : u32; - v373 = arith.add v371, v372 : u32 #[overflow = checked]; - v961 = arith.constant 4 : u32; - v375 = arith.mod v373, v961 : u32; - hir.assertz v375 #[code = 250]; - v376 = hir.int_to_ptr v373 : ptr; - v377 = hir.load v376 : felt; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_asset_to_note::wit_import9(v356, v363, v370, v377, v297) - v960 = arith.constant 20 : i32; - v379 = arith.add v129, v960 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::drop::Drop>::drop(v379) - v959 = arith.constant 20 : i32; - v381 = arith.add v129, v959 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::drop::Drop>::drop(v381) - v958 = arith.constant 80 : i32; - v383 = arith.add v129, v958 : i32 #[overflow = wrapping]; - v384 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v385 = hir.bitcast v384 : ptr; - hir.store v385, v383; + v362 = hir.load_local : i32 #[local = lv4]; + v368 = hir.bitcast v362 : u32; + v1203 = arith.constant 4 : u32; + v370 = arith.mod v368, v1203 : u32; + hir.assertz v370 #[code = 250]; + v371 = hir.int_to_ptr v368 : ptr; + v372 = hir.load v371 : i32; + hir.store_local v372 #[local = lv9]; + v1202 = arith.constant 8 : i32; + v374 = arith.add v372, v1202 : i32 #[overflow = wrapping]; + v375 = hir.bitcast v374 : u32; + v1201 = arith.constant 4 : u32; + v377 = arith.mod v375, v1201 : u32; + hir.assertz v377 #[code = 250]; + v378 = hir.int_to_ptr v375 : ptr; + v379 = hir.load v378 : i64; + v1200 = arith.constant 8 : i32; + v1094 = arith.constant 48 : i32; + v364 = arith.add v362, v1094 : i32 #[overflow = wrapping]; + v366 = arith.add v364, v1200 : i32 #[overflow = wrapping]; + v380 = hir.bitcast v366 : u32; + v1199 = arith.constant 8 : u32; + v382 = arith.mod v380, v1199 : u32; + hir.assertz v382 #[code = 250]; + v383 = hir.int_to_ptr v380 : ptr; + hir.store v383, v379; + v384 = hir.load_local : i32 #[local = lv4]; + v385 = hir.load_local : i32 #[local = lv9]; + v386 = hir.bitcast v385 : u32; + v1198 = arith.constant 4 : u32; + v388 = arith.mod v386, v1198 : u32; + hir.assertz v388 #[code = 250]; + v389 = hir.int_to_ptr v386 : ptr; + v390 = hir.load v389 : i64; + v1093 = arith.constant 48 : u32; + v391 = hir.bitcast v384 : u32; + v393 = arith.add v391, v1093 : u32 #[overflow = checked]; + v1197 = arith.constant 8 : u32; + v395 = arith.mod v393, v1197 : u32; + hir.assertz v395 #[code = 250]; + v396 = hir.int_to_ptr v393 : ptr; + hir.store v396, v390; + v397 = hir.load_local : i32 #[local = lv4]; + v1195 = arith.constant 48 : i32; + v402 = arith.add v397, v1195 : i32 #[overflow = wrapping]; + v1196 = arith.constant 64 : i32; + v399 = arith.add v397, v1196 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::from(v399, v402) + v403 = hir.load_local : i32 #[local = lv4]; + v1194 = arith.constant 64 : u32; + v404 = hir.bitcast v403 : u32; + v406 = arith.add v404, v1194 : u32 #[overflow = checked]; + v1193 = arith.constant 4 : u32; + v408 = arith.mod v406, v1193 : u32; + hir.assertz v408 #[code = 250]; + v409 = hir.int_to_ptr v406 : ptr; + v410 = hir.load v409 : felt; + v411 = hir.load_local : i32 #[local = lv4]; + v1192 = arith.constant 68 : u32; + v412 = hir.bitcast v411 : u32; + v414 = arith.add v412, v1192 : u32 #[overflow = checked]; + v1191 = arith.constant 4 : u32; + v416 = arith.mod v414, v1191 : u32; + hir.assertz v416 #[code = 250]; + v417 = hir.int_to_ptr v414 : ptr; + v418 = hir.load v417 : felt; + v419 = hir.load_local : i32 #[local = lv4]; + v1190 = arith.constant 72 : u32; + v420 = hir.bitcast v419 : u32; + v422 = arith.add v420, v1190 : u32 #[overflow = checked]; + v1189 = arith.constant 4 : u32; + v424 = arith.mod v422, v1189 : u32; + hir.assertz v424 #[code = 250]; + v425 = hir.int_to_ptr v422 : ptr; + v426 = hir.load v425 : felt; + v427 = hir.load_local : i32 #[local = lv4]; + v1092 = arith.constant 76 : u32; + v428 = hir.bitcast v427 : u32; + v430 = arith.add v428, v1092 : u32 #[overflow = checked]; + v1188 = arith.constant 4 : u32; + v432 = arith.mod v430, v1188 : u32; + hir.assertz v432 #[code = 250]; + v433 = hir.int_to_ptr v430 : ptr; + v434 = hir.load v433 : felt; + v435 = hir.load_local : felt #[local = lv0]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_asset_to_note::wit_import9(v410, v418, v426, v434, v435) + v436 = hir.load_local : i32 #[local = lv4]; + v1187 = arith.constant 20 : i32; + v438 = arith.add v436, v1187 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::drop::Drop>::drop(v438) + v439 = hir.load_local : i32 #[local = lv4]; + v1186 = arith.constant 20 : i32; + v441 = arith.add v439, v1186 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::drop::Drop>::drop(v441) + v442 = hir.load_local : i32 #[local = lv4]; + v1185 = arith.constant 80 : i32; + v444 = arith.add v442, v1185 : i32 #[overflow = wrapping]; + v445 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v446 = hir.bitcast v445 : ptr; + hir.store v446, v444; scf.yield ; }; - v945 = arith.constant 1 : u32; - v957 = arith.constant 0 : u32; - v955 = cf.select v314, v957, v945 : u32; - scf.yield v955; + v1172 = arith.constant 1 : u32; + v1184 = arith.constant 0 : u32; + v1182 = cf.select v361, v1184, v1172 : u32; + scf.yield v1182; }; - scf.yield v951; + scf.yield v1178; }; - scf.yield v949; + scf.yield v1176; }; - v956 = arith.constant 0 : u32; - v954 = arith.eq v947, v956 : i1; - cf.cond_br v954 ^block33, ^block139; + v1183 = arith.constant 0 : u32; + v1181 = arith.eq v1174, v1183 : i1; + cf.cond_br v1181 ^block33, ^block133; ^block33: ub.unreachable ; - ^block139: + ^block133: builtin.ret ; }; @@ -540,755 +622,866 @@ builtin.component miden:base/transaction-script@1.0.0 { private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block41: - v394 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v395 = hir.bitcast v394 : ptr; - v396 = hir.load v395 : i32; - v397 = arith.constant 1048620 : i32; - v398 = arith.add v396, v397 : i32 #[overflow = wrapping]; - v399 = hir.bitcast v398 : u32; - v400 = hir.int_to_ptr v399 : ptr; - v401 = hir.load v400 : u8; - v393 = arith.constant 0 : i32; - v402 = arith.zext v401 : u32; - v403 = hir.bitcast v402 : i32; - v405 = arith.neq v403, v393 : i1; - scf.if v405{ + v456 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr + v457 = hir.bitcast v456 : ptr; + v458 = hir.load v457 : i32; + v1243 = arith.constant 1048620 : i32; + v460 = arith.add v458, v1243 : i32 #[overflow = wrapping]; + v461 = hir.bitcast v460 : u32; + v462 = hir.int_to_ptr v461 : ptr; + v463 = hir.load v462 : u8; + v1242 = arith.constant 0 : i32; + v464 = arith.zext v463 : u32; + v465 = hir.bitcast v464 : i32; + v467 = arith.neq v465, v1242 : i1; + scf.if v467{ ^block43: scf.yield ; } else { ^block44: - v406 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v407 = hir.bitcast v406 : ptr; - v408 = hir.load v407 : i32; + v468 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr + v469 = hir.bitcast v468 : ptr; + v470 = hir.load v469 : i32; + hir.store_local v470 #[local = lv0]; hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__wasm_call_ctors() - v1020 = arith.constant 1 : u8; - v1022 = arith.constant 1048620 : i32; - v410 = arith.add v408, v1022 : i32 #[overflow = wrapping]; - v414 = hir.bitcast v410 : u32; - v415 = hir.int_to_ptr v414 : ptr; - hir.store v415, v1020; + v471 = hir.load_local : i32 #[local = lv0]; + v1241 = arith.constant 1 : u8; + v1246 = arith.constant 1048620 : i32; + v473 = arith.add v471, v1246 : i32 #[overflow = wrapping]; + v477 = hir.bitcast v473 : u32; + v478 = hir.int_to_ptr v477 : ptr; + hir.store v478, v1241; scf.yield ; }; builtin.ret ; }; - private builtin.function @::alloc(v416: i32, v417: i32, v418: i32) -> i32 { - ^block45(v416: i32, v417: i32, v418: i32): - v421 = arith.constant 16 : i32; - v420 = arith.constant 0 : i32; - v1024 = arith.constant 16 : u32; - v423 = hir.bitcast v417 : u32; - v425 = arith.gt v423, v1024 : i1; - v426 = arith.zext v425 : u32; - v427 = hir.bitcast v426 : i32; - v429 = arith.neq v427, v420 : i1; - v430 = cf.select v429, v417, v421 : i32; - v1064 = arith.constant 0 : i32; - v431 = arith.constant -1 : i32; - v432 = arith.add v430, v431 : i32 #[overflow = wrapping]; - v433 = arith.band v430, v432 : i32; - v435 = arith.neq v433, v1064 : i1; - v1033, v1034 = scf.if v435 : i32, u32 { - ^block147: - v1025 = arith.constant 0 : u32; - v1029 = ub.poison i32 : i32; - scf.yield v1029, v1025; + private builtin.function @::alloc(v479: i32, v480: i32, v481: i32) -> i32 { + ^block45(v479: i32, v480: i32, v481: i32): + hir.store_local v479 #[local = lv0]; + hir.store_local v480 #[local = lv1]; + hir.store_local v481 #[local = lv2]; + v483 = hir.load_local : i32 #[local = lv1]; + v1254 = arith.constant 16 : i32; + v1253 = arith.constant 0 : i32; + v1249 = arith.constant 16 : u32; + v487 = hir.bitcast v483 : u32; + v489 = arith.gt v487, v1249 : i1; + v490 = arith.zext v489 : u32; + v491 = hir.bitcast v490 : i32; + v493 = arith.neq v491, v1253 : i1; + v494 = cf.select v493, v483, v1254 : i32; + hir.store_local v494 #[local = lv3]; + v495 = hir.load_local : i32 #[local = lv3]; + v1297 = arith.constant 0 : i32; + v1252 = arith.constant -1 : i32; + v497 = arith.add v495, v1252 : i32 #[overflow = wrapping]; + v498 = arith.band v494, v497 : i32; + v500 = arith.neq v498, v1297 : i1; + v1275, v1276 = scf.if v500 : i32, u32 { + ^block142: + v1267 = arith.constant 0 : u32; + v1271 = ub.poison i32 : i32; + scf.yield v1271, v1267; } else { ^block48: - v437 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::max(v417, v430) : i32 - v1063 = arith.constant 0 : i32; - v436 = arith.constant -2147483648 : i32; - v438 = arith.sub v436, v437 : i32 #[overflow = wrapping]; - v440 = hir.bitcast v438 : u32; - v439 = hir.bitcast v418 : u32; - v441 = arith.gt v439, v440 : i1; - v442 = arith.zext v441 : u32; - v443 = hir.bitcast v442 : i32; - v445 = arith.neq v443, v1063 : i1; - v1048 = scf.if v445 : i32 { - ^block146: - v1062 = ub.poison i32 : i32; - scf.yield v1062; + v501 = hir.load_local : i32 #[local = lv2]; + v503 = hir.load_local : i32 #[local = lv1]; + v504 = hir.load_local : i32 #[local = lv3]; + v505 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::max(v503, v504) : i32 + hir.store_local v505 #[local = lv1]; + v1296 = arith.constant 0 : i32; + v1251 = arith.constant -2147483648 : i32; + v506 = arith.sub v1251, v505 : i32 #[overflow = wrapping]; + v508 = hir.bitcast v506 : u32; + v507 = hir.bitcast v501 : u32; + v509 = arith.gt v507, v508 : i1; + v510 = arith.zext v509 : u32; + v511 = hir.bitcast v510 : i32; + v513 = arith.neq v511, v1296 : i1; + v1281 = scf.if v513 : i32 { + ^block141: + v1295 = ub.poison i32 : i32; + scf.yield v1295; } else { ^block49: - v1060 = arith.constant 0 : i32; - v451 = arith.sub v1060, v437 : i32 #[overflow = wrapping]; - v1061 = arith.constant -1 : i32; - v447 = arith.add v418, v437 : i32 #[overflow = wrapping]; - v449 = arith.add v447, v1061 : i32 #[overflow = wrapping]; - v452 = arith.band v449, v451 : i32; - v453 = hir.bitcast v416 : u32; - v454 = arith.constant 4 : u32; - v455 = arith.mod v453, v454 : u32; - hir.assertz v455 #[code = 250]; - v456 = hir.int_to_ptr v453 : ptr; - v457 = hir.load v456 : i32; - v1059 = arith.constant 0 : i32; - v459 = arith.neq v457, v1059 : i1; - scf.if v459{ - ^block145: + v1294 = arith.constant 0 : i32; + hir.store_local v1294 #[local = lv3]; + v515 = hir.load_local : i32 #[local = lv2]; + v516 = hir.load_local : i32 #[local = lv1]; + v1292 = arith.constant 0 : i32; + v522 = arith.sub v1292, v516 : i32 #[overflow = wrapping]; + v1293 = arith.constant -1 : i32; + v517 = arith.add v515, v516 : i32 #[overflow = wrapping]; + v519 = arith.add v517, v1293 : i32 #[overflow = wrapping]; + v523 = arith.band v519, v522 : i32; + hir.store_local v523 #[local = lv2]; + v524 = hir.load_local : i32 #[local = lv0]; + v525 = hir.bitcast v524 : u32; + v1250 = arith.constant 4 : u32; + v527 = arith.mod v525, v1250 : u32; + hir.assertz v527 #[code = 250]; + v528 = hir.int_to_ptr v525 : ptr; + v529 = hir.load v528 : i32; + v1291 = arith.constant 0 : i32; + v531 = arith.neq v529, v1291 : i1; + scf.if v531{ + ^block140: scf.yield ; } else { ^block51: - v460 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::mem::heap_base() : i32 - v461 = hir.mem_size : u32; - v467 = hir.bitcast v416 : u32; - v1058 = arith.constant 4 : u32; - v469 = arith.mod v467, v1058 : u32; - hir.assertz v469 #[code = 250]; - v1057 = arith.constant 16 : u32; - v462 = hir.bitcast v461 : i32; - v465 = arith.shl v462, v1057 : i32; - v466 = arith.add v460, v465 : i32 #[overflow = wrapping]; - v470 = hir.int_to_ptr v467 : ptr; - hir.store v470, v466; + v532 = hir.load_local : i32 #[local = lv0]; + v533 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::mem::heap_base() : i32 + v534 = hir.mem_size : u32; + v540 = hir.bitcast v532 : u32; + v1290 = arith.constant 4 : u32; + v542 = arith.mod v540, v1290 : u32; + hir.assertz v542 #[code = 250]; + v1289 = arith.constant 16 : u32; + v535 = hir.bitcast v534 : i32; + v538 = arith.shl v535, v1289 : i32; + v539 = arith.add v533, v538 : i32 #[overflow = wrapping]; + v543 = hir.int_to_ptr v540 : ptr; + hir.store v543, v539; scf.yield ; }; - v473 = hir.bitcast v416 : u32; - v1056 = arith.constant 4 : u32; - v475 = arith.mod v473, v1056 : u32; - hir.assertz v475 #[code = 250]; - v476 = hir.int_to_ptr v473 : ptr; - v477 = hir.load v476 : i32; - v1054 = arith.constant 0 : i32; - v1055 = arith.constant -1 : i32; - v479 = arith.bxor v477, v1055 : i32; - v481 = hir.bitcast v479 : u32; - v480 = hir.bitcast v452 : u32; - v482 = arith.gt v480, v481 : i1; - v483 = arith.zext v482 : u32; - v484 = hir.bitcast v483 : i32; - v486 = arith.neq v484, v1054 : i1; - v1047 = scf.if v486 : i32 { - ^block52: - v1053 = arith.constant 0 : i32; - scf.yield v1053; + v544 = hir.load_local : i32 #[local = lv2]; + v545 = hir.load_local : i32 #[local = lv0]; + v546 = hir.bitcast v545 : u32; + v1288 = arith.constant 4 : u32; + v548 = arith.mod v546, v1288 : u32; + hir.assertz v548 #[code = 250]; + v549 = hir.int_to_ptr v546 : ptr; + v550 = hir.load v549 : i32; + hir.store_local v550 #[local = lv4]; + v1286 = arith.constant 0 : i32; + v1287 = arith.constant -1 : i32; + v552 = arith.bxor v550, v1287 : i32; + v554 = hir.bitcast v552 : u32; + v553 = hir.bitcast v544 : u32; + v555 = arith.gt v553, v554 : i1; + v556 = arith.zext v555 : u32; + v557 = hir.bitcast v556 : i32; + v559 = arith.neq v557, v1286 : i1; + scf.if v559{ + ^block139: + scf.yield ; } else { ^block53: - v488 = hir.bitcast v416 : u32; - v1052 = arith.constant 4 : u32; - v490 = arith.mod v488, v1052 : u32; - hir.assertz v490 #[code = 250]; - v487 = arith.add v477, v452 : i32 #[overflow = wrapping]; - v491 = hir.int_to_ptr v488 : ptr; - hir.store v491, v487; - v493 = arith.add v477, v437 : i32 #[overflow = wrapping]; - scf.yield v493; + v560 = hir.load_local : i32 #[local = lv0]; + v561 = hir.load_local : i32 #[local = lv4]; + v562 = hir.load_local : i32 #[local = lv2]; + v564 = hir.bitcast v560 : u32; + v1285 = arith.constant 4 : u32; + v566 = arith.mod v564, v1285 : u32; + hir.assertz v566 #[code = 250]; + v563 = arith.add v561, v562 : i32 #[overflow = wrapping]; + v567 = hir.int_to_ptr v564 : ptr; + hir.store v567, v563; + v568 = hir.load_local : i32 #[local = lv4]; + v569 = hir.load_local : i32 #[local = lv1]; + v570 = arith.add v568, v569 : i32 #[overflow = wrapping]; + hir.store_local v570 #[local = lv3]; + scf.yield ; }; - scf.yield v1047; + v571 = hir.load_local : i32 #[local = lv3]; + scf.yield v571; }; - v1030 = arith.constant 1 : u32; - v1051 = arith.constant 0 : u32; - v1049 = cf.select v445, v1051, v1030 : u32; - scf.yield v1048, v1049; + v1272 = arith.constant 1 : u32; + v1284 = arith.constant 0 : u32; + v1282 = cf.select v513, v1284, v1272 : u32; + scf.yield v1281, v1282; }; - v1050 = arith.constant 0 : u32; - v1046 = arith.eq v1034, v1050 : i1; - cf.cond_br v1046 ^block47, ^block149(v1033); + v1283 = arith.constant 0 : u32; + v1280 = arith.eq v1276, v1283 : i1; + cf.cond_br v1280 ^block47, ^block144(v1275); ^block47: ub.unreachable ; - ^block149(v1026: i32): - builtin.ret v1026; + ^block144(v1268: i32): + builtin.ret v1268; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { ^block54: - v496 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v496; + v572 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v572; }; - private builtin.function @ as core::ops::drop::Drop>::drop(v498: i32) { - ^block58(v498: i32): - v499 = arith.constant 4 : i32; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::deallocate(v498, v499, v499) + private builtin.function @ as core::ops::drop::Drop>::drop(v574: i32) { + ^block58(v574: i32): + v1298 = arith.constant 4 : i32; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::deallocate(v574, v1298, v1298) builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::output_note::create(v501: felt, v502: felt, v503: felt, v504: felt, v505: i32) -> felt { - ^block60(v501: felt, v502: felt, v503: felt, v504: felt, v505: i32): - v508 = arith.constant 12 : u32; - v507 = hir.bitcast v505 : u32; - v509 = arith.add v507, v508 : u32 #[overflow = checked]; - v510 = arith.constant 4 : u32; - v511 = arith.mod v509, v510 : u32; - hir.assertz v511 #[code = 250]; - v512 = hir.int_to_ptr v509 : ptr; - v513 = hir.load v512 : felt; - v515 = arith.constant 8 : u32; - v514 = hir.bitcast v505 : u32; - v516 = arith.add v514, v515 : u32 #[overflow = checked]; - v1068 = arith.constant 4 : u32; - v518 = arith.mod v516, v1068 : u32; - hir.assertz v518 #[code = 250]; - v519 = hir.int_to_ptr v516 : ptr; - v520 = hir.load v519 : felt; - v1067 = arith.constant 4 : u32; - v521 = hir.bitcast v505 : u32; - v523 = arith.add v521, v1067 : u32 #[overflow = checked]; - v1066 = arith.constant 4 : u32; - v525 = arith.mod v523, v1066 : u32; - hir.assertz v525 #[code = 250]; - v526 = hir.int_to_ptr v523 : ptr; - v527 = hir.load v526 : felt; - v528 = hir.bitcast v505 : u32; - v1065 = arith.constant 4 : u32; - v530 = arith.mod v528, v1065 : u32; - hir.assertz v530 #[code = 250]; - v531 = hir.int_to_ptr v528 : ptr; - v532 = hir.load v531 : felt; - v533 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden::output_note::create(v501, v502, v503, v504, v513, v520, v527, v532) : felt - builtin.ret v533; + private builtin.function @miden_base_sys::bindings::output_note::create(v578: felt, v579: felt, v580: i32) -> felt { + ^block60(v578: felt, v579: felt, v580: i32): + hir.store_local v580 #[local = lv2]; + v584 = hir.load_local : i32 #[local = lv2]; + v1301 = arith.constant 12 : u32; + v585 = hir.bitcast v584 : u32; + v587 = arith.add v585, v1301 : u32 #[overflow = checked]; + v1300 = arith.constant 4 : u32; + v589 = arith.mod v587, v1300 : u32; + hir.assertz v589 #[code = 250]; + v590 = hir.int_to_ptr v587 : ptr; + v591 = hir.load v590 : felt; + v592 = hir.load_local : i32 #[local = lv2]; + v1299 = arith.constant 8 : u32; + v593 = hir.bitcast v592 : u32; + v595 = arith.add v593, v1299 : u32 #[overflow = checked]; + v1309 = arith.constant 4 : u32; + v597 = arith.mod v595, v1309 : u32; + hir.assertz v597 #[code = 250]; + v598 = hir.int_to_ptr v595 : ptr; + v599 = hir.load v598 : felt; + v600 = hir.load_local : i32 #[local = lv2]; + v1308 = arith.constant 4 : u32; + v601 = hir.bitcast v600 : u32; + v603 = arith.add v601, v1308 : u32 #[overflow = checked]; + v1307 = arith.constant 4 : u32; + v605 = arith.mod v603, v1307 : u32; + hir.assertz v605 #[code = 250]; + v606 = hir.int_to_ptr v603 : ptr; + v607 = hir.load v606 : felt; + v608 = hir.load_local : i32 #[local = lv2]; + v609 = hir.bitcast v608 : u32; + v1306 = arith.constant 4 : u32; + v611 = arith.mod v609, v1306 : u32; + hir.assertz v611 #[code = 250]; + v612 = hir.int_to_ptr v609 : ptr; + v613 = hir.load v612 : felt; + v614 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden::protocol::output_note::create(v578, v579, v591, v599, v607, v613) : felt + builtin.ret v614; }; - private builtin.function @>::from(v534: i32, v535: i32) { - ^block62(v534: i32, v535: i32): - v537 = arith.constant 8 : u32; - v536 = hir.bitcast v535 : u32; - v538 = arith.add v536, v537 : u32 #[overflow = checked]; - v539 = arith.constant 4 : u32; - v540 = arith.mod v538, v539 : u32; - hir.assertz v540 #[code = 250]; - v541 = hir.int_to_ptr v538 : ptr; - v542 = hir.load v541 : i64; - v1072 = arith.constant 8 : u32; - v543 = hir.bitcast v534 : u32; - v545 = arith.add v543, v1072 : u32 #[overflow = checked]; - v1071 = arith.constant 8 : u32; - v547 = arith.mod v545, v1071 : u32; - hir.assertz v547 #[code = 250]; - v548 = hir.int_to_ptr v545 : ptr; - hir.store v548, v542; - v549 = hir.bitcast v535 : u32; - v1070 = arith.constant 4 : u32; - v551 = arith.mod v549, v1070 : u32; - hir.assertz v551 #[code = 250]; - v552 = hir.int_to_ptr v549 : ptr; - v553 = hir.load v552 : i64; - v554 = hir.bitcast v534 : u32; - v1069 = arith.constant 8 : u32; - v556 = arith.mod v554, v1069 : u32; - hir.assertz v556 #[code = 250]; - v557 = hir.int_to_ptr v554 : ptr; - hir.store v557, v553; + private builtin.function @>::from(v615: i32, v616: i32) { + ^block62(v615: i32, v616: i32): + hir.store_local v615 #[local = lv0]; + hir.store_local v616 #[local = lv1]; + v617 = hir.load_local : i32 #[local = lv0]; + v618 = hir.load_local : i32 #[local = lv1]; + v1311 = arith.constant 8 : u32; + v619 = hir.bitcast v618 : u32; + v621 = arith.add v619, v1311 : u32 #[overflow = checked]; + v1310 = arith.constant 4 : u32; + v623 = arith.mod v621, v1310 : u32; + hir.assertz v623 #[code = 250]; + v624 = hir.int_to_ptr v621 : ptr; + v625 = hir.load v624 : i64; + v1319 = arith.constant 8 : u32; + v626 = hir.bitcast v617 : u32; + v628 = arith.add v626, v1319 : u32 #[overflow = checked]; + v1318 = arith.constant 8 : u32; + v630 = arith.mod v628, v1318 : u32; + hir.assertz v630 #[code = 250]; + v631 = hir.int_to_ptr v628 : ptr; + hir.store v631, v625; + v632 = hir.load_local : i32 #[local = lv0]; + v633 = hir.load_local : i32 #[local = lv1]; + v634 = hir.bitcast v633 : u32; + v1317 = arith.constant 4 : u32; + v636 = arith.mod v634, v1317 : u32; + hir.assertz v636 #[code = 250]; + v637 = hir.int_to_ptr v634 : ptr; + v638 = hir.load v637 : i64; + v639 = hir.bitcast v632 : u32; + v1316 = arith.constant 8 : u32; + v641 = arith.mod v639, v1316 : u32; + hir.assertz v641 #[code = 250]; + v642 = hir.int_to_ptr v639 : ptr; + hir.store v642, v638; builtin.ret ; }; - private builtin.function @ as core::ops::drop::Drop>::drop(v558: i32) { - ^block64(v558: i32): + private builtin.function @ as core::ops::drop::Drop>::drop(v643: i32) { + ^block64(v643: i32): builtin.ret ; }; - private builtin.function @intrinsics::advice::adv_push_mapvaln(v559: felt, v560: felt, v561: felt, v562: felt) -> felt { - ^block66(v559: felt, v560: felt, v561: felt, v562: felt): - v563 = hir.exec @intrinsics/advice/adv_push_mapvaln(v559, v560, v561, v562) : felt - builtin.ret v563; - }; - - private builtin.function @intrinsics::felt::as_u64(v565: felt) -> i64 { - ^block69(v565: felt): - v566 = hir.cast v565 : i64; - builtin.ret v566; - }; - - private builtin.function @intrinsics::felt::assert_eq(v568: felt, v569: felt) { - ^block71(v568: felt, v569: felt): - hir.assert_eq v568, v569; - builtin.ret ; + private builtin.function @intrinsics::advice::adv_push_mapvaln(v644: felt, v645: felt, v646: felt, v647: felt) -> felt { + ^block66(v644: felt, v645: felt, v646: felt, v647: felt): + v648 = hir.exec @intrinsics/advice/adv_push_mapvaln(v644, v645, v646, v647) : felt + builtin.ret v648; }; - private builtin.function @intrinsics::felt::from_u32(v570: i32) -> felt { - ^block73(v570: i32): - v571 = hir.bitcast v570 : felt; - builtin.ret v571; + private builtin.function @miden::core::mem::pipe_preimage_to_memory(v650: felt, v651: i32, v652: felt, v653: felt, v654: felt, v655: felt) -> i32 { + ^block69(v650: felt, v651: i32, v652: felt, v653: felt, v654: felt, v655: felt): + v656 = hir.exec @miden/core/mem/pipe_preimage_to_memory(v650, v651, v652, v653, v654, v655) : i32 + builtin.ret v656; }; - private builtin.function @intrinsics::felt::from_u64_unchecked(v573: i64) -> felt { - ^block75(v573: i64): - v574 = hir.cast v573 : felt; - builtin.ret v574; - }; - - private builtin.function @std::mem::pipe_preimage_to_memory(v576: felt, v577: i32, v578: felt, v579: felt, v580: felt, v581: felt) -> i32 { - ^block77(v576: felt, v577: i32, v578: felt, v579: felt, v580: felt, v581: felt): - v582 = hir.exec @std/mem/pipe_preimage_to_memory(v576, v577, v578, v579, v580, v581) : i32 - builtin.ret v582; - }; - - private builtin.function @::alloc_impl(v584: i32, v585: i32, v586: i32, v587: i32) { - ^block81(v584: i32, v585: i32, v586: i32, v587: i32): - v1088 = arith.constant 0 : i32; - v588 = arith.constant 0 : i32; - v589 = arith.eq v586, v588 : i1; - v590 = arith.zext v589 : u32; - v591 = hir.bitcast v590 : i32; - v593 = arith.neq v591, v1088 : i1; - v1084 = scf.if v593 : i32 { - ^block153: - scf.yield v585; + private builtin.function @::alloc_impl(v658: i32, v659: i32, v660: i32, v661: i32) { + ^block74(v658: i32, v659: i32, v660: i32, v661: i32): + hir.store_local v658 #[local = lv0]; + hir.store_local v659 #[local = lv1]; + hir.store_local v660 #[local = lv2]; + hir.store_local v661 #[local = lv3]; + v662 = hir.load_local : i32 #[local = lv2]; + v1330 = arith.constant 0 : i32; + v1325 = arith.constant 0 : i32; + v664 = arith.eq v662, v1325 : i1; + v665 = arith.zext v664 : u32; + v666 = hir.bitcast v665 : i32; + v668 = arith.neq v666, v1330 : i1; + scf.if v668{ + ^block147: + scf.yield ; } else { - ^block84: + ^block77: hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v1087 = arith.constant 0 : i32; - v595 = arith.neq v587, v1087 : i1; - v1083 = scf.if v595 : i32 { - ^block85: - v597 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_alloc_zeroed(v586, v585) : i32 - scf.yield v597; + v669 = hir.load_local : i32 #[local = lv3]; + v1329 = arith.constant 0 : i32; + v671 = arith.neq v669, v1329 : i1; + scf.if v671{ + ^block78: + v675 = hir.load_local : i32 #[local = lv2]; + v676 = hir.load_local : i32 #[local = lv1]; + v677 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_alloc_zeroed(v675, v676) : i32 + hir.store_local v677 #[local = lv1]; + scf.yield ; } else { - ^block86: - v596 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_alloc(v586, v585) : i32 - scf.yield v596; + ^block79: + v672 = hir.load_local : i32 #[local = lv2]; + v673 = hir.load_local : i32 #[local = lv1]; + v674 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_alloc(v672, v673) : i32 + hir.store_local v674 #[local = lv1]; + scf.yield ; }; - scf.yield v1083; + scf.yield ; }; - v601 = arith.constant 4 : u32; - v600 = hir.bitcast v584 : u32; - v602 = arith.add v600, v601 : u32 #[overflow = checked]; - v1086 = arith.constant 4 : u32; - v604 = arith.mod v602, v1086 : u32; - hir.assertz v604 #[code = 250]; - v605 = hir.int_to_ptr v602 : ptr; - hir.store v605, v586; - v607 = hir.bitcast v584 : u32; - v1085 = arith.constant 4 : u32; - v609 = arith.mod v607, v1085 : u32; - hir.assertz v609 #[code = 250]; - v610 = hir.int_to_ptr v607 : ptr; - hir.store v610, v1084; + v678 = hir.load_local : i32 #[local = lv0]; + v679 = hir.load_local : i32 #[local = lv2]; + v1320 = arith.constant 4 : u32; + v680 = hir.bitcast v678 : u32; + v682 = arith.add v680, v1320 : u32 #[overflow = checked]; + v1328 = arith.constant 4 : u32; + v684 = arith.mod v682, v1328 : u32; + hir.assertz v684 #[code = 250]; + v685 = hir.int_to_ptr v682 : ptr; + hir.store v685, v679; + v686 = hir.load_local : i32 #[local = lv0]; + v687 = hir.load_local : i32 #[local = lv1]; + v688 = hir.bitcast v686 : u32; + v1327 = arith.constant 4 : u32; + v690 = arith.mod v688, v1327 : u32; + hir.assertz v690 #[code = 250]; + v691 = hir.int_to_ptr v688 : ptr; + hir.store v691, v687; builtin.ret ; }; - private builtin.function @::deallocate(v611: i32, v612: i32, v613: i32) { - ^block87(v611: i32, v612: i32, v613: i32): - v615 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v616 = hir.bitcast v615 : ptr; - v617 = hir.load v616 : i32; - v618 = arith.constant 16 : i32; - v619 = arith.sub v617, v618 : i32 #[overflow = wrapping]; - v620 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v621 = hir.bitcast v620 : ptr; - hir.store v621, v619; - v622 = arith.constant 4 : i32; - v623 = arith.add v619, v622 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::current_memory(v623, v611, v612, v613) - v625 = arith.constant 8 : u32; - v624 = hir.bitcast v619 : u32; - v626 = arith.add v624, v625 : u32 #[overflow = checked]; - v627 = arith.constant 4 : u32; - v628 = arith.mod v626, v627 : u32; - hir.assertz v628 #[code = 250]; - v629 = hir.int_to_ptr v626 : ptr; - v630 = hir.load v629 : i32; - v1095 = arith.constant 0 : i32; - v614 = arith.constant 0 : i32; - v632 = arith.eq v630, v614 : i1; - v633 = arith.zext v632 : u32; - v634 = hir.bitcast v633 : i32; - v636 = arith.neq v634, v1095 : i1; - scf.if v636{ - ^block156: + private builtin.function @::deallocate(v692: i32, v693: i32, v694: i32) { + ^block80(v692: i32, v693: i32, v694: i32): + hir.store_local v694 #[local = lv2]; + v695 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v696 = hir.bitcast v695 : ptr; + v697 = hir.load v696 : i32; + v1336 = arith.constant 16 : i32; + v699 = arith.sub v697, v1336 : i32 #[overflow = wrapping]; + hir.store_local v699 #[local = lv3]; + v700 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v701 = hir.bitcast v700 : ptr; + hir.store v701, v699; + v702 = hir.load_local : i32 #[local = lv3]; + v707 = hir.load_local : i32 #[local = lv2]; + v1335 = arith.constant 4 : i32; + v704 = arith.add v702, v1335 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::current_memory(v704, v692, v693, v707) + v708 = hir.load_local : i32 #[local = lv3]; + v1334 = arith.constant 8 : u32; + v709 = hir.bitcast v708 : u32; + v711 = arith.add v709, v1334 : u32 #[overflow = checked]; + v1333 = arith.constant 4 : u32; + v713 = arith.mod v711, v1333 : u32; + hir.assertz v713 #[code = 250]; + v714 = hir.int_to_ptr v711 : ptr; + v715 = hir.load v714 : i32; + hir.store_local v715 #[local = lv2]; + v1347 = arith.constant 0 : i32; + v1341 = arith.constant 0 : i32; + v717 = arith.eq v715, v1341 : i1; + v718 = arith.zext v717 : u32; + v719 = hir.bitcast v718 : i32; + v721 = arith.neq v719, v1347 : i1; + scf.if v721{ + ^block150: scf.yield ; } else { - ^block90: - v1094 = arith.constant 4 : u32; - v637 = hir.bitcast v619 : u32; - v639 = arith.add v637, v1094 : u32 #[overflow = checked]; - v1093 = arith.constant 4 : u32; - v641 = arith.mod v639, v1093 : u32; - hir.assertz v641 #[code = 250]; - v642 = hir.int_to_ptr v639 : ptr; - v643 = hir.load v642 : i32; - v645 = arith.constant 12 : u32; - v644 = hir.bitcast v619 : u32; - v646 = arith.add v644, v645 : u32 #[overflow = checked]; - v1092 = arith.constant 4 : u32; - v648 = arith.mod v646, v1092 : u32; - hir.assertz v648 #[code = 250]; - v649 = hir.int_to_ptr v646 : ptr; - v650 = hir.load v649 : i32; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::deallocate(v643, v630, v650) + ^block83: + v722 = hir.load_local : i32 #[local = lv3]; + v1346 = arith.constant 4 : u32; + v723 = hir.bitcast v722 : u32; + v725 = arith.add v723, v1346 : u32 #[overflow = checked]; + v1345 = arith.constant 4 : u32; + v727 = arith.mod v725, v1345 : u32; + hir.assertz v727 #[code = 250]; + v728 = hir.int_to_ptr v725 : ptr; + v729 = hir.load v728 : i32; + v730 = hir.load_local : i32 #[local = lv2]; + v731 = hir.load_local : i32 #[local = lv3]; + v1331 = arith.constant 12 : u32; + v732 = hir.bitcast v731 : u32; + v734 = arith.add v732, v1331 : u32 #[overflow = checked]; + v1344 = arith.constant 4 : u32; + v736 = arith.mod v734, v1344 : u32; + hir.assertz v736 #[code = 250]; + v737 = hir.int_to_ptr v734 : ptr; + v738 = hir.load v737 : i32; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::deallocate(v729, v730, v738) scf.yield ; }; - v1091 = arith.constant 16 : i32; - v653 = arith.add v619, v1091 : i32 #[overflow = wrapping]; - v654 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v655 = hir.bitcast v654 : ptr; - hir.store v655, v653; + v739 = hir.load_local : i32 #[local = lv3]; + v1343 = arith.constant 16 : i32; + v741 = arith.add v739, v1343 : i32 #[overflow = wrapping]; + v742 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v743 = hir.bitcast v742 : ptr; + hir.store v743, v741; builtin.ret ; }; - private builtin.function @::current_memory(v656: i32, v657: i32, v658: i32, v659: i32) { - ^block91(v656: i32, v657: i32, v658: i32, v659: i32): - v1121 = arith.constant 0 : i32; - v660 = arith.constant 0 : i32; - v664 = arith.eq v659, v660 : i1; - v665 = arith.zext v664 : u32; - v666 = hir.bitcast v665 : i32; - v668 = arith.neq v666, v1121 : i1; - v1108, v1109 = scf.if v668 : i32, i32 { - ^block159: - v1120 = arith.constant 0 : i32; - v662 = arith.constant 4 : i32; - scf.yield v662, v1120; + private builtin.function @::current_memory(v744: i32, v745: i32, v746: i32, v747: i32) { + ^block84(v744: i32, v745: i32, v746: i32, v747: i32): + hir.store_local v744 #[local = lv0]; + hir.store_local v745 #[local = lv1]; + hir.store_local v746 #[local = lv2]; + hir.store_local v747 #[local = lv3]; + v1351 = arith.constant 0 : i32; + hir.store_local v1351 #[local = lv4]; + v1350 = arith.constant 4 : i32; + hir.store_local v1350 #[local = lv5]; + v750 = hir.load_local : i32 #[local = lv3]; + v1371 = arith.constant 0 : i32; + v1372 = arith.constant 0 : i32; + v752 = arith.eq v750, v1372 : i1; + v753 = arith.zext v752 : u32; + v754 = hir.bitcast v753 : i32; + v756 = arith.neq v754, v1371 : i1; + scf.if v756{ + ^block153: + scf.yield ; } else { - ^block94: - v669 = hir.bitcast v657 : u32; - v704 = arith.constant 4 : u32; - v671 = arith.mod v669, v704 : u32; - hir.assertz v671 #[code = 250]; - v672 = hir.int_to_ptr v669 : ptr; - v673 = hir.load v672 : i32; - v1118 = arith.constant 0 : i32; - v1119 = arith.constant 0 : i32; - v675 = arith.eq v673, v1119 : i1; - v676 = arith.zext v675 : u32; - v677 = hir.bitcast v676 : i32; - v679 = arith.neq v677, v1118 : i1; - v1106 = scf.if v679 : i32 { - ^block158: - v1117 = arith.constant 0 : i32; - scf.yield v1117; + ^block87: + v757 = hir.load_local : i32 #[local = lv1]; + v758 = hir.bitcast v757 : u32; + v1359 = arith.constant 4 : u32; + v760 = arith.mod v758, v1359 : u32; + hir.assertz v760 #[code = 250]; + v761 = hir.int_to_ptr v758 : ptr; + v762 = hir.load v761 : i32; + hir.store_local v762 #[local = lv6]; + v1369 = arith.constant 0 : i32; + v1370 = arith.constant 0 : i32; + v764 = arith.eq v762, v1370 : i1; + v765 = arith.zext v764 : u32; + v766 = hir.bitcast v765 : i32; + v768 = arith.neq v766, v1369 : i1; + scf.if v768{ + ^block152: + scf.yield ; } else { - ^block95: - v1116 = arith.constant 4 : u32; - v680 = hir.bitcast v656 : u32; - v682 = arith.add v680, v1116 : u32 #[overflow = checked]; - v1115 = arith.constant 4 : u32; - v684 = arith.mod v682, v1115 : u32; - hir.assertz v684 #[code = 250]; - v685 = hir.int_to_ptr v682 : ptr; - hir.store v685, v658; - v1114 = arith.constant 4 : u32; - v686 = hir.bitcast v657 : u32; - v688 = arith.add v686, v1114 : u32 #[overflow = checked]; - v1113 = arith.constant 4 : u32; - v690 = arith.mod v688, v1113 : u32; - hir.assertz v690 #[code = 250]; - v691 = hir.int_to_ptr v688 : ptr; - v692 = hir.load v691 : i32; - v693 = hir.bitcast v656 : u32; - v1112 = arith.constant 4 : u32; - v695 = arith.mod v693, v1112 : u32; - hir.assertz v695 #[code = 250]; - v696 = hir.int_to_ptr v693 : ptr; - hir.store v696, v692; - v697 = arith.mul v673, v659 : i32 #[overflow = wrapping]; - scf.yield v697; + ^block88: + v769 = hir.load_local : i32 #[local = lv0]; + v770 = hir.load_local : i32 #[local = lv2]; + v1368 = arith.constant 4 : u32; + v771 = hir.bitcast v769 : u32; + v773 = arith.add v771, v1368 : u32 #[overflow = checked]; + v1367 = arith.constant 4 : u32; + v775 = arith.mod v773, v1367 : u32; + hir.assertz v775 #[code = 250]; + v776 = hir.int_to_ptr v773 : ptr; + hir.store v776, v770; + v777 = hir.load_local : i32 #[local = lv0]; + v778 = hir.load_local : i32 #[local = lv1]; + v1366 = arith.constant 4 : u32; + v779 = hir.bitcast v778 : u32; + v781 = arith.add v779, v1366 : u32 #[overflow = checked]; + v1365 = arith.constant 4 : u32; + v783 = arith.mod v781, v1365 : u32; + hir.assertz v783 #[code = 250]; + v784 = hir.int_to_ptr v781 : ptr; + v785 = hir.load v784 : i32; + v786 = hir.bitcast v777 : u32; + v1364 = arith.constant 4 : u32; + v788 = arith.mod v786, v1364 : u32; + hir.assertz v788 #[code = 250]; + v789 = hir.int_to_ptr v786 : ptr; + hir.store v789, v785; + v790 = hir.load_local : i32 #[local = lv6]; + v791 = hir.load_local : i32 #[local = lv3]; + v792 = arith.mul v790, v791 : i32 #[overflow = wrapping]; + hir.store_local v792 #[local = lv4]; + v1348 = arith.constant 8 : i32; + hir.store_local v1348 #[local = lv5]; + scf.yield ; }; - v698 = arith.constant 8 : i32; - v1111 = arith.constant 4 : i32; - v1107 = cf.select v679, v1111, v698 : i32; - scf.yield v1107, v1106; + scf.yield ; }; - v701 = arith.add v656, v1108 : i32 #[overflow = wrapping]; - v703 = hir.bitcast v701 : u32; - v1110 = arith.constant 4 : u32; - v705 = arith.mod v703, v1110 : u32; - hir.assertz v705 #[code = 250]; - v706 = hir.int_to_ptr v703 : ptr; - hir.store v706, v1109; + v794 = hir.load_local : i32 #[local = lv0]; + v795 = hir.load_local : i32 #[local = lv5]; + v797 = hir.load_local : i32 #[local = lv4]; + v796 = arith.add v794, v795 : i32 #[overflow = wrapping]; + v798 = hir.bitcast v796 : u32; + v1363 = arith.constant 4 : u32; + v800 = arith.mod v798, v1363 : u32; + hir.assertz v800 #[code = 250]; + v801 = hir.int_to_ptr v798 : ptr; + hir.store v801, v797; builtin.ret ; }; - private builtin.function @::deallocate(v707: i32, v708: i32, v709: i32) { - ^block96(v707: i32, v708: i32, v709: i32): - v1123 = arith.constant 0 : i32; - v710 = arith.constant 0 : i32; - v711 = arith.eq v709, v710 : i1; - v712 = arith.zext v711 : u32; - v713 = hir.bitcast v712 : i32; - v715 = arith.neq v713, v1123 : i1; - scf.if v715{ - ^block98: + private builtin.function @::deallocate(v802: i32, v803: i32, v804: i32) { + ^block89(v802: i32, v803: i32, v804: i32): + hir.store_local v802 #[local = lv0]; + hir.store_local v803 #[local = lv1]; + hir.store_local v804 #[local = lv2]; + v805 = hir.load_local : i32 #[local = lv2]; + v1376 = arith.constant 0 : i32; + v1374 = arith.constant 0 : i32; + v807 = arith.eq v805, v1374 : i1; + v808 = arith.zext v807 : u32; + v809 = hir.bitcast v808 : i32; + v811 = arith.neq v809, v1376 : i1; + scf.if v811{ + ^block91: scf.yield ; } else { - ^block99: - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_dealloc(v707, v709, v708) + ^block92: + v812 = hir.load_local : i32 #[local = lv0]; + v813 = hir.load_local : i32 #[local = lv2]; + v814 = hir.load_local : i32 #[local = lv1]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_dealloc(v812, v813, v814) scf.yield ; }; builtin.ret ; }; - private builtin.function @::allocate(v716: i32, v717: i32, v718: i32) { - ^block100(v716: i32, v717: i32, v718: i32): - v720 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v721 = hir.bitcast v720 : ptr; - v722 = hir.load v721 : i32; - v723 = arith.constant 16 : i32; - v724 = arith.sub v722, v723 : i32 #[overflow = wrapping]; - v725 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v726 = hir.bitcast v725 : ptr; - hir.store v726, v724; - v719 = arith.constant 0 : i32; - v727 = arith.constant 8 : i32; - v728 = arith.add v724, v727 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc_impl(v728, v717, v718, v719) - v731 = arith.constant 12 : u32; - v730 = hir.bitcast v724 : u32; - v732 = arith.add v730, v731 : u32 #[overflow = checked]; - v733 = arith.constant 4 : u32; - v734 = arith.mod v732, v733 : u32; - hir.assertz v734 #[code = 250]; - v735 = hir.int_to_ptr v732 : ptr; - v736 = hir.load v735 : i32; - v738 = arith.constant 8 : u32; - v737 = hir.bitcast v724 : u32; - v739 = arith.add v737, v738 : u32 #[overflow = checked]; - v1128 = arith.constant 4 : u32; - v741 = arith.mod v739, v1128 : u32; - hir.assertz v741 #[code = 250]; - v742 = hir.int_to_ptr v739 : ptr; - v743 = hir.load v742 : i32; - v744 = hir.bitcast v716 : u32; - v1127 = arith.constant 4 : u32; - v746 = arith.mod v744, v1127 : u32; - hir.assertz v746 #[code = 250]; - v747 = hir.int_to_ptr v744 : ptr; - hir.store v747, v743; - v1126 = arith.constant 4 : u32; - v748 = hir.bitcast v716 : u32; - v750 = arith.add v748, v1126 : u32 #[overflow = checked]; - v1125 = arith.constant 4 : u32; - v752 = arith.mod v750, v1125 : u32; - hir.assertz v752 #[code = 250]; - v753 = hir.int_to_ptr v750 : ptr; - hir.store v753, v736; - v1124 = arith.constant 16 : i32; - v755 = arith.add v724, v1124 : i32 #[overflow = wrapping]; - v756 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v757 = hir.bitcast v756 : ptr; - hir.store v757, v755; + private builtin.function @::allocate(v815: i32, v816: i32, v817: i32) { + ^block93(v815: i32, v816: i32, v817: i32): + hir.store_local v815 #[local = lv0]; + hir.store_local v817 #[local = lv2]; + v818 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v819 = hir.bitcast v818 : ptr; + v820 = hir.load v819 : i32; + v1382 = arith.constant 16 : i32; + v822 = arith.sub v820, v1382 : i32 #[overflow = wrapping]; + hir.store_local v822 #[local = lv3]; + v823 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v824 = hir.bitcast v823 : ptr; + hir.store v824, v822; + v825 = hir.load_local : i32 #[local = lv3]; + v829 = hir.load_local : i32 #[local = lv2]; + v1380 = arith.constant 0 : i32; + v1381 = arith.constant 8 : i32; + v827 = arith.add v825, v1381 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc_impl(v827, v816, v829, v1380) + v831 = hir.load_local : i32 #[local = lv3]; + v1379 = arith.constant 12 : u32; + v832 = hir.bitcast v831 : u32; + v834 = arith.add v832, v1379 : u32 #[overflow = checked]; + v1378 = arith.constant 4 : u32; + v836 = arith.mod v834, v1378 : u32; + hir.assertz v836 #[code = 250]; + v837 = hir.int_to_ptr v834 : ptr; + v838 = hir.load v837 : i32; + hir.store_local v838 #[local = lv2]; + v839 = hir.load_local : i32 #[local = lv0]; + v840 = hir.load_local : i32 #[local = lv3]; + v1377 = arith.constant 8 : u32; + v841 = hir.bitcast v840 : u32; + v843 = arith.add v841, v1377 : u32 #[overflow = checked]; + v1392 = arith.constant 4 : u32; + v845 = arith.mod v843, v1392 : u32; + hir.assertz v845 #[code = 250]; + v846 = hir.int_to_ptr v843 : ptr; + v847 = hir.load v846 : i32; + v848 = hir.bitcast v839 : u32; + v1391 = arith.constant 4 : u32; + v850 = arith.mod v848, v1391 : u32; + hir.assertz v850 #[code = 250]; + v851 = hir.int_to_ptr v848 : ptr; + hir.store v851, v847; + v852 = hir.load_local : i32 #[local = lv0]; + v853 = hir.load_local : i32 #[local = lv2]; + v1390 = arith.constant 4 : u32; + v854 = hir.bitcast v852 : u32; + v856 = arith.add v854, v1390 : u32 #[overflow = checked]; + v1389 = arith.constant 4 : u32; + v858 = arith.mod v856, v1389 : u32; + hir.assertz v858 #[code = 250]; + v859 = hir.int_to_ptr v856 : ptr; + hir.store v859, v853; + v860 = hir.load_local : i32 #[local = lv3]; + v1388 = arith.constant 16 : i32; + v862 = arith.add v860, v1388 : i32 #[overflow = wrapping]; + v863 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v864 = hir.bitcast v863 : ptr; + hir.store v864, v862; builtin.ret ; }; - private builtin.function @::try_allocate_in(v758: i32, v759: i32, v760: i32, v761: i32, v762: i32) { - ^block102(v758: i32, v759: i32, v760: i32, v761: i32, v762: i32): - v765 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v766 = hir.bitcast v765 : ptr; - v767 = hir.load v766 : i32; - v768 = arith.constant 16 : i32; - v769 = arith.sub v767, v768 : i32 #[overflow = wrapping]; - v770 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v771 = hir.bitcast v770 : ptr; - hir.store v771, v769; - v781 = hir.bitcast v759 : u32; - v782 = arith.zext v781 : u64; - v783 = hir.bitcast v782 : i64; - v763 = arith.constant 0 : i32; - v776 = arith.sub v763, v761 : i32 #[overflow = wrapping]; - v773 = arith.constant -1 : i32; - v772 = arith.add v761, v762 : i32 #[overflow = wrapping]; - v774 = arith.add v772, v773 : i32 #[overflow = wrapping]; - v777 = arith.band v774, v776 : i32; - v778 = hir.bitcast v777 : u32; - v779 = arith.zext v778 : u64; - v780 = hir.bitcast v779 : i64; - v784 = arith.mul v780, v783 : i64 #[overflow = wrapping]; - v1231 = arith.constant 0 : i32; - v785 = arith.constant 32 : i64; - v787 = hir.cast v785 : u32; - v786 = hir.bitcast v784 : u64; - v788 = arith.shr v786, v787 : u64; - v789 = hir.bitcast v788 : i64; - v790 = arith.trunc v789 : i32; - v792 = arith.neq v790, v1231 : i1; - v1144, v1145, v1146, v1147, v1148, v1149 = scf.if v792 : i32, i32, i32, i32, i32, u32 { - ^block163: - v1129 = arith.constant 0 : u32; - v1136 = ub.poison i32 : i32; - scf.yield v758, v769, v1136, v1136, v1136, v1129; + private builtin.function @::try_allocate_in(v865: i32, v866: i32, v867: i32, v868: i32, v869: i32) { + ^block95(v865: i32, v866: i32, v867: i32, v868: i32, v869: i32): + hir.store_local v865 #[local = lv0]; + hir.store_local v866 #[local = lv1]; + hir.store_local v867 #[local = lv2]; + hir.store_local v868 #[local = lv3]; + hir.store_local v869 #[local = lv4]; + v870 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v871 = hir.bitcast v870 : ptr; + v872 = hir.load v871 : i32; + v1401 = arith.constant 16 : i32; + v874 = arith.sub v872, v1401 : i32 #[overflow = wrapping]; + hir.store_local v874 #[local = lv5]; + v875 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v876 = hir.bitcast v875 : ptr; + hir.store v876, v874; + v877 = hir.load_local : i32 #[local = lv3]; + v878 = hir.load_local : i32 #[local = lv4]; + v889 = hir.load_local : i32 #[local = lv1]; + v890 = hir.bitcast v889 : u32; + v891 = arith.zext v890 : u64; + v892 = hir.bitcast v891 : i64; + v1399 = arith.constant 0 : i32; + v884 = arith.sub v1399, v877 : i32 #[overflow = wrapping]; + v1400 = arith.constant -1 : i32; + v879 = arith.add v877, v878 : i32 #[overflow = wrapping]; + v881 = arith.add v879, v1400 : i32 #[overflow = wrapping]; + v885 = arith.band v881, v884 : i32; + v886 = hir.bitcast v885 : u32; + v887 = arith.zext v886 : u64; + v888 = hir.bitcast v887 : i64; + v893 = arith.mul v888, v892 : i64 #[overflow = wrapping]; + hir.store_local v893 #[local = lv6]; + v1469 = arith.constant 0 : i32; + v1398 = arith.constant 32 : i64; + v896 = hir.cast v1398 : u32; + v895 = hir.bitcast v893 : u64; + v897 = arith.shr v895, v896 : u64; + v898 = hir.bitcast v897 : i64; + v899 = arith.trunc v898 : i32; + v901 = arith.neq v899, v1469 : i1; + v1434 = scf.if v901 : u32 { + ^block157: + v1430 = arith.constant 0 : u32; + scf.yield v1430; } else { - ^block107: - v793 = arith.trunc v784 : i32; - v1230 = arith.constant 0 : i32; - v794 = arith.constant -2147483648 : i32; - v795 = arith.sub v794, v761 : i32 #[overflow = wrapping]; - v797 = hir.bitcast v795 : u32; - v796 = hir.bitcast v793 : u32; - v798 = arith.lte v796, v797 : i1; - v799 = arith.zext v798 : u32; - v800 = hir.bitcast v799 : i32; - v802 = arith.neq v800, v1230 : i1; - v1192 = scf.if v802 : i32 { - ^block105: - v1229 = arith.constant 0 : i32; - v813 = arith.neq v793, v1229 : i1; - v1191 = scf.if v813 : i32 { - ^block109: - v1228 = arith.constant 0 : i32; - v829 = arith.neq v760, v1228 : i1; - v1190 = scf.if v829 : i32 { - ^block112: - v811 = arith.constant 1 : i32; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc_impl(v769, v761, v793, v811) - v840 = hir.bitcast v769 : u32; - v881 = arith.constant 4 : u32; - v842 = arith.mod v840, v881 : u32; - hir.assertz v842 #[code = 250]; - v843 = hir.int_to_ptr v840 : ptr; - v844 = hir.load v843 : i32; - scf.yield v844; + ^block100: + v902 = hir.load_local : i64 #[local = lv6]; + v903 = arith.trunc v902 : i32; + hir.store_local v903 #[local = lv4]; + v905 = hir.load_local : i32 #[local = lv3]; + v1468 = arith.constant 0 : i32; + v1395 = arith.constant -2147483648 : i32; + v906 = arith.sub v1395, v905 : i32 #[overflow = wrapping]; + v908 = hir.bitcast v906 : u32; + v907 = hir.bitcast v903 : u32; + v909 = arith.lte v907, v908 : i1; + v910 = arith.zext v909 : u32; + v911 = hir.bitcast v910 : i32; + v913 = arith.neq v911, v1468 : i1; + scf.if v913{ + ^block98: + v923 = hir.load_local : i32 #[local = lv4]; + v1467 = arith.constant 0 : i32; + v925 = arith.neq v923, v1467 : i1; + scf.if v925{ + ^block102: + v943 = hir.load_local : i32 #[local = lv2]; + v1466 = arith.constant 0 : i32; + v945 = arith.neq v943, v1466 : i1; + scf.if v945{ + ^block105: + v959 = hir.load_local : i32 #[local = lv5]; + v960 = hir.load_local : i32 #[local = lv3]; + v961 = hir.load_local : i32 #[local = lv4]; + v1415 = arith.constant 1 : i32; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc_impl(v959, v960, v961, v1415) + v963 = hir.load_local : i32 #[local = lv5]; + v964 = hir.bitcast v963 : u32; + v1414 = arith.constant 4 : u32; + v966 = arith.mod v964, v1414 : u32; + hir.assertz v966 #[code = 250]; + v967 = hir.int_to_ptr v964 : ptr; + v968 = hir.load v967 : i32; + hir.store_local v968 #[local = lv2]; + scf.yield ; } else { - ^block113: - v830 = arith.constant 8 : i32; - v831 = arith.add v769, v830 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::allocate(v831, v761, v793) - v815 = arith.constant 8 : u32; - v832 = hir.bitcast v769 : u32; - v834 = arith.add v832, v815 : u32 #[overflow = checked]; - v1227 = arith.constant 4 : u32; - v836 = arith.mod v834, v1227 : u32; - hir.assertz v836 #[code = 250]; - v837 = hir.int_to_ptr v834 : ptr; - v838 = hir.load v837 : i32; - scf.yield v838; + ^block106: + v946 = hir.load_local : i32 #[local = lv5]; + v949 = hir.load_local : i32 #[local = lv3]; + v950 = hir.load_local : i32 #[local = lv4]; + v1393 = arith.constant 8 : i32; + v948 = arith.add v946, v1393 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::allocate(v948, v949, v950) + v951 = hir.load_local : i32 #[local = lv5]; + v1413 = arith.constant 8 : u32; + v952 = hir.bitcast v951 : u32; + v954 = arith.add v952, v1413 : u32 #[overflow = checked]; + v1465 = arith.constant 4 : u32; + v956 = arith.mod v954, v1465 : u32; + hir.assertz v956 #[code = 250]; + v957 = hir.int_to_ptr v954 : ptr; + v958 = hir.load v957 : i32; + hir.store_local v958 #[local = lv2]; + scf.yield ; }; - v1226 = arith.constant 0 : i32; - v847 = arith.neq v1190, v1226 : i1; - scf.if v847{ - ^block114: - v1225 = arith.constant 8 : u32; - v864 = hir.bitcast v758 : u32; - v866 = arith.add v864, v1225 : u32 #[overflow = checked]; - v1224 = arith.constant 4 : u32; - v868 = arith.mod v866, v1224 : u32; - hir.assertz v868 #[code = 250]; - v869 = hir.int_to_ptr v866 : ptr; - hir.store v869, v1190; - v1223 = arith.constant 4 : u32; - v871 = hir.bitcast v758 : u32; - v873 = arith.add v871, v1223 : u32 #[overflow = checked]; - v1222 = arith.constant 4 : u32; - v875 = arith.mod v873, v1222 : u32; - hir.assertz v875 #[code = 250]; - v876 = hir.int_to_ptr v873 : ptr; - hir.store v876, v759; + v969 = hir.load_local : i32 #[local = lv2]; + v1464 = arith.constant 0 : i32; + v971 = arith.neq v969, v1464 : i1; + scf.if v971{ + ^block107: + v989 = hir.load_local : i32 #[local = lv0]; + v990 = hir.load_local : i32 #[local = lv2]; + v1463 = arith.constant 8 : u32; + v991 = hir.bitcast v989 : u32; + v993 = arith.add v991, v1463 : u32 #[overflow = checked]; + v1462 = arith.constant 4 : u32; + v995 = arith.mod v993, v1462 : u32; + hir.assertz v995 #[code = 250]; + v996 = hir.int_to_ptr v993 : ptr; + hir.store v996, v990; + v997 = hir.load_local : i32 #[local = lv0]; + v998 = hir.load_local : i32 #[local = lv1]; + v1461 = arith.constant 4 : u32; + v999 = hir.bitcast v997 : u32; + v1001 = arith.add v999, v1461 : u32 #[overflow = checked]; + v1460 = arith.constant 4 : u32; + v1003 = arith.mod v1001, v1460 : u32; + hir.assertz v1003 #[code = 250]; + v1004 = hir.int_to_ptr v1001 : ptr; + hir.store v1004, v998; + v1459 = arith.constant 0 : i32; + hir.store_local v1459 #[local = lv3]; scf.yield ; } else { - ^block115: - v1221 = arith.constant 8 : u32; - v850 = hir.bitcast v758 : u32; - v852 = arith.add v850, v1221 : u32 #[overflow = checked]; - v1220 = arith.constant 4 : u32; - v854 = arith.mod v852, v1220 : u32; - hir.assertz v854 #[code = 250]; - v855 = hir.int_to_ptr v852 : ptr; - hir.store v855, v793; - v1219 = arith.constant 4 : u32; - v857 = hir.bitcast v758 : u32; - v859 = arith.add v857, v1219 : u32 #[overflow = checked]; - v1218 = arith.constant 4 : u32; - v861 = arith.mod v859, v1218 : u32; - hir.assertz v861 #[code = 250]; - v862 = hir.int_to_ptr v859 : ptr; - hir.store v862, v761; + ^block108: + v972 = hir.load_local : i32 #[local = lv0]; + v973 = hir.load_local : i32 #[local = lv4]; + v1458 = arith.constant 8 : u32; + v974 = hir.bitcast v972 : u32; + v976 = arith.add v974, v1458 : u32 #[overflow = checked]; + v1457 = arith.constant 4 : u32; + v978 = arith.mod v976, v1457 : u32; + hir.assertz v978 #[code = 250]; + v979 = hir.int_to_ptr v976 : ptr; + hir.store v979, v973; + v980 = hir.load_local : i32 #[local = lv0]; + v981 = hir.load_local : i32 #[local = lv3]; + v1456 = arith.constant 4 : u32; + v982 = hir.bitcast v980 : u32; + v984 = arith.add v982, v1456 : u32 #[overflow = checked]; + v1455 = arith.constant 4 : u32; + v986 = arith.mod v984, v1455 : u32; + hir.assertz v986 #[code = 250]; + v987 = hir.int_to_ptr v984 : ptr; + hir.store v987, v981; + v1454 = arith.constant 1 : i32; + hir.store_local v1454 #[local = lv3]; scf.yield ; }; - v1216 = arith.constant 1 : i32; - v1217 = arith.constant 0 : i32; - v1189 = cf.select v847, v1217, v1216 : i32; - scf.yield v1189; + scf.yield ; } else { - ^block110: - v1215 = arith.constant 8 : u32; - v814 = hir.bitcast v758 : u32; - v816 = arith.add v814, v1215 : u32 #[overflow = checked]; - v1214 = arith.constant 4 : u32; - v818 = arith.mod v816, v1214 : u32; - hir.assertz v818 #[code = 250]; - v819 = hir.int_to_ptr v816 : ptr; - hir.store v819, v761; - v1213 = arith.constant 4 : u32; - v822 = hir.bitcast v758 : u32; - v824 = arith.add v822, v1213 : u32 #[overflow = checked]; - v1212 = arith.constant 4 : u32; - v826 = arith.mod v824, v1212 : u32; - hir.assertz v826 #[code = 250]; - v1211 = arith.constant 0 : i32; - v827 = hir.int_to_ptr v824 : ptr; - hir.store v827, v1211; - v1210 = arith.constant 0 : i32; - scf.yield v1210; + ^block103: + v926 = hir.load_local : i32 #[local = lv0]; + v927 = hir.load_local : i32 #[local = lv3]; + v1453 = arith.constant 8 : u32; + v928 = hir.bitcast v926 : u32; + v930 = arith.add v928, v1453 : u32 #[overflow = checked]; + v1452 = arith.constant 4 : u32; + v932 = arith.mod v930, v1452 : u32; + hir.assertz v932 #[code = 250]; + v933 = hir.int_to_ptr v930 : ptr; + hir.store v933, v927; + v1451 = arith.constant 0 : i32; + hir.store_local v1451 #[local = lv3]; + v935 = hir.load_local : i32 #[local = lv0]; + v1450 = arith.constant 4 : u32; + v937 = hir.bitcast v935 : u32; + v939 = arith.add v937, v1450 : u32 #[overflow = checked]; + v1449 = arith.constant 4 : u32; + v941 = arith.mod v939, v1449 : u32; + hir.assertz v941 #[code = 250]; + v1448 = arith.constant 0 : i32; + v942 = hir.int_to_ptr v939 : ptr; + hir.store v942, v1448; + scf.yield ; }; - scf.yield v1191; + scf.yield ; } else { - ^block108: - v1209 = ub.poison i32 : i32; - scf.yield v1209; + ^block101: + scf.yield ; }; - v1204 = arith.constant 0 : u32; - v1137 = arith.constant 1 : u32; - v1197 = cf.select v802, v1137, v1204 : u32; - v1205 = ub.poison i32 : i32; - v1196 = cf.select v802, v769, v1205 : i32; - v1206 = ub.poison i32 : i32; - v1195 = cf.select v802, v758, v1206 : i32; - v1207 = ub.poison i32 : i32; - v1194 = cf.select v802, v1207, v769 : i32; - v1208 = ub.poison i32 : i32; - v1193 = cf.select v802, v1208, v758 : i32; - scf.yield v1193, v1194, v1195, v1192, v1196, v1197; + v1447 = arith.constant 0 : u32; + v1432 = arith.constant 1 : u32; + v1440 = cf.select v913, v1432, v1447 : u32; + scf.yield v1440; }; - v1150, v1151, v1152 = scf.index_switch v1149 : i32, i32, i32 + scf.index_switch v1434 case 0 { - ^block106: - v1203 = arith.constant 4 : u32; - v805 = hir.bitcast v1144 : u32; - v807 = arith.add v805, v1203 : u32 #[overflow = checked]; - v1202 = arith.constant 4 : u32; - v809 = arith.mod v807, v1202 : u32; - hir.assertz v809 #[code = 250]; - v1201 = arith.constant 0 : i32; - v810 = hir.int_to_ptr v807 : ptr; - hir.store v810, v1201; - v1200 = arith.constant 1 : i32; - scf.yield v1144, v1200, v1145; + ^block99: + v914 = hir.load_local : i32 #[local = lv0]; + v1446 = arith.constant 4 : u32; + v916 = hir.bitcast v914 : u32; + v918 = arith.add v916, v1446 : u32 #[overflow = checked]; + v1445 = arith.constant 4 : u32; + v920 = arith.mod v918, v1445 : u32; + hir.assertz v920 #[code = 250]; + v1444 = arith.constant 0 : i32; + v921 = hir.int_to_ptr v918 : ptr; + hir.store v921, v1444; + v1443 = arith.constant 1 : i32; + hir.store_local v1443 #[local = lv3]; + scf.yield ; } default { - ^block167: - scf.yield v1146, v1147, v1148; + ^block161: + scf.yield ; }; - v880 = hir.bitcast v1150 : u32; - v1199 = arith.constant 4 : u32; - v882 = arith.mod v880, v1199 : u32; - hir.assertz v882 #[code = 250]; - v883 = hir.int_to_ptr v880 : ptr; - hir.store v883, v1151; - v1198 = arith.constant 16 : i32; - v888 = arith.add v1152, v1198 : i32 #[overflow = wrapping]; - v889 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v890 = hir.bitcast v889 : ptr; - hir.store v890, v888; + v1006 = hir.load_local : i32 #[local = lv0]; + v1007 = hir.load_local : i32 #[local = lv3]; + v1008 = hir.bitcast v1006 : u32; + v1442 = arith.constant 4 : u32; + v1010 = arith.mod v1008, v1442 : u32; + hir.assertz v1010 #[code = 250]; + v1011 = hir.int_to_ptr v1008 : ptr; + hir.store v1011, v1007; + v1012 = hir.load_local : i32 #[local = lv5]; + v1441 = arith.constant 16 : i32; + v1014 = arith.add v1012, v1441 : i32 #[overflow = wrapping]; + v1015 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v1016 = hir.bitcast v1015 : ptr; + hir.store v1016, v1014; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v891: i32, v892: i32) { - ^block116(v891: i32, v892: i32): + private builtin.function @alloc::raw_vec::handle_error(v1017: i32, v1018: i32) { + ^block109(v1017: i32, v1018: i32): ub.unreachable ; }; - private builtin.function @core::slice::index::slice_index_fail::do_panic::runtime(v893: i32, v894: i32, v895: i32) { - ^block118(v893: i32, v894: i32, v895: i32): + private builtin.function @core::slice::index::slice_index_fail::do_panic::runtime(v1019: i32, v1020: i32, v1021: i32) { + ^block111(v1019: i32, v1020: i32, v1021: i32): ub.unreachable ; }; - private builtin.function @::max(v896: i32, v897: i32) -> i32 { - ^block120(v896: i32, v897: i32): - v904 = arith.constant 0 : i32; - v900 = hir.bitcast v897 : u32; - v899 = hir.bitcast v896 : u32; - v901 = arith.gt v899, v900 : i1; - v902 = arith.zext v901 : u32; - v903 = hir.bitcast v902 : i32; - v905 = arith.neq v903, v904 : i1; - v906 = cf.select v905, v896, v897 : i32; - builtin.ret v906; + private builtin.function @::max(v1022: i32, v1023: i32) -> i32 { + ^block113(v1022: i32, v1023: i32): + v1470 = arith.constant 0 : i32; + v1030 = hir.bitcast v1023 : u32; + v1029 = hir.bitcast v1022 : u32; + v1031 = arith.gt v1029, v1030 : i1; + v1032 = arith.zext v1031 : u32; + v1033 = hir.bitcast v1032 : i32; + v1035 = arith.neq v1033, v1470 : i1; + v1036 = cf.select v1035, v1022, v1023 : i32; + builtin.ret v1036; }; - private builtin.function @miden::output_note::create(v907: felt, v908: felt, v909: felt, v910: felt, v911: felt, v912: felt, v913: felt, v914: felt) -> felt { - ^block122(v907: felt, v908: felt, v909: felt, v910: felt, v911: felt, v912: felt, v913: felt, v914: felt): - v915 = hir.exec @miden/output_note/create(v907, v908, v909, v910, v911, v912, v913, v914) : felt - builtin.ret v915; + private builtin.function @miden::protocol::output_note::create(v1037: felt, v1038: felt, v1039: felt, v1040: felt, v1041: felt, v1042: felt) -> felt { + ^block115(v1037: felt, v1038: felt, v1039: felt, v1040: felt, v1041: felt, v1042: felt): + v1043 = hir.exec @miden/protocol/output_note/create(v1037, v1038, v1039, v1040, v1041, v1042) : felt + builtin.ret v1043; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -1304,9 +1497,9 @@ builtin.component miden:base/transaction-script@1.0.0 { builtin.segment @1048588 = 0x00000000000000000000000a00100000000000010000000100000001; }; - public builtin.function @run(v917: felt, v918: felt, v919: felt, v920: felt) { - ^block126(v917: felt, v918: felt, v919: felt, v920: felt): - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden:base/transaction-script@1.0.0#run(v917, v918, v919, v920) + public builtin.function @run(v1045: felt, v1046: felt, v1047: felt, v1048: felt) { + ^block119(v1045: felt, v1046: felt, v1047: felt, v1048: felt): + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden:base/transaction-script@1.0.0#run(v1045, v1046, v1047, v1048) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/examples/basic_wallet_tx_script.masm b/tests/integration/expected/examples/basic_wallet_tx_script.masm index 865986108..df5624b22 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.masm +++ b/tests/integration/expected/examples/basic_wallet_tx_script.masm @@ -1,14 +1,14 @@ -# mod miden:base/transaction-script@1.0.0 +# mod ::"miden:base/transaction-script@1.0.0" @callconv("canon-lift") pub proc run(felt, felt, felt, felt) - exec.::miden:base/transaction-script@1.0.0::init + exec."miden:base/transaction-script@1.0.0"::init trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::miden:base/transaction-script@1.0.0#run + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::"miden:base/transaction-script@1.0.0#run" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -21,7 +21,7 @@ proc init push.262144 push.3 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -32,7 +32,7 @@ proc init mem_store.278545 end -# mod miden:base/transaction-script@1.0.0::basic_wallet_tx_script +# mod ::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script @callconv("C") proc basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_asset_to_note::wit_import9( @@ -44,7 +44,7 @@ proc basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_a ) trace.240 nop - call.::miden:basic-wallet/basic-wallet@0.1.0::move-asset-to-note + call.::"miden:basic-wallet/basic-wallet@0.1.0"::"move-asset-to-note" trace.252 nop end @@ -56,6 +56,7 @@ proc __wasm_call_ctors( nop end +@locals("2") @callconv("C") proc __rustc::__rust_alloc(i32, i32) -> i32 push.1114180 @@ -72,11 +73,12 @@ proc __rustc::__rust_alloc(i32, i32) -> i32 swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::::alloc + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::::alloc trace.252 nop end +@locals("3") @callconv("C") proc __rustc::__rust_dealloc(i32, i32, i32) drop @@ -84,8 +86,25 @@ proc __rustc::__rust_dealloc(i32, i32, i32) drop end +@locals("2") @callconv("C") proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114180 u32divmod.4 swap.1 @@ -94,38 +113,84 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.1048616 + movup.3 u32wrapping_add - dup.1 - swap.2 - swap.3 + movup.2 + swap.1 + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::::alloc + trace.252 + nop + dup.0 + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::::alloc + exec.::intrinsics::mem::store_sw trace.252 nop push.0 push.0 - dup.2 + movup.2 eq neq if.true - swap.1 - drop + nop else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.0 - dup.3 + movup.2 eq neq if.true - swap.1 - drop + nop else + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 + swap.1 movup.2 - dup.2 push.0 dup.2 push.0 @@ -167,6 +232,14 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 dropw end end + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end @callconv("C") @@ -176,17 +249,72 @@ proc basic_wallet_tx_script::bindings::__link_custom_section_describing_imports( nop end +@locals("3") @callconv("C") proc core::slice::index::slice_index_fail(i32, i32, i32) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 - dup.3 - dup.2 + swap.1 + movup.2 swap.1 u32gt neq if.true + locaddr.0 + push.0 swap.1 - drop + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.1114180 u32divmod.4 swap.1 @@ -197,21 +325,52 @@ proc core::slice::index::slice_index_fail(i32, i32, i32) nop push.1048600 u32wrapping_add - movdn.2 + swap.2 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::core::slice::index::slice_index_fail::do_panic::runtime + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::core::slice::index::slice_index_fail::do_panic::runtime trace.252 nop else - drop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 push.0 - dup.2 - dup.2 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + swap.1 + movup.2 swap.1 u32gt neq if.true + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.1114180 u32divmod.4 swap.1 @@ -222,13 +381,29 @@ proc core::slice::index::slice_index_fail(i32, i32, i32) nop push.1048600 u32wrapping_add - movdn.2 + swap.2 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::core::slice::index::slice_index_fail::do_panic::runtime + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::core::slice::index::slice_index_fail::do_panic::runtime trace.252 nop else + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.1114180 u32divmod.4 swap.1 @@ -239,10 +414,10 @@ proc core::slice::index::slice_index_fail(i32, i32, i32) nop push.1048600 u32wrapping_add - movdn.2 + swap.2 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::core::slice::index::slice_index_fail::do_panic::runtime + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::core::slice::index::slice_index_fail::do_panic::runtime trace.252 nop end @@ -251,15 +426,64 @@ proc core::slice::index::slice_index_fail(i32, i32, i32) assert end +@locals("5") @callconv("C") -proc as core::ops::index::Index>>::index( +proc as core::ops::index::Index>>::index( i32, i32, i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.2 + swap.1 add u32assert push.4 @@ -275,38 +499,85 @@ proc as core::ops::in exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.4 push.0 - dup.1 - dup.6 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + swap.1 + movup.2 swap.1 u32lte neq if.true - drop - push.4 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.4 - dup.4 - u32wrapping_sub - swap.1 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop - push.4 - movup.2 - add + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + movup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movdn.2 + u32wrapping_sub + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 + add u32assert push.4 dup.1 @@ -321,7 +592,15 @@ proc as core::ops::in exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 push.4 dup.1 swap.1 @@ -329,7 +608,7 @@ proc as core::ops::in u32assert assertz push.2 - movup.3 + movup.2 swap.1 u32shl movup.2 @@ -343,13 +622,34 @@ proc as core::ops::in trace.252 nop else - movdn.2 - drop - drop - movdn.2 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::core::slice::index::slice_index_fail + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.2 + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::core::slice::index::slice_index_fail trace.252 nop push.0 @@ -357,8 +657,41 @@ proc as core::ops::in end end +@locals("11") @callconv("C") proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1114176 u32divmod.4 swap.1 @@ -369,9 +702,16 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) nop push.80 u32wrapping_sub - push.1114176 - dup.1 + dup.0 + locaddr.4 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114176 u32divmod.4 swap.1 trace.240 @@ -381,43 +721,62 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) nop trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::wit_bindgen::rt::run_ctors_once + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::wit_bindgen::rt::run_ctors_once trace.252 nop - dup.1 - dup.3 - dup.5 - dup.7 + locaddr.3 + push.0 + swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::advice::adv_push_mapvaln + exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::felt::as_u64 + exec.::intrinsics::mem::load_felt trace.252 nop - push.3 - dup.2 - dup.2 - drop - u32and + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.0 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::felt::from_u32 + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::"intrinsics::advice::adv_push_mapvaln" trace.252 nop + u32split + push.0 + push.3 + dup.3 + dup.3 + drop + u32and + assert_eq + locaddr.4 + push.0 swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_sw trace.252 nop push.2 @@ -432,46 +791,63 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) push.4294967295 u32lte assert - movdn.2 + movup.3 + movup.3 movup.2 trace.240 nop - exec.::std::math::u64::shr - trace.252 - nop - trace.240 - nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::felt::from_u64_unchecked + exec.::miden::core::math::u64::shr trace.252 nop + mul.4294967296 + add dup.0 + locaddr.7 + push.0 + swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::felt::as_u64 + exec.::intrinsics::mem::store_felt trace.252 nop push.2 - movdn.2 + swap.1 + u32split drop swap.1 u32shl + dup.0 + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.4 push.0 push.64 - dup.5 + movup.4 u32wrapping_add - dup.3 - dup.3 + dup.2 swap.4 - swap.3 - swap.2 + swap.1 + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::::try_allocate_in + trace.252 + nop + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::::try_allocate_in + exec.::intrinsics::mem::load_sw trace.252 nop push.68 - dup.3 + swap.1 add u32assert push.4 @@ -487,8 +863,24 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.64 - dup.4 + swap.1 add u32assert push.4 @@ -510,19 +902,24 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) eq neq if.true - movdn.2 - drop - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.72 - movup.2 + swap.1 add u32assert push.4 @@ -541,13 +938,29 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::alloc::raw_vec::handle_error + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::alloc::raw_vec::handle_error trace.252 nop push.0 else + locaddr.7 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.72 - dup.4 + swap.1 add u32assert push.4 @@ -563,30 +976,80 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop - push.2 - dup.1 + dup.0 + locaddr.10 + push.0 swap.1 - u32shr - movup.5 - swap.6 - movdn.5 - movup.3 - swap.8 - movdn.3 - movup.2 - swap.9 - movdn.2 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.2 + movup.5 swap.1 - swap.7 + u32shr + movup.2 swap.4 + movdn.2 + swap.1 + swap.5 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::std::mem::pipe_preimage_to_memory + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::"miden::core::mem::pipe_preimage_to_memory" trace.252 nop drop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.28 - dup.1 + movup.2 add u32assert push.4 @@ -595,8 +1058,6 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) u32mod u32assert assertz - dup.3 - swap.1 u32divmod.4 swap.1 trace.240 @@ -604,8 +1065,24 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.10 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.24 - dup.1 + movup.2 add u32assert push.4 @@ -614,8 +1091,6 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) u32mod u32assert assertz - dup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -623,8 +1098,24 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.20 - dup.1 + movup.2 add u32assert push.4 @@ -633,8 +1124,6 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) u32mod u32assert assertz - movup.4 - swap.1 u32divmod.4 swap.1 trace.240 @@ -642,18 +1131,32 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.0 - movup.4 + movup.2 eq neq if.true - drop - drop push.0 else - push.12 - dup.2 + locaddr.10 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 add u32assert push.4 @@ -669,28 +1172,23 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop - push.8 - dup.3 - add - u32assert - push.4 - dup.1 + locaddr.0 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.10 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::load_sw trace.252 nop push.4 - dup.4 - add - u32assert - push.4 dup.1 swap.1 u32mod @@ -703,35 +1201,45 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop - movup.4 - push.4 - dup.1 + locaddr.1 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::load_sw trace.252 nop - push.8 - push.4 + push.6 + push.2 push.20 - dup.7 + dup.3 u32wrapping_add push.8 - dup.8 + movup.4 u32wrapping_add trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script:: as core::ops::index::Index>>::index + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script:: as core::ops::index::Index>>::index + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.12 - dup.5 + swap.1 add u32assert push.4 @@ -753,12 +1261,18 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) neq neq if.true - dropw - drop push.0 else + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.5 + dup.1 add u32assert push.4 @@ -774,8 +1288,16 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.10 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.8 - dup.1 u32wrapping_add push.4 dup.1 @@ -793,7 +1315,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) swap.1 push.8 push.32 - dup.9 + movup.4 u32wrapping_add u32wrapping_add push.8 @@ -811,6 +1333,22 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.10 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -826,7 +1364,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) nop swap.1 push.32 - dup.7 + movup.3 add u32assert push.8 @@ -844,39 +1382,94 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.32 - dup.5 + dup.1 u32wrapping_add push.64 - dup.6 + movup.2 u32wrapping_add trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::>::from + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::>::from + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.64 - dup.5 u32wrapping_add - movdn.4 + swap.2 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::miden_base_sys::bindings::output_note::create + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::miden_base_sys::bindings::output_note::create trace.252 nop - push.12 - push.8 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.10 + push.6 push.20 - dup.4 + dup.3 u32wrapping_add - dup.4 + movup.3 + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script:: as core::ops::index::Index>>::index + trace.252 + nop + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script:: as core::ops::index::Index>>::index + exec.::intrinsics::mem::load_sw trace.252 nop push.4 - dup.2 + swap.1 add u32assert push.4 @@ -899,27 +1492,41 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) neq dup.0 if.true - movdn.2 - drop - drop + nop else - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.4 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.8 - dup.1 - u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.0 + locaddr.10 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + u32wrapping_add push.4 dup.1 swap.1 @@ -936,7 +1543,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) swap.1 push.8 push.48 - dup.7 + movup.4 u32wrapping_add u32wrapping_add push.8 @@ -954,6 +1561,22 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.10 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -969,7 +1592,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) nop swap.1 push.48 - dup.5 + movup.3 add u32assert push.8 @@ -987,19 +1610,35 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.48 - dup.3 + dup.1 u32wrapping_add push.64 - dup.4 + movup.2 u32wrapping_add trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::>::from + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::>::from + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.64 - dup.3 + swap.1 add u32assert push.4 @@ -1015,8 +1654,16 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.68 - dup.4 + swap.1 add u32assert push.4 @@ -1032,8 +1679,16 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.72 - dup.5 + swap.1 add u32assert push.4 @@ -1049,8 +1704,16 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.76 - dup.6 + swap.1 add u32assert push.4 @@ -1066,36 +1729,62 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop - movup.4 - swap.5 - movdn.4 + locaddr.0 + push.0 swap.1 - swap.2 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop swap.1 swap.3 + swap.1 + swap.4 + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_asset_to_note::wit_import9 + trace.252 + nop + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_asset_to_note::wit_import9 + exec.::intrinsics::mem::load_sw trace.252 nop push.20 - dup.2 u32wrapping_add trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script:: as core::ops::drop::Drop>::drop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script:: as core::ops::drop::Drop>::drop + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.20 - dup.2 u32wrapping_add trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script:: as core::ops::drop::Drop>::drop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script:: as core::ops::drop::Drop>::drop + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.80 - movup.2 u32wrapping_add push.1114176 u32divmod.4 @@ -1130,6 +1819,7 @@ proc __rustc::__rust_no_alloc_shim_is_unstable_v2( nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -1171,9 +1861,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -1204,66 +1910,184 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("5") @callconv("C") proc ::alloc( i32, i32, i32 ) -> i32 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 push.0 push.16 - dup.4 + dup.3 swap.1 u32gt neq - dup.3 + movup.2 swap.1 cdrop + dup.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.4294967295 - dup.2 + movup.2 u32wrapping_add - dup.2 + movup.2 u32and neq if.true - dropw push.0 push.3735929054 else - movup.2 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::::max + trace.252 + nop + dup.0 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::::max + exec.::intrinsics::mem::store_sw trace.252 nop push.0 push.2147483648 - dup.2 + movup.2 u32wrapping_sub - dup.4 + movup.2 swap.1 u32gt neq dup.0 if.true - movdn.3 - drop - drop - drop push.3735929054 else push.0 - dup.2 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + dup.1 u32wrapping_sub push.4294967295 - movup.5 - dup.4 + movup.3 + movup.3 u32wrapping_add u32wrapping_add u32and - dup.3 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -1282,9 +2106,17 @@ proc ::alloc( if.true nop else + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::mem::heap_base + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::"intrinsics::mem::heap_base" trace.252 nop trace.240 @@ -1292,7 +2124,7 @@ proc ::alloc( exec.::intrinsics::mem::memory_size trace.252 nop - dup.5 + movup.2 push.4 dup.1 swap.1 @@ -1314,45 +2146,87 @@ proc ::alloc( trace.252 nop end - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 push.0 - push.4294967295 - dup.2 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.4294967295 + movup.2 u32xor - dup.3 + movup.2 swap.1 u32gt neq if.true - drop - drop - movdn.2 - drop - drop - push.0 + nop else - movup.4 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 push.4 dup.1 swap.1 u32mod u32assert assertz - movup.2 - dup.2 + movdn.2 u32wrapping_add swap.1 u32divmod.4 @@ -1362,9 +2236,40 @@ proc ::alloc( exec.::intrinsics::mem::store_sw trace.252 nop - movup.2 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop u32wrapping_add + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end push.1 push.0 @@ -1395,8 +2300,9 @@ proc intrinsics::mem::heap_base( nop end +@locals("1") @callconv("C") -proc as core::ops::drop::Drop>::drop( +proc as core::ops::drop::Drop>::drop( i32 ) push.4 @@ -1404,21 +2310,37 @@ proc as core:: swap.2 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::::deallocate + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::::deallocate trace.252 nop end +@locals("3") @callconv("C") proc miden_base_sys::bindings::output_note::create( - felt, - felt, felt, felt, i32 ) -> felt + movup.2 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.5 + swap.1 add u32assert push.4 @@ -1434,8 +2356,16 @@ proc miden_base_sys::bindings::output_note::create( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.6 + swap.1 add u32assert push.4 @@ -1451,8 +2381,16 @@ proc miden_base_sys::bindings::output_note::create( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.7 + swap.1 add u32assert push.4 @@ -1468,7 +2406,14 @@ proc miden_base_sys::bindings::output_note::create( exec.::intrinsics::mem::load_felt trace.252 nop - movup.7 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -1482,28 +2427,59 @@ proc miden_base_sys::bindings::output_note::create( exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - swap.6 - swap.2 + movup.2 + swap.3 + movdn.2 swap.5 swap.1 - swap.7 - swap.3 swap.4 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::miden::output_note::create + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::"miden::protocol::output_note::create" trace.252 nop end +@locals("2") @callconv("C") -proc >::from( +proc >::from( i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.2 + swap.1 add u32assert push.4 @@ -1521,7 +2497,7 @@ proc as core::ops::drop::Drop>::drop( +proc as core::ops::drop::Drop>::drop( i32 ) drop @@ -1589,45 +2581,22 @@ proc intrinsics::advice::adv_push_mapvaln(felt, felt, felt, felt) -> felt end @callconv("C") -proc intrinsics::felt::as_u64(felt) -> [u32; 2] - u32split -end - -@callconv("C") -proc intrinsics::felt::assert_eq(felt, felt) - assert_eq -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc intrinsics::felt::from_u64_unchecked([u32; 2]) -> felt - dup.1 - dup.1 - push.1 - push.4294967295 - trace.240 - nop - exec.::std::math::u64::lt - trace.252 - nop - assert - mul.4294967296 - add -end - -@callconv("C") -proc std::mem::pipe_preimage_to_memory(felt, i32, felt, felt, felt, felt) -> i32 +proc miden::core::mem::pipe_preimage_to_memory( + felt, + i32, + felt, + felt, + felt, + felt +) -> i32 trace.240 nop - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 nop end +@locals("4") @callconv("C") proc ::alloc_impl( i32, @@ -1635,44 +2604,151 @@ proc ::alloc_impl( i32, i32 ) + locaddr.0 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 push.0 - dup.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 eq neq if.true - movup.3 - drop - swap.1 + nop else trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::__rustc::__rust_no_alloc_shim_is_unstable_v2 + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::__rustc::__rust_no_alloc_shim_is_unstable_v2 + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.0 - movup.4 neq if.true + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::__rustc::__rust_alloc_zeroed + trace.252 + nop + locaddr.1 + push.0 swap.1 - dup.2 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::__rustc::__rust_alloc_zeroed + exec.::intrinsics::mem::store_sw trace.252 nop else + locaddr.2 + push.0 swap.1 - dup.2 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::__rustc::__rust_alloc + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::__rustc::__rust_alloc + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw trace.252 nop end end + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.2 + movup.2 add u32assert push.4 @@ -1681,8 +2757,6 @@ proc ::alloc_impl( u32mod u32assert assertz - movup.3 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1690,6 +2764,22 @@ proc ::alloc_impl( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop swap.1 push.4 dup.1 @@ -1706,12 +2796,22 @@ proc ::alloc_impl( nop end +@locals("4") @callconv("C") proc ::deallocate( i32, i32, i32 ) + movup.2 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114176 u32divmod.4 swap.1 @@ -1722,9 +2822,16 @@ proc ::deallocate( nop push.16 u32wrapping_sub - push.1114176 - dup.1 + dup.0 + locaddr.3 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1732,21 +2839,44 @@ proc ::deallocate( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + movup.2 u32wrapping_add swap.1 - swap.4 swap.3 swap.2 swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::::current_memory + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::"::current_memory" + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.1 + swap.1 add u32assert push.4 @@ -1762,16 +2892,33 @@ proc ::deallocate( exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 push.0 - dup.2 + movup.2 eq neq if.true - drop + nop else + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.2 + swap.1 add u32assert push.4 @@ -1787,8 +2934,24 @@ proc ::deallocate( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.3 + swap.1 add u32assert push.4 @@ -1804,13 +2967,21 @@ proc ::deallocate( exec.::intrinsics::mem::load_sw trace.252 nop - movdn.2 + swap.2 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::::deallocate + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::"::deallocate" trace.252 nop end + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114176 @@ -1823,6 +2994,7 @@ proc ::deallocate( nop end +@locals("7") @callconv("C") proc ::current_memory( i32, @@ -1830,20 +3002,80 @@ proc ::current_memory( i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.0 - dup.5 + movup.2 eq neq if.true - movdn.3 - drop - drop - drop - push.0 - push.4 + nop else - dup.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -1857,25 +3089,41 @@ proc ::current_memory( exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 push.0 - dup.2 + movup.2 eq neq - dup.0 if.true + nop + else + locaddr.0 + push.0 swap.1 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 push.0 - else + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.3 + movup.2 add u32assert push.4 @@ -1884,8 +3132,6 @@ proc ::current_memory( u32mod u32assert assertz - movup.5 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1893,8 +3139,24 @@ proc ::current_memory( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - movup.4 + swap.1 add u32assert push.4 @@ -1910,7 +3172,7 @@ proc ::current_memory( exec.::intrinsics::mem::load_sw trace.252 nop - dup.3 + swap.1 push.4 dup.1 swap.1 @@ -1924,21 +3186,71 @@ proc ::current_memory( exec.::intrinsics::mem::store_sw trace.252 nop - swap.3 + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop trace.240 nop exec.::intrinsics::i32::wrapping_mul trace.252 nop - movup.2 + locaddr.4 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.8 - push.4 - movup.3 - cdrop end - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movdn.2 u32wrapping_add push.4 dup.1 @@ -1955,38 +3267,110 @@ proc ::current_memory( nop end +@locals("3") @callconv("C") proc ::deallocate( i32, i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 push.0 - dup.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 eq neq if.true - drop - drop - drop + nop else - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::__rustc::__rust_dealloc + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.2 + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::__rustc::__rust_dealloc trace.252 nop end end +@locals("4") @callconv("C") proc ::allocate( i32, i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + swap.1 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114176 u32divmod.4 swap.1 @@ -1997,9 +3381,16 @@ proc ::allocate( nop push.16 u32wrapping_sub - push.1114176 - dup.1 + dup.0 + locaddr.3 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114176 u32divmod.4 swap.1 trace.240 @@ -2007,24 +3398,44 @@ proc ::allocate( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.8 - dup.2 + movup.3 u32wrapping_add - movup.2 - swap.5 - movdn.2 swap.1 swap.3 - swap.4 swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::::alloc_impl + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::"::alloc_impl" + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.12 - dup.2 + swap.1 add u32assert push.4 @@ -2040,8 +3451,32 @@ proc ::allocate( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.3 + swap.1 add u32assert push.4 @@ -2057,7 +3492,7 @@ proc ::allocate( exec.::intrinsics::mem::load_sw trace.252 nop - dup.2 + swap.1 push.4 dup.1 swap.1 @@ -2071,6 +3506,22 @@ proc ::allocate( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 movup.2 add @@ -2088,6 +3539,14 @@ proc ::allocate( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114176 @@ -2100,6 +3559,7 @@ proc ::allocate( nop end +@locals("8") @callconv("C") proc ::try_allocate_in( i32, @@ -2108,6 +3568,46 @@ proc ::try_allocate_in( i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114176 u32divmod.4 swap.1 @@ -2118,9 +3618,16 @@ proc ::try_allocate_in( nop push.16 u32wrapping_sub - push.1114176 - dup.1 + dup.0 + locaddr.5 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114176 u32divmod.4 swap.1 trace.240 @@ -2128,14 +3635,37 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop - dup.2 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.0 - dup.7 + dup.4 u32wrapping_sub push.4294967295 - movup.9 - dup.9 + movup.5 + movup.5 u32wrapping_add u32wrapping_add u32and @@ -2145,6 +3675,18 @@ proc ::try_allocate_in( exec.::intrinsics::i64::wrapping_mul trace.252 nop + dup.1 + dup.1 + locaddr.6 + push.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop push.0 push.32 push.0 @@ -2158,64 +3700,118 @@ proc ::try_allocate_in( push.4294967295 u32lte assert - dup.3 - dup.3 + movup.3 + movup.3 movup.2 trace.240 nop - exec.::std::math::u64::shr + exec.::miden::core::math::u64::shr trace.252 nop drop neq if.true - drop - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop push.0 - push.3735929054 - dup.0 - dup.1 - swap.4 - swap.1 - swap.3 - swap.5 else + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 drop + dup.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.2147483648 - dup.7 + movup.2 u32wrapping_sub - dup.2 + movup.2 swap.1 u32lte neq dup.0 if.true + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 - dup.2 neq if.true + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 - movup.6 neq if.true + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.1 - dup.3 - dup.7 - dup.4 + movdn.3 swap.2 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::::alloc_impl + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::"::alloc_impl" + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop - dup.2 push.4 dup.1 swap.1 @@ -2229,20 +3825,59 @@ proc ::try_allocate_in( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop else + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.3 + movup.3 u32wrapping_add - dup.6 - dup.3 - swap.2 + movup.2 + swap.1 + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::"::allocate" + trace.252 + nop + locaddr.5 + push.0 + swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::::allocate + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.3 + swap.1 add u32assert push.4 @@ -2258,18 +3893,44 @@ proc ::try_allocate_in( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 - dup.1 neq - dup.0 if.true - movup.7 - movup.4 - drop - drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.5 + movup.2 add u32assert push.4 @@ -2278,8 +3939,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -2287,8 +3946,24 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.4 + movup.2 add u32assert push.4 @@ -2297,8 +3972,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.5 - swap.1 u32divmod.4 swap.1 trace.240 @@ -2306,13 +3979,34 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + push.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop else - movup.6 - movup.2 - drop - drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.5 + movup.2 add u32assert push.4 @@ -2321,8 +4015,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.3 - swap.1 u32divmod.4 swap.1 trace.240 @@ -2330,8 +4022,24 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.4 + movup.2 add u32assert push.4 @@ -2340,8 +4048,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.5 - swap.1 u32divmod.4 swap.1 trace.240 @@ -2349,22 +4055,35 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + push.1 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.1 - push.0 - movup.2 - cdrop else - movup.2 - swap.5 - movdn.2 - swap.4 + locaddr.0 + push.0 swap.1 - drop - drop - drop + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.1 + movup.2 add u32assert push.4 @@ -2373,8 +4092,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.4 - swap.1 u32divmod.4 swap.1 trace.240 @@ -2382,8 +4099,25 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + push.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + swap.1 add u32assert push.4 @@ -2401,68 +4135,27 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop - push.0 - swap.1 - swap.3 - swap.2 - swap.1 end else - swap.1 - drop - movup.3 - drop - movup.3 - drop - movup.3 - drop - push.3735929054 + nop end push.0 push.1 - dup.3 - cdrop - push.3735929054 - dup.3 - dup.5 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.7 - swap.1 - cdrop - push.3735929054 - dup.5 - movup.2 - swap.7 - movdn.2 - cdrop - push.3735929054 movup.2 - swap.7 - movdn.2 - swap.1 - swap.5 cdrop - swap.1 - swap.5 - swap.4 - swap.2 - swap.3 - swap.1 end - movup.5 eq.0 if.true - movup.2 - drop - movup.2 - drop - movup.2 - drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + swap.1 add u32assert push.4 @@ -2481,11 +4174,34 @@ proc ::try_allocate_in( trace.252 nop push.1 + locaddr.3 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop else - drop - drop + nop end + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 push.4 dup.1 swap.1 @@ -2499,6 +4215,14 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114176 @@ -2511,6 +4235,7 @@ proc ::try_allocate_in( nop end +@locals("2") @callconv("C") proc alloc::raw_vec::handle_error(i32, i32) drop @@ -2519,6 +4244,7 @@ proc alloc::raw_vec::handle_error(i32, i32) assert end +@locals("3") @callconv("C") proc core::slice::index::slice_index_fail::do_panic::runtime( i32, @@ -2532,6 +4258,7 @@ proc core::slice::index::slice_index_fail::do_panic::runtime( assert end +@locals("2") @callconv("C") proc ::max( i32, @@ -2547,9 +4274,7 @@ proc ::max( end @callconv("C") -proc miden::output_note::create( - felt, - felt, +proc miden::protocol::output_note::create( felt, felt, felt, @@ -2559,7 +4284,7 @@ proc miden::output_note::create( ) -> felt trace.240 nop - exec.::miden::output_note::create + exec.::miden::protocol::output_note::create trace.252 nop end diff --git a/tests/integration/expected/examples/basic_wallet_tx_script.wat b/tests/integration/expected/examples/basic_wallet_tx_script.wat index 109a772e3..c150ba832 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.wat +++ b/tests/integration/expected/examples/basic_wallet_tx_script.wat @@ -36,7 +36,7 @@ (type (;6;) (func (param i32 i32 i32) (result i32))) (type (;7;) (func (result i32))) (type (;8;) (func (param i32))) - (type (;9;) (func (param f32 f32 f32 f32 i32) (result f32))) + (type (;9;) (func (param f32 f32 i32) (result f32))) (type (;10;) (func (param i32 i32))) (type (;11;) (func (param f32 f32 f32 f32) (result f32))) (type (;12;) (func (param f32) (result i64))) @@ -45,7 +45,7 @@ (type (;15;) (func (param i64) (result f32))) (type (;16;) (func (param f32 i32 f32 f32 f32 f32) (result i32))) (type (;17;) (func (param i32 i32 i32 i32 i32))) - (type (;18;) (func (param f32 f32 f32 f32 f32 f32 f32 f32) (result f32))) + (type (;18;) (func (param f32 f32 f32 f32 f32 f32) (result f32))) (import "miden:basic-wallet/basic-wallet@0.1.0" "move-asset-to-note" (func $basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_asset_to_note::wit_import9 (;0;) (type 0))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -121,7 +121,7 @@ call $core::slice::index::slice_index_fail::do_panic::runtime unreachable ) - (func $ as core::ops::index::Index>>::index (;7;) (type 4) (param i32 i32 i32 i32) + (func $ as core::ops::index::Index>>::index (;7;) (type 4) (param i32 i32 i32 i32) (local i32) block ;; label = @1 local.get 3 @@ -209,7 +209,7 @@ local.get 2 local.get 1 local.get 0 - call $std::mem::pipe_preimage_to_memory + call $miden::core::mem::pipe_preimage_to_memory drop local.get 4 local.get 7 @@ -224,26 +224,20 @@ i32.eqz br_if 1 (;@1;) local.get 9 - f32.load offset=12 - local.set 0 - local.get 9 - f32.load offset=8 - local.set 1 - local.get 9 f32.load offset=4 - local.set 2 + local.set 0 local.get 9 f32.load - local.set 3 + local.set 1 local.get 4 i32.const 8 i32.add local.get 4 i32.const 20 i32.add - i32.const 4 - i32.const 8 - call $ as core::ops::index::Index>>::index + i32.const 2 + i32.const 6 + call $ as core::ops::index::Index>>::index local.get 4 i32.load offset=12 i32.const 4 @@ -271,9 +265,7 @@ local.get 4 i32.const 32 i32.add - call $>::from - local.get 3 - local.get 2 + call $>::from local.get 1 local.get 0 local.get 4 @@ -285,9 +277,9 @@ local.get 4 i32.const 20 i32.add - i32.const 8 - i32.const 12 - call $ as core::ops::index::Index>>::index + i32.const 6 + i32.const 10 + call $ as core::ops::index::Index>>::index local.get 4 i32.load offset=4 i32.const 4 @@ -315,7 +307,7 @@ local.get 4 i32.const 48 i32.add - call $>::from + call $>::from local.get 4 f32.load offset=64 local.get 4 @@ -329,11 +321,11 @@ local.get 4 i32.const 20 i32.add - call $ as core::ops::drop::Drop>::drop + call $ as core::ops::drop::Drop>::drop local.get 4 i32.const 20 i32.add - call $ as core::ops::drop::Drop>::drop + call $ as core::ops::drop::Drop>::drop local.get 4 i32.const 80 i32.add @@ -443,28 +435,26 @@ (func $intrinsics::mem::heap_base (;12;) (type 7) (result i32) unreachable ) - (func $ as core::ops::drop::Drop>::drop (;13;) (type 8) (param i32) + (func $ as core::ops::drop::Drop>::drop (;13;) (type 8) (param i32) local.get 0 i32.const 4 i32.const 4 call $::deallocate ) - (func $miden_base_sys::bindings::output_note::create (;14;) (type 9) (param f32 f32 f32 f32 i32) (result f32) + (func $miden_base_sys::bindings::output_note::create (;14;) (type 9) (param f32 f32 i32) (result f32) local.get 0 local.get 1 local.get 2 - local.get 3 - local.get 4 f32.load offset=12 - local.get 4 + local.get 2 f32.load offset=8 - local.get 4 + local.get 2 f32.load offset=4 - local.get 4 + local.get 2 f32.load - call $miden::output_note::create + call $miden::protocol::output_note::create ) - (func $>::from (;15;) (type 10) (param i32 i32) + (func $>::from (;15;) (type 10) (param i32 i32) local.get 0 local.get 1 i64.load offset=8 align=4 @@ -474,7 +464,7 @@ i64.load align=4 i64.store ) - (func $ as core::ops::drop::Drop>::drop (;16;) (type 8) (param i32)) + (func $ as core::ops::drop::Drop>::drop (;16;) (type 8) (param i32)) (func $intrinsics::advice::adv_push_mapvaln (;17;) (type 11) (param f32 f32 f32 f32) (result f32) unreachable ) @@ -490,7 +480,7 @@ (func $intrinsics::felt::from_u64_unchecked (;21;) (type 15) (param i64) (result f32) unreachable ) - (func $std::mem::pipe_preimage_to_memory (;22;) (type 16) (param f32 i32 f32 f32 f32 f32) (result i32) + (func $miden::core::mem::pipe_preimage_to_memory (;22;) (type 16) (param f32 i32 f32 f32 f32 f32) (result i32) unreachable ) (func $::alloc_impl (;23;) (type 4) (param i32 i32 i32 i32) @@ -752,7 +742,7 @@ i32.gt_u select ) - (func $miden::output_note::create (;32;) (type 18) (param f32 f32 f32 f32 f32 f32 f32 f32) (result f32) + (func $miden::protocol::output_note::create (;32;) (type 18) (param f32 f32 f32 f32 f32 f32) (result f32) unreachable ) (data $.rodata (;0;) (i32.const 1048576) "\00") diff --git a/tests/integration/expected/examples/counter.hir b/tests/integration/expected/examples/counter.hir index cc8d3632f..880cbfa49 100644 --- a/tests/integration/expected/examples/counter.hir +++ b/tests/integration/expected/examples/counter.hir @@ -10,620 +10,512 @@ builtin.component miden:counter-contract/counter-contract@0.1.0 { builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::storage::get_map_item(v0: i32, v1: i32) { - ^block9(v0: i32, v1: i32): - v3 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr - v4 = hir.bitcast v3 : ptr; - v5 = hir.load v4 : i32; - v6 = arith.constant 32 : i32; - v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; - v8 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr - v9 = hir.bitcast v8 : ptr; - hir.store v9, v7; - v2 = arith.constant 0 : i32; - v11 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/>::from(v2) : felt - v13 = arith.constant 12 : u32; - v12 = hir.bitcast v1 : u32; - v14 = arith.add v12, v13 : u32 #[overflow = checked]; - v15 = arith.constant 4 : u32; - v16 = arith.mod v14, v15 : u32; - hir.assertz v16 #[code = 250]; - v17 = hir.int_to_ptr v14 : ptr; - v18 = hir.load v17 : felt; - v20 = arith.constant 8 : u32; - v19 = hir.bitcast v1 : u32; - v21 = arith.add v19, v20 : u32 #[overflow = checked]; - v499 = arith.constant 4 : u32; - v23 = arith.mod v21, v499 : u32; - hir.assertz v23 #[code = 250]; - v24 = hir.int_to_ptr v21 : ptr; - v25 = hir.load v24 : felt; - v498 = arith.constant 4 : u32; - v26 = hir.bitcast v1 : u32; - v28 = arith.add v26, v498 : u32 #[overflow = checked]; - v497 = arith.constant 4 : u32; - v30 = arith.mod v28, v497 : u32; - hir.assertz v30 #[code = 250]; - v31 = hir.int_to_ptr v28 : ptr; - v32 = hir.load v31 : felt; - v33 = hir.bitcast v1 : u32; - v496 = arith.constant 4 : u32; - v35 = arith.mod v33, v496 : u32; - hir.assertz v35 #[code = 250]; - v36 = hir.int_to_ptr v33 : ptr; - v37 = hir.load v36 : felt; - hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden::active_account::get_map_item(v11, v18, v25, v32, v37, v7) - v495 = arith.constant 8 : u32; - v38 = hir.bitcast v7 : u32; - v40 = arith.add v38, v495 : u32 #[overflow = checked]; - v494 = arith.constant 8 : u32; - v42 = arith.mod v40, v494 : u32; - hir.assertz v42 #[code = 250]; - v43 = hir.int_to_ptr v40 : ptr; - v44 = hir.load v43 : i64; - v46 = arith.constant 24 : u32; - v45 = hir.bitcast v7 : u32; - v47 = arith.add v45, v46 : u32 #[overflow = checked]; - v493 = arith.constant 8 : u32; - v49 = arith.mod v47, v493 : u32; - hir.assertz v49 #[code = 250]; - v50 = hir.int_to_ptr v47 : ptr; - hir.store v50, v44; - v51 = hir.bitcast v7 : u32; - v492 = arith.constant 8 : u32; - v53 = arith.mod v51, v492 : u32; - hir.assertz v53 #[code = 250]; - v54 = hir.int_to_ptr v51 : ptr; - v55 = hir.load v54 : i64; - v57 = arith.constant 16 : u32; - v56 = hir.bitcast v7 : u32; - v58 = arith.add v56, v57 : u32 #[overflow = checked]; - v491 = arith.constant 8 : u32; - v60 = arith.mod v58, v491 : u32; - hir.assertz v60 #[code = 250]; - v61 = hir.int_to_ptr v58 : ptr; - hir.store v61, v55; - v62 = arith.constant 16 : i32; - v63 = arith.add v7, v62 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/::reverse(v0, v63) - v490 = arith.constant 32 : i32; - v65 = arith.add v7, v490 : i32 #[overflow = wrapping]; - v66 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr - v67 = hir.bitcast v66 : ptr; - hir.store v67, v65; + private builtin.function @miden_base_sys::bindings::storage::get_map_item(v0: i32, v1: felt, v2: felt, v3: i32) { + ^block9(v0: i32, v1: felt, v2: felt, v3: i32): + hir.store_local v0 #[local = lv0]; + hir.store_local v3 #[local = lv3]; + v4 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr + v5 = hir.bitcast v4 : ptr; + v6 = hir.load v5 : i32; + v442 = arith.constant 16 : i32; + v8 = arith.sub v6, v442 : i32 #[overflow = wrapping]; + hir.store_local v8 #[local = lv4]; + v9 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr + v10 = hir.bitcast v9 : ptr; + hir.store v10, v8; + v13 = hir.load_local : i32 #[local = lv3]; + v441 = arith.constant 12 : u32; + v14 = hir.bitcast v13 : u32; + v16 = arith.add v14, v441 : u32 #[overflow = checked]; + v440 = arith.constant 4 : u32; + v18 = arith.mod v16, v440 : u32; + hir.assertz v18 #[code = 250]; + v19 = hir.int_to_ptr v16 : ptr; + v20 = hir.load v19 : felt; + v21 = hir.load_local : i32 #[local = lv3]; + v439 = arith.constant 8 : u32; + v22 = hir.bitcast v21 : u32; + v24 = arith.add v22, v439 : u32 #[overflow = checked]; + v464 = arith.constant 4 : u32; + v26 = arith.mod v24, v464 : u32; + hir.assertz v26 #[code = 250]; + v27 = hir.int_to_ptr v24 : ptr; + v28 = hir.load v27 : felt; + v29 = hir.load_local : i32 #[local = lv3]; + v463 = arith.constant 4 : u32; + v30 = hir.bitcast v29 : u32; + v32 = arith.add v30, v463 : u32 #[overflow = checked]; + v462 = arith.constant 4 : u32; + v34 = arith.mod v32, v462 : u32; + hir.assertz v34 #[code = 250]; + v35 = hir.int_to_ptr v32 : ptr; + v36 = hir.load v35 : felt; + v37 = hir.load_local : i32 #[local = lv3]; + v38 = hir.bitcast v37 : u32; + v461 = arith.constant 4 : u32; + v40 = arith.mod v38, v461 : u32; + hir.assertz v40 #[code = 250]; + v41 = hir.int_to_ptr v38 : ptr; + v42 = hir.load v41 : felt; + v43 = hir.load_local : i32 #[local = lv4]; + hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden::protocol::active_account::get_map_item(v2, v1, v20, v28, v36, v42, v43) + v44 = hir.load_local : i32 #[local = lv0]; + v45 = hir.load_local : i32 #[local = lv4]; + v46 = hir.bitcast v45 : u32; + v460 = arith.constant 8 : u32; + v48 = arith.mod v46, v460 : u32; + hir.assertz v48 #[code = 250]; + v49 = hir.int_to_ptr v46 : ptr; + v50 = hir.load v49 : i64; + v436, v437 = arith.split v50 : felt, felt; + v459 = arith.constant 8 : u32; + v54 = hir.bitcast v44 : u32; + v56 = arith.add v54, v459 : u32 #[overflow = checked]; + v458 = arith.constant 8 : u32; + v58 = arith.mod v56, v458 : u32; + hir.assertz v58 #[code = 250]; + v438 = arith.join v437, v436 : i64; + v59 = hir.int_to_ptr v56 : ptr; + hir.store v59, v438; + v60 = hir.load_local : i32 #[local = lv0]; + v61 = hir.load_local : i32 #[local = lv4]; + v457 = arith.constant 8 : u32; + v62 = hir.bitcast v61 : u32; + v64 = arith.add v62, v457 : u32 #[overflow = checked]; + v456 = arith.constant 8 : u32; + v66 = arith.mod v64, v456 : u32; + hir.assertz v66 #[code = 250]; + v67 = hir.int_to_ptr v64 : ptr; + v68 = hir.load v67 : i64; + v433, v434 = arith.split v68 : felt, felt; + v72 = hir.bitcast v60 : u32; + v455 = arith.constant 8 : u32; + v74 = arith.mod v72, v455 : u32; + hir.assertz v74 #[code = 250]; + v435 = arith.join v434, v433 : i64; + v75 = hir.int_to_ptr v72 : ptr; + hir.store v75, v435; + v76 = hir.load_local : i32 #[local = lv4]; + v454 = arith.constant 16 : i32; + v78 = arith.add v76, v454 : i32 #[overflow = wrapping]; + v79 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr + v80 = hir.bitcast v79 : ptr; + hir.store v80, v78; + builtin.ret ; + }; + + private builtin.function @::default(v81: i32) { + ^block11(v81: i32): + hir.store_local v81 #[local = lv0]; + v84 = hir.load_local : i32 #[local = lv0]; + v465 = arith.constant 4 : u32; + v87 = hir.bitcast v84 : u32; + v89 = arith.add v87, v465 : u32 #[overflow = checked]; + v471 = arith.constant 4 : u32; + v91 = arith.mod v89, v471 : u32; + hir.assertz v91 #[code = 250]; + v466 = arith.constant 1466204381252459361 : i64; + v86 = arith.trunc v466 : felt; + v92 = hir.int_to_ptr v89 : ptr; + hir.store v92, v86; + v93 = hir.load_local : i32 #[local = lv0]; + v95 = hir.bitcast v93 : u32; + v470 = arith.constant 4 : u32; + v97 = arith.mod v95, v470 : u32; + hir.assertz v97 #[code = 250]; + v467 = arith.constant -6649237899119803499 : i64; + v83 = arith.trunc v467 : felt; + v98 = hir.int_to_ptr v95 : ptr; + hir.store v98, v83; builtin.ret ; }; private builtin.function @miden:counter-contract/counter-contract@0.1.0#get-count() -> felt { - ^block11: - v71 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr - v72 = hir.bitcast v71 : ptr; - v73 = hir.load v72 : i32; - v74 = arith.constant 32 : i32; - v75 = arith.sub v73, v74 : i32 #[overflow = wrapping]; - v76 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr - v77 = hir.bitcast v76 : ptr; - hir.store v77, v75; + ^block13: + v100 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr + v101 = hir.bitcast v100 : ptr; + v102 = hir.load v101 : i32; + v485 = arith.constant 48 : i32; + v104 = arith.sub v102, v485 : i32 #[overflow = wrapping]; + hir.store_local v104 #[local = lv0]; + v105 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr + v106 = hir.bitcast v105 : ptr; + hir.store v106, v104; hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/wit_bindgen::rt::run_ctors_once() - v69 = arith.constant 0 : i32; - v79 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/intrinsics::felt::from_u32(v69) : felt - v507 = arith.constant 0 : i32; - v81 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/intrinsics::felt::from_u32(v507) : felt - v506 = arith.constant 0 : i32; - v83 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/intrinsics::felt::from_u32(v506) : felt - v84 = arith.constant 1 : i32; - v85 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/intrinsics::felt::from_u32(v84) : felt - v87 = arith.constant 12 : u32; - v86 = hir.bitcast v75 : u32; - v88 = arith.add v86, v87 : u32 #[overflow = checked]; - v89 = arith.constant 4 : u32; - v90 = arith.mod v88, v89 : u32; - hir.assertz v90 #[code = 250]; - v91 = hir.int_to_ptr v88 : ptr; - hir.store v91, v85; - v93 = arith.constant 8 : u32; - v92 = hir.bitcast v75 : u32; - v94 = arith.add v92, v93 : u32 #[overflow = checked]; - v505 = arith.constant 4 : u32; - v96 = arith.mod v94, v505 : u32; - hir.assertz v96 #[code = 250]; - v97 = hir.int_to_ptr v94 : ptr; - hir.store v97, v83; - v504 = arith.constant 4 : u32; - v98 = hir.bitcast v75 : u32; - v100 = arith.add v98, v504 : u32 #[overflow = checked]; - v503 = arith.constant 4 : u32; - v102 = arith.mod v100, v503 : u32; - hir.assertz v102 #[code = 250]; - v103 = hir.int_to_ptr v100 : ptr; - hir.store v103, v81; - v104 = hir.bitcast v75 : u32; - v502 = arith.constant 4 : u32; - v106 = arith.mod v104, v502 : u32; - hir.assertz v106 #[code = 250]; - v107 = hir.int_to_ptr v104 : ptr; - hir.store v107, v79; - v108 = arith.constant 16 : i32; - v109 = arith.add v75, v108 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden_base_sys::bindings::storage::get_map_item(v109, v75) - v111 = arith.constant 28 : u32; - v110 = hir.bitcast v75 : u32; - v112 = arith.add v110, v111 : u32 #[overflow = checked]; + v107 = hir.load_local : i32 #[local = lv0]; + v484 = arith.constant 8 : i32; + v109 = arith.add v107, v484 : i32 #[overflow = wrapping]; + hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/::default(v109) + v110 = hir.load_local : i32 #[local = lv0]; + v483 = arith.constant 12 : u32; + v111 = hir.bitcast v110 : u32; + v113 = arith.add v111, v483 : u32 #[overflow = checked]; + v482 = arith.constant 4 : u32; + v115 = arith.mod v113, v482 : u32; + hir.assertz v115 #[code = 250]; + v116 = hir.int_to_ptr v113 : ptr; + v117 = hir.load v116 : felt; + hir.store_local v117 #[local = lv1]; + v118 = hir.load_local : i32 #[local = lv0]; + v481 = arith.constant 8 : u32; + v119 = hir.bitcast v118 : u32; + v121 = arith.add v119, v481 : u32 #[overflow = checked]; v501 = arith.constant 4 : u32; - v114 = arith.mod v112, v501 : u32; - hir.assertz v114 #[code = 250]; - v115 = hir.int_to_ptr v112 : ptr; - v116 = hir.load v115 : felt; - v500 = arith.constant 32 : i32; - v118 = arith.add v75, v500 : i32 #[overflow = wrapping]; - v119 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr - v120 = hir.bitcast v119 : ptr; - hir.store v120, v118; - builtin.ret v116; + v123 = arith.mod v121, v501 : u32; + hir.assertz v123 #[code = 250]; + v124 = hir.int_to_ptr v121 : ptr; + v125 = hir.load v124 : felt; + v480 = arith.constant 0 : i64; + v129 = arith.trunc v480 : felt; + v132 = hir.load_local : i32 #[local = lv0]; + v478 = arith.constant 28 : u32; + v135 = hir.bitcast v132 : u32; + v137 = arith.add v135, v478 : u32 #[overflow = checked]; + v500 = arith.constant 4 : u32; + v139 = arith.mod v137, v500 : u32; + hir.assertz v139 #[code = 250]; + v479 = arith.constant 1 : i64; + v134 = arith.trunc v479 : felt; + v140 = hir.int_to_ptr v137 : ptr; + hir.store v140, v134; + v141 = hir.load_local : i32 #[local = lv0]; + v477 = arith.constant 24 : u32; + v143 = hir.bitcast v141 : u32; + v145 = arith.add v143, v477 : u32 #[overflow = checked]; + v499 = arith.constant 4 : u32; + v147 = arith.mod v145, v499 : u32; + hir.assertz v147 #[code = 250]; + v148 = hir.int_to_ptr v145 : ptr; + hir.store v148, v129; + v149 = hir.load_local : i32 #[local = lv0]; + v476 = arith.constant 20 : u32; + v151 = hir.bitcast v149 : u32; + v153 = arith.add v151, v476 : u32 #[overflow = checked]; + v498 = arith.constant 4 : u32; + v155 = arith.mod v153, v498 : u32; + hir.assertz v155 #[code = 250]; + v156 = hir.int_to_ptr v153 : ptr; + hir.store v156, v129; + v157 = hir.load_local : i32 #[local = lv0]; + v475 = arith.constant 16 : u32; + v159 = hir.bitcast v157 : u32; + v161 = arith.add v159, v475 : u32 #[overflow = checked]; + v497 = arith.constant 4 : u32; + v163 = arith.mod v161, v497 : u32; + hir.assertz v163 #[code = 250]; + v496 = arith.constant 0 : i64; + v127 = arith.trunc v496 : felt; + v164 = hir.int_to_ptr v161 : ptr; + hir.store v164, v127; + v165 = hir.load_local : i32 #[local = lv0]; + v169 = hir.load_local : felt #[local = lv1]; + v473 = arith.constant 16 : i32; + v172 = arith.add v165, v473 : i32 #[overflow = wrapping]; + v474 = arith.constant 32 : i32; + v167 = arith.add v165, v474 : i32 #[overflow = wrapping]; + hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden_base_sys::bindings::storage::get_map_item(v167, v125, v169, v172) + v173 = hir.load_local : i32 #[local = lv0]; + v472 = arith.constant 44 : u32; + v174 = hir.bitcast v173 : u32; + v176 = arith.add v174, v472 : u32 #[overflow = checked]; + v495 = arith.constant 4 : u32; + v178 = arith.mod v176, v495 : u32; + hir.assertz v178 #[code = 250]; + v179 = hir.int_to_ptr v176 : ptr; + v180 = hir.load v179 : felt; + hir.store_local v180 #[local = lv1]; + v181 = hir.load_local : i32 #[local = lv0]; + v494 = arith.constant 48 : i32; + v183 = arith.add v181, v494 : i32 #[overflow = wrapping]; + v184 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr + v185 = hir.bitcast v184 : ptr; + hir.store v185, v183; + v186 = hir.load_local : felt #[local = lv1]; + builtin.ret v186; }; private builtin.function @miden:counter-contract/counter-contract@0.1.0#increment-count() -> felt { - ^block13: - v124 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr - v125 = hir.bitcast v124 : ptr; - v126 = hir.load v125 : i32; - v127 = arith.constant 144 : i32; - v128 = arith.sub v126, v127 : i32 #[overflow = wrapping]; - v129 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr - v130 = hir.bitcast v129 : ptr; - hir.store v130, v128; + ^block15: + v188 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr + v189 = hir.bitcast v188 : ptr; + v190 = hir.load v189 : i32; + v522 = arith.constant 64 : i32; + v192 = arith.sub v190, v522 : i32 #[overflow = wrapping]; + hir.store_local v192 #[local = lv0]; + v193 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr + v194 = hir.bitcast v193 : ptr; + hir.store v194, v192; hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/wit_bindgen::rt::run_ctors_once() - v122 = arith.constant 0 : i32; - v132 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/intrinsics::felt::from_u32(v122) : felt - v530 = arith.constant 0 : i32; - v134 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/intrinsics::felt::from_u32(v530) : felt - v529 = arith.constant 0 : i32; - v136 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/intrinsics::felt::from_u32(v529) : felt - v137 = arith.constant 1 : i32; - v138 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/intrinsics::felt::from_u32(v137) : felt - v140 = arith.constant 12 : u32; - v139 = hir.bitcast v128 : u32; - v141 = arith.add v139, v140 : u32 #[overflow = checked]; - v142 = arith.constant 4 : u32; - v143 = arith.mod v141, v142 : u32; - hir.assertz v143 #[code = 250]; - v144 = hir.int_to_ptr v141 : ptr; - hir.store v144, v138; - v146 = arith.constant 8 : u32; - v145 = hir.bitcast v128 : u32; - v147 = arith.add v145, v146 : u32 #[overflow = checked]; - v528 = arith.constant 4 : u32; - v149 = arith.mod v147, v528 : u32; - hir.assertz v149 #[code = 250]; - v150 = hir.int_to_ptr v147 : ptr; - hir.store v150, v136; - v527 = arith.constant 4 : u32; - v151 = hir.bitcast v128 : u32; - v153 = arith.add v151, v527 : u32 #[overflow = checked]; - v526 = arith.constant 4 : u32; - v155 = arith.mod v153, v526 : u32; - hir.assertz v155 #[code = 250]; - v156 = hir.int_to_ptr v153 : ptr; - hir.store v156, v134; - v157 = hir.bitcast v128 : u32; - v525 = arith.constant 4 : u32; - v159 = arith.mod v157, v525 : u32; - hir.assertz v159 #[code = 250]; - v160 = hir.int_to_ptr v157 : ptr; - hir.store v160, v132; - v161 = arith.constant 64 : i32; - v162 = arith.add v128, v161 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden_base_sys::bindings::storage::get_map_item(v162, v128) - v166 = arith.constant 76 : u32; - v165 = hir.bitcast v128 : u32; - v167 = arith.add v165, v166 : u32 #[overflow = checked]; - v524 = arith.constant 4 : u32; - v169 = arith.mod v167, v524 : u32; - hir.assertz v169 #[code = 250]; - v170 = hir.int_to_ptr v167 : ptr; - v171 = hir.load v170 : felt; - v523 = arith.constant 1 : i32; - v173 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/intrinsics::felt::from_u32(v523) : felt - v174 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/intrinsics::felt::add(v171, v173) : felt - v163 = arith.constant 48 : i32; - v164 = arith.add v128, v163 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/>::from(v164, v174) - v522 = arith.constant 0 : i32; - v176 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/>::from(v522) : felt - v178 = arith.constant 60 : u32; - v177 = hir.bitcast v128 : u32; - v179 = arith.add v177, v178 : u32 #[overflow = checked]; - v521 = arith.constant 4 : u32; - v181 = arith.mod v179, v521 : u32; - hir.assertz v181 #[code = 250]; - v182 = hir.int_to_ptr v179 : ptr; - v183 = hir.load v182 : felt; - v185 = arith.constant 56 : u32; - v184 = hir.bitcast v128 : u32; - v186 = arith.add v184, v185 : u32 #[overflow = checked]; - v520 = arith.constant 4 : u32; - v188 = arith.mod v186, v520 : u32; - hir.assertz v188 #[code = 250]; - v189 = hir.int_to_ptr v186 : ptr; - v190 = hir.load v189 : felt; - v192 = arith.constant 52 : u32; - v191 = hir.bitcast v128 : u32; - v193 = arith.add v191, v192 : u32 #[overflow = checked]; + v195 = hir.load_local : i32 #[local = lv0]; + v521 = arith.constant 8 : i32; + v197 = arith.add v195, v521 : i32 #[overflow = wrapping]; + hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/::default(v197) + v198 = hir.load_local : i32 #[local = lv0]; + v520 = arith.constant 12 : u32; + v199 = hir.bitcast v198 : u32; + v201 = arith.add v199, v520 : u32 #[overflow = checked]; v519 = arith.constant 4 : u32; - v195 = arith.mod v193, v519 : u32; - hir.assertz v195 #[code = 250]; - v196 = hir.int_to_ptr v193 : ptr; - v197 = hir.load v196 : felt; - v199 = arith.constant 48 : u32; - v198 = hir.bitcast v128 : u32; - v200 = arith.add v198, v199 : u32 #[overflow = checked]; - v518 = arith.constant 4 : u32; - v202 = arith.mod v200, v518 : u32; - hir.assertz v202 #[code = 250]; - v203 = hir.int_to_ptr v200 : ptr; - v204 = hir.load v203 : felt; - v517 = arith.constant 64 : i32; - v206 = arith.add v128, v517 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden::native_account::set_map_item(v176, v138, v136, v134, v132, v183, v190, v197, v204, v206) - v208 = arith.constant 72 : u32; - v207 = hir.bitcast v128 : u32; - v209 = arith.add v207, v208 : u32 #[overflow = checked]; - v516 = arith.constant 8 : u32; - v211 = arith.mod v209, v516 : u32; + v203 = arith.mod v201, v519 : u32; + hir.assertz v203 #[code = 250]; + v204 = hir.int_to_ptr v201 : ptr; + v205 = hir.load v204 : felt; + hir.store_local v205 #[local = lv1]; + v206 = hir.load_local : i32 #[local = lv0]; + v518 = arith.constant 8 : u32; + v207 = hir.bitcast v206 : u32; + v209 = arith.add v207, v518 : u32 #[overflow = checked]; + v548 = arith.constant 4 : u32; + v211 = arith.mod v209, v548 : u32; hir.assertz v211 #[code = 250]; - v212 = hir.int_to_ptr v209 : ptr; - v213 = hir.load v212 : i64; - v215 = arith.constant 104 : u32; - v214 = hir.bitcast v128 : u32; - v216 = arith.add v214, v215 : u32 #[overflow = checked]; - v515 = arith.constant 8 : u32; - v218 = arith.mod v216, v515 : u32; - hir.assertz v218 #[code = 250]; - v219 = hir.int_to_ptr v216 : ptr; - hir.store v219, v213; - v221 = arith.constant 64 : u32; - v220 = hir.bitcast v128 : u32; - v222 = arith.add v220, v221 : u32 #[overflow = checked]; - v514 = arith.constant 8 : u32; - v224 = arith.mod v222, v514 : u32; - hir.assertz v224 #[code = 250]; - v225 = hir.int_to_ptr v222 : ptr; - v226 = hir.load v225 : i64; - v228 = arith.constant 96 : u32; - v227 = hir.bitcast v128 : u32; - v229 = arith.add v227, v228 : u32 #[overflow = checked]; - v513 = arith.constant 8 : u32; - v231 = arith.mod v229, v513 : u32; - hir.assertz v231 #[code = 250]; - v232 = hir.int_to_ptr v229 : ptr; - hir.store v232, v226; - v233 = arith.constant 88 : i32; - v234 = arith.add v128, v233 : i32 #[overflow = wrapping]; - v235 = hir.bitcast v234 : u32; - v512 = arith.constant 8 : u32; - v237 = arith.mod v235, v512 : u32; - hir.assertz v237 #[code = 250]; - v238 = hir.int_to_ptr v235 : ptr; - v239 = hir.load v238 : i64; - v241 = arith.constant 120 : u32; - v240 = hir.bitcast v128 : u32; - v242 = arith.add v240, v241 : u32 #[overflow = checked]; - v511 = arith.constant 8 : u32; - v244 = arith.mod v242, v511 : u32; - hir.assertz v244 #[code = 250]; - v245 = hir.int_to_ptr v242 : ptr; - hir.store v245, v239; - v247 = arith.constant 80 : u32; - v246 = hir.bitcast v128 : u32; - v248 = arith.add v246, v247 : u32 #[overflow = checked]; - v510 = arith.constant 8 : u32; - v250 = arith.mod v248, v510 : u32; - hir.assertz v250 #[code = 250]; - v251 = hir.int_to_ptr v248 : ptr; - v252 = hir.load v251 : i64; - v254 = arith.constant 112 : u32; - v253 = hir.bitcast v128 : u32; - v255 = arith.add v253, v254 : u32 #[overflow = checked]; - v509 = arith.constant 8 : u32; - v257 = arith.mod v255, v509 : u32; - hir.assertz v257 #[code = 250]; - v258 = hir.int_to_ptr v255 : ptr; - hir.store v258, v252; - v261 = arith.constant 96 : i32; - v262 = arith.add v128, v261 : i32 #[overflow = wrapping]; - v259 = arith.constant 16 : i32; - v260 = arith.add v128, v259 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/::reverse(v260, v262) - v265 = arith.constant 112 : i32; - v266 = arith.add v128, v265 : i32 #[overflow = wrapping]; - v263 = arith.constant 128 : i32; - v264 = arith.add v128, v263 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/::reverse(v264, v266) - v508 = arith.constant 144 : i32; - v268 = arith.add v128, v508 : i32 #[overflow = wrapping]; - v269 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr - v270 = hir.bitcast v269 : ptr; - hir.store v270, v268; - builtin.ret v174; + v212 = hir.int_to_ptr v209 : ptr; + v213 = hir.load v212 : felt; + hir.store_local v213 #[local = lv2]; + v517 = arith.constant 0 : i64; + v215 = arith.trunc v517 : felt; + hir.store_local v215 #[local = lv3]; + v547 = arith.constant 0 : i64; + v217 = arith.trunc v547 : felt; + hir.store_local v217 #[local = lv4]; + hir.store_local v217 #[local = lv5]; + v220 = hir.load_local : i32 #[local = lv0]; + v516 = arith.constant 1 : i64; + v222 = arith.trunc v516 : felt; + hir.store_local v222 #[local = lv6]; + v515 = arith.constant 28 : u32; + v223 = hir.bitcast v220 : u32; + v225 = arith.add v223, v515 : u32 #[overflow = checked]; + v546 = arith.constant 4 : u32; + v227 = arith.mod v225, v546 : u32; + hir.assertz v227 #[code = 250]; + v228 = hir.int_to_ptr v225 : ptr; + hir.store v228, v222; + v229 = hir.load_local : i32 #[local = lv0]; + v230 = hir.load_local : felt #[local = lv5]; + v514 = arith.constant 24 : u32; + v231 = hir.bitcast v229 : u32; + v233 = arith.add v231, v514 : u32 #[overflow = checked]; + v545 = arith.constant 4 : u32; + v235 = arith.mod v233, v545 : u32; + hir.assertz v235 #[code = 250]; + v236 = hir.int_to_ptr v233 : ptr; + hir.store v236, v230; + v237 = hir.load_local : i32 #[local = lv0]; + v238 = hir.load_local : felt #[local = lv4]; + v513 = arith.constant 20 : u32; + v239 = hir.bitcast v237 : u32; + v241 = arith.add v239, v513 : u32 #[overflow = checked]; + v544 = arith.constant 4 : u32; + v243 = arith.mod v241, v544 : u32; + hir.assertz v243 #[code = 250]; + v244 = hir.int_to_ptr v241 : ptr; + hir.store v244, v238; + v245 = hir.load_local : i32 #[local = lv0]; + v246 = hir.load_local : felt #[local = lv3]; + v512 = arith.constant 16 : u32; + v247 = hir.bitcast v245 : u32; + v249 = arith.add v247, v512 : u32 #[overflow = checked]; + v543 = arith.constant 4 : u32; + v251 = arith.mod v249, v543 : u32; + hir.assertz v251 #[code = 250]; + v252 = hir.int_to_ptr v249 : ptr; + hir.store v252, v246; + v253 = hir.load_local : i32 #[local = lv0]; + v256 = hir.load_local : felt #[local = lv2]; + v257 = hir.load_local : felt #[local = lv1]; + v510 = arith.constant 16 : i32; + v260 = arith.add v253, v510 : i32 #[overflow = wrapping]; + v511 = arith.constant 48 : i32; + v255 = arith.add v253, v511 : i32 #[overflow = wrapping]; + hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden_base_sys::bindings::storage::get_map_item(v255, v256, v257, v260) + v261 = hir.load_local : i32 #[local = lv0]; + v508 = arith.constant 60 : u32; + v265 = hir.bitcast v261 : u32; + v267 = arith.add v265, v508 : u32 #[overflow = checked]; + v542 = arith.constant 4 : u32; + v269 = arith.mod v267, v542 : u32; + hir.assertz v269 #[code = 250]; + v270 = hir.int_to_ptr v267 : ptr; + v271 = hir.load v270 : felt; + v503 = arith.constant 1 : felt; + v274 = arith.add v271, v503 : felt #[overflow = unchecked]; + hir.store_local v274 #[local = lv7]; + v509 = arith.constant 32 : i32; + v263 = arith.add v261, v509 : i32 #[overflow = wrapping]; + hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/>::from(v263, v274) + v275 = hir.load_local : felt #[local = lv1]; + v276 = hir.load_local : felt #[local = lv2]; + v277 = hir.load_local : felt #[local = lv6]; + v278 = hir.load_local : felt #[local = lv5]; + v279 = hir.load_local : felt #[local = lv4]; + v280 = hir.load_local : felt #[local = lv3]; + v281 = hir.load_local : i32 #[local = lv0]; + v507 = arith.constant 44 : u32; + v282 = hir.bitcast v281 : u32; + v284 = arith.add v282, v507 : u32 #[overflow = checked]; + v541 = arith.constant 4 : u32; + v286 = arith.mod v284, v541 : u32; + hir.assertz v286 #[code = 250]; + v287 = hir.int_to_ptr v284 : ptr; + v288 = hir.load v287 : felt; + v289 = hir.load_local : i32 #[local = lv0]; + v506 = arith.constant 40 : u32; + v290 = hir.bitcast v289 : u32; + v292 = arith.add v290, v506 : u32 #[overflow = checked]; + v540 = arith.constant 4 : u32; + v294 = arith.mod v292, v540 : u32; + hir.assertz v294 #[code = 250]; + v295 = hir.int_to_ptr v292 : ptr; + v296 = hir.load v295 : felt; + v297 = hir.load_local : i32 #[local = lv0]; + v505 = arith.constant 36 : u32; + v298 = hir.bitcast v297 : u32; + v300 = arith.add v298, v505 : u32 #[overflow = checked]; + v539 = arith.constant 4 : u32; + v302 = arith.mod v300, v539 : u32; + hir.assertz v302 #[code = 250]; + v303 = hir.int_to_ptr v300 : ptr; + v304 = hir.load v303 : felt; + v305 = hir.load_local : i32 #[local = lv0]; + v504 = arith.constant 32 : u32; + v306 = hir.bitcast v305 : u32; + v308 = arith.add v306, v504 : u32 #[overflow = checked]; + v538 = arith.constant 4 : u32; + v310 = arith.mod v308, v538 : u32; + hir.assertz v310 #[code = 250]; + v311 = hir.int_to_ptr v308 : ptr; + v312 = hir.load v311 : felt; + v313 = hir.load_local : i32 #[local = lv0]; + v537 = arith.constant 48 : i32; + v315 = arith.add v313, v537 : i32 #[overflow = wrapping]; + hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden::protocol::native_account::set_map_item(v275, v276, v277, v278, v279, v280, v288, v296, v304, v312, v315) + v316 = hir.load_local : i32 #[local = lv0]; + v536 = arith.constant 64 : i32; + v318 = arith.add v316, v536 : i32 #[overflow = wrapping]; + v319 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr + v320 = hir.bitcast v319 : ptr; + hir.store v320, v318; + v321 = hir.load_local : felt #[local = lv7]; + builtin.ret v321; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { - ^block15: - v272 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/GOT.data.internal.__memory_base : ptr - v273 = hir.bitcast v272 : ptr; - v274 = hir.load v273 : i32; - v275 = arith.constant 1048584 : i32; - v276 = arith.add v274, v275 : i32 #[overflow = wrapping]; - v277 = hir.bitcast v276 : u32; - v278 = hir.int_to_ptr v277 : ptr; - v279 = hir.load v278 : u8; - v271 = arith.constant 0 : i32; - v280 = arith.zext v279 : u32; - v281 = hir.bitcast v280 : i32; - v283 = arith.neq v281, v271 : i1; - scf.if v283{ - ^block17: + ^block17: + v322 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/GOT.data.internal.__memory_base : ptr + v323 = hir.bitcast v322 : ptr; + v324 = hir.load v323 : i32; + v553 = arith.constant 1048584 : i32; + v326 = arith.add v324, v553 : i32 #[overflow = wrapping]; + v327 = hir.bitcast v326 : u32; + v328 = hir.int_to_ptr v327 : ptr; + v329 = hir.load v328 : u8; + v552 = arith.constant 0 : i32; + v330 = arith.zext v329 : u32; + v331 = hir.bitcast v330 : i32; + v333 = arith.neq v331, v552 : i1; + scf.if v333{ + ^block19: scf.yield ; } else { - ^block18: - v284 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/GOT.data.internal.__memory_base : ptr - v285 = hir.bitcast v284 : ptr; - v286 = hir.load v285 : i32; + ^block20: + v334 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/GOT.data.internal.__memory_base : ptr + v335 = hir.bitcast v334 : ptr; + v336 = hir.load v335 : i32; + hir.store_local v336 #[local = lv0]; hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/__wasm_call_ctors() - v532 = arith.constant 1 : u8; - v534 = arith.constant 1048584 : i32; - v288 = arith.add v286, v534 : i32 #[overflow = wrapping]; - v292 = hir.bitcast v288 : u32; - v293 = hir.int_to_ptr v292 : ptr; - hir.store v293, v532; + v337 = hir.load_local : i32 #[local = lv0]; + v551 = arith.constant 1 : u8; + v556 = arith.constant 1048584 : i32; + v339 = arith.add v337, v556 : i32 #[overflow = wrapping]; + v343 = hir.bitcast v339 : u32; + v344 = hir.int_to_ptr v343 : ptr; + hir.store v344, v551; scf.yield ; }; builtin.ret ; }; - private builtin.function @::reverse(v294: i32, v295: i32) { - ^block19(v294: i32, v295: i32): - v298 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr - v299 = hir.bitcast v298 : ptr; - v300 = hir.load v299 : i32; - v301 = arith.constant 16 : i32; - v302 = arith.sub v300, v301 : i32 #[overflow = wrapping]; - v304 = arith.constant 8 : u32; - v303 = hir.bitcast v295 : u32; - v305 = arith.add v303, v304 : u32 #[overflow = checked]; - v621 = arith.constant 8 : u32; - v307 = arith.mod v305, v621 : u32; - hir.assertz v307 #[code = 250]; - v308 = hir.int_to_ptr v305 : ptr; - v309 = hir.load v308 : i64; - v620 = arith.constant 8 : u32; - v310 = hir.bitcast v302 : u32; - v312 = arith.add v310, v620 : u32 #[overflow = checked]; - v313 = arith.constant 4 : u32; - v314 = arith.mod v312, v313 : u32; - hir.assertz v314 #[code = 250]; - v315 = hir.int_to_ptr v312 : ptr; - hir.store v315, v309; - v316 = hir.bitcast v295 : u32; - v619 = arith.constant 8 : u32; - v318 = arith.mod v316, v619 : u32; - hir.assertz v318 #[code = 250]; - v319 = hir.int_to_ptr v316 : ptr; - v320 = hir.load v319 : i64; - v321 = hir.bitcast v302 : u32; - v618 = arith.constant 4 : u32; - v323 = arith.mod v321, v618 : u32; - hir.assertz v323 #[code = 250]; - v324 = hir.int_to_ptr v321 : ptr; - hir.store v324, v320; - v325 = arith.constant 12 : i32; - v326 = arith.add v302, v325 : i32 #[overflow = wrapping]; - v296 = arith.constant 0 : i32; - v589, v590, v591, v592, v593, v594 = scf.while v296, v302, v326, v294 : i32, i32, i32, i32, i32, i32 { - ^block52(v595: i32, v596: i32, v597: i32, v598: i32): - v617 = arith.constant 0 : i32; - v329 = arith.constant 8 : i32; - v330 = arith.eq v595, v329 : i1; - v331 = arith.zext v330 : u32; - v332 = hir.bitcast v331 : i32; - v334 = arith.neq v332, v617 : i1; - v583, v584 = scf.if v334 : i32, i32 { - ^block51: - v543 = ub.poison i32 : i32; - scf.yield v543, v543; - } else { - ^block24: - v336 = arith.add v596, v595 : i32 #[overflow = wrapping]; - v337 = hir.bitcast v336 : u32; - v616 = arith.constant 4 : u32; - v339 = arith.mod v337, v616 : u32; - hir.assertz v339 #[code = 250]; - v340 = hir.int_to_ptr v337 : ptr; - v341 = hir.load v340 : felt; - v343 = hir.bitcast v597 : u32; - v615 = arith.constant 4 : u32; - v345 = arith.mod v343, v615 : u32; - hir.assertz v345 #[code = 250]; - v346 = hir.int_to_ptr v343 : ptr; - v347 = hir.load v346 : i32; - v348 = hir.bitcast v336 : u32; - v614 = arith.constant 4 : u32; - v350 = arith.mod v348, v614 : u32; - hir.assertz v350 #[code = 250]; - v351 = hir.int_to_ptr v348 : ptr; - hir.store v351, v347; - v352 = hir.bitcast v597 : u32; - v613 = arith.constant 4 : u32; - v354 = arith.mod v352, v613 : u32; - hir.assertz v354 #[code = 250]; - v355 = hir.int_to_ptr v352 : ptr; - hir.store v355, v341; - v358 = arith.constant -4 : i32; - v359 = arith.add v597, v358 : i32 #[overflow = wrapping]; - v356 = arith.constant 4 : i32; - v357 = arith.add v595, v356 : i32 #[overflow = wrapping]; - scf.yield v357, v359; - }; - v611 = ub.poison i32 : i32; - v586 = cf.select v334, v611, v598 : i32; - v612 = ub.poison i32 : i32; - v585 = cf.select v334, v612, v596 : i32; - v542 = arith.constant 1 : u32; - v535 = arith.constant 0 : u32; - v588 = cf.select v334, v535, v542 : u32; - v576 = arith.trunc v588 : i1; - scf.condition v576, v583, v585, v584, v586, v596, v598; - } do { - ^block53(v599: i32, v600: i32, v601: i32, v602: i32, v603: i32, v604: i32): - scf.yield v599, v600, v601, v602; - }; - v610 = arith.constant 8 : u32; - v361 = hir.bitcast v593 : u32; - v363 = arith.add v361, v610 : u32 #[overflow = checked]; - v609 = arith.constant 4 : u32; - v365 = arith.mod v363, v609 : u32; - hir.assertz v365 #[code = 250]; - v366 = hir.int_to_ptr v363 : ptr; - v367 = hir.load v366 : i64; - v608 = arith.constant 8 : u32; - v368 = hir.bitcast v594 : u32; - v370 = arith.add v368, v608 : u32 #[overflow = checked]; - v607 = arith.constant 8 : u32; - v372 = arith.mod v370, v607 : u32; - hir.assertz v372 #[code = 250]; - v373 = hir.int_to_ptr v370 : ptr; - hir.store v373, v367; - v374 = hir.bitcast v593 : u32; - v606 = arith.constant 4 : u32; - v376 = arith.mod v374, v606 : u32; - hir.assertz v376 #[code = 250]; - v377 = hir.int_to_ptr v374 : ptr; - v378 = hir.load v377 : i64; - v379 = hir.bitcast v594 : u32; - v605 = arith.constant 8 : u32; - v381 = arith.mod v379, v605 : u32; + private builtin.function @>::from(v345: i32, v346: felt) { + ^block21(v345: i32, v346: felt): + hir.store_local v345 #[local = lv0]; + v353 = hir.load_local : i32 #[local = lv0]; + v563 = arith.constant 12 : u32; + v355 = hir.bitcast v353 : u32; + v357 = arith.add v355, v563 : u32 #[overflow = checked]; + v562 = arith.constant 4 : u32; + v359 = arith.mod v357, v562 : u32; + hir.assertz v359 #[code = 250]; + v360 = hir.int_to_ptr v357 : ptr; + hir.store v360, v346; + v361 = hir.load_local : i32 #[local = lv0]; + v561 = arith.constant 8 : u32; + v363 = hir.bitcast v361 : u32; + v365 = arith.add v363, v561 : u32 #[overflow = checked]; + v575 = arith.constant 4 : u32; + v367 = arith.mod v365, v575 : u32; + hir.assertz v367 #[code = 250]; + v560 = arith.constant 0 : felt; + v368 = hir.int_to_ptr v365 : ptr; + hir.store v368, v560; + v369 = hir.load_local : i32 #[local = lv0]; + v574 = arith.constant 4 : u32; + v371 = hir.bitcast v369 : u32; + v373 = arith.add v371, v574 : u32 #[overflow = checked]; + v573 = arith.constant 4 : u32; + v375 = arith.mod v373, v573 : u32; + hir.assertz v375 #[code = 250]; + v572 = arith.constant 0 : felt; + v376 = hir.int_to_ptr v373 : ptr; + hir.store v376, v572; + v377 = hir.load_local : i32 #[local = lv0]; + v379 = hir.bitcast v377 : u32; + v571 = arith.constant 4 : u32; + v381 = arith.mod v379, v571 : u32; hir.assertz v381 #[code = 250]; - v382 = hir.int_to_ptr v379 : ptr; - hir.store v382, v378; + v570 = arith.constant 0 : felt; + v382 = hir.int_to_ptr v379 : ptr; + hir.store v382, v570; builtin.ret ; }; - private builtin.function @>::from(v383: i32) -> felt { - ^block25(v383: i32): - v385 = arith.constant 255 : i32; - v386 = arith.band v383, v385 : i32; - v387 = hir.bitcast v386 : felt; - builtin.ret v387; - }; - - private builtin.function @>::from(v388: i32, v389: felt) { - ^block27(v388: i32, v389: felt): - v391 = arith.constant 0 : i32; - v392 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/intrinsics::felt::from_u32(v391) : felt - v627 = arith.constant 0 : i32; - v394 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/intrinsics::felt::from_u32(v627) : felt - v626 = arith.constant 0 : i32; - v396 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/intrinsics::felt::from_u32(v626) : felt - v398 = arith.constant 12 : u32; - v397 = hir.bitcast v388 : u32; - v399 = arith.add v397, v398 : u32 #[overflow = checked]; - v400 = arith.constant 4 : u32; - v401 = arith.mod v399, v400 : u32; - hir.assertz v401 #[code = 250]; - v402 = hir.int_to_ptr v399 : ptr; - hir.store v402, v389; - v404 = arith.constant 8 : u32; - v403 = hir.bitcast v388 : u32; - v405 = arith.add v403, v404 : u32 #[overflow = checked]; - v625 = arith.constant 4 : u32; - v407 = arith.mod v405, v625 : u32; - hir.assertz v407 #[code = 250]; - v408 = hir.int_to_ptr v405 : ptr; - hir.store v408, v396; - v624 = arith.constant 4 : u32; - v409 = hir.bitcast v388 : u32; - v411 = arith.add v409, v624 : u32 #[overflow = checked]; - v623 = arith.constant 4 : u32; - v413 = arith.mod v411, v623 : u32; - hir.assertz v413 #[code = 250]; - v414 = hir.int_to_ptr v411 : ptr; - hir.store v414, v394; - v415 = hir.bitcast v388 : u32; - v622 = arith.constant 4 : u32; - v417 = arith.mod v415, v622 : u32; - hir.assertz v417 #[code = 250]; - v418 = hir.int_to_ptr v415 : ptr; - hir.store v418, v392; - builtin.ret ; - }; - - private builtin.function @intrinsics::felt::add(v419: felt, v420: felt) -> felt { - ^block29(v419: felt, v420: felt): - v421 = arith.add v419, v420 : felt #[overflow = unchecked]; - builtin.ret v421; - }; - - private builtin.function @intrinsics::felt::from_u32(v423: i32) -> felt { - ^block31(v423: i32): - v424 = hir.bitcast v423 : felt; - builtin.ret v424; - }; - - private builtin.function @miden::active_account::get_map_item(v426: felt, v427: felt, v428: felt, v429: felt, v430: felt, v431: i32) { - ^block33(v426: felt, v427: felt, v428: felt, v429: felt, v430: felt, v431: i32): - v432, v433, v434, v435 = hir.exec @miden/active_account/get_map_item(v426, v427, v428, v429, v430) : felt, felt, felt, felt - v436 = hir.bitcast v431 : u32; - v437 = hir.int_to_ptr v436 : ptr; - hir.store v437, v432; - v438 = arith.constant 4 : u32; - v439 = arith.add v436, v438 : u32 #[overflow = checked]; - v440 = hir.int_to_ptr v439 : ptr; - hir.store v440, v433; - v441 = arith.constant 8 : u32; - v442 = arith.add v436, v441 : u32 #[overflow = checked]; - v443 = hir.int_to_ptr v442 : ptr; - hir.store v443, v434; - v444 = arith.constant 12 : u32; - v445 = arith.add v436, v444 : u32 #[overflow = checked]; - v446 = hir.int_to_ptr v445 : ptr; - hir.store v446, v435; + private builtin.function @miden::protocol::active_account::get_map_item(v383: felt, v384: felt, v385: felt, v386: felt, v387: felt, v388: felt, v389: i32) { + ^block23(v383: felt, v384: felt, v385: felt, v386: felt, v387: felt, v388: felt, v389: i32): + v390, v391, v392, v393 = hir.exec @miden/protocol/active_account/get_map_item(v383, v384, v385, v386, v387, v388) : felt, felt, felt, felt + v394 = hir.bitcast v389 : u32; + v395 = hir.int_to_ptr v394 : ptr; + hir.store v395, v390; + v578 = arith.constant 4 : u32; + v397 = arith.add v394, v578 : u32 #[overflow = checked]; + v398 = hir.int_to_ptr v397 : ptr; + hir.store v398, v391; + v577 = arith.constant 8 : u32; + v400 = arith.add v394, v577 : u32 #[overflow = checked]; + v401 = hir.int_to_ptr v400 : ptr; + hir.store v401, v392; + v576 = arith.constant 12 : u32; + v403 = arith.add v394, v576 : u32 #[overflow = checked]; + v404 = hir.int_to_ptr v403 : ptr; + hir.store v404, v393; builtin.ret ; }; - private builtin.function @miden::native_account::set_map_item(v447: felt, v448: felt, v449: felt, v450: felt, v451: felt, v452: felt, v453: felt, v454: felt, v455: felt, v456: i32) { - ^block37(v447: felt, v448: felt, v449: felt, v450: felt, v451: felt, v452: felt, v453: felt, v454: felt, v455: felt, v456: i32): - v457, v458, v459, v460, v461, v462, v463, v464 = hir.exec @miden/native_account/set_map_item(v447, v448, v449, v450, v451, v452, v453, v454, v455) : felt, felt, felt, felt, felt, felt, felt, felt - v465 = hir.bitcast v456 : u32; - v466 = hir.int_to_ptr v465 : ptr; - hir.store v466, v457; - v467 = arith.constant 4 : u32; - v468 = arith.add v465, v467 : u32 #[overflow = checked]; - v469 = hir.int_to_ptr v468 : ptr; - hir.store v469, v458; - v470 = arith.constant 8 : u32; - v471 = arith.add v465, v470 : u32 #[overflow = checked]; - v472 = hir.int_to_ptr v471 : ptr; - hir.store v472, v459; - v473 = arith.constant 12 : u32; - v474 = arith.add v465, v473 : u32 #[overflow = checked]; - v475 = hir.int_to_ptr v474 : ptr; - hir.store v475, v460; - v476 = arith.constant 16 : u32; - v477 = arith.add v465, v476 : u32 #[overflow = checked]; - v478 = hir.int_to_ptr v477 : ptr; - hir.store v478, v461; - v479 = arith.constant 20 : u32; - v480 = arith.add v465, v479 : u32 #[overflow = checked]; - v481 = hir.int_to_ptr v480 : ptr; - hir.store v481, v462; - v482 = arith.constant 24 : u32; - v483 = arith.add v465, v482 : u32 #[overflow = checked]; - v484 = hir.int_to_ptr v483 : ptr; - hir.store v484, v463; - v485 = arith.constant 28 : u32; - v486 = arith.add v465, v485 : u32 #[overflow = checked]; - v487 = hir.int_to_ptr v486 : ptr; - hir.store v487, v464; + private builtin.function @miden::protocol::native_account::set_map_item(v405: felt, v406: felt, v407: felt, v408: felt, v409: felt, v410: felt, v411: felt, v412: felt, v413: felt, v414: felt, v415: i32) { + ^block28(v405: felt, v406: felt, v407: felt, v408: felt, v409: felt, v410: felt, v411: felt, v412: felt, v413: felt, v414: felt, v415: i32): + v416, v417, v418, v419 = hir.exec @miden/protocol/native_account/set_map_item(v405, v406, v407, v408, v409, v410, v411, v412, v413, v414) : felt, felt, felt, felt + v420 = hir.bitcast v415 : u32; + v421 = hir.int_to_ptr v420 : ptr; + hir.store v421, v416; + v581 = arith.constant 4 : u32; + v423 = arith.add v420, v581 : u32 #[overflow = checked]; + v424 = hir.int_to_ptr v423 : ptr; + hir.store v424, v417; + v580 = arith.constant 8 : u32; + v426 = arith.add v420, v580 : u32 #[overflow = checked]; + v427 = hir.int_to_ptr v426 : ptr; + hir.store v427, v418; + v579 = arith.constant 12 : u32; + v429 = arith.add v420, v579 : u32 #[overflow = checked]; + v430 = hir.int_to_ptr v429 : ptr; + hir.store v430, v419; builtin.ret ; }; @@ -639,14 +531,14 @@ builtin.component miden:counter-contract/counter-contract@0.1.0 { }; public builtin.function @get-count() -> felt { - ^block40: - v488 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden:counter-contract/counter-contract@0.1.0#get-count() : felt - builtin.ret v488; + ^block31: + v431 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden:counter-contract/counter-contract@0.1.0#get-count() : felt + builtin.ret v431; }; public builtin.function @increment-count() -> felt { - ^block42: - v489 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden:counter-contract/counter-contract@0.1.0#increment-count() : felt - builtin.ret v489; + ^block33: + v432 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden:counter-contract/counter-contract@0.1.0#increment-count() : felt + builtin.ret v432; }; }; \ No newline at end of file diff --git a/tests/integration/expected/examples/counter.masm b/tests/integration/expected/examples/counter.masm index 8b0b61d71..0a999eb62 100644 --- a/tests/integration/expected/examples/counter.masm +++ b/tests/integration/expected/examples/counter.masm @@ -1,29 +1,29 @@ -# mod miden:counter-contract/counter-contract@0.1.0 +# mod ::"miden:counter-contract/counter-contract@0.1.0" @callconv("canon-lift") pub proc get-count( ) -> felt - exec.::miden:counter-contract/counter-contract@0.1.0::init + exec."miden:counter-contract/counter-contract@0.1.0"::init trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::miden:counter-contract/counter-contract@0.1.0#get-count + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::"miden:counter-contract/counter-contract@0.1.0#get-count" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end @callconv("canon-lift") pub proc increment-count( ) -> felt - exec.::miden:counter-contract/counter-contract@0.1.0::init + exec."miden:counter-contract/counter-contract@0.1.0"::init trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::miden:counter-contract/counter-contract@0.1.0#increment-count + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::"miden:counter-contract/counter-contract@0.1.0#increment-count" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -36,7 +36,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -47,7 +47,7 @@ proc init mem_store.278537 end -# mod miden:counter-contract/counter-contract@0.1.0::counter_contract +# mod ::"miden:counter-contract/counter-contract@0.1.0"::counter_contract @callconv("C") proc __wasm_call_ctors( @@ -63,11 +63,31 @@ proc counter_contract::bindings::__link_custom_section_describing_imports( nop end +@locals("5") @callconv("C") proc miden_base_sys::bindings::storage::get_map_item( i32, + felt, + felt, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -76,11 +96,18 @@ proc miden_base_sys::bindings::storage::get_map_item( exec.::intrinsics::mem::load_sw trace.252 nop - push.32 + push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.4 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -88,14 +115,16 @@ proc miden_base_sys::bindings::storage::get_map_item( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.3 push.0 + swap.1 trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::>::from + exec.::intrinsics::mem::load_sw trace.252 nop push.12 - dup.4 + swap.1 add u32assert push.4 @@ -111,8 +140,16 @@ proc miden_base_sys::bindings::storage::get_map_item( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.5 + swap.1 add u32assert push.4 @@ -128,8 +165,16 @@ proc miden_base_sys::bindings::storage::get_map_item( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.6 + swap.1 add u32assert push.4 @@ -145,7 +190,14 @@ proc miden_base_sys::bindings::storage::get_map_item( exec.::intrinsics::mem::load_felt trace.252 nop - movup.6 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -159,23 +211,42 @@ proc miden_base_sys::bindings::storage::get_map_item( exec.::intrinsics::mem::load_felt trace.252 nop - dup.5 - movup.2 - swap.3 - movdn.2 + locaddr.4 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 swap.4 + movdn.2 swap.1 swap.5 + swap.1 + swap.6 trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::miden::active_account::get_map_item + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::"miden::protocol::active_account::get_map_item" + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop - push.8 - dup.1 - add - u32assert push.8 dup.1 swap.1 @@ -190,8 +261,8 @@ proc miden_base_sys::bindings::storage::get_map_item( trace.252 nop swap.1 - push.24 - dup.3 + push.8 + movup.3 add u32assert push.8 @@ -200,6 +271,8 @@ proc miden_base_sys::bindings::storage::get_map_item( u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -209,7 +282,26 @@ proc miden_base_sys::bindings::storage::get_map_item( exec.::intrinsics::mem::store_dw trace.252 nop - dup.0 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + swap.1 + add + u32assert push.8 dup.1 swap.1 @@ -224,16 +316,15 @@ proc miden_base_sys::bindings::storage::get_map_item( trace.252 nop swap.1 - push.16 - dup.3 - add - u32assert + movup.2 push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -243,16 +334,15 @@ proc miden_base_sys::bindings::storage::get_map_item( exec.::intrinsics::mem::store_dw trace.252 nop - push.16 - dup.1 - u32wrapping_add - movup.2 + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::::reverse + exec.::intrinsics::mem::load_sw trace.252 nop - push.32 + push.16 u32wrapping_add push.1114144 u32divmod.4 @@ -264,6 +354,78 @@ proc miden_base_sys::bindings::storage::get_map_item( nop end +@locals("2") +@callconv("C") +proc ::default( + i32 +) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.3500972897 + push.341377309 + mul.4294967296 + add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.602293141 + push.2746820956 + mul.4294967296 + add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + +@locals("6") @callconv("C") proc miden:counter-contract/counter-contract@0.1.0#get-count( @@ -276,49 +438,55 @@ proc miden:counter-contract/counter-contract@0.1.0#get-count( exec.::intrinsics::mem::load_sw trace.252 nop - push.32 + push.48 u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 + dup.0 + locaddr.0 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::store_sw trace.252 nop + push.1114144 + u32divmod.4 + swap.1 trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::wit_bindgen::rt::run_ctors_once + exec.::intrinsics::mem::store_sw trace.252 nop - push.0 trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::intrinsics::felt::from_u32 + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::wit_bindgen::rt::run_ctors_once trace.252 nop + locaddr.0 push.0 + swap.1 trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop - push.0 + push.8 + u32wrapping_add trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::intrinsics::felt::from_u32 + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::::default trace.252 nop - push.1 + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop push.12 - dup.5 + swap.1 add u32assert push.4 @@ -331,11 +499,27 @@ proc miden:counter-contract/counter-contract@0.1.0#get-count( swap.1 trace.240 nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.4 + swap.1 add u32assert push.4 @@ -348,33 +532,36 @@ proc miden:counter-contract/counter-contract@0.1.0#get-count( swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_felt trace.252 nop - push.4 - dup.3 + push.0 + push.0 + mul.4294967296 add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_sw trace.252 nop - dup.1 + push.28 + swap.1 + add + u32assert push.4 dup.1 swap.1 u32mod u32assert assertz + push.1 + push.0 + mul.4294967296 + add + swap.1 u32divmod.4 swap.1 trace.240 @@ -382,18 +569,16 @@ proc miden:counter-contract/counter-contract@0.1.0#get-count( exec.::intrinsics::mem::store_felt trace.252 nop - push.16 - dup.1 - u32wrapping_add - dup.1 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::miden_base_sys::bindings::storage::get_map_item + exec.::intrinsics::mem::load_sw trace.252 nop - push.28 - dup.1 + push.24 + swap.1 add u32assert push.4 @@ -402,100 +587,110 @@ proc miden:counter-contract/counter-contract@0.1.0#get-count( u32mod u32assert assertz - u32divmod.4 + dup.1 swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.32 - movup.2 - u32wrapping_add - push.1114144 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::store_felt trace.252 nop -end - -@callconv("C") -proc miden:counter-contract/counter-contract@0.1.0#increment-count( - -) -> felt - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.144 - u32wrapping_sub - push.1114144 + push.20 + swap.1 + add + u32assert + push.4 dup.1 swap.1 + u32mod + u32assert + assertz u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::wit_bindgen::rt::run_ctors_once + exec.::intrinsics::mem::load_sw trace.252 nop + push.16 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 push.0 + mul.4294967296 + add + swap.1 + u32divmod.4 + swap.1 trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.0 push.0 + swap.1 trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.1 push.0 + swap.1 trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_felt trace.252 nop - push.1 + push.16 + dup.2 + u32wrapping_add + push.32 + movup.3 + u32wrapping_add + swap.1 + swap.3 + swap.1 trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::intrinsics::felt::from_u32 + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::miden_base_sys::bindings::storage::get_map_item trace.252 nop - push.12 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - dup.1 - swap.1 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_sw trace.252 nop - push.8 - dup.5 + push.44 + swap.1 add u32assert push.4 @@ -504,107 +699,111 @@ proc miden:counter-contract/counter-contract@0.1.0#increment-count( u32mod u32assert assertz - dup.2 - swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_felt trace.252 nop - push.4 - dup.5 - add - u32assert - push.4 - dup.1 + locaddr.1 + push.0 swap.1 - u32mod - u32assert - assertz - dup.3 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.48 + u32wrapping_add + push.1114144 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::store_sw trace.252 nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - dup.4 + locaddr.1 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop +end + +@locals("8") +@callconv("C") +proc miden:counter-contract/counter-contract@0.1.0#increment-count( + +) -> felt + push.1114144 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_sw trace.252 nop push.64 - dup.5 - u32wrapping_add - dup.5 + u32wrapping_sub + dup.0 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::miden_base_sys::bindings::storage::get_map_item + exec.::intrinsics::mem::store_sw trace.252 nop - push.76 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.1114144 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::store_sw trace.252 nop - push.1 trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::intrinsics::felt::from_u32 + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::wit_bindgen::rt::run_ctors_once trace.252 nop + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::intrinsics::felt::add + exec.::intrinsics::mem::load_sw trace.252 nop - push.48 - dup.6 + push.8 u32wrapping_add - dup.1 - swap.1 trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::>::from + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::::default trace.252 nop + locaddr.0 push.0 + swap.1 trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::>::from + exec.::intrinsics::mem::load_sw trace.252 nop - push.60 - dup.7 + push.12 + swap.1 add u32assert push.4 @@ -620,25 +819,24 @@ proc miden:counter-contract/counter-contract@0.1.0#increment-count( exec.::intrinsics::mem::load_felt trace.252 nop - push.56 - dup.8 - add - u32assert - push.4 - dup.1 + locaddr.1 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::load_sw trace.252 nop - push.52 - dup.9 + push.8 + swap.1 add u32assert push.4 @@ -654,65 +852,73 @@ proc miden:counter-contract/counter-contract@0.1.0#increment-count( exec.::intrinsics::mem::load_felt trace.252 nop - push.48 - dup.10 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.0 + push.0 + mul.4294967296 add - u32assert - push.4 - dup.1 + locaddr.3 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.0 + push.0 + mul.4294967296 + add + dup.0 + locaddr.4 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::store_felt trace.252 nop - push.64 - dup.11 - u32wrapping_add + locaddr.5 + push.0 swap.1 - swap.8 - swap.2 - swap.7 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.0 + push.0 swap.1 - swap.9 - swap.3 - swap.6 - swap.10 - swap.4 - swap.5 trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::miden::native_account::set_map_item + exec.::intrinsics::mem::load_sw trace.252 nop - push.72 - dup.2 + push.1 + push.0 + mul.4294967296 add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + dup.0 + locaddr.6 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_felt trace.252 nop - swap.1 - push.104 - dup.4 + push.28 + movup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -720,18 +926,32 @@ proc miden:counter-contract/counter-contract@0.1.0#increment-count( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.64 - dup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.24 + movup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -741,15 +961,30 @@ proc miden:counter-contract/counter-contract@0.1.0#increment-count( swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.0 + push.0 swap.1 - push.96 - dup.4 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.20 + movup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -757,35 +992,32 @@ proc miden:counter-contract/counter-contract@0.1.0#increment-count( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.88 - dup.2 - u32wrapping_add - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.3 + push.0 swap.1 - push.120 - dup.4 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.16 + movup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -793,36 +1025,62 @@ proc miden:counter-contract/counter-contract@0.1.0#increment-count( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.80 - dup.2 - add - u32assert - push.8 - dup.1 + locaddr.0 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.1 + push.0 swap.1 - push.112 - dup.4 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.16 + dup.3 + u32wrapping_add + push.48 + movup.4 + u32wrapping_add + swap.1 + swap.3 + swap.1 + trace.240 + nop + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::miden_base_sys::bindings::storage::get_map_item + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.60 + dup.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -830,142 +1088,91 @@ proc miden:counter-contract/counter-contract@0.1.0#increment-count( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop - push.96 - dup.2 - u32wrapping_add - push.16 - dup.3 - u32wrapping_add + push.1 + add + dup.0 + locaddr.7 + push.0 + swap.1 trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::::reverse + exec.::intrinsics::mem::store_felt trace.252 nop - push.112 - dup.2 - u32wrapping_add - push.128 - dup.3 + push.32 + movup.2 u32wrapping_add trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::::reverse + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::>::from trace.252 nop - push.144 - movup.2 - u32wrapping_add - push.1114144 - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_felt trace.252 nop -end - -@callconv("C") -proc wit_bindgen::rt::run_ctors_once( - -) - push.1114148 - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::load_felt trace.252 nop - push.1048584 - u32wrapping_add - u32divmod.4 - swap.1 + locaddr.6 + push.0 swap.1 - dup.1 - mem_load + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.5 + push.0 swap.1 - push.8 - u32wrapping_mul - u32shr + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.4 + push.0 swap.1 - drop - push.255 - u32and + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.3 push.0 swap.1 - neq - if.true - nop - else - push.1114148 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - trace.240 - nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::__wasm_call_ctors - trace.252 - nop - push.1 - push.1048584 - movup.2 - u32wrapping_add - u32divmod.4 - swap.1 - dup.0 - mem_load - dup.2 - push.8 - u32wrapping_mul - push.255 - swap.1 - u32shl - u32not - swap.1 - u32and - movup.3 - movup.3 - push.8 - u32wrapping_mul - u32shl - u32or - swap.1 - mem_store - end -end - -@callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.0 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - u32wrapping_sub - push.8 - dup.3 + push.44 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -975,12 +1182,19 @@ proc ::reverse( swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.40 swap.1 - push.8 - dup.3 add u32assert push.4 @@ -991,29 +1205,23 @@ proc ::reverse( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + push.36 swap.1 - dup.2 + add + u32assert push.4 dup.1 swap.1 @@ -1022,140 +1230,21 @@ proc ::reverse( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop - push.12 - dup.1 - u32wrapping_add + locaddr.0 push.0 - movup.2 swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.8 - dup.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + swap.1 add u32assert push.4 @@ -1168,94 +1257,180 @@ proc ::reverse( swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.0 + push.0 swap.1 - push.8 - dup.4 - add - u32assert - push.8 - dup.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.48 + u32wrapping_add + movup.4 + swap.6 + movdn.4 + movup.3 + swap.7 + movdn.3 + movup.2 + swap.8 + movdn.2 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + swap.9 swap.1 - movup.2 - movdn.3 + swap.10 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::"miden::protocol::native_account::set_map_item" trace.252 nop - push.4 - dup.1 + locaddr.0 + push.0 swap.1 - u32mod - u32assert - assertz + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.64 + u32wrapping_add + push.1114144 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.7 + push.0 swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop end +@locals("1") @callconv("C") -proc >::from( - i32 -) -> felt +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop push.255 u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end end +@locals("5") @callconv("C") -proc >::from( +proc >::from( i32, felt ) + locaddr.0 push.0 + swap.1 trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::intrinsics::felt::from_u32 - trace.252 - nop - push.0 - trace.240 - nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 push.0 + swap.1 trace.240 nop - exec.::miden:counter-contract/counter-contract@0.1.0::counter_contract::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop push.12 - dup.4 + swap.1 add u32assert push.4 @@ -1264,8 +1439,6 @@ proc felt - add -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc miden::active_account::get_map_item(felt, felt, felt, felt, felt, i32) +proc miden::protocol::active_account::get_map_item( + felt, + felt, + felt, + felt, + felt, + felt, + i32 +) trace.240 nop - exec.::miden::active_account::get_map_item + exec.::miden::protocol::active_account::get_map_item trace.252 nop movup.4 @@ -1390,7 +1590,8 @@ proc miden::active_account::get_map_item(felt, felt, felt, felt, felt, i32) end @callconv("C") -proc miden::native_account::set_map_item( +proc miden::protocol::native_account::set_map_item( + felt, felt, felt, felt, @@ -1404,10 +1605,10 @@ proc miden::native_account::set_map_item( ) trace.240 nop - exec.::miden::native_account::set_map_item + exec.::miden::protocol::native_account::set_map_item trace.252 nop - movup.8 + movup.4 dup.0 movup.2 swap.1 @@ -1445,58 +1646,6 @@ proc miden::native_account::set_map_item( trace.252 nop push.12 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.16 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.20 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.24 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.28 add u32assert u32divmod.4 diff --git a/tests/integration/expected/examples/counter.wat b/tests/integration/expected/examples/counter.wat index 280135a48..bd1f0f1d6 100644 --- a/tests/integration/expected/examples/counter.wat +++ b/tests/integration/expected/examples/counter.wat @@ -8,13 +8,15 @@ (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) (core module $main (;0;) (type (;0;) (func)) - (type (;1;) (func (param i32 i32))) - (type (;2;) (func (result f32))) - (type (;3;) (func (param i32) (result f32))) + (type (;1;) (func (param i32 f32 f32 i32))) + (type (;2;) (func (param i32))) + (type (;3;) (func (result f32))) (type (;4;) (func (param i32 f32))) (type (;5;) (func (param f32 f32) (result f32))) - (type (;6;) (func (param f32 f32 f32 f32 f32 i32))) - (type (;7;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32 i32))) + (type (;6;) (func (param i32) (result f32))) + (type (;7;) (func (param i64) (result f32))) + (type (;8;) (func (param f32 f32 f32 f32 f32 f32 i32))) + (type (;9;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -25,190 +27,198 @@ (elem (;0;) (i32.const 1) func $counter_contract::bindings::__link_custom_section_describing_imports) (func $__wasm_call_ctors (;0;) (type 0)) (func $counter_contract::bindings::__link_custom_section_describing_imports (;1;) (type 0)) - (func $miden_base_sys::bindings::storage::get_map_item (;2;) (type 1) (param i32 i32) + (func $miden_base_sys::bindings::storage::get_map_item (;2;) (type 1) (param i32 f32 f32 i32) (local i32) global.get $__stack_pointer - i32.const 32 + i32.const 16 i32.sub - local.tee 2 + local.tee 4 global.set $__stack_pointer - i32.const 0 - call $>::from + local.get 2 local.get 1 + local.get 3 f32.load offset=12 - local.get 1 + local.get 3 f32.load offset=8 - local.get 1 + local.get 3 f32.load offset=4 - local.get 1 + local.get 3 f32.load - local.get 2 - call $miden::active_account::get_map_item - local.get 2 - local.get 2 - i64.load offset=8 - i64.store offset=24 - local.get 2 - local.get 2 + local.get 4 + call $miden::protocol::active_account::get_map_item + local.get 0 + local.get 4 i64.load - i64.store offset=16 + i64.const 32 + i64.rotl + i64.store offset=8 local.get 0 - local.get 2 + local.get 4 + i64.load offset=8 + i64.const 32 + i64.rotl + i64.store + local.get 4 i32.const 16 i32.add - call $::reverse - local.get 2 - i32.const 32 - i32.add global.set $__stack_pointer ) - (func $miden:counter-contract/counter-contract@0.1.0#get-count (;3;) (type 2) (result f32) - (local i32 f32 f32 f32) + (func $::default (;3;) (type 2) (param i32) + (local f32) + i64.const -6649237899119803499 + call $intrinsics::felt::from_u64_unchecked + local.set 1 + local.get 0 + i64.const 1466204381252459361 + call $intrinsics::felt::from_u64_unchecked + f32.store offset=4 + local.get 0 + local.get 1 + f32.store + ) + (func $miden:counter-contract/counter-contract@0.1.0#get-count (;4;) (type 3) (result f32) + (local i32 f32 f32 f32 f32 f32) global.get $__stack_pointer - i32.const 32 + i32.const 48 i32.sub local.tee 0 global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once - i32.const 0 - call $intrinsics::felt::from_u32 + local.get 0 + i32.const 8 + i32.add + call $::default + local.get 0 + f32.load offset=12 local.set 1 - i32.const 0 - call $intrinsics::felt::from_u32 + local.get 0 + f32.load offset=8 local.set 2 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 3 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked + local.set 4 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked + local.set 5 local.get 0 - i32.const 1 - call $intrinsics::felt::from_u32 - f32.store offset=12 + i64.const 1 + call $intrinsics::felt::from_u64_unchecked + f32.store offset=28 + local.get 0 + local.get 5 + f32.store offset=24 + local.get 0 + local.get 4 + f32.store offset=20 local.get 0 local.get 3 - f32.store offset=8 + f32.store offset=16 local.get 0 + i32.const 32 + i32.add local.get 2 - f32.store offset=4 - local.get 0 local.get 1 - f32.store local.get 0 i32.const 16 i32.add - local.get 0 call $miden_base_sys::bindings::storage::get_map_item local.get 0 - f32.load offset=28 + f32.load offset=44 local.set 1 local.get 0 - i32.const 32 + i32.const 48 i32.add global.set $__stack_pointer local.get 1 ) - (func $miden:counter-contract/counter-contract@0.1.0#increment-count (;4;) (type 2) (result f32) - (local i32 f32 f32 f32 f32 f32) + (func $miden:counter-contract/counter-contract@0.1.0#increment-count (;5;) (type 3) (result f32) + (local i32 f32 f32 f32 f32 f32 f32 f32) global.get $__stack_pointer - i32.const 144 + i32.const 64 i32.sub local.tee 0 global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once - i32.const 0 - call $intrinsics::felt::from_u32 + local.get 0 + i32.const 8 + i32.add + call $::default + local.get 0 + f32.load offset=12 local.set 1 - i32.const 0 - call $intrinsics::felt::from_u32 + local.get 0 + f32.load offset=8 local.set 2 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 3 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked + local.set 4 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked + local.set 5 local.get 0 - i32.const 1 - call $intrinsics::felt::from_u32 - local.tee 4 - f32.store offset=12 + i64.const 1 + call $intrinsics::felt::from_u64_unchecked + local.tee 6 + f32.store offset=28 + local.get 0 + local.get 5 + f32.store offset=24 + local.get 0 + local.get 4 + f32.store offset=20 local.get 0 local.get 3 - f32.store offset=8 + f32.store offset=16 local.get 0 + i32.const 48 + i32.add local.get 2 - f32.store offset=4 - local.get 0 local.get 1 - f32.store local.get 0 - i32.const 64 + i32.const 16 i32.add - local.get 0 call $miden_base_sys::bindings::storage::get_map_item local.get 0 - i32.const 48 + i32.const 32 i32.add local.get 0 - f32.load offset=76 + f32.load offset=60 i32.const 1 call $intrinsics::felt::from_u32 call $intrinsics::felt::add - local.tee 5 - call $>::from - i32.const 0 - call $>::from + local.tee 7 + call $>::from + local.get 1 + local.get 2 + local.get 6 + local.get 5 local.get 4 local.get 3 - local.get 2 - local.get 1 - local.get 0 - f32.load offset=60 - local.get 0 - f32.load offset=56 - local.get 0 - f32.load offset=52 - local.get 0 - f32.load offset=48 - local.get 0 - i32.const 64 - i32.add - call $miden::native_account::set_map_item - local.get 0 - local.get 0 - i64.load offset=72 - i64.store offset=104 local.get 0 + f32.load offset=44 local.get 0 - i64.load offset=64 - i64.store offset=96 + f32.load offset=40 local.get 0 + f32.load offset=36 local.get 0 - i32.const 88 - i32.add - i64.load - i64.store offset=120 - local.get 0 - local.get 0 - i64.load offset=80 - i64.store offset=112 - local.get 0 - i32.const 16 - i32.add - local.get 0 - i32.const 96 - i32.add - call $::reverse - local.get 0 - i32.const 128 - i32.add + f32.load offset=32 local.get 0 - i32.const 112 + i32.const 48 i32.add - call $::reverse + call $miden::protocol::native_account::set_map_item local.get 0 - i32.const 144 + i32.const 64 i32.add global.set $__stack_pointer - local.get 5 + local.get 7 ) - (func $wit_bindgen::rt::run_ctors_once (;5;) (type 0) + (func $wit_bindgen::rt::run_ctors_once (;6;) (type 0) (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base @@ -226,71 +236,7 @@ i32.store8 end ) - (func $::reverse (;6;) (type 1) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store - ) - (func $>::from (;7;) (type 3) (param i32) (result f32) - local.get 0 - i32.const 255 - i32.and - f32.reinterpret_i32 - ) - (func $>::from (;8;) (type 4) (param i32 f32) + (func $>::from (;7;) (type 4) (param i32 f32) (local f32 f32 f32) i32.const 0 call $intrinsics::felt::from_u32 @@ -314,20 +260,23 @@ local.get 2 f32.store ) - (func $intrinsics::felt::add (;9;) (type 5) (param f32 f32) (result f32) + (func $intrinsics::felt::add (;8;) (type 5) (param f32 f32) (result f32) + unreachable + ) + (func $intrinsics::felt::from_u32 (;9;) (type 6) (param i32) (result f32) unreachable ) - (func $intrinsics::felt::from_u32 (;10;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;10;) (type 7) (param i64) (result f32) unreachable ) - (func $miden::active_account::get_map_item (;11;) (type 6) (param f32 f32 f32 f32 f32 i32) + (func $miden::protocol::active_account::get_map_item (;11;) (type 8) (param f32 f32 f32 f32 f32 f32 i32) unreachable ) - (func $miden::native_account::set_map_item (;12;) (type 7) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 i32) + (func $miden::protocol::native_account::set_map_item (;12;) (type 9) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "!counter-contract\95A simple example of a Miden counter contract using the Account Storage API\0b0.1.0\03\01\03\01\00\00\13count_map\019counter contract storage map\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "!counter-contract\95A simple example of a Miden counter contract using the Account Storage API\0b0.1.0\03\01\01\003miden::component::miden_counter_contract::count_map\01\019counter contract storage map\00\00\09word\00\00\09word\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/examples/counter_note.hir b/tests/integration/expected/examples/counter_note.hir index 6ff9b1d3d..fce9f124e 100644 --- a/tests/integration/expected/examples/counter_note.hir +++ b/tests/integration/expected/examples/counter_note.hir @@ -25,13 +25,16 @@ builtin.component miden:base/note-script@1.0.0 { private builtin.function @miden:base/note-script@1.0.0#run(v2: felt, v3: felt, v4: felt, v5: felt) { ^block14(v2: felt, v3: felt, v4: felt, v5: felt): hir.exec @miden:base/note-script@1.0.0/counter_note/wit_bindgen::rt::run_ctors_once() - v7 = hir.exec @miden:base/note-script@1.0.0/counter_note/counter_note::bindings::miden::counter_contract::counter_contract::get_count::wit_import0() : felt - v8 = hir.exec @miden:base/note-script@1.0.0/counter_note/counter_note::bindings::miden::counter_contract::counter_contract::increment_count::wit_import0() : felt - v9 = arith.constant 1 : i32; - v10 = hir.exec @miden:base/note-script@1.0.0/counter_note/intrinsics::felt::from_u32(v9) : felt - v11 = hir.exec @miden:base/note-script@1.0.0/counter_note/intrinsics::felt::add(v7, v10) : felt + v6 = hir.exec @miden:base/note-script@1.0.0/counter_note/counter_note::bindings::miden::counter_contract::counter_contract::get_count::wit_import0() : felt + hir.store_local v6 #[local = lv4]; + v7 = hir.exec @miden:base/note-script@1.0.0/counter_note/counter_note::bindings::miden::counter_contract::counter_contract::increment_count::wit_import0() : felt + v8 = hir.load_local : felt #[local = lv4]; + v42 = arith.constant 1 : felt; + v11 = arith.add v8, v42 : felt #[overflow = unchecked]; + hir.store_local v11 #[local = lv4]; v12 = hir.exec @miden:base/note-script@1.0.0/counter_note/counter_note::bindings::miden::counter_contract::counter_contract::get_count::wit_import0() : felt - hir.exec @miden:base/note-script@1.0.0/counter_note/intrinsics::felt::assert_eq(v12, v11) + v13 = hir.load_local : felt #[local = lv4]; + hir.assert_eq v12, v13; builtin.ret ; }; @@ -40,15 +43,15 @@ builtin.component miden:base/note-script@1.0.0 { v14 = builtin.global_symbol @miden:base/note-script@1.0.0/counter_note/GOT.data.internal.__memory_base : ptr v15 = hir.bitcast v14 : ptr; v16 = hir.load v15 : i32; - v17 = arith.constant 1048588 : i32; - v18 = arith.add v16, v17 : i32 #[overflow = wrapping]; + v47 = arith.constant 1048588 : i32; + v18 = arith.add v16, v47 : i32 #[overflow = wrapping]; v19 = hir.bitcast v18 : u32; v20 = hir.int_to_ptr v19 : ptr; v21 = hir.load v20 : u8; - v13 = arith.constant 0 : i32; + v46 = arith.constant 0 : i32; v22 = arith.zext v21 : u32; v23 = hir.bitcast v22 : i32; - v25 = arith.neq v23, v13 : i1; + v25 = arith.neq v23, v46 : i1; scf.if v25{ ^block18: scf.yield ; @@ -57,36 +60,20 @@ builtin.component miden:base/note-script@1.0.0 { v26 = builtin.global_symbol @miden:base/note-script@1.0.0/counter_note/GOT.data.internal.__memory_base : ptr v27 = hir.bitcast v26 : ptr; v28 = hir.load v27 : i32; + hir.store_local v28 #[local = lv0]; hir.exec @miden:base/note-script@1.0.0/counter_note/__wasm_call_ctors() - v50 = arith.constant 1 : u8; - v52 = arith.constant 1048588 : i32; - v30 = arith.add v28, v52 : i32 #[overflow = wrapping]; - v34 = hir.bitcast v30 : u32; - v35 = hir.int_to_ptr v34 : ptr; - hir.store v35, v50; + v29 = hir.load_local : i32 #[local = lv0]; + v45 = arith.constant 1 : u8; + v50 = arith.constant 1048588 : i32; + v31 = arith.add v29, v50 : i32 #[overflow = wrapping]; + v35 = hir.bitcast v31 : u32; + v36 = hir.int_to_ptr v35 : ptr; + hir.store v36, v45; scf.yield ; }; builtin.ret ; }; - private builtin.function @intrinsics::felt::add(v36: felt, v37: felt) -> felt { - ^block20(v36: felt, v37: felt): - v38 = arith.add v36, v37 : felt #[overflow = unchecked]; - builtin.ret v38; - }; - - private builtin.function @intrinsics::felt::assert_eq(v40: felt, v41: felt) { - ^block22(v40: felt, v41: felt): - hir.assert_eq v40, v41; - builtin.ret ; - }; - - private builtin.function @intrinsics::felt::from_u32(v42: i32) -> felt { - ^block24(v42: i32): - v43 = hir.bitcast v42 : felt; - builtin.ret v43; - }; - builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; @@ -98,9 +85,9 @@ builtin.component miden:base/note-script@1.0.0 { builtin.segment @1048576 = 0x000000010000000100000001; }; - public builtin.function @run(v45: felt, v46: felt, v47: felt, v48: felt) { - ^block26(v45: felt, v46: felt, v47: felt, v48: felt): - hir.exec @miden:base/note-script@1.0.0/counter_note/miden:base/note-script@1.0.0#run(v45, v46, v47, v48) + public builtin.function @run(v37: felt, v38: felt, v39: felt, v40: felt) { + ^block20(v37: felt, v38: felt, v39: felt, v40: felt): + hir.exec @miden:base/note-script@1.0.0/counter_note/miden:base/note-script@1.0.0#run(v37, v38, v39, v40) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/examples/counter_note.masm b/tests/integration/expected/examples/counter_note.masm index 6d65b143c..6f1b66234 100644 --- a/tests/integration/expected/examples/counter_note.masm +++ b/tests/integration/expected/examples/counter_note.masm @@ -1,14 +1,14 @@ -# mod miden:base/note-script@1.0.0 +# mod ::"miden:base/note-script@1.0.0" @callconv("canon-lift") pub proc run(felt, felt, felt, felt) - exec.::miden:base/note-script@1.0.0::init + exec."miden:base/note-script@1.0.0"::init trace.240 nop - exec.::miden:base/note-script@1.0.0::counter_note::miden:base/note-script@1.0.0#run + exec.::"miden:base/note-script@1.0.0"::counter_note::"miden:base/note-script@1.0.0#run" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -21,7 +21,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -32,7 +32,7 @@ proc init mem_store.278537 end -# mod miden:base/note-script@1.0.0::counter_note +# mod ::"miden:base/note-script@1.0.0"::counter_note @callconv("C") proc counter_note::bindings::miden::counter_contract::counter_contract::get_count::wit_import0( @@ -40,7 +40,7 @@ proc counter_note::bindings::miden::counter_contract::counter_contract::get_coun ) -> felt trace.240 nop - call.::miden:counter-contract/counter-contract@0.1.0::get-count + call.::"miden:counter-contract/counter-contract@0.1.0"::"get-count" trace.252 nop end @@ -51,7 +51,7 @@ proc counter_note::bindings::miden::counter_contract::counter_contract::incremen ) -> felt trace.240 nop - call.::miden:counter-contract/counter-contract@0.1.0::increment-count + call.::"miden:counter-contract/counter-contract@0.1.0"::"increment-count" trace.252 nop end @@ -70,6 +70,7 @@ proc counter_note::bindings::__link_custom_section_describing_imports( nop end +@locals("5") @callconv("C") proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop @@ -78,44 +79,63 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop trace.240 nop - exec.::miden:base/note-script@1.0.0::counter_note::wit_bindgen::rt::run_ctors_once + exec.::"miden:base/note-script@1.0.0"::counter_note::wit_bindgen::rt::run_ctors_once trace.252 nop trace.240 nop - exec.::miden:base/note-script@1.0.0::counter_note::counter_note::bindings::miden::counter_contract::counter_contract::get_count::wit_import0 + exec.::"miden:base/note-script@1.0.0"::counter_note::counter_note::bindings::miden::counter_contract::counter_contract::get_count::wit_import0 + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt trace.252 nop trace.240 nop - exec.::miden:base/note-script@1.0.0::counter_note::counter_note::bindings::miden::counter_contract::counter_contract::increment_count::wit_import0 + exec.::"miden:base/note-script@1.0.0"::counter_note::counter_note::bindings::miden::counter_contract::counter_contract::increment_count::wit_import0 trace.252 nop drop - push.1 + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::counter_note::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_felt trace.252 nop + push.1 + add + locaddr.4 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::counter_note::intrinsics::felt::add + exec.::intrinsics::mem::store_felt trace.252 nop trace.240 nop - exec.::miden:base/note-script@1.0.0::counter_note::counter_note::bindings::miden::counter_contract::counter_contract::get_count::wit_import0 + exec.::"miden:base/note-script@1.0.0"::counter_note::counter_note::bindings::miden::counter_contract::counter_contract::get_count::wit_import0 trace.252 nop + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::counter_note::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_felt trace.252 nop + assert_eq end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -157,9 +177,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::counter_note::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::counter_note::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -190,18 +226,3 @@ proc wit_bindgen::rt::run_ctors_once( end end -@callconv("C") -proc intrinsics::felt::add(felt, felt) -> felt - add -end - -@callconv("C") -proc intrinsics::felt::assert_eq(felt, felt) - assert_eq -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - diff --git a/tests/integration/expected/examples/fib.hir b/tests/integration/expected/examples/fib.hir index 849062295..6422624fc 100644 --- a/tests/integration/expected/examples/fib.hir +++ b/tests/integration/expected/examples/fib.hir @@ -2,39 +2,50 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @fibonacci { public builtin.function @entrypoint(v0: i32) -> i32 { ^block4(v0: i32): - v2 = arith.constant 0 : i32; - v4 = arith.constant 1 : i32; - v58, v59, v60, v61 = scf.while v4, v0, v2 : i32, i32, i32, i32 { - ^block18(v62: i32, v63: i32, v64: i32): - v70 = arith.constant 0 : i32; - v71 = arith.constant 0 : i32; - v8 = arith.eq v63, v71 : i1; - v9 = arith.zext v8 : u32; - v10 = hir.bitcast v9 : i32; - v12 = arith.neq v10, v70 : i1; - v53, v54 = scf.if v12 : i32, i32 { - ^block17: - v25 = ub.poison i32 : i32; - scf.yield v25, v25; + hir.store_local v0 #[local = lv0]; + v22 = arith.constant 0 : i32; + hir.store_local v22 #[local = lv1]; + v21 = arith.constant 1 : i32; + hir.store_local v21 #[local = lv2]; + scf.while { + ^block7: + v4 = hir.load_local : i32 #[local = lv2]; + hir.store_local v4 #[local = lv3]; + v5 = hir.load_local : i32 #[local = lv0]; + v35 = arith.constant 0 : i32; + v36 = arith.constant 0 : i32; + v7 = arith.eq v5, v36 : i1; + v8 = arith.zext v7 : u32; + v9 = hir.bitcast v8 : i32; + v11 = arith.neq v9, v35 : i1; + scf.if v11{ + ^block16: + scf.yield ; } else { ^block9: - v13 = arith.constant -1 : i32; - v14 = arith.add v63, v13 : i32 #[overflow = wrapping]; - v16 = arith.add v64, v62 : i32 #[overflow = wrapping]; - scf.yield v16, v14; + v12 = hir.load_local : i32 #[local = lv0]; + v20 = arith.constant -1 : i32; + v14 = arith.add v12, v20 : i32 #[overflow = wrapping]; + hir.store_local v14 #[local = lv0]; + v15 = hir.load_local : i32 #[local = lv1]; + v16 = hir.load_local : i32 #[local = lv3]; + v17 = arith.add v15, v16 : i32 #[overflow = wrapping]; + hir.store_local v17 #[local = lv2]; + v18 = hir.load_local : i32 #[local = lv3]; + hir.store_local v18 #[local = lv1]; + scf.yield ; }; - v69 = ub.poison i32 : i32; - v55 = cf.select v12, v69, v62 : i32; - v24 = arith.constant 1 : u32; - v18 = arith.constant 0 : u32; - v57 = cf.select v12, v18, v24 : u32; - v47 = arith.trunc v57 : i1; - scf.condition v47, v53, v54, v55, v64; + v29 = arith.constant 1 : u32; + v26 = arith.constant 0 : u32; + v34 = cf.select v11, v26, v29 : u32; + v30 = arith.trunc v34 : i1; + scf.condition v30; } do { - ^block19(v65: i32, v66: i32, v67: i32, v68: i32): - scf.yield v65, v66, v67; + ^block15: + scf.yield ; }; - builtin.ret v61; + v19 = hir.load_local : i32 #[local = lv1]; + builtin.ret v19; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/examples/fib.masm b/tests/integration/expected/examples/fib.masm index 500010e98..a3007d2dc 100644 --- a/tests/integration/expected/examples/fib.masm +++ b/tests/integration/expected/examples/fib.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,60 +10,151 @@ proc init mem_store.278528 end -# mod root_ns:root@1.0.0::fibonacci +# mod ::"root_ns:root@1.0.0"::fibonacci +@locals("4") @callconv("C") pub proc entrypoint(i32) -> i32 + locaddr.0 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1 - movup.2 + locaddr.2 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1 while.true + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.0 - dup.3 + movup.2 eq neq dup.0 if.true - movup.2 - drop - push.3735929054 - dup.0 + nop else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4294967295 - movup.3 u32wrapping_add - dup.3 - dup.3 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop u32wrapping_add + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.3735929054 - dup.3 - movup.2 - swap.5 - movdn.2 - cdrop push.1 push.0 - movup.4 + movup.2 cdrop push.1 u32and - swap.1 - swap.3 - swap.1 if.true - movup.3 - drop push.1 else push.0 end end - drop - drop - drop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end diff --git a/tests/integration/expected/examples/p2id.hir b/tests/integration/expected/examples/p2id.hir index a9d798e6b..386b2f49e 100644 --- a/tests/integration/expected/examples/p2id.hir +++ b/tests/integration/expected/examples/p2id.hir @@ -16,57 +16,66 @@ builtin.component miden:base/note-script@1.0.0 { v7 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr v8 = hir.bitcast v7 : ptr; v9 = hir.load v8 : i32; - v10 = arith.constant 1048588 : i32; - v11 = arith.add v9, v10 : i32 #[overflow = wrapping]; - v12 = hir.exec @miden:base/note-script@1.0.0/p2id/::alloc(v11, v5, v4) : i32 - builtin.ret v12; + v1009 = arith.constant 1048588 : i32; + v11 = arith.add v9, v1009 : i32 #[overflow = wrapping]; + v14 = hir.exec @miden:base/note-script@1.0.0/p2id/::alloc(v11, v5, v4) : i32 + builtin.ret v14; }; - private builtin.function @__rustc::__rust_dealloc(v13: i32, v14: i32, v15: i32) { - ^block12(v13: i32, v14: i32, v15: i32): + private builtin.function @__rustc::__rust_dealloc(v15: i32, v16: i32, v17: i32) { + ^block12(v15: i32, v16: i32, v17: i32): builtin.ret ; }; - private builtin.function @__rustc::__rust_alloc_zeroed(v16: i32, v17: i32) -> i32 { - ^block14(v16: i32, v17: i32): - v19 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr - v20 = hir.bitcast v19 : ptr; - v21 = hir.load v20 : i32; - v22 = arith.constant 1048588 : i32; - v23 = arith.add v21, v22 : i32 #[overflow = wrapping]; - v24 = hir.exec @miden:base/note-script@1.0.0/p2id/::alloc(v23, v17, v16) : i32 - v892 = arith.constant 0 : i32; - v25 = arith.constant 0 : i32; - v26 = arith.eq v24, v25 : i1; - v27 = arith.zext v26 : u32; - v28 = hir.bitcast v27 : i32; - v30 = arith.neq v28, v892 : i1; - scf.if v30{ - ^block16: + private builtin.function @__rustc::__rust_alloc_zeroed(v18: i32, v19: i32) -> i32 { + ^block14(v18: i32, v19: i32): + hir.store_local v18 #[local = lv0]; + hir.store_local v19 #[local = lv1]; + v21 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr + v22 = hir.bitcast v21 : ptr; + v23 = hir.load v22 : i32; + v26 = hir.load_local : i32 #[local = lv1]; + v27 = hir.load_local : i32 #[local = lv0]; + v1013 = arith.constant 1048588 : i32; + v25 = arith.add v23, v1013 : i32 #[overflow = wrapping]; + v28 = hir.exec @miden:base/note-script@1.0.0/p2id/::alloc(v25, v26, v27) : i32 + hir.store_local v28 #[local = lv1]; + v1021 = arith.constant 0 : i32; + v1016 = arith.constant 0 : i32; + v30 = arith.eq v28, v1016 : i1; + v31 = arith.zext v30 : u32; + v32 = hir.bitcast v31 : i32; + v34 = arith.neq v32, v1021 : i1; + scf.if v34{ + ^block118: scf.yield ; } else { ^block17: - v890 = arith.constant 0 : i32; - v891 = arith.constant 0 : i32; - v32 = arith.eq v16, v891 : i1; - v33 = arith.zext v32 : u32; - v34 = hir.bitcast v33 : i32; - v36 = arith.neq v34, v890 : i1; - scf.if v36{ - ^block118: + v35 = hir.load_local : i32 #[local = lv0]; + v1019 = arith.constant 0 : i32; + v1020 = arith.constant 0 : i32; + v37 = arith.eq v35, v1020 : i1; + v38 = arith.zext v37 : u32; + v39 = hir.bitcast v38 : i32; + v41 = arith.neq v39, v1019 : i1; + scf.if v41{ + ^block117: scf.yield ; } else { ^block18: - v884 = arith.constant 0 : u8; - v39 = hir.bitcast v16 : u32; - v40 = hir.bitcast v24 : u32; - v41 = hir.int_to_ptr v40 : ptr; - hir.mem_set v41, v39, v884; + v42 = hir.load_local : i32 #[local = lv1]; + v44 = hir.load_local : i32 #[local = lv0]; + v1011 = arith.constant 0 : u8; + v46 = hir.bitcast v44 : u32; + v47 = hir.bitcast v42 : u32; + v48 = hir.int_to_ptr v47 : ptr; + hir.mem_set v48, v46, v1011; scf.yield ; }; scf.yield ; }; - builtin.ret v24; + v49 = hir.load_local : i32 #[local = lv1]; + builtin.ret v49; }; private builtin.function @p2id::bindings::__link_custom_section_describing_imports() { @@ -74,246 +83,277 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret ; }; - private builtin.function @miden:base/note-script@1.0.0#run(v43: felt, v44: felt, v45: felt, v46: felt) { - ^block21(v43: felt, v44: felt, v45: felt, v46: felt): - v50 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v51 = hir.bitcast v50 : ptr; - v52 = hir.load v51 : i32; - v53 = arith.constant 48 : i32; - v54 = arith.sub v52, v53 : i32 #[overflow = wrapping]; - v55 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v56 = hir.bitcast v55 : ptr; - hir.store v56, v54; + private builtin.function @miden:base/note-script@1.0.0#run(v50: felt, v51: felt, v52: felt, v53: felt) { + ^block21(v50: felt, v51: felt, v52: felt, v53: felt): + v54 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v55 = hir.bitcast v54 : ptr; + v56 = hir.load v55 : i32; + v1036 = arith.constant 32 : i32; + v58 = arith.sub v56, v1036 : i32 #[overflow = wrapping]; + hir.store_local v58 #[local = lv4]; + v59 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v60 = hir.bitcast v59 : ptr; + hir.store v60, v58; hir.exec @miden:base/note-script@1.0.0/p2id/wit_bindgen::rt::run_ctors_once() - v57 = arith.constant 16 : i32; - v58 = arith.add v54, v57 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::active_note::get_inputs(v58) - v60 = arith.constant 24 : u32; - v59 = hir.bitcast v54 : u32; - v61 = arith.add v59, v60 : u32 #[overflow = checked]; - v62 = arith.constant 4 : u32; - v63 = arith.mod v61, v62 : u32; - hir.assertz v63 #[code = 250]; - v64 = hir.int_to_ptr v61 : ptr; - v65 = hir.load v64 : i32; - v66 = hir.cast v65 : u32; - v950 = scf.index_switch v66 : u32 + v61 = hir.load_local : i32 #[local = lv4]; + v1035 = arith.constant 12 : i32; + v63 = arith.add v61, v1035 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::active_note::get_inputs(v63) + v64 = hir.load_local : i32 #[local = lv4]; + v1034 = arith.constant 20 : u32; + v65 = hir.bitcast v64 : u32; + v67 = arith.add v65, v1034 : u32 #[overflow = checked]; + v1033 = arith.constant 4 : u32; + v69 = arith.mod v67, v1033 : u32; + hir.assertz v69 #[code = 250]; + v70 = hir.int_to_ptr v67 : ptr; + v71 = hir.load v70 : i32; + v72 = hir.cast v71 : u32; + v1074 = scf.index_switch v72 : u32 case 0 { ^block123: - v994 = arith.constant 1 : u32; - scf.yield v994; + v1087 = arith.constant 1 : u32; + scf.yield v1087; } case 1 { ^block124: - v993 = arith.constant 1 : u32; - scf.yield v993; + v1086 = arith.constant 1 : u32; + scf.yield v1086; } default { ^block24: - v68 = arith.constant 20 : u32; - v67 = hir.bitcast v54 : u32; - v69 = arith.add v67, v68 : u32 #[overflow = checked]; - v1028 = arith.constant 4 : u32; - v71 = arith.mod v69, v1028 : u32; - hir.assertz v71 #[code = 250]; - v72 = hir.int_to_ptr v69 : ptr; - v73 = hir.load v72 : i32; - v1027 = arith.constant 4 : u32; + v73 = hir.load_local : i32 #[local = lv4]; + v1032 = arith.constant 16 : u32; v74 = hir.bitcast v73 : u32; - v76 = arith.add v74, v1027 : u32 #[overflow = checked]; - v1026 = arith.constant 4 : u32; - v78 = arith.mod v76, v1026 : u32; + v76 = arith.add v74, v1032 : u32 #[overflow = checked]; + v1120 = arith.constant 4 : u32; + v78 = arith.mod v76, v1120 : u32; hir.assertz v78 #[code = 250]; - v79 = hir.int_to_ptr v76 : ptr; - v80 = hir.load v79 : felt; - v81 = hir.bitcast v73 : u32; - v1025 = arith.constant 4 : u32; - v83 = arith.mod v81, v1025 : u32; - hir.assertz v83 #[code = 250]; - v84 = hir.int_to_ptr v81 : ptr; - v85 = hir.load v84 : felt; - v86 = arith.constant 8 : i32; - v87 = arith.add v54, v86 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::active_account::get_id(v87) - v89 = arith.constant 12 : u32; - v88 = hir.bitcast v54 : u32; - v90 = arith.add v88, v89 : u32 #[overflow = checked]; - v1024 = arith.constant 4 : u32; - v92 = arith.mod v90, v1024 : u32; - hir.assertz v92 #[code = 250]; - v93 = hir.int_to_ptr v90 : ptr; - v94 = hir.load v93 : felt; - v96 = arith.constant 8 : u32; - v95 = hir.bitcast v54 : u32; - v97 = arith.add v95, v96 : u32 #[overflow = checked]; - v1023 = arith.constant 4 : u32; - v99 = arith.mod v97, v1023 : u32; - hir.assertz v99 #[code = 250]; - v100 = hir.int_to_ptr v97 : ptr; - v101 = hir.load v100 : felt; - v102 = hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::felt::eq(v101, v85) : i32 - v47 = arith.constant 0 : i32; - v103 = arith.constant 1 : i32; - v104 = arith.neq v102, v103 : i1; - v105 = arith.zext v104 : u32; - v106 = hir.bitcast v105 : i32; - v108 = arith.neq v106, v47 : i1; - v952 = scf.if v108 : u32 { + v79 = hir.int_to_ptr v76 : ptr; + v80 = hir.load v79 : i32; + hir.store_local v80 #[local = lv5]; + v1119 = arith.constant 4 : u32; + v81 = hir.bitcast v80 : u32; + v83 = arith.add v81, v1119 : u32 #[overflow = checked]; + v1118 = arith.constant 4 : u32; + v85 = arith.mod v83, v1118 : u32; + hir.assertz v85 #[code = 250]; + v86 = hir.int_to_ptr v83 : ptr; + v87 = hir.load v86 : felt; + hir.store_local v87 #[local = lv6]; + v88 = hir.load_local : i32 #[local = lv5]; + v89 = hir.bitcast v88 : u32; + v1117 = arith.constant 4 : u32; + v91 = arith.mod v89, v1117 : u32; + hir.assertz v91 #[code = 250]; + v92 = hir.int_to_ptr v89 : ptr; + v93 = hir.load v92 : felt; + hir.store_local v93 #[local = lv7]; + v94 = hir.load_local : i32 #[local = lv4]; + v1116 = arith.constant 12 : i32; + v96 = arith.add v94, v1116 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/ as core::ops::drop::Drop>::drop(v96) + v97 = hir.load_local : i32 #[local = lv4]; + v1115 = arith.constant 12 : i32; + v99 = arith.add v97, v1115 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/ as core::ops::drop::Drop>::drop(v99) + v100 = hir.load_local : i32 #[local = lv4]; + hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::active_account::get_id(v100) + v101 = hir.load_local : i32 #[local = lv4]; + v1114 = arith.constant 4 : u32; + v102 = hir.bitcast v101 : u32; + v104 = arith.add v102, v1114 : u32 #[overflow = checked]; + v1113 = arith.constant 4 : u32; + v106 = arith.mod v104, v1113 : u32; + hir.assertz v106 #[code = 250]; + v107 = hir.int_to_ptr v104 : ptr; + v108 = hir.load v107 : felt; + hir.store_local v108 #[local = lv8]; + v109 = hir.load_local : i32 #[local = lv4]; + v110 = hir.bitcast v109 : u32; + v1112 = arith.constant 4 : u32; + v112 = arith.mod v110, v1112 : u32; + hir.assertz v112 #[code = 250]; + v113 = hir.int_to_ptr v110 : ptr; + v114 = hir.load v113 : felt; + v115 = hir.load_local : felt #[local = lv7]; + v1030 = arith.constant 0 : i32; + v1031 = arith.constant 1 : i32; + v116 = arith.eq v114, v115 : i1; + v117 = hir.cast v116 : i32; + v119 = arith.neq v117, v1031 : i1; + v120 = arith.zext v119 : u32; + v121 = hir.bitcast v120 : i32; + v123 = arith.neq v121, v1030 : i1; + v1076 = scf.if v123 : u32 { ^block122: - v902 = arith.constant 1 : u32; - scf.yield v902; + v1070 = arith.constant 1 : u32; + scf.yield v1070; } else { ^block25: - v109 = hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::felt::eq(v94, v80) : i32 - v1021 = arith.constant 0 : i32; - v1022 = arith.constant 1 : i32; - v111 = arith.neq v109, v1022 : i1; - v112 = arith.zext v111 : u32; - v113 = hir.bitcast v112 : i32; - v115 = arith.neq v113, v1021 : i1; - scf.if v115{ + v124 = hir.load_local : felt #[local = lv8]; + v125 = hir.load_local : felt #[local = lv6]; + v1110 = arith.constant 0 : i32; + v1111 = arith.constant 1 : i32; + v126 = arith.eq v124, v125 : i1; + v127 = hir.cast v126 : i32; + v129 = arith.neq v127, v1111 : i1; + v130 = arith.zext v129 : u32; + v131 = hir.bitcast v130 : i32; + v133 = arith.neq v131, v1110 : i1; + scf.if v133{ ^block121: scf.yield ; } else { ^block26: - v116 = arith.constant 28 : i32; - v117 = arith.add v54, v116 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::active_note::get_assets(v117) - v119 = arith.constant 36 : u32; - v118 = hir.bitcast v54 : u32; - v120 = arith.add v118, v119 : u32 #[overflow = checked]; - v1020 = arith.constant 4 : u32; - v122 = arith.mod v120, v1020 : u32; - hir.assertz v122 #[code = 250]; - v123 = hir.int_to_ptr v120 : ptr; - v124 = hir.load v123 : i32; - v129 = arith.constant 28 : u32; - v128 = hir.bitcast v54 : u32; - v130 = arith.add v128, v129 : u32 #[overflow = checked]; - v1019 = arith.constant 4 : u32; - v132 = arith.mod v130, v1019 : u32; - hir.assertz v132 #[code = 250]; - v133 = hir.int_to_ptr v130 : ptr; - v134 = hir.load v133 : i32; - v136 = arith.constant 32 : u32; - v135 = hir.bitcast v54 : u32; - v137 = arith.add v135, v136 : u32 #[overflow = checked]; - v1018 = arith.constant 4 : u32; - v139 = arith.mod v137, v1018 : u32; - hir.assertz v139 #[code = 250]; - v140 = hir.int_to_ptr v137 : ptr; - v141 = hir.load v140 : i32; - v1017 = arith.constant 4 : u32; - v127 = arith.shl v124, v1017 : i32; - v970, v971, v972, v973, v974, v975, v976, v977 = scf.while v127, v141, v54, v141, v134 : i32, i32, i32, i32, i32, i32, i32, i32 { - ^block136(v978: i32, v979: i32, v980: i32, v981: i32, v982: i32): - v1015 = arith.constant 0 : i32; - v1016 = arith.constant 0 : i32; - v144 = arith.eq v978, v1016 : i1; - v145 = arith.zext v144 : u32; - v146 = hir.bitcast v145 : i32; - v148 = arith.neq v146, v1015 : i1; - v963, v964 = scf.if v148 : i32, i32 { + v134 = hir.load_local : i32 #[local = lv4]; + v1109 = arith.constant 12 : i32; + v136 = arith.add v134, v1109 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::active_note::get_assets(v136) + v137 = hir.load_local : i32 #[local = lv4]; + v1108 = arith.constant 20 : u32; + v138 = hir.bitcast v137 : u32; + v140 = arith.add v138, v1108 : u32 #[overflow = checked]; + v1107 = arith.constant 4 : u32; + v142 = arith.mod v140, v1107 : u32; + hir.assertz v142 #[code = 250]; + v143 = hir.int_to_ptr v140 : ptr; + v144 = hir.load v143 : i32; + v1106 = arith.constant 4 : u32; + v147 = arith.shl v144, v1106 : i32; + hir.store_local v147 #[local = lv9]; + v148 = hir.load_local : i32 #[local = lv4]; + v1029 = arith.constant 12 : u32; + v149 = hir.bitcast v148 : u32; + v151 = arith.add v149, v1029 : u32 #[overflow = checked]; + v1105 = arith.constant 4 : u32; + v153 = arith.mod v151, v1105 : u32; + hir.assertz v153 #[code = 250]; + v154 = hir.int_to_ptr v151 : ptr; + v155 = hir.load v154 : i32; + hir.store_local v155 #[local = lv10]; + v156 = hir.load_local : i32 #[local = lv4]; + v1104 = arith.constant 16 : u32; + v157 = hir.bitcast v156 : u32; + v159 = arith.add v157, v1104 : u32 #[overflow = checked]; + v1103 = arith.constant 4 : u32; + v161 = arith.mod v159, v1103 : u32; + hir.assertz v161 #[code = 250]; + v162 = hir.int_to_ptr v159 : ptr; + v163 = hir.load v162 : i32; + hir.store_local v163 #[local = lv11]; + hir.store_local v163 #[local = lv5]; + scf.while { + ^block28: + v164 = hir.load_local : i32 #[local = lv9]; + v1101 = arith.constant 0 : i32; + v1102 = arith.constant 0 : i32; + v166 = arith.eq v164, v1102 : i1; + v167 = arith.zext v166 : u32; + v168 = hir.bitcast v167 : i32; + v170 = arith.neq v168, v1101 : i1; + scf.if v170{ ^block135: - v903 = ub.poison i32 : i32; - scf.yield v903, v903; + scf.yield ; } else { ^block30: - v150 = hir.bitcast v979 : u32; - v1014 = arith.constant 4 : u32; - v152 = arith.mod v150, v1014 : u32; - hir.assertz v152 #[code = 250]; - v153 = hir.int_to_ptr v150 : ptr; - v154 = hir.load v153 : felt; - v1013 = arith.constant 4 : u32; - v155 = hir.bitcast v979 : u32; - v157 = arith.add v155, v1013 : u32 #[overflow = checked]; - v1012 = arith.constant 4 : u32; - v159 = arith.mod v157, v1012 : u32; - hir.assertz v159 #[code = 250]; - v160 = hir.int_to_ptr v157 : ptr; - v161 = hir.load v160 : felt; - v1011 = arith.constant 8 : u32; - v162 = hir.bitcast v979 : u32; - v164 = arith.add v162, v1011 : u32 #[overflow = checked]; - v1010 = arith.constant 4 : u32; - v166 = arith.mod v164, v1010 : u32; - hir.assertz v166 #[code = 250]; - v167 = hir.int_to_ptr v164 : ptr; - v168 = hir.load v167 : felt; - v1009 = arith.constant 12 : u32; - v169 = hir.bitcast v979 : u32; - v171 = arith.add v169, v1009 : u32 #[overflow = checked]; - v1008 = arith.constant 4 : u32; - v173 = arith.mod v171, v1008 : u32; - hir.assertz v173 #[code = 250]; - v174 = hir.int_to_ptr v171 : ptr; - v175 = hir.load v174 : felt; - hir.exec @miden:base/note-script@1.0.0/p2id/p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7(v154, v161, v168, v175) - v1007 = arith.constant 16 : i32; - v179 = arith.add v979, v1007 : i32 #[overflow = wrapping]; - v176 = arith.constant -16 : i32; - v177 = arith.add v978, v176 : i32 #[overflow = wrapping]; - scf.yield v177, v179; + v171 = hir.load_local : i32 #[local = lv5]; + v172 = hir.bitcast v171 : u32; + v1100 = arith.constant 4 : u32; + v174 = arith.mod v172, v1100 : u32; + hir.assertz v174 #[code = 250]; + v175 = hir.int_to_ptr v172 : ptr; + v176 = hir.load v175 : felt; + v177 = hir.load_local : i32 #[local = lv5]; + v1099 = arith.constant 4 : u32; + v178 = hir.bitcast v177 : u32; + v180 = arith.add v178, v1099 : u32 #[overflow = checked]; + v1098 = arith.constant 4 : u32; + v182 = arith.mod v180, v1098 : u32; + hir.assertz v182 #[code = 250]; + v183 = hir.int_to_ptr v180 : ptr; + v184 = hir.load v183 : felt; + v185 = hir.load_local : i32 #[local = lv5]; + v1024 = arith.constant 8 : u32; + v186 = hir.bitcast v185 : u32; + v188 = arith.add v186, v1024 : u32 #[overflow = checked]; + v1097 = arith.constant 4 : u32; + v190 = arith.mod v188, v1097 : u32; + hir.assertz v190 #[code = 250]; + v191 = hir.int_to_ptr v188 : ptr; + v192 = hir.load v191 : felt; + v193 = hir.load_local : i32 #[local = lv5]; + v1096 = arith.constant 12 : u32; + v194 = hir.bitcast v193 : u32; + v196 = arith.add v194, v1096 : u32 #[overflow = checked]; + v1095 = arith.constant 4 : u32; + v198 = arith.mod v196, v1095 : u32; + hir.assertz v198 #[code = 250]; + v199 = hir.int_to_ptr v196 : ptr; + v200 = hir.load v199 : felt; + hir.exec @miden:base/note-script@1.0.0/p2id/p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7(v176, v184, v192, v200) + v201 = hir.load_local : i32 #[local = lv9]; + v1023 = arith.constant -16 : i32; + v203 = arith.add v201, v1023 : i32 #[overflow = wrapping]; + hir.store_local v203 #[local = lv9]; + v204 = hir.load_local : i32 #[local = lv5]; + v1037 = arith.constant 16 : i32; + v206 = arith.add v204, v1037 : i32 #[overflow = wrapping]; + hir.store_local v206 #[local = lv5]; + scf.yield ; }; - v1003 = ub.poison i32 : i32; - v967 = cf.select v148, v1003, v982 : i32; - v1004 = ub.poison i32 : i32; - v966 = cf.select v148, v1004, v981 : i32; - v1005 = ub.poison i32 : i32; - v965 = cf.select v148, v1005, v980 : i32; - v1006 = arith.constant 1 : u32; - v894 = arith.constant 0 : u32; - v969 = cf.select v148, v894, v1006 : u32; - v947 = arith.trunc v969 : i1; - scf.condition v947, v963, v964, v965, v966, v967, v980, v981, v982; + v1094 = arith.constant 1 : u32; + v1067 = arith.constant 0 : u32; + v1083 = cf.select v170, v1067, v1094 : u32; + v1071 = arith.trunc v1083 : i1; + scf.condition v1071; } do { - ^block137(v983: i32, v984: i32, v985: i32, v986: i32, v987: i32, v988: i32, v989: i32, v990: i32): - scf.yield v983, v984, v985, v986, v987; + ^block131: + scf.yield ; }; - v183 = arith.constant 44 : u32; - v182 = hir.bitcast v975 : u32; - v184 = arith.add v182, v183 : u32 #[overflow = checked]; - v1002 = arith.constant 4 : u32; - v186 = arith.mod v184, v1002 : u32; - hir.assertz v186 #[code = 250]; - v187 = hir.int_to_ptr v184 : ptr; - hir.store v187, v976; - v190 = arith.constant 40 : u32; - v189 = hir.bitcast v975 : u32; - v191 = arith.add v189, v190 : u32 #[overflow = checked]; - v1001 = arith.constant 4 : u32; - v193 = arith.mod v191, v1001 : u32; - hir.assertz v193 #[code = 250]; - v194 = hir.int_to_ptr v191 : ptr; - hir.store v194, v977; - v1000 = arith.constant 16 : i32; - v195 = arith.constant 40 : i32; - v196 = arith.add v975, v195 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v196, v1000, v1000) - v999 = arith.constant 16 : i32; - v200 = arith.add v975, v999 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/ as core::ops::drop::Drop>::drop(v200) - v998 = arith.constant 16 : i32; - v202 = arith.add v975, v998 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/ as core::ops::drop::Drop>::drop(v202) - v997 = arith.constant 48 : i32; - v204 = arith.add v975, v997 : i32 #[overflow = wrapping]; - v205 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v206 = hir.bitcast v205 : ptr; - hir.store v206, v204; + v207 = hir.load_local : i32 #[local = lv4]; + v208 = hir.load_local : i32 #[local = lv11]; + v1028 = arith.constant 28 : u32; + v209 = hir.bitcast v207 : u32; + v211 = arith.add v209, v1028 : u32 #[overflow = checked]; + v1093 = arith.constant 4 : u32; + v213 = arith.mod v211, v1093 : u32; + hir.assertz v213 #[code = 250]; + v214 = hir.int_to_ptr v211 : ptr; + hir.store v214, v208; + v215 = hir.load_local : i32 #[local = lv4]; + v216 = hir.load_local : i32 #[local = lv10]; + v1027 = arith.constant 24 : u32; + v217 = hir.bitcast v215 : u32; + v219 = arith.add v217, v1027 : u32 #[overflow = checked]; + v1092 = arith.constant 4 : u32; + v221 = arith.mod v219, v1092 : u32; + hir.assertz v221 #[code = 250]; + v222 = hir.int_to_ptr v219 : ptr; + hir.store v222, v216; + v223 = hir.load_local : i32 #[local = lv4]; + v1091 = arith.constant 16 : i32; + v1026 = arith.constant 24 : i32; + v225 = arith.add v223, v1026 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v225, v1091, v1091) + v228 = hir.load_local : i32 #[local = lv4]; + v1090 = arith.constant 32 : i32; + v230 = arith.add v228, v1090 : i32 #[overflow = wrapping]; + v231 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v232 = hir.bitcast v231 : ptr; + hir.store v232, v230; scf.yield ; }; - v995 = arith.constant 0 : u32; - v996 = arith.constant 1 : u32; - v991 = cf.select v115, v996, v995 : u32; - scf.yield v991; + v1088 = arith.constant 0 : u32; + v1089 = arith.constant 1 : u32; + v1084 = cf.select v133, v1089, v1088 : u32; + scf.yield v1084; }; - scf.yield v952; + scf.yield v1076; }; - v992 = arith.constant 0 : u32; - v962 = arith.eq v950, v992 : i1; - cf.cond_br v962 ^block126, ^block23; + v1085 = arith.constant 0 : u32; + v1081 = arith.eq v1074, v1085 : i1; + cf.cond_br v1081 ^block126, ^block23; ^block23: ub.unreachable ; ^block126: @@ -327,952 +367,1119 @@ builtin.component miden:base/note-script@1.0.0 { private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block33: - v208 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr - v209 = hir.bitcast v208 : ptr; - v210 = hir.load v209 : i32; - v211 = arith.constant 1048592 : i32; - v212 = arith.add v210, v211 : i32 #[overflow = wrapping]; - v213 = hir.bitcast v212 : u32; - v214 = hir.int_to_ptr v213 : ptr; - v215 = hir.load v214 : u8; - v207 = arith.constant 0 : i32; - v216 = arith.zext v215 : u32; - v217 = hir.bitcast v216 : i32; - v219 = arith.neq v217, v207 : i1; - scf.if v219{ + v233 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr + v234 = hir.bitcast v233 : ptr; + v235 = hir.load v234 : i32; + v1125 = arith.constant 1048592 : i32; + v237 = arith.add v235, v1125 : i32 #[overflow = wrapping]; + v238 = hir.bitcast v237 : u32; + v239 = hir.int_to_ptr v238 : ptr; + v240 = hir.load v239 : u8; + v1124 = arith.constant 0 : i32; + v241 = arith.zext v240 : u32; + v242 = hir.bitcast v241 : i32; + v244 = arith.neq v242, v1124 : i1; + scf.if v244{ ^block35: scf.yield ; } else { ^block36: - v220 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr - v221 = hir.bitcast v220 : ptr; - v222 = hir.load v221 : i32; + v245 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr + v246 = hir.bitcast v245 : ptr; + v247 = hir.load v246 : i32; + hir.store_local v247 #[local = lv0]; hir.exec @miden:base/note-script@1.0.0/p2id/__wasm_call_ctors() - v1030 = arith.constant 1 : u8; - v1032 = arith.constant 1048592 : i32; - v224 = arith.add v222, v1032 : i32 #[overflow = wrapping]; - v228 = hir.bitcast v224 : u32; - v229 = hir.int_to_ptr v228 : ptr; - hir.store v229, v1030; + v248 = hir.load_local : i32 #[local = lv0]; + v1123 = arith.constant 1 : u8; + v1128 = arith.constant 1048592 : i32; + v250 = arith.add v248, v1128 : i32 #[overflow = wrapping]; + v254 = hir.bitcast v250 : u32; + v255 = hir.int_to_ptr v254 : ptr; + hir.store v255, v1123; scf.yield ; }; builtin.ret ; }; - private builtin.function @::alloc(v230: i32, v231: i32, v232: i32) -> i32 { - ^block37(v230: i32, v231: i32, v232: i32): - v235 = arith.constant 16 : i32; - v234 = arith.constant 0 : i32; - v1034 = arith.constant 16 : u32; - v237 = hir.bitcast v231 : u32; - v239 = arith.gt v237, v1034 : i1; - v240 = arith.zext v239 : u32; - v241 = hir.bitcast v240 : i32; - v243 = arith.neq v241, v234 : i1; - v244 = cf.select v243, v231, v235 : i32; - v1074 = arith.constant 0 : i32; - v245 = arith.constant -1 : i32; - v246 = arith.add v244, v245 : i32 #[overflow = wrapping]; - v247 = arith.band v244, v246 : i32; - v249 = arith.neq v247, v1074 : i1; - v1043, v1044 = scf.if v249 : i32, u32 { - ^block141: - v1035 = arith.constant 0 : u32; - v1039 = ub.poison i32 : i32; - scf.yield v1039, v1035; + private builtin.function @::alloc(v256: i32, v257: i32, v258: i32) -> i32 { + ^block37(v256: i32, v257: i32, v258: i32): + hir.store_local v256 #[local = lv0]; + hir.store_local v257 #[local = lv1]; + hir.store_local v258 #[local = lv2]; + v260 = hir.load_local : i32 #[local = lv1]; + v1136 = arith.constant 16 : i32; + v1135 = arith.constant 0 : i32; + v1131 = arith.constant 16 : u32; + v264 = hir.bitcast v260 : u32; + v266 = arith.gt v264, v1131 : i1; + v267 = arith.zext v266 : u32; + v268 = hir.bitcast v267 : i32; + v270 = arith.neq v268, v1135 : i1; + v271 = cf.select v270, v260, v1136 : i32; + hir.store_local v271 #[local = lv3]; + v272 = hir.load_local : i32 #[local = lv3]; + v1179 = arith.constant 0 : i32; + v1134 = arith.constant -1 : i32; + v274 = arith.add v272, v1134 : i32 #[overflow = wrapping]; + v275 = arith.band v271, v274 : i32; + v277 = arith.neq v275, v1179 : i1; + v1157, v1158 = scf.if v277 : i32, u32 { + ^block140: + v1149 = arith.constant 0 : u32; + v1153 = ub.poison i32 : i32; + scf.yield v1153, v1149; } else { ^block40: - v251 = hir.exec @miden:base/note-script@1.0.0/p2id/::max(v231, v244) : i32 - v1073 = arith.constant 0 : i32; - v250 = arith.constant -2147483648 : i32; - v252 = arith.sub v250, v251 : i32 #[overflow = wrapping]; - v254 = hir.bitcast v252 : u32; - v253 = hir.bitcast v232 : u32; - v255 = arith.gt v253, v254 : i1; - v256 = arith.zext v255 : u32; - v257 = hir.bitcast v256 : i32; - v259 = arith.neq v257, v1073 : i1; - v1058 = scf.if v259 : i32 { - ^block140: - v1072 = ub.poison i32 : i32; - scf.yield v1072; + v278 = hir.load_local : i32 #[local = lv2]; + v280 = hir.load_local : i32 #[local = lv1]; + v281 = hir.load_local : i32 #[local = lv3]; + v282 = hir.exec @miden:base/note-script@1.0.0/p2id/::max(v280, v281) : i32 + hir.store_local v282 #[local = lv1]; + v1178 = arith.constant 0 : i32; + v1133 = arith.constant -2147483648 : i32; + v283 = arith.sub v1133, v282 : i32 #[overflow = wrapping]; + v285 = hir.bitcast v283 : u32; + v284 = hir.bitcast v278 : u32; + v286 = arith.gt v284, v285 : i1; + v287 = arith.zext v286 : u32; + v288 = hir.bitcast v287 : i32; + v290 = arith.neq v288, v1178 : i1; + v1163 = scf.if v290 : i32 { + ^block139: + v1177 = ub.poison i32 : i32; + scf.yield v1177; } else { ^block41: - v1070 = arith.constant 0 : i32; - v265 = arith.sub v1070, v251 : i32 #[overflow = wrapping]; - v1071 = arith.constant -1 : i32; - v261 = arith.add v232, v251 : i32 #[overflow = wrapping]; - v263 = arith.add v261, v1071 : i32 #[overflow = wrapping]; - v266 = arith.band v263, v265 : i32; - v267 = hir.bitcast v230 : u32; - v268 = arith.constant 4 : u32; - v269 = arith.mod v267, v268 : u32; - hir.assertz v269 #[code = 250]; - v270 = hir.int_to_ptr v267 : ptr; - v271 = hir.load v270 : i32; - v1069 = arith.constant 0 : i32; - v273 = arith.neq v271, v1069 : i1; - scf.if v273{ - ^block139: + v1176 = arith.constant 0 : i32; + hir.store_local v1176 #[local = lv3]; + v292 = hir.load_local : i32 #[local = lv2]; + v293 = hir.load_local : i32 #[local = lv1]; + v1174 = arith.constant 0 : i32; + v299 = arith.sub v1174, v293 : i32 #[overflow = wrapping]; + v1175 = arith.constant -1 : i32; + v294 = arith.add v292, v293 : i32 #[overflow = wrapping]; + v296 = arith.add v294, v1175 : i32 #[overflow = wrapping]; + v300 = arith.band v296, v299 : i32; + hir.store_local v300 #[local = lv2]; + v301 = hir.load_local : i32 #[local = lv0]; + v302 = hir.bitcast v301 : u32; + v1132 = arith.constant 4 : u32; + v304 = arith.mod v302, v1132 : u32; + hir.assertz v304 #[code = 250]; + v305 = hir.int_to_ptr v302 : ptr; + v306 = hir.load v305 : i32; + v1173 = arith.constant 0 : i32; + v308 = arith.neq v306, v1173 : i1; + scf.if v308{ + ^block138: scf.yield ; } else { ^block43: - v274 = hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::mem::heap_base() : i32 - v275 = hir.mem_size : u32; - v281 = hir.bitcast v230 : u32; - v1068 = arith.constant 4 : u32; - v283 = arith.mod v281, v1068 : u32; - hir.assertz v283 #[code = 250]; - v1067 = arith.constant 16 : u32; - v276 = hir.bitcast v275 : i32; - v279 = arith.shl v276, v1067 : i32; - v280 = arith.add v274, v279 : i32 #[overflow = wrapping]; - v284 = hir.int_to_ptr v281 : ptr; - hir.store v284, v280; + v309 = hir.load_local : i32 #[local = lv0]; + v310 = hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::mem::heap_base() : i32 + v311 = hir.mem_size : u32; + v317 = hir.bitcast v309 : u32; + v1172 = arith.constant 4 : u32; + v319 = arith.mod v317, v1172 : u32; + hir.assertz v319 #[code = 250]; + v1171 = arith.constant 16 : u32; + v312 = hir.bitcast v311 : i32; + v315 = arith.shl v312, v1171 : i32; + v316 = arith.add v310, v315 : i32 #[overflow = wrapping]; + v320 = hir.int_to_ptr v317 : ptr; + hir.store v320, v316; scf.yield ; }; - v287 = hir.bitcast v230 : u32; - v1066 = arith.constant 4 : u32; - v289 = arith.mod v287, v1066 : u32; - hir.assertz v289 #[code = 250]; - v290 = hir.int_to_ptr v287 : ptr; - v291 = hir.load v290 : i32; - v1064 = arith.constant 0 : i32; - v1065 = arith.constant -1 : i32; - v293 = arith.bxor v291, v1065 : i32; - v295 = hir.bitcast v293 : u32; - v294 = hir.bitcast v266 : u32; - v296 = arith.gt v294, v295 : i1; - v297 = arith.zext v296 : u32; - v298 = hir.bitcast v297 : i32; - v300 = arith.neq v298, v1064 : i1; - v1057 = scf.if v300 : i32 { - ^block44: - v1063 = arith.constant 0 : i32; - scf.yield v1063; + v321 = hir.load_local : i32 #[local = lv2]; + v322 = hir.load_local : i32 #[local = lv0]; + v323 = hir.bitcast v322 : u32; + v1170 = arith.constant 4 : u32; + v325 = arith.mod v323, v1170 : u32; + hir.assertz v325 #[code = 250]; + v326 = hir.int_to_ptr v323 : ptr; + v327 = hir.load v326 : i32; + hir.store_local v327 #[local = lv4]; + v1168 = arith.constant 0 : i32; + v1169 = arith.constant -1 : i32; + v329 = arith.bxor v327, v1169 : i32; + v331 = hir.bitcast v329 : u32; + v330 = hir.bitcast v321 : u32; + v332 = arith.gt v330, v331 : i1; + v333 = arith.zext v332 : u32; + v334 = hir.bitcast v333 : i32; + v336 = arith.neq v334, v1168 : i1; + scf.if v336{ + ^block137: + scf.yield ; } else { ^block45: - v302 = hir.bitcast v230 : u32; - v1062 = arith.constant 4 : u32; - v304 = arith.mod v302, v1062 : u32; - hir.assertz v304 #[code = 250]; - v301 = arith.add v291, v266 : i32 #[overflow = wrapping]; - v305 = hir.int_to_ptr v302 : ptr; - hir.store v305, v301; - v307 = arith.add v291, v251 : i32 #[overflow = wrapping]; - scf.yield v307; + v337 = hir.load_local : i32 #[local = lv0]; + v338 = hir.load_local : i32 #[local = lv4]; + v339 = hir.load_local : i32 #[local = lv2]; + v341 = hir.bitcast v337 : u32; + v1167 = arith.constant 4 : u32; + v343 = arith.mod v341, v1167 : u32; + hir.assertz v343 #[code = 250]; + v340 = arith.add v338, v339 : i32 #[overflow = wrapping]; + v344 = hir.int_to_ptr v341 : ptr; + hir.store v344, v340; + v345 = hir.load_local : i32 #[local = lv4]; + v346 = hir.load_local : i32 #[local = lv1]; + v347 = arith.add v345, v346 : i32 #[overflow = wrapping]; + hir.store_local v347 #[local = lv3]; + scf.yield ; }; - scf.yield v1057; + v348 = hir.load_local : i32 #[local = lv3]; + scf.yield v348; }; - v1040 = arith.constant 1 : u32; - v1061 = arith.constant 0 : u32; - v1059 = cf.select v259, v1061, v1040 : u32; - scf.yield v1058, v1059; + v1154 = arith.constant 1 : u32; + v1166 = arith.constant 0 : u32; + v1164 = cf.select v290, v1166, v1154 : u32; + scf.yield v1163, v1164; }; - v1060 = arith.constant 0 : u32; - v1056 = arith.eq v1044, v1060 : i1; - cf.cond_br v1056 ^block39, ^block143(v1043); + v1165 = arith.constant 0 : u32; + v1162 = arith.eq v1158, v1165 : i1; + cf.cond_br v1162 ^block39, ^block142(v1157); ^block39: ub.unreachable ; - ^block143(v1036: i32): - builtin.ret v1036; + ^block142(v1150: i32): + builtin.ret v1150; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { ^block46: - v310 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v310; - }; - - private builtin.function @>::with_capacity(v312: i32) { - ^block50(v312: i32): - v315 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v316 = hir.bitcast v315 : ptr; - v317 = hir.load v316 : i32; - v318 = arith.constant 16 : i32; - v319 = arith.sub v317, v318 : i32 #[overflow = wrapping]; - v320 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v321 = hir.bitcast v320 : ptr; - hir.store v321, v319; - v1079 = arith.constant 16 : i32; - v322 = arith.constant 8 : i32; - v323 = arith.add v319, v322 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/::with_capacity_in(v323, v1079, v1079) - v327 = arith.constant 8 : u32; - v326 = hir.bitcast v319 : u32; - v328 = arith.add v326, v327 : u32 #[overflow = checked]; - v1078 = arith.constant 8 : u32; - v330 = arith.mod v328, v1078 : u32; - hir.assertz v330 #[code = 250]; - v331 = hir.int_to_ptr v328 : ptr; - v332 = hir.load v331 : i64; - v1077 = arith.constant 8 : u32; - v334 = hir.bitcast v312 : u32; - v336 = arith.add v334, v1077 : u32 #[overflow = checked]; - v337 = arith.constant 4 : u32; - v338 = arith.mod v336, v337 : u32; - hir.assertz v338 #[code = 250]; - v313 = arith.constant 0 : i32; - v339 = hir.int_to_ptr v336 : ptr; - hir.store v339, v313; - v340 = hir.bitcast v312 : u32; - v1076 = arith.constant 4 : u32; - v342 = arith.mod v340, v1076 : u32; - hir.assertz v342 #[code = 250]; - v343 = hir.int_to_ptr v340 : ptr; - hir.store v343, v332; - v1075 = arith.constant 16 : i32; - v345 = arith.add v319, v1075 : i32 #[overflow = wrapping]; - v346 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v347 = hir.bitcast v346 : ptr; - hir.store v347, v345; - builtin.ret ; + v349 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v349; }; - private builtin.function @::with_capacity_in(v348: i32, v349: i32, v350: i32) { - ^block52(v348: i32, v349: i32, v350: i32): + private builtin.function @>::with_capacity(v351: i32) { + ^block50(v351: i32): + hir.store_local v351 #[local = lv0]; v352 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr v353 = hir.bitcast v352 : ptr; v354 = hir.load v353 : i32; - v355 = arith.constant 16 : i32; - v356 = arith.sub v354, v355 : i32 #[overflow = wrapping]; + v1185 = arith.constant 16 : i32; + v356 = arith.sub v354, v1185 : i32 #[overflow = wrapping]; + hir.store_local v356 #[local = lv1]; v357 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr v358 = hir.bitcast v357 : ptr; hir.store v358, v356; - v351 = arith.constant 0 : i32; - v361 = arith.constant 256 : i32; - v359 = arith.constant 4 : i32; - v360 = arith.add v356, v359 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/::try_allocate_in(v360, v361, v351, v349, v350) - v364 = arith.constant 8 : u32; - v363 = hir.bitcast v356 : u32; - v365 = arith.add v363, v364 : u32 #[overflow = checked]; - v366 = arith.constant 4 : u32; - v367 = arith.mod v365, v366 : u32; - hir.assertz v367 #[code = 250]; - v368 = hir.int_to_ptr v365 : ptr; - v369 = hir.load v368 : i32; - v1090 = arith.constant 4 : u32; - v370 = hir.bitcast v356 : u32; - v372 = arith.add v370, v1090 : u32 #[overflow = checked]; - v1089 = arith.constant 4 : u32; - v374 = arith.mod v372, v1089 : u32; - hir.assertz v374 #[code = 250]; - v375 = hir.int_to_ptr v372 : ptr; - v376 = hir.load v375 : i32; - v1088 = arith.constant 0 : i32; - v377 = arith.constant 1 : i32; - v378 = arith.neq v376, v377 : i1; - v379 = arith.zext v378 : u32; - v380 = hir.bitcast v379 : i32; - v382 = arith.neq v380, v1088 : i1; - cf.cond_br v382 ^block54, ^block55; + v359 = hir.load_local : i32 #[local = lv1]; + v1195 = arith.constant 16 : i32; + v1183 = arith.constant 256 : i32; + v1184 = arith.constant 8 : i32; + v361 = arith.add v359, v1184 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/::with_capacity_in(v361, v1183, v1195, v1195) + v365 = hir.load_local : i32 #[local = lv1]; + v1182 = arith.constant 8 : u32; + v366 = hir.bitcast v365 : u32; + v368 = arith.add v366, v1182 : u32 #[overflow = checked]; + v1194 = arith.constant 8 : u32; + v370 = arith.mod v368, v1194 : u32; + hir.assertz v370 #[code = 250]; + v371 = hir.int_to_ptr v368 : ptr; + v372 = hir.load v371 : i64; + v373 = hir.load_local : i32 #[local = lv0]; + v1193 = arith.constant 8 : u32; + v375 = hir.bitcast v373 : u32; + v377 = arith.add v375, v1193 : u32 #[overflow = checked]; + v1180 = arith.constant 4 : u32; + v379 = arith.mod v377, v1180 : u32; + hir.assertz v379 #[code = 250]; + v1181 = arith.constant 0 : i32; + v380 = hir.int_to_ptr v377 : ptr; + hir.store v380, v1181; + v381 = hir.load_local : i32 #[local = lv0]; + v383 = hir.bitcast v381 : u32; + v1192 = arith.constant 4 : u32; + v385 = arith.mod v383, v1192 : u32; + hir.assertz v385 #[code = 250]; + v386 = hir.int_to_ptr v383 : ptr; + hir.store v386, v372; + v387 = hir.load_local : i32 #[local = lv1]; + v1191 = arith.constant 16 : i32; + v389 = arith.add v387, v1191 : i32 #[overflow = wrapping]; + v390 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v391 = hir.bitcast v390 : ptr; + hir.store v391, v389; + builtin.ret ; + }; + + private builtin.function @::with_capacity_in(v392: i32, v393: i32, v394: i32, v395: i32) { + ^block52(v392: i32, v393: i32, v394: i32, v395: i32): + hir.store_local v392 #[local = lv0]; + hir.store_local v395 #[local = lv3]; + v396 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v397 = hir.bitcast v396 : ptr; + v398 = hir.load v397 : i32; + v1202 = arith.constant 16 : i32; + v400 = arith.sub v398, v1202 : i32 #[overflow = wrapping]; + hir.store_local v400 #[local = lv4]; + v401 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v402 = hir.bitcast v401 : ptr; + hir.store v402, v400; + v403 = hir.load_local : i32 #[local = lv4]; + v409 = hir.load_local : i32 #[local = lv3]; + v1200 = arith.constant 0 : i32; + v1201 = arith.constant 4 : i32; + v405 = arith.add v403, v1201 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/::try_allocate_in(v405, v393, v1200, v394, v409) + v410 = hir.load_local : i32 #[local = lv4]; + v1199 = arith.constant 8 : u32; + v411 = hir.bitcast v410 : u32; + v413 = arith.add v411, v1199 : u32 #[overflow = checked]; + v1198 = arith.constant 4 : u32; + v415 = arith.mod v413, v1198 : u32; + hir.assertz v415 #[code = 250]; + v416 = hir.int_to_ptr v413 : ptr; + v417 = hir.load v416 : i32; + hir.store_local v417 #[local = lv3]; + v418 = hir.load_local : i32 #[local = lv4]; + v1223 = arith.constant 4 : u32; + v419 = hir.bitcast v418 : u32; + v421 = arith.add v419, v1223 : u32 #[overflow = checked]; + v1222 = arith.constant 4 : u32; + v423 = arith.mod v421, v1222 : u32; + hir.assertz v423 #[code = 250]; + v424 = hir.int_to_ptr v421 : ptr; + v425 = hir.load v424 : i32; + v1221 = arith.constant 0 : i32; + v1197 = arith.constant 1 : i32; + v427 = arith.neq v425, v1197 : i1; + v428 = arith.zext v427 : u32; + v429 = hir.bitcast v428 : i32; + v431 = arith.neq v429, v1221 : i1; + cf.cond_br v431 ^block54, ^block55; ^block54: - v391 = arith.constant 12 : u32; - v390 = hir.bitcast v356 : u32; - v392 = arith.add v390, v391 : u32 #[overflow = checked]; - v1087 = arith.constant 4 : u32; - v394 = arith.mod v392, v1087 : u32; - hir.assertz v394 #[code = 250]; - v395 = hir.int_to_ptr v392 : ptr; - v396 = hir.load v395 : i32; - v1086 = arith.constant 4 : u32; - v397 = hir.bitcast v348 : u32; - v399 = arith.add v397, v1086 : u32 #[overflow = checked]; - v1085 = arith.constant 4 : u32; - v401 = arith.mod v399, v1085 : u32; - hir.assertz v401 #[code = 250]; - v402 = hir.int_to_ptr v399 : ptr; - hir.store v402, v396; - v403 = hir.bitcast v348 : u32; - v1084 = arith.constant 4 : u32; - v405 = arith.mod v403, v1084 : u32; - hir.assertz v405 #[code = 250]; - v406 = hir.int_to_ptr v403 : ptr; - hir.store v406, v369; - v1083 = arith.constant 16 : i32; - v408 = arith.add v356, v1083 : i32 #[overflow = wrapping]; - v409 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v410 = hir.bitcast v409 : ptr; - hir.store v410, v408; + v441 = hir.load_local : i32 #[local = lv0]; + v442 = hir.load_local : i32 #[local = lv4]; + v1196 = arith.constant 12 : u32; + v443 = hir.bitcast v442 : u32; + v445 = arith.add v443, v1196 : u32 #[overflow = checked]; + v1220 = arith.constant 4 : u32; + v447 = arith.mod v445, v1220 : u32; + hir.assertz v447 #[code = 250]; + v448 = hir.int_to_ptr v445 : ptr; + v449 = hir.load v448 : i32; + v1219 = arith.constant 4 : u32; + v450 = hir.bitcast v441 : u32; + v452 = arith.add v450, v1219 : u32 #[overflow = checked]; + v1218 = arith.constant 4 : u32; + v454 = arith.mod v452, v1218 : u32; + hir.assertz v454 #[code = 250]; + v455 = hir.int_to_ptr v452 : ptr; + hir.store v455, v449; + v456 = hir.load_local : i32 #[local = lv0]; + v457 = hir.load_local : i32 #[local = lv3]; + v458 = hir.bitcast v456 : u32; + v1217 = arith.constant 4 : u32; + v460 = arith.mod v458, v1217 : u32; + hir.assertz v460 #[code = 250]; + v461 = hir.int_to_ptr v458 : ptr; + hir.store v461, v457; + v462 = hir.load_local : i32 #[local = lv4]; + v1216 = arith.constant 16 : i32; + v464 = arith.add v462, v1216 : i32 #[overflow = wrapping]; + v465 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v466 = hir.bitcast v465 : ptr; + hir.store v466, v464; builtin.ret ; ^block55: - v1082 = arith.constant 12 : u32; - v383 = hir.bitcast v356 : u32; - v385 = arith.add v383, v1082 : u32 #[overflow = checked]; - v1081 = arith.constant 4 : u32; - v387 = arith.mod v385, v1081 : u32; - hir.assertz v387 #[code = 250]; - v388 = hir.int_to_ptr v385 : ptr; - v389 = hir.load v388 : i32; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::handle_error(v369, v389) + v432 = hir.load_local : i32 #[local = lv3]; + v433 = hir.load_local : i32 #[local = lv4]; + v1215 = arith.constant 12 : u32; + v434 = hir.bitcast v433 : u32; + v436 = arith.add v434, v1215 : u32 #[overflow = checked]; + v1214 = arith.constant 4 : u32; + v438 = arith.mod v436, v1214 : u32; + hir.assertz v438 #[code = 250]; + v439 = hir.int_to_ptr v436 : ptr; + v440 = hir.load v439 : i32; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::handle_error(v432, v440) ub.unreachable ; }; - private builtin.function @ as core::ops::drop::Drop>::drop(v411: i32) { - ^block56(v411: i32): - v412 = arith.constant 4 : i32; - hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v411, v412, v412) + private builtin.function @ as core::ops::drop::Drop>::drop(v467: i32) { + ^block56(v467: i32): + v1224 = arith.constant 4 : i32; + hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v467, v1224, v1224) builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::active_note::get_assets(v414: i32) { - ^block58(v414: i32): - v416 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v417 = hir.bitcast v416 : ptr; - v418 = hir.load v417 : i32; - v419 = arith.constant 16 : i32; - v420 = arith.sub v418, v419 : i32 #[overflow = wrapping]; - v421 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v422 = hir.bitcast v421 : ptr; - hir.store v422, v420; - v423 = arith.constant 4 : i32; - v424 = arith.add v420, v423 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/>::with_capacity(v424) - v428 = arith.constant 8 : u32; - v427 = hir.bitcast v420 : u32; - v429 = arith.add v427, v428 : u32 #[overflow = checked]; - v430 = arith.constant 4 : u32; - v431 = arith.mod v429, v430 : u32; - hir.assertz v431 #[code = 250]; - v432 = hir.int_to_ptr v429 : ptr; - v433 = hir.load v432 : i32; - v1091 = arith.constant 2 : u32; - v435 = hir.bitcast v433 : u32; - v437 = arith.shr v435, v1091 : u32; - v438 = hir.bitcast v437 : i32; - v439 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_assets(v438) : i32 - v425 = arith.constant 8 : i32; - v426 = arith.add v414, v425 : i32 #[overflow = wrapping]; - v440 = hir.bitcast v426 : u32; - v1096 = arith.constant 4 : u32; - v442 = arith.mod v440, v1096 : u32; - hir.assertz v442 #[code = 250]; - v443 = hir.int_to_ptr v440 : ptr; - hir.store v443, v439; - v1095 = arith.constant 4 : u32; - v444 = hir.bitcast v420 : u32; - v446 = arith.add v444, v1095 : u32 #[overflow = checked]; - v1094 = arith.constant 4 : u32; - v448 = arith.mod v446, v1094 : u32; - hir.assertz v448 #[code = 250]; - v449 = hir.int_to_ptr v446 : ptr; - v450 = hir.load v449 : i64; - v451 = hir.bitcast v414 : u32; - v1093 = arith.constant 4 : u32; - v453 = arith.mod v451, v1093 : u32; - hir.assertz v453 #[code = 250]; - v454 = hir.int_to_ptr v451 : ptr; - hir.store v454, v450; - v1092 = arith.constant 16 : i32; - v456 = arith.add v420, v1092 : i32 #[overflow = wrapping]; - v457 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v458 = hir.bitcast v457 : ptr; - hir.store v458, v456; + private builtin.function @miden_base_sys::bindings::active_note::get_assets(v471: i32) { + ^block58(v471: i32): + hir.store_local v471 #[local = lv0]; + v472 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v473 = hir.bitcast v472 : ptr; + v474 = hir.load v473 : i32; + v1231 = arith.constant 16 : i32; + v476 = arith.sub v474, v1231 : i32 #[overflow = wrapping]; + hir.store_local v476 #[local = lv1]; + v477 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v478 = hir.bitcast v477 : ptr; + hir.store v478, v476; + v479 = hir.load_local : i32 #[local = lv1]; + v1230 = arith.constant 4 : i32; + v481 = arith.add v479, v1230 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/>::with_capacity(v481) + v482 = hir.load_local : i32 #[local = lv0]; + v485 = hir.load_local : i32 #[local = lv1]; + v1228 = arith.constant 8 : u32; + v486 = hir.bitcast v485 : u32; + v488 = arith.add v486, v1228 : u32 #[overflow = checked]; + v1227 = arith.constant 4 : u32; + v490 = arith.mod v488, v1227 : u32; + hir.assertz v490 #[code = 250]; + v491 = hir.int_to_ptr v488 : ptr; + v492 = hir.load v491 : i32; + v1226 = arith.constant 2 : u32; + v494 = hir.bitcast v492 : u32; + v496 = arith.shr v494, v1226 : u32; + v497 = hir.bitcast v496 : i32; + v498 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::protocol::active_note::get_assets(v497) : i32 + v1229 = arith.constant 8 : i32; + v484 = arith.add v482, v1229 : i32 #[overflow = wrapping]; + v499 = hir.bitcast v484 : u32; + v1241 = arith.constant 4 : u32; + v501 = arith.mod v499, v1241 : u32; + hir.assertz v501 #[code = 250]; + v502 = hir.int_to_ptr v499 : ptr; + hir.store v502, v498; + v503 = hir.load_local : i32 #[local = lv0]; + v504 = hir.load_local : i32 #[local = lv1]; + v1240 = arith.constant 4 : u32; + v505 = hir.bitcast v504 : u32; + v507 = arith.add v505, v1240 : u32 #[overflow = checked]; + v1239 = arith.constant 4 : u32; + v509 = arith.mod v507, v1239 : u32; + hir.assertz v509 #[code = 250]; + v510 = hir.int_to_ptr v507 : ptr; + v511 = hir.load v510 : i64; + v512 = hir.bitcast v503 : u32; + v1238 = arith.constant 4 : u32; + v514 = arith.mod v512, v1238 : u32; + hir.assertz v514 #[code = 250]; + v515 = hir.int_to_ptr v512 : ptr; + hir.store v515, v511; + v516 = hir.load_local : i32 #[local = lv1]; + v1237 = arith.constant 16 : i32; + v518 = arith.add v516, v1237 : i32 #[overflow = wrapping]; + v519 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v520 = hir.bitcast v519 : ptr; + hir.store v520, v518; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::active_note::get_inputs(v459: i32) { - ^block60(v459: i32): - v461 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v462 = hir.bitcast v461 : ptr; - v463 = hir.load v462 : i32; - v464 = arith.constant 16 : i32; - v465 = arith.sub v463, v464 : i32 #[overflow = wrapping]; - v466 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v467 = hir.bitcast v466 : ptr; - hir.store v467, v465; - v470 = arith.constant 4 : i32; - v468 = arith.constant 8 : i32; - v469 = arith.add v465, v468 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/::with_capacity_in(v469, v470, v470) - v473 = arith.constant 8 : u32; - v472 = hir.bitcast v465 : u32; - v474 = arith.add v472, v473 : u32 #[overflow = checked]; - v475 = arith.constant 4 : u32; - v476 = arith.mod v474, v475 : u32; - hir.assertz v476 #[code = 250]; - v477 = hir.int_to_ptr v474 : ptr; - v478 = hir.load v477 : i32; - v480 = arith.constant 12 : u32; - v479 = hir.bitcast v465 : u32; - v481 = arith.add v479, v480 : u32 #[overflow = checked]; - v1104 = arith.constant 4 : u32; - v483 = arith.mod v481, v1104 : u32; - hir.assertz v483 #[code = 250]; - v484 = hir.int_to_ptr v481 : ptr; - v485 = hir.load v484 : i32; - v1097 = arith.constant 2 : u32; - v487 = hir.bitcast v485 : u32; - v489 = arith.shr v487, v1097 : u32; - v490 = hir.bitcast v489 : i32; - v491 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_inputs(v490) : i32 - v1103 = arith.constant 8 : u32; - v492 = hir.bitcast v459 : u32; - v494 = arith.add v492, v1103 : u32 #[overflow = checked]; - v1102 = arith.constant 4 : u32; - v496 = arith.mod v494, v1102 : u32; - hir.assertz v496 #[code = 250]; - v497 = hir.int_to_ptr v494 : ptr; - hir.store v497, v491; - v1101 = arith.constant 4 : u32; - v498 = hir.bitcast v459 : u32; - v500 = arith.add v498, v1101 : u32 #[overflow = checked]; - v1100 = arith.constant 4 : u32; - v502 = arith.mod v500, v1100 : u32; - hir.assertz v502 #[code = 250]; - v503 = hir.int_to_ptr v500 : ptr; - hir.store v503, v485; - v504 = hir.bitcast v459 : u32; - v1099 = arith.constant 4 : u32; - v506 = arith.mod v504, v1099 : u32; - hir.assertz v506 #[code = 250]; - v507 = hir.int_to_ptr v504 : ptr; - hir.store v507, v478; - v1098 = arith.constant 16 : i32; - v509 = arith.add v465, v1098 : i32 #[overflow = wrapping]; - v510 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v511 = hir.bitcast v510 : ptr; - hir.store v511, v509; + private builtin.function @miden_base_sys::bindings::active_note::get_inputs(v521: i32) { + ^block60(v521: i32): + hir.store_local v521 #[local = lv0]; + v522 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v523 = hir.bitcast v522 : ptr; + v524 = hir.load v523 : i32; + v1250 = arith.constant 16 : i32; + v526 = arith.sub v524, v1250 : i32 #[overflow = wrapping]; + hir.store_local v526 #[local = lv1]; + v527 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v528 = hir.bitcast v527 : ptr; + hir.store v528, v526; + v529 = hir.load_local : i32 #[local = lv1]; + v1247 = arith.constant 4 : i32; + v1248 = arith.constant 1024 : i32; + v1249 = arith.constant 8 : i32; + v531 = arith.add v529, v1249 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/::with_capacity_in(v531, v1248, v1247, v1247) + v535 = hir.load_local : i32 #[local = lv1]; + v1246 = arith.constant 8 : u32; + v536 = hir.bitcast v535 : u32; + v538 = arith.add v536, v1246 : u32 #[overflow = checked]; + v1245 = arith.constant 4 : u32; + v540 = arith.mod v538, v1245 : u32; + hir.assertz v540 #[code = 250]; + v541 = hir.int_to_ptr v538 : ptr; + v542 = hir.load v541 : i32; + hir.store_local v542 #[local = lv2]; + v543 = hir.load_local : i32 #[local = lv0]; + v544 = hir.load_local : i32 #[local = lv1]; + v1244 = arith.constant 12 : u32; + v545 = hir.bitcast v544 : u32; + v547 = arith.add v545, v1244 : u32 #[overflow = checked]; + v1264 = arith.constant 4 : u32; + v549 = arith.mod v547, v1264 : u32; + hir.assertz v549 #[code = 250]; + v550 = hir.int_to_ptr v547 : ptr; + v551 = hir.load v550 : i32; + hir.store_local v551 #[local = lv3]; + v1243 = arith.constant 2 : u32; + v553 = hir.bitcast v551 : u32; + v555 = arith.shr v553, v1243 : u32; + v556 = hir.bitcast v555 : i32; + v557 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::protocol::active_note::get_inputs(v556) : i32 + v1263 = arith.constant 8 : u32; + v558 = hir.bitcast v543 : u32; + v560 = arith.add v558, v1263 : u32 #[overflow = checked]; + v1262 = arith.constant 4 : u32; + v562 = arith.mod v560, v1262 : u32; + hir.assertz v562 #[code = 250]; + v563 = hir.int_to_ptr v560 : ptr; + hir.store v563, v557; + v564 = hir.load_local : i32 #[local = lv0]; + v565 = hir.load_local : i32 #[local = lv3]; + v1261 = arith.constant 4 : u32; + v566 = hir.bitcast v564 : u32; + v568 = arith.add v566, v1261 : u32 #[overflow = checked]; + v1260 = arith.constant 4 : u32; + v570 = arith.mod v568, v1260 : u32; + hir.assertz v570 #[code = 250]; + v571 = hir.int_to_ptr v568 : ptr; + hir.store v571, v565; + v572 = hir.load_local : i32 #[local = lv0]; + v573 = hir.load_local : i32 #[local = lv2]; + v574 = hir.bitcast v572 : u32; + v1259 = arith.constant 4 : u32; + v576 = arith.mod v574, v1259 : u32; + hir.assertz v576 #[code = 250]; + v577 = hir.int_to_ptr v574 : ptr; + hir.store v577, v573; + v578 = hir.load_local : i32 #[local = lv1]; + v1258 = arith.constant 16 : i32; + v580 = arith.add v578, v1258 : i32 #[overflow = wrapping]; + v581 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v582 = hir.bitcast v581 : ptr; + hir.store v582, v580; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::active_account::get_id(v512: i32) { - ^block62(v512: i32): - v514 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v515 = hir.bitcast v514 : ptr; - v516 = hir.load v515 : i32; - v517 = arith.constant 16 : i32; - v518 = arith.sub v516, v517 : i32 #[overflow = wrapping]; - v519 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v520 = hir.bitcast v519 : ptr; - hir.store v520, v518; - v521 = arith.constant 8 : i32; - v522 = arith.add v518, v521 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_account::get_id(v522) - v524 = arith.constant 8 : u32; - v523 = hir.bitcast v518 : u32; - v525 = arith.add v523, v524 : u32 #[overflow = checked]; - v526 = arith.constant 4 : u32; - v527 = arith.mod v525, v526 : u32; - hir.assertz v527 #[code = 250]; - v528 = hir.int_to_ptr v525 : ptr; - v529 = hir.load v528 : i64; - v530 = hir.bitcast v512 : u32; - v1106 = arith.constant 8 : u32; - v532 = arith.mod v530, v1106 : u32; - hir.assertz v532 #[code = 250]; - v533 = hir.int_to_ptr v530 : ptr; - hir.store v533, v529; - v1105 = arith.constant 16 : i32; - v535 = arith.add v518, v1105 : i32 #[overflow = wrapping]; - v536 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v537 = hir.bitcast v536 : ptr; - hir.store v537, v535; + private builtin.function @miden_base_sys::bindings::active_account::get_id(v583: i32) { + ^block62(v583: i32): + hir.store_local v583 #[local = lv0]; + v584 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v585 = hir.bitcast v584 : ptr; + v586 = hir.load v585 : i32; + v1268 = arith.constant 16 : i32; + v588 = arith.sub v586, v1268 : i32 #[overflow = wrapping]; + hir.store_local v588 #[local = lv1]; + v589 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v590 = hir.bitcast v589 : ptr; + hir.store v590, v588; + v591 = hir.load_local : i32 #[local = lv1]; + v1267 = arith.constant 8 : i32; + v593 = arith.add v591, v1267 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/miden::protocol::active_account::get_id(v593) + v594 = hir.load_local : i32 #[local = lv0]; + v595 = hir.load_local : i32 #[local = lv1]; + v1266 = arith.constant 8 : u32; + v596 = hir.bitcast v595 : u32; + v598 = arith.add v596, v1266 : u32 #[overflow = checked]; + v1265 = arith.constant 4 : u32; + v600 = arith.mod v598, v1265 : u32; + hir.assertz v600 #[code = 250]; + v601 = hir.int_to_ptr v598 : ptr; + v602 = hir.load v601 : i64; + v603 = hir.bitcast v594 : u32; + v1272 = arith.constant 8 : u32; + v605 = arith.mod v603, v1272 : u32; + hir.assertz v605 #[code = 250]; + v606 = hir.int_to_ptr v603 : ptr; + hir.store v606, v602; + v607 = hir.load_local : i32 #[local = lv1]; + v1271 = arith.constant 16 : i32; + v609 = arith.add v607, v1271 : i32 #[overflow = wrapping]; + v610 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v611 = hir.bitcast v610 : ptr; + hir.store v611, v609; builtin.ret ; }; - private builtin.function @ as core::ops::drop::Drop>::drop(v538: i32) { - ^block64(v538: i32): + private builtin.function @ as core::ops::drop::Drop>::drop(v612: i32) { + ^block64(v612: i32): builtin.ret ; }; - private builtin.function @intrinsics::felt::eq(v539: felt, v540: felt) -> i32 { - ^block66(v539: felt, v540: felt): - v541 = arith.eq v539, v540 : i1; - v542 = hir.cast v541 : i32; - builtin.ret v542; - }; - - private builtin.function @::alloc_impl(v544: i32, v545: i32, v546: i32, v547: i32) { - ^block68(v544: i32, v545: i32, v546: i32, v547: i32): - v1122 = arith.constant 0 : i32; - v548 = arith.constant 0 : i32; - v549 = arith.eq v546, v548 : i1; - v550 = arith.zext v549 : u32; - v551 = hir.bitcast v550 : i32; - v553 = arith.neq v551, v1122 : i1; - v1118 = scf.if v553 : i32 { - ^block149: - scf.yield v545; + private builtin.function @::alloc_impl(v613: i32, v614: i32, v615: i32, v616: i32) { + ^block66(v613: i32, v614: i32, v615: i32, v616: i32): + hir.store_local v613 #[local = lv0]; + hir.store_local v614 #[local = lv1]; + hir.store_local v615 #[local = lv2]; + hir.store_local v616 #[local = lv3]; + v617 = hir.load_local : i32 #[local = lv2]; + v1283 = arith.constant 0 : i32; + v1278 = arith.constant 0 : i32; + v619 = arith.eq v617, v1278 : i1; + v620 = arith.zext v619 : u32; + v621 = hir.bitcast v620 : i32; + v623 = arith.neq v621, v1283 : i1; + scf.if v623{ + ^block147: + scf.yield ; } else { - ^block71: + ^block69: hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v1121 = arith.constant 0 : i32; - v555 = arith.neq v547, v1121 : i1; - v1117 = scf.if v555 : i32 { - ^block72: - v557 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc_zeroed(v546, v545) : i32 - scf.yield v557; + v624 = hir.load_local : i32 #[local = lv3]; + v1282 = arith.constant 0 : i32; + v626 = arith.neq v624, v1282 : i1; + scf.if v626{ + ^block70: + v630 = hir.load_local : i32 #[local = lv2]; + v631 = hir.load_local : i32 #[local = lv1]; + v632 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc_zeroed(v630, v631) : i32 + hir.store_local v632 #[local = lv1]; + scf.yield ; } else { - ^block73: - v556 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc(v546, v545) : i32 - scf.yield v556; + ^block71: + v627 = hir.load_local : i32 #[local = lv2]; + v628 = hir.load_local : i32 #[local = lv1]; + v629 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc(v627, v628) : i32 + hir.store_local v629 #[local = lv1]; + scf.yield ; }; - scf.yield v1117; + scf.yield ; }; - v561 = arith.constant 4 : u32; - v560 = hir.bitcast v544 : u32; - v562 = arith.add v560, v561 : u32 #[overflow = checked]; - v1120 = arith.constant 4 : u32; - v564 = arith.mod v562, v1120 : u32; - hir.assertz v564 #[code = 250]; - v565 = hir.int_to_ptr v562 : ptr; - hir.store v565, v546; - v567 = hir.bitcast v544 : u32; - v1119 = arith.constant 4 : u32; - v569 = arith.mod v567, v1119 : u32; - hir.assertz v569 #[code = 250]; - v570 = hir.int_to_ptr v567 : ptr; - hir.store v570, v1118; + v633 = hir.load_local : i32 #[local = lv0]; + v634 = hir.load_local : i32 #[local = lv2]; + v1273 = arith.constant 4 : u32; + v635 = hir.bitcast v633 : u32; + v637 = arith.add v635, v1273 : u32 #[overflow = checked]; + v1281 = arith.constant 4 : u32; + v639 = arith.mod v637, v1281 : u32; + hir.assertz v639 #[code = 250]; + v640 = hir.int_to_ptr v637 : ptr; + hir.store v640, v634; + v641 = hir.load_local : i32 #[local = lv0]; + v642 = hir.load_local : i32 #[local = lv1]; + v643 = hir.bitcast v641 : u32; + v1280 = arith.constant 4 : u32; + v645 = arith.mod v643, v1280 : u32; + hir.assertz v645 #[code = 250]; + v646 = hir.int_to_ptr v643 : ptr; + hir.store v646, v642; builtin.ret ; }; - private builtin.function @::deallocate(v571: i32, v572: i32, v573: i32) { - ^block74(v571: i32, v572: i32, v573: i32): - v575 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v576 = hir.bitcast v575 : ptr; - v577 = hir.load v576 : i32; - v578 = arith.constant 16 : i32; - v579 = arith.sub v577, v578 : i32 #[overflow = wrapping]; - v580 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v581 = hir.bitcast v580 : ptr; - hir.store v581, v579; - v582 = arith.constant 4 : i32; - v583 = arith.add v579, v582 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/::current_memory(v583, v571, v572, v573) - v585 = arith.constant 8 : u32; - v584 = hir.bitcast v579 : u32; - v586 = arith.add v584, v585 : u32 #[overflow = checked]; - v587 = arith.constant 4 : u32; - v588 = arith.mod v586, v587 : u32; - hir.assertz v588 #[code = 250]; - v589 = hir.int_to_ptr v586 : ptr; - v590 = hir.load v589 : i32; - v1129 = arith.constant 0 : i32; - v574 = arith.constant 0 : i32; - v592 = arith.eq v590, v574 : i1; - v593 = arith.zext v592 : u32; - v594 = hir.bitcast v593 : i32; - v596 = arith.neq v594, v1129 : i1; - scf.if v596{ - ^block152: + private builtin.function @::deallocate(v647: i32, v648: i32, v649: i32) { + ^block72(v647: i32, v648: i32, v649: i32): + hir.store_local v649 #[local = lv2]; + v650 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v651 = hir.bitcast v650 : ptr; + v652 = hir.load v651 : i32; + v1289 = arith.constant 16 : i32; + v654 = arith.sub v652, v1289 : i32 #[overflow = wrapping]; + hir.store_local v654 #[local = lv3]; + v655 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v656 = hir.bitcast v655 : ptr; + hir.store v656, v654; + v657 = hir.load_local : i32 #[local = lv3]; + v662 = hir.load_local : i32 #[local = lv2]; + v1288 = arith.constant 4 : i32; + v659 = arith.add v657, v1288 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/::current_memory(v659, v647, v648, v662) + v663 = hir.load_local : i32 #[local = lv3]; + v1287 = arith.constant 8 : u32; + v664 = hir.bitcast v663 : u32; + v666 = arith.add v664, v1287 : u32 #[overflow = checked]; + v1286 = arith.constant 4 : u32; + v668 = arith.mod v666, v1286 : u32; + hir.assertz v668 #[code = 250]; + v669 = hir.int_to_ptr v666 : ptr; + v670 = hir.load v669 : i32; + hir.store_local v670 #[local = lv2]; + v1300 = arith.constant 0 : i32; + v1294 = arith.constant 0 : i32; + v672 = arith.eq v670, v1294 : i1; + v673 = arith.zext v672 : u32; + v674 = hir.bitcast v673 : i32; + v676 = arith.neq v674, v1300 : i1; + scf.if v676{ + ^block150: scf.yield ; } else { - ^block77: - v1128 = arith.constant 4 : u32; - v597 = hir.bitcast v579 : u32; - v599 = arith.add v597, v1128 : u32 #[overflow = checked]; - v1127 = arith.constant 4 : u32; - v601 = arith.mod v599, v1127 : u32; - hir.assertz v601 #[code = 250]; - v602 = hir.int_to_ptr v599 : ptr; - v603 = hir.load v602 : i32; - v605 = arith.constant 12 : u32; - v604 = hir.bitcast v579 : u32; - v606 = arith.add v604, v605 : u32 #[overflow = checked]; - v1126 = arith.constant 4 : u32; - v608 = arith.mod v606, v1126 : u32; - hir.assertz v608 #[code = 250]; - v609 = hir.int_to_ptr v606 : ptr; - v610 = hir.load v609 : i32; - hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v603, v590, v610) + ^block75: + v677 = hir.load_local : i32 #[local = lv3]; + v1299 = arith.constant 4 : u32; + v678 = hir.bitcast v677 : u32; + v680 = arith.add v678, v1299 : u32 #[overflow = checked]; + v1298 = arith.constant 4 : u32; + v682 = arith.mod v680, v1298 : u32; + hir.assertz v682 #[code = 250]; + v683 = hir.int_to_ptr v680 : ptr; + v684 = hir.load v683 : i32; + v685 = hir.load_local : i32 #[local = lv2]; + v686 = hir.load_local : i32 #[local = lv3]; + v1284 = arith.constant 12 : u32; + v687 = hir.bitcast v686 : u32; + v689 = arith.add v687, v1284 : u32 #[overflow = checked]; + v1297 = arith.constant 4 : u32; + v691 = arith.mod v689, v1297 : u32; + hir.assertz v691 #[code = 250]; + v692 = hir.int_to_ptr v689 : ptr; + v693 = hir.load v692 : i32; + hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v684, v685, v693) scf.yield ; }; - v1125 = arith.constant 16 : i32; - v613 = arith.add v579, v1125 : i32 #[overflow = wrapping]; - v614 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v615 = hir.bitcast v614 : ptr; - hir.store v615, v613; + v694 = hir.load_local : i32 #[local = lv3]; + v1296 = arith.constant 16 : i32; + v696 = arith.add v694, v1296 : i32 #[overflow = wrapping]; + v697 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v698 = hir.bitcast v697 : ptr; + hir.store v698, v696; builtin.ret ; }; - private builtin.function @::current_memory(v616: i32, v617: i32, v618: i32, v619: i32) { - ^block78(v616: i32, v617: i32, v618: i32, v619: i32): - v1155 = arith.constant 0 : i32; - v620 = arith.constant 0 : i32; - v624 = arith.eq v619, v620 : i1; - v625 = arith.zext v624 : u32; - v626 = hir.bitcast v625 : i32; - v628 = arith.neq v626, v1155 : i1; - v1142, v1143 = scf.if v628 : i32, i32 { - ^block155: - v1154 = arith.constant 0 : i32; - v622 = arith.constant 4 : i32; - scf.yield v622, v1154; + private builtin.function @::current_memory(v699: i32, v700: i32, v701: i32, v702: i32) { + ^block76(v699: i32, v700: i32, v701: i32, v702: i32): + hir.store_local v699 #[local = lv0]; + hir.store_local v700 #[local = lv1]; + hir.store_local v701 #[local = lv2]; + hir.store_local v702 #[local = lv3]; + v1304 = arith.constant 0 : i32; + hir.store_local v1304 #[local = lv4]; + v1303 = arith.constant 4 : i32; + hir.store_local v1303 #[local = lv5]; + v705 = hir.load_local : i32 #[local = lv3]; + v1324 = arith.constant 0 : i32; + v1325 = arith.constant 0 : i32; + v707 = arith.eq v705, v1325 : i1; + v708 = arith.zext v707 : u32; + v709 = hir.bitcast v708 : i32; + v711 = arith.neq v709, v1324 : i1; + scf.if v711{ + ^block153: + scf.yield ; } else { - ^block81: - v629 = hir.bitcast v617 : u32; - v664 = arith.constant 4 : u32; - v631 = arith.mod v629, v664 : u32; - hir.assertz v631 #[code = 250]; - v632 = hir.int_to_ptr v629 : ptr; - v633 = hir.load v632 : i32; - v1152 = arith.constant 0 : i32; - v1153 = arith.constant 0 : i32; - v635 = arith.eq v633, v1153 : i1; - v636 = arith.zext v635 : u32; - v637 = hir.bitcast v636 : i32; - v639 = arith.neq v637, v1152 : i1; - v1140 = scf.if v639 : i32 { - ^block154: - v1151 = arith.constant 0 : i32; - scf.yield v1151; + ^block79: + v712 = hir.load_local : i32 #[local = lv1]; + v713 = hir.bitcast v712 : u32; + v1312 = arith.constant 4 : u32; + v715 = arith.mod v713, v1312 : u32; + hir.assertz v715 #[code = 250]; + v716 = hir.int_to_ptr v713 : ptr; + v717 = hir.load v716 : i32; + hir.store_local v717 #[local = lv6]; + v1322 = arith.constant 0 : i32; + v1323 = arith.constant 0 : i32; + v719 = arith.eq v717, v1323 : i1; + v720 = arith.zext v719 : u32; + v721 = hir.bitcast v720 : i32; + v723 = arith.neq v721, v1322 : i1; + scf.if v723{ + ^block152: + scf.yield ; } else { - ^block82: - v1150 = arith.constant 4 : u32; - v640 = hir.bitcast v616 : u32; - v642 = arith.add v640, v1150 : u32 #[overflow = checked]; - v1149 = arith.constant 4 : u32; - v644 = arith.mod v642, v1149 : u32; - hir.assertz v644 #[code = 250]; - v645 = hir.int_to_ptr v642 : ptr; - hir.store v645, v618; - v1148 = arith.constant 4 : u32; - v646 = hir.bitcast v617 : u32; - v648 = arith.add v646, v1148 : u32 #[overflow = checked]; - v1147 = arith.constant 4 : u32; - v650 = arith.mod v648, v1147 : u32; - hir.assertz v650 #[code = 250]; - v651 = hir.int_to_ptr v648 : ptr; - v652 = hir.load v651 : i32; - v653 = hir.bitcast v616 : u32; - v1146 = arith.constant 4 : u32; - v655 = arith.mod v653, v1146 : u32; - hir.assertz v655 #[code = 250]; - v656 = hir.int_to_ptr v653 : ptr; - hir.store v656, v652; - v657 = arith.mul v633, v619 : i32 #[overflow = wrapping]; - scf.yield v657; + ^block80: + v724 = hir.load_local : i32 #[local = lv0]; + v725 = hir.load_local : i32 #[local = lv2]; + v1321 = arith.constant 4 : u32; + v726 = hir.bitcast v724 : u32; + v728 = arith.add v726, v1321 : u32 #[overflow = checked]; + v1320 = arith.constant 4 : u32; + v730 = arith.mod v728, v1320 : u32; + hir.assertz v730 #[code = 250]; + v731 = hir.int_to_ptr v728 : ptr; + hir.store v731, v725; + v732 = hir.load_local : i32 #[local = lv0]; + v733 = hir.load_local : i32 #[local = lv1]; + v1319 = arith.constant 4 : u32; + v734 = hir.bitcast v733 : u32; + v736 = arith.add v734, v1319 : u32 #[overflow = checked]; + v1318 = arith.constant 4 : u32; + v738 = arith.mod v736, v1318 : u32; + hir.assertz v738 #[code = 250]; + v739 = hir.int_to_ptr v736 : ptr; + v740 = hir.load v739 : i32; + v741 = hir.bitcast v732 : u32; + v1317 = arith.constant 4 : u32; + v743 = arith.mod v741, v1317 : u32; + hir.assertz v743 #[code = 250]; + v744 = hir.int_to_ptr v741 : ptr; + hir.store v744, v740; + v745 = hir.load_local : i32 #[local = lv6]; + v746 = hir.load_local : i32 #[local = lv3]; + v747 = arith.mul v745, v746 : i32 #[overflow = wrapping]; + hir.store_local v747 #[local = lv4]; + v1301 = arith.constant 8 : i32; + hir.store_local v1301 #[local = lv5]; + scf.yield ; }; - v658 = arith.constant 8 : i32; - v1145 = arith.constant 4 : i32; - v1141 = cf.select v639, v1145, v658 : i32; - scf.yield v1141, v1140; + scf.yield ; }; - v661 = arith.add v616, v1142 : i32 #[overflow = wrapping]; - v663 = hir.bitcast v661 : u32; - v1144 = arith.constant 4 : u32; - v665 = arith.mod v663, v1144 : u32; - hir.assertz v665 #[code = 250]; - v666 = hir.int_to_ptr v663 : ptr; - hir.store v666, v1143; + v749 = hir.load_local : i32 #[local = lv0]; + v750 = hir.load_local : i32 #[local = lv5]; + v752 = hir.load_local : i32 #[local = lv4]; + v751 = arith.add v749, v750 : i32 #[overflow = wrapping]; + v753 = hir.bitcast v751 : u32; + v1316 = arith.constant 4 : u32; + v755 = arith.mod v753, v1316 : u32; + hir.assertz v755 #[code = 250]; + v756 = hir.int_to_ptr v753 : ptr; + hir.store v756, v752; builtin.ret ; }; - private builtin.function @::deallocate(v667: i32, v668: i32, v669: i32) { - ^block83(v667: i32, v668: i32, v669: i32): - v1157 = arith.constant 0 : i32; - v670 = arith.constant 0 : i32; - v671 = arith.eq v669, v670 : i1; - v672 = arith.zext v671 : u32; - v673 = hir.bitcast v672 : i32; - v675 = arith.neq v673, v1157 : i1; - scf.if v675{ - ^block85: + private builtin.function @::deallocate(v757: i32, v758: i32, v759: i32) { + ^block81(v757: i32, v758: i32, v759: i32): + hir.store_local v757 #[local = lv0]; + hir.store_local v758 #[local = lv1]; + hir.store_local v759 #[local = lv2]; + v760 = hir.load_local : i32 #[local = lv2]; + v1329 = arith.constant 0 : i32; + v1327 = arith.constant 0 : i32; + v762 = arith.eq v760, v1327 : i1; + v763 = arith.zext v762 : u32; + v764 = hir.bitcast v763 : i32; + v766 = arith.neq v764, v1329 : i1; + scf.if v766{ + ^block83: scf.yield ; } else { - ^block86: - hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_dealloc(v667, v669, v668) + ^block84: + v767 = hir.load_local : i32 #[local = lv0]; + v768 = hir.load_local : i32 #[local = lv2]; + v769 = hir.load_local : i32 #[local = lv1]; + hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_dealloc(v767, v768, v769) scf.yield ; }; builtin.ret ; }; - private builtin.function @::allocate(v676: i32, v677: i32, v678: i32) { - ^block87(v676: i32, v677: i32, v678: i32): - v680 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v681 = hir.bitcast v680 : ptr; - v682 = hir.load v681 : i32; - v683 = arith.constant 16 : i32; - v684 = arith.sub v682, v683 : i32 #[overflow = wrapping]; - v685 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v686 = hir.bitcast v685 : ptr; - hir.store v686, v684; - v679 = arith.constant 0 : i32; - v687 = arith.constant 8 : i32; - v688 = arith.add v684, v687 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/::alloc_impl(v688, v677, v678, v679) - v691 = arith.constant 12 : u32; - v690 = hir.bitcast v684 : u32; - v692 = arith.add v690, v691 : u32 #[overflow = checked]; - v693 = arith.constant 4 : u32; - v694 = arith.mod v692, v693 : u32; - hir.assertz v694 #[code = 250]; - v695 = hir.int_to_ptr v692 : ptr; - v696 = hir.load v695 : i32; - v698 = arith.constant 8 : u32; - v697 = hir.bitcast v684 : u32; - v699 = arith.add v697, v698 : u32 #[overflow = checked]; - v1162 = arith.constant 4 : u32; - v701 = arith.mod v699, v1162 : u32; - hir.assertz v701 #[code = 250]; - v702 = hir.int_to_ptr v699 : ptr; - v703 = hir.load v702 : i32; - v704 = hir.bitcast v676 : u32; - v1161 = arith.constant 4 : u32; - v706 = arith.mod v704, v1161 : u32; - hir.assertz v706 #[code = 250]; - v707 = hir.int_to_ptr v704 : ptr; - hir.store v707, v703; - v1160 = arith.constant 4 : u32; - v708 = hir.bitcast v676 : u32; - v710 = arith.add v708, v1160 : u32 #[overflow = checked]; - v1159 = arith.constant 4 : u32; - v712 = arith.mod v710, v1159 : u32; - hir.assertz v712 #[code = 250]; - v713 = hir.int_to_ptr v710 : ptr; - hir.store v713, v696; - v1158 = arith.constant 16 : i32; - v715 = arith.add v684, v1158 : i32 #[overflow = wrapping]; - v716 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v717 = hir.bitcast v716 : ptr; - hir.store v717, v715; + private builtin.function @::allocate(v770: i32, v771: i32, v772: i32) { + ^block85(v770: i32, v771: i32, v772: i32): + hir.store_local v770 #[local = lv0]; + hir.store_local v772 #[local = lv2]; + v773 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v774 = hir.bitcast v773 : ptr; + v775 = hir.load v774 : i32; + v1335 = arith.constant 16 : i32; + v777 = arith.sub v775, v1335 : i32 #[overflow = wrapping]; + hir.store_local v777 #[local = lv3]; + v778 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v779 = hir.bitcast v778 : ptr; + hir.store v779, v777; + v780 = hir.load_local : i32 #[local = lv3]; + v784 = hir.load_local : i32 #[local = lv2]; + v1333 = arith.constant 0 : i32; + v1334 = arith.constant 8 : i32; + v782 = arith.add v780, v1334 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/::alloc_impl(v782, v771, v784, v1333) + v786 = hir.load_local : i32 #[local = lv3]; + v1332 = arith.constant 12 : u32; + v787 = hir.bitcast v786 : u32; + v789 = arith.add v787, v1332 : u32 #[overflow = checked]; + v1331 = arith.constant 4 : u32; + v791 = arith.mod v789, v1331 : u32; + hir.assertz v791 #[code = 250]; + v792 = hir.int_to_ptr v789 : ptr; + v793 = hir.load v792 : i32; + hir.store_local v793 #[local = lv2]; + v794 = hir.load_local : i32 #[local = lv0]; + v795 = hir.load_local : i32 #[local = lv3]; + v1330 = arith.constant 8 : u32; + v796 = hir.bitcast v795 : u32; + v798 = arith.add v796, v1330 : u32 #[overflow = checked]; + v1345 = arith.constant 4 : u32; + v800 = arith.mod v798, v1345 : u32; + hir.assertz v800 #[code = 250]; + v801 = hir.int_to_ptr v798 : ptr; + v802 = hir.load v801 : i32; + v803 = hir.bitcast v794 : u32; + v1344 = arith.constant 4 : u32; + v805 = arith.mod v803, v1344 : u32; + hir.assertz v805 #[code = 250]; + v806 = hir.int_to_ptr v803 : ptr; + hir.store v806, v802; + v807 = hir.load_local : i32 #[local = lv0]; + v808 = hir.load_local : i32 #[local = lv2]; + v1343 = arith.constant 4 : u32; + v809 = hir.bitcast v807 : u32; + v811 = arith.add v809, v1343 : u32 #[overflow = checked]; + v1342 = arith.constant 4 : u32; + v813 = arith.mod v811, v1342 : u32; + hir.assertz v813 #[code = 250]; + v814 = hir.int_to_ptr v811 : ptr; + hir.store v814, v808; + v815 = hir.load_local : i32 #[local = lv3]; + v1341 = arith.constant 16 : i32; + v817 = arith.add v815, v1341 : i32 #[overflow = wrapping]; + v818 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v819 = hir.bitcast v818 : ptr; + hir.store v819, v817; builtin.ret ; }; - private builtin.function @::try_allocate_in(v718: i32, v719: i32, v720: i32, v721: i32, v722: i32) { - ^block89(v718: i32, v719: i32, v720: i32, v721: i32, v722: i32): - v725 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v726 = hir.bitcast v725 : ptr; - v727 = hir.load v726 : i32; - v728 = arith.constant 16 : i32; - v729 = arith.sub v727, v728 : i32 #[overflow = wrapping]; - v730 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v731 = hir.bitcast v730 : ptr; - hir.store v731, v729; - v741 = hir.bitcast v719 : u32; - v742 = arith.zext v741 : u64; - v743 = hir.bitcast v742 : i64; - v723 = arith.constant 0 : i32; - v736 = arith.sub v723, v721 : i32 #[overflow = wrapping]; - v733 = arith.constant -1 : i32; - v732 = arith.add v721, v722 : i32 #[overflow = wrapping]; - v734 = arith.add v732, v733 : i32 #[overflow = wrapping]; - v737 = arith.band v734, v736 : i32; - v738 = hir.bitcast v737 : u32; - v739 = arith.zext v738 : u64; - v740 = hir.bitcast v739 : i64; - v744 = arith.mul v740, v743 : i64 #[overflow = wrapping]; - v1265 = arith.constant 0 : i32; - v745 = arith.constant 32 : i64; - v747 = hir.cast v745 : u32; - v746 = hir.bitcast v744 : u64; - v748 = arith.shr v746, v747 : u64; - v749 = hir.bitcast v748 : i64; - v750 = arith.trunc v749 : i32; - v752 = arith.neq v750, v1265 : i1; - v1178, v1179, v1180, v1181, v1182, v1183 = scf.if v752 : i32, i32, i32, i32, i32, u32 { - ^block159: - v1163 = arith.constant 0 : u32; - v1170 = ub.poison i32 : i32; - scf.yield v718, v729, v1170, v1170, v1170, v1163; + private builtin.function @::try_allocate_in(v820: i32, v821: i32, v822: i32, v823: i32, v824: i32) { + ^block87(v820: i32, v821: i32, v822: i32, v823: i32, v824: i32): + hir.store_local v820 #[local = lv0]; + hir.store_local v821 #[local = lv1]; + hir.store_local v822 #[local = lv2]; + hir.store_local v823 #[local = lv3]; + hir.store_local v824 #[local = lv4]; + v825 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v826 = hir.bitcast v825 : ptr; + v827 = hir.load v826 : i32; + v1354 = arith.constant 16 : i32; + v829 = arith.sub v827, v1354 : i32 #[overflow = wrapping]; + hir.store_local v829 #[local = lv5]; + v830 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v831 = hir.bitcast v830 : ptr; + hir.store v831, v829; + v832 = hir.load_local : i32 #[local = lv3]; + v833 = hir.load_local : i32 #[local = lv4]; + v844 = hir.load_local : i32 #[local = lv1]; + v845 = hir.bitcast v844 : u32; + v846 = arith.zext v845 : u64; + v847 = hir.bitcast v846 : i64; + v1352 = arith.constant 0 : i32; + v839 = arith.sub v1352, v832 : i32 #[overflow = wrapping]; + v1353 = arith.constant -1 : i32; + v834 = arith.add v832, v833 : i32 #[overflow = wrapping]; + v836 = arith.add v834, v1353 : i32 #[overflow = wrapping]; + v840 = arith.band v836, v839 : i32; + v841 = hir.bitcast v840 : u32; + v842 = arith.zext v841 : u64; + v843 = hir.bitcast v842 : i64; + v848 = arith.mul v843, v847 : i64 #[overflow = wrapping]; + hir.store_local v848 #[local = lv6]; + v1422 = arith.constant 0 : i32; + v1351 = arith.constant 32 : i64; + v851 = hir.cast v1351 : u32; + v850 = hir.bitcast v848 : u64; + v852 = arith.shr v850, v851 : u64; + v853 = hir.bitcast v852 : i64; + v854 = arith.trunc v853 : i32; + v856 = arith.neq v854, v1422 : i1; + v1387 = scf.if v856 : u32 { + ^block157: + v1383 = arith.constant 0 : u32; + scf.yield v1383; } else { - ^block94: - v753 = arith.trunc v744 : i32; - v1264 = arith.constant 0 : i32; - v754 = arith.constant -2147483648 : i32; - v755 = arith.sub v754, v721 : i32 #[overflow = wrapping]; - v757 = hir.bitcast v755 : u32; - v756 = hir.bitcast v753 : u32; - v758 = arith.lte v756, v757 : i1; - v759 = arith.zext v758 : u32; - v760 = hir.bitcast v759 : i32; - v762 = arith.neq v760, v1264 : i1; - v1226 = scf.if v762 : i32 { - ^block92: - v1263 = arith.constant 0 : i32; - v773 = arith.neq v753, v1263 : i1; - v1225 = scf.if v773 : i32 { - ^block96: - v1262 = arith.constant 0 : i32; - v789 = arith.neq v720, v1262 : i1; - v1224 = scf.if v789 : i32 { - ^block99: - v771 = arith.constant 1 : i32; - hir.exec @miden:base/note-script@1.0.0/p2id/::alloc_impl(v729, v721, v753, v771) - v800 = hir.bitcast v729 : u32; - v841 = arith.constant 4 : u32; - v802 = arith.mod v800, v841 : u32; - hir.assertz v802 #[code = 250]; - v803 = hir.int_to_ptr v800 : ptr; - v804 = hir.load v803 : i32; - scf.yield v804; + ^block92: + v857 = hir.load_local : i64 #[local = lv6]; + v858 = arith.trunc v857 : i32; + hir.store_local v858 #[local = lv4]; + v860 = hir.load_local : i32 #[local = lv3]; + v1421 = arith.constant 0 : i32; + v1348 = arith.constant -2147483648 : i32; + v861 = arith.sub v1348, v860 : i32 #[overflow = wrapping]; + v863 = hir.bitcast v861 : u32; + v862 = hir.bitcast v858 : u32; + v864 = arith.lte v862, v863 : i1; + v865 = arith.zext v864 : u32; + v866 = hir.bitcast v865 : i32; + v868 = arith.neq v866, v1421 : i1; + scf.if v868{ + ^block90: + v878 = hir.load_local : i32 #[local = lv4]; + v1420 = arith.constant 0 : i32; + v880 = arith.neq v878, v1420 : i1; + scf.if v880{ + ^block94: + v898 = hir.load_local : i32 #[local = lv2]; + v1419 = arith.constant 0 : i32; + v900 = arith.neq v898, v1419 : i1; + scf.if v900{ + ^block97: + v914 = hir.load_local : i32 #[local = lv5]; + v915 = hir.load_local : i32 #[local = lv3]; + v916 = hir.load_local : i32 #[local = lv4]; + v1368 = arith.constant 1 : i32; + hir.exec @miden:base/note-script@1.0.0/p2id/::alloc_impl(v914, v915, v916, v1368) + v918 = hir.load_local : i32 #[local = lv5]; + v919 = hir.bitcast v918 : u32; + v1367 = arith.constant 4 : u32; + v921 = arith.mod v919, v1367 : u32; + hir.assertz v921 #[code = 250]; + v922 = hir.int_to_ptr v919 : ptr; + v923 = hir.load v922 : i32; + hir.store_local v923 #[local = lv2]; + scf.yield ; } else { - ^block100: - v790 = arith.constant 8 : i32; - v791 = arith.add v729, v790 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/::allocate(v791, v721, v753) - v775 = arith.constant 8 : u32; - v792 = hir.bitcast v729 : u32; - v794 = arith.add v792, v775 : u32 #[overflow = checked]; - v1261 = arith.constant 4 : u32; - v796 = arith.mod v794, v1261 : u32; - hir.assertz v796 #[code = 250]; - v797 = hir.int_to_ptr v794 : ptr; - v798 = hir.load v797 : i32; - scf.yield v798; + ^block98: + v901 = hir.load_local : i32 #[local = lv5]; + v904 = hir.load_local : i32 #[local = lv3]; + v905 = hir.load_local : i32 #[local = lv4]; + v1346 = arith.constant 8 : i32; + v903 = arith.add v901, v1346 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/::allocate(v903, v904, v905) + v906 = hir.load_local : i32 #[local = lv5]; + v1366 = arith.constant 8 : u32; + v907 = hir.bitcast v906 : u32; + v909 = arith.add v907, v1366 : u32 #[overflow = checked]; + v1418 = arith.constant 4 : u32; + v911 = arith.mod v909, v1418 : u32; + hir.assertz v911 #[code = 250]; + v912 = hir.int_to_ptr v909 : ptr; + v913 = hir.load v912 : i32; + hir.store_local v913 #[local = lv2]; + scf.yield ; }; - v1260 = arith.constant 0 : i32; - v807 = arith.neq v1224, v1260 : i1; - scf.if v807{ - ^block101: - v1259 = arith.constant 8 : u32; - v824 = hir.bitcast v718 : u32; - v826 = arith.add v824, v1259 : u32 #[overflow = checked]; - v1258 = arith.constant 4 : u32; - v828 = arith.mod v826, v1258 : u32; - hir.assertz v828 #[code = 250]; - v829 = hir.int_to_ptr v826 : ptr; - hir.store v829, v1224; - v1257 = arith.constant 4 : u32; - v831 = hir.bitcast v718 : u32; - v833 = arith.add v831, v1257 : u32 #[overflow = checked]; - v1256 = arith.constant 4 : u32; - v835 = arith.mod v833, v1256 : u32; - hir.assertz v835 #[code = 250]; - v836 = hir.int_to_ptr v833 : ptr; - hir.store v836, v719; + v924 = hir.load_local : i32 #[local = lv2]; + v1417 = arith.constant 0 : i32; + v926 = arith.neq v924, v1417 : i1; + scf.if v926{ + ^block99: + v944 = hir.load_local : i32 #[local = lv0]; + v945 = hir.load_local : i32 #[local = lv2]; + v1416 = arith.constant 8 : u32; + v946 = hir.bitcast v944 : u32; + v948 = arith.add v946, v1416 : u32 #[overflow = checked]; + v1415 = arith.constant 4 : u32; + v950 = arith.mod v948, v1415 : u32; + hir.assertz v950 #[code = 250]; + v951 = hir.int_to_ptr v948 : ptr; + hir.store v951, v945; + v952 = hir.load_local : i32 #[local = lv0]; + v953 = hir.load_local : i32 #[local = lv1]; + v1414 = arith.constant 4 : u32; + v954 = hir.bitcast v952 : u32; + v956 = arith.add v954, v1414 : u32 #[overflow = checked]; + v1413 = arith.constant 4 : u32; + v958 = arith.mod v956, v1413 : u32; + hir.assertz v958 #[code = 250]; + v959 = hir.int_to_ptr v956 : ptr; + hir.store v959, v953; + v1412 = arith.constant 0 : i32; + hir.store_local v1412 #[local = lv3]; scf.yield ; } else { - ^block102: - v1255 = arith.constant 8 : u32; - v810 = hir.bitcast v718 : u32; - v812 = arith.add v810, v1255 : u32 #[overflow = checked]; - v1254 = arith.constant 4 : u32; - v814 = arith.mod v812, v1254 : u32; - hir.assertz v814 #[code = 250]; - v815 = hir.int_to_ptr v812 : ptr; - hir.store v815, v753; - v1253 = arith.constant 4 : u32; - v817 = hir.bitcast v718 : u32; - v819 = arith.add v817, v1253 : u32 #[overflow = checked]; - v1252 = arith.constant 4 : u32; - v821 = arith.mod v819, v1252 : u32; - hir.assertz v821 #[code = 250]; - v822 = hir.int_to_ptr v819 : ptr; - hir.store v822, v721; + ^block100: + v927 = hir.load_local : i32 #[local = lv0]; + v928 = hir.load_local : i32 #[local = lv4]; + v1411 = arith.constant 8 : u32; + v929 = hir.bitcast v927 : u32; + v931 = arith.add v929, v1411 : u32 #[overflow = checked]; + v1410 = arith.constant 4 : u32; + v933 = arith.mod v931, v1410 : u32; + hir.assertz v933 #[code = 250]; + v934 = hir.int_to_ptr v931 : ptr; + hir.store v934, v928; + v935 = hir.load_local : i32 #[local = lv0]; + v936 = hir.load_local : i32 #[local = lv3]; + v1409 = arith.constant 4 : u32; + v937 = hir.bitcast v935 : u32; + v939 = arith.add v937, v1409 : u32 #[overflow = checked]; + v1408 = arith.constant 4 : u32; + v941 = arith.mod v939, v1408 : u32; + hir.assertz v941 #[code = 250]; + v942 = hir.int_to_ptr v939 : ptr; + hir.store v942, v936; + v1407 = arith.constant 1 : i32; + hir.store_local v1407 #[local = lv3]; scf.yield ; }; - v1250 = arith.constant 1 : i32; - v1251 = arith.constant 0 : i32; - v1223 = cf.select v807, v1251, v1250 : i32; - scf.yield v1223; + scf.yield ; } else { - ^block97: - v1249 = arith.constant 8 : u32; - v774 = hir.bitcast v718 : u32; - v776 = arith.add v774, v1249 : u32 #[overflow = checked]; - v1248 = arith.constant 4 : u32; - v778 = arith.mod v776, v1248 : u32; - hir.assertz v778 #[code = 250]; - v779 = hir.int_to_ptr v776 : ptr; - hir.store v779, v721; - v1247 = arith.constant 4 : u32; - v782 = hir.bitcast v718 : u32; - v784 = arith.add v782, v1247 : u32 #[overflow = checked]; - v1246 = arith.constant 4 : u32; - v786 = arith.mod v784, v1246 : u32; - hir.assertz v786 #[code = 250]; - v1245 = arith.constant 0 : i32; - v787 = hir.int_to_ptr v784 : ptr; - hir.store v787, v1245; - v1244 = arith.constant 0 : i32; - scf.yield v1244; + ^block95: + v881 = hir.load_local : i32 #[local = lv0]; + v882 = hir.load_local : i32 #[local = lv3]; + v1406 = arith.constant 8 : u32; + v883 = hir.bitcast v881 : u32; + v885 = arith.add v883, v1406 : u32 #[overflow = checked]; + v1405 = arith.constant 4 : u32; + v887 = arith.mod v885, v1405 : u32; + hir.assertz v887 #[code = 250]; + v888 = hir.int_to_ptr v885 : ptr; + hir.store v888, v882; + v1404 = arith.constant 0 : i32; + hir.store_local v1404 #[local = lv3]; + v890 = hir.load_local : i32 #[local = lv0]; + v1403 = arith.constant 4 : u32; + v892 = hir.bitcast v890 : u32; + v894 = arith.add v892, v1403 : u32 #[overflow = checked]; + v1402 = arith.constant 4 : u32; + v896 = arith.mod v894, v1402 : u32; + hir.assertz v896 #[code = 250]; + v1401 = arith.constant 0 : i32; + v897 = hir.int_to_ptr v894 : ptr; + hir.store v897, v1401; + scf.yield ; }; - scf.yield v1225; + scf.yield ; } else { - ^block95: - v1243 = ub.poison i32 : i32; - scf.yield v1243; + ^block93: + scf.yield ; }; - v1238 = arith.constant 0 : u32; - v1171 = arith.constant 1 : u32; - v1231 = cf.select v762, v1171, v1238 : u32; - v1239 = ub.poison i32 : i32; - v1230 = cf.select v762, v729, v1239 : i32; - v1240 = ub.poison i32 : i32; - v1229 = cf.select v762, v718, v1240 : i32; - v1241 = ub.poison i32 : i32; - v1228 = cf.select v762, v1241, v729 : i32; - v1242 = ub.poison i32 : i32; - v1227 = cf.select v762, v1242, v718 : i32; - scf.yield v1227, v1228, v1229, v1226, v1230, v1231; + v1400 = arith.constant 0 : u32; + v1385 = arith.constant 1 : u32; + v1393 = cf.select v868, v1385, v1400 : u32; + scf.yield v1393; }; - v1184, v1185, v1186 = scf.index_switch v1183 : i32, i32, i32 + scf.index_switch v1387 case 0 { - ^block93: - v1237 = arith.constant 4 : u32; - v765 = hir.bitcast v1178 : u32; - v767 = arith.add v765, v1237 : u32 #[overflow = checked]; - v1236 = arith.constant 4 : u32; - v769 = arith.mod v767, v1236 : u32; - hir.assertz v769 #[code = 250]; - v1235 = arith.constant 0 : i32; - v770 = hir.int_to_ptr v767 : ptr; - hir.store v770, v1235; - v1234 = arith.constant 1 : i32; - scf.yield v1178, v1234, v1179; + ^block91: + v869 = hir.load_local : i32 #[local = lv0]; + v1399 = arith.constant 4 : u32; + v871 = hir.bitcast v869 : u32; + v873 = arith.add v871, v1399 : u32 #[overflow = checked]; + v1398 = arith.constant 4 : u32; + v875 = arith.mod v873, v1398 : u32; + hir.assertz v875 #[code = 250]; + v1397 = arith.constant 0 : i32; + v876 = hir.int_to_ptr v873 : ptr; + hir.store v876, v1397; + v1396 = arith.constant 1 : i32; + hir.store_local v1396 #[local = lv3]; + scf.yield ; } default { - ^block163: - scf.yield v1180, v1181, v1182; + ^block161: + scf.yield ; }; - v840 = hir.bitcast v1184 : u32; - v1233 = arith.constant 4 : u32; - v842 = arith.mod v840, v1233 : u32; - hir.assertz v842 #[code = 250]; - v843 = hir.int_to_ptr v840 : ptr; - hir.store v843, v1185; - v1232 = arith.constant 16 : i32; - v848 = arith.add v1186, v1232 : i32 #[overflow = wrapping]; - v849 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v850 = hir.bitcast v849 : ptr; - hir.store v850, v848; + v961 = hir.load_local : i32 #[local = lv0]; + v962 = hir.load_local : i32 #[local = lv3]; + v963 = hir.bitcast v961 : u32; + v1395 = arith.constant 4 : u32; + v965 = arith.mod v963, v1395 : u32; + hir.assertz v965 #[code = 250]; + v966 = hir.int_to_ptr v963 : ptr; + hir.store v966, v962; + v967 = hir.load_local : i32 #[local = lv5]; + v1394 = arith.constant 16 : i32; + v969 = arith.add v967, v1394 : i32 #[overflow = wrapping]; + v970 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v971 = hir.bitcast v970 : ptr; + hir.store v971, v969; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v851: i32, v852: i32) { - ^block103(v851: i32, v852: i32): + private builtin.function @alloc::raw_vec::handle_error(v972: i32, v973: i32) { + ^block101(v972: i32, v973: i32): ub.unreachable ; }; - private builtin.function @::max(v853: i32, v854: i32) -> i32 { - ^block105(v853: i32, v854: i32): - v861 = arith.constant 0 : i32; - v857 = hir.bitcast v854 : u32; - v856 = hir.bitcast v853 : u32; - v858 = arith.gt v856, v857 : i1; - v859 = arith.zext v858 : u32; - v860 = hir.bitcast v859 : i32; - v862 = arith.neq v860, v861 : i1; - v863 = cf.select v862, v853, v854 : i32; - builtin.ret v863; + private builtin.function @::max(v974: i32, v975: i32) -> i32 { + ^block103(v974: i32, v975: i32): + v1423 = arith.constant 0 : i32; + v982 = hir.bitcast v975 : u32; + v981 = hir.bitcast v974 : u32; + v983 = arith.gt v981, v982 : i1; + v984 = arith.zext v983 : u32; + v985 = hir.bitcast v984 : i32; + v987 = arith.neq v985, v1423 : i1; + v988 = cf.select v987, v974, v975 : i32; + builtin.ret v988; }; - private builtin.function @miden::active_account::get_id(v864: i32) { - ^block107(v864: i32): - v865, v866 = hir.exec @miden/active_account/get_id() : felt, felt - v867 = hir.bitcast v864 : u32; - v868 = hir.int_to_ptr v867 : ptr; - hir.store v868, v865; - v869 = arith.constant 4 : u32; - v870 = arith.add v867, v869 : u32 #[overflow = checked]; - v871 = hir.int_to_ptr v870 : ptr; - hir.store v871, v866; + private builtin.function @miden::protocol::active_account::get_id(v989: i32) { + ^block105(v989: i32): + v990, v991 = hir.exec @miden/protocol/active_account/get_id() : felt, felt + v992 = hir.bitcast v989 : u32; + v993 = hir.int_to_ptr v992 : ptr; + hir.store v993, v990; + v1424 = arith.constant 4 : u32; + v995 = arith.add v992, v1424 : u32 #[overflow = checked]; + v996 = hir.int_to_ptr v995 : ptr; + hir.store v996, v991; builtin.ret ; }; - private builtin.function @miden::active_note::get_assets(v872: i32) -> i32 { - ^block111(v872: i32): - v873, v874 = hir.exec @miden/active_note/get_assets(v872) : i32, i32 - builtin.ret v873; + private builtin.function @miden::protocol::active_note::get_assets(v997: i32) -> i32 { + ^block110(v997: i32): + v998, v999 = hir.exec @miden/protocol/active_note/get_assets(v997) : i32, i32 + builtin.ret v998; }; - private builtin.function @miden::active_note::get_inputs(v876: i32) -> i32 { - ^block114(v876: i32): - v877, v878 = hir.exec @miden/active_note/get_inputs(v876) : i32, i32 - builtin.ret v877; + private builtin.function @miden::protocol::active_note::get_inputs(v1001: i32) -> i32 { + ^block113(v1001: i32): + v1002, v1003 = hir.exec @miden/protocol/active_note/get_inputs(v1001) : i32, i32 + builtin.ret v1002; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -1286,9 +1493,9 @@ builtin.component miden:base/note-script@1.0.0 { builtin.segment @1048576 = 0x000000010000000100000001; }; - public builtin.function @run(v880: felt, v881: felt, v882: felt, v883: felt) { - ^block116(v880: felt, v881: felt, v882: felt, v883: felt): - hir.exec @miden:base/note-script@1.0.0/p2id/miden:base/note-script@1.0.0#run(v880, v881, v882, v883) + public builtin.function @run(v1005: felt, v1006: felt, v1007: felt, v1008: felt) { + ^block115(v1005: felt, v1006: felt, v1007: felt, v1008: felt): + hir.exec @miden:base/note-script@1.0.0/p2id/miden:base/note-script@1.0.0#run(v1005, v1006, v1007, v1008) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/examples/p2id.masm b/tests/integration/expected/examples/p2id.masm index 194dea317..1f29a6565 100644 --- a/tests/integration/expected/examples/p2id.masm +++ b/tests/integration/expected/examples/p2id.masm @@ -1,14 +1,14 @@ -# mod miden:base/note-script@1.0.0 +# mod ::"miden:base/note-script@1.0.0" @callconv("canon-lift") pub proc run(felt, felt, felt, felt) - exec.::miden:base/note-script@1.0.0::init + exec."miden:base/note-script@1.0.0"::init trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::miden:base/note-script@1.0.0#run + exec.::"miden:base/note-script@1.0.0"::p2id::"miden:base/note-script@1.0.0#run" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -21,7 +21,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -32,7 +32,7 @@ proc init mem_store.278537 end -# mod miden:base/note-script@1.0.0::p2id +# mod ::"miden:base/note-script@1.0.0"::p2id @callconv("C") proc p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7( @@ -43,7 +43,7 @@ proc p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_impor ) trace.240 nop - call.::miden:basic-wallet/basic-wallet@0.1.0::receive-asset + call.::"miden:basic-wallet/basic-wallet@0.1.0"::"receive-asset" trace.252 nop end @@ -55,6 +55,7 @@ proc __wasm_call_ctors( nop end +@locals("2") @callconv("C") proc __rustc::__rust_alloc(i32, i32) -> i32 push.1114148 @@ -71,11 +72,12 @@ proc __rustc::__rust_alloc(i32, i32) -> i32 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::::alloc + exec.::"miden:base/note-script@1.0.0"::p2id::::alloc trace.252 nop end +@locals("3") @callconv("C") proc __rustc::__rust_dealloc(i32, i32, i32) drop @@ -83,8 +85,25 @@ proc __rustc::__rust_dealloc(i32, i32, i32) drop end +@locals("2") @callconv("C") proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114148 u32divmod.4 swap.1 @@ -93,38 +112,84 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.1048588 + movup.3 u32wrapping_add - dup.1 - swap.2 - swap.3 + movup.2 + swap.1 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::p2id::::alloc + trace.252 + nop + dup.0 + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::::alloc + exec.::intrinsics::mem::store_sw trace.252 nop push.0 push.0 - dup.2 + movup.2 eq neq if.true - swap.1 - drop + nop else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.0 - dup.3 + movup.2 eq neq if.true - swap.1 - drop + nop else + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 + swap.1 movup.2 - dup.2 push.0 dup.2 push.0 @@ -166,6 +231,14 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 dropw end end + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end @callconv("C") @@ -175,6 +248,7 @@ proc p2id::bindings::__link_custom_section_describing_imports( nop end +@locals("12") @callconv("C") proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop @@ -189,11 +263,18 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop - push.48 + push.32 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.4 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -203,19 +284,34 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) nop trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::wit_bindgen::rt::run_ctors_once + exec.::"miden:base/note-script@1.0.0"::p2id::wit_bindgen::rt::run_ctors_once trace.252 nop - push.16 - dup.1 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 u32wrapping_add trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::miden_base_sys::bindings::active_note::get_inputs + exec.::"miden:base/note-script@1.0.0"::p2id::miden_base_sys::bindings::active_note::get_inputs trace.252 nop - push.24 - dup.1 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.20 + swap.1 add u32assert push.4 @@ -241,16 +337,22 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) if.true eq.0 if.true - drop push.1 else - drop push.1 end else drop - push.20 - dup.1 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + swap.1 add u32assert push.4 @@ -266,8 +368,17 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.4 - dup.1 + swap.1 add u32assert push.4 @@ -283,7 +394,22 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.5 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -297,16 +423,67 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop - push.8 - dup.3 + locaddr.7 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 u32wrapping_add trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::miden_base_sys::bindings::active_account::get_id + exec.::"miden:base/note-script@1.0.0"::p2id:: as core::ops::drop::Drop>::drop + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.12 - dup.3 + u32wrapping_add + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::p2id:: as core::ops::drop::Drop>::drop + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::p2id::miden_base_sys::bindings::active_account::get_id + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 add u32assert push.4 @@ -322,10 +499,22 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop - push.8 - dup.4 - add - u32assert + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -339,66 +528,76 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop - movup.2 + locaddr.7 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::intrinsics::felt::eq + exec.::intrinsics::mem::load_felt trace.252 nop push.0 push.1 - movup.2 + movup.3 + movup.3 + eq neq neq if.true - drop - drop - drop push.1 else + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.6 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::intrinsics::felt::eq + exec.::intrinsics::mem::load_felt trace.252 nop push.0 push.1 - movup.2 + movup.3 + movup.3 + eq neq neq dup.0 if.true - swap.1 - drop + nop else - push.28 - dup.2 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 u32wrapping_add trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::miden_base_sys::bindings::active_note::get_assets + exec.::"miden:base/note-script@1.0.0"::p2id::miden_base_sys::bindings::active_note::get_assets trace.252 nop - push.36 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.4 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.28 - dup.3 + push.20 + swap.1 add u32assert push.4 @@ -414,15 +613,33 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop - push.32 - dup.4 - add - u32assert push.4 - dup.1 + u32shl + locaddr.9 + push.0 swap.1 - u32mod - u32assert + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert assertz u32divmod.4 swap.1 @@ -431,32 +648,83 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop - push.4 - movup.3 + locaddr.10 + push.0 swap.1 - u32shl + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + swap.1 + add + u32assert + push.4 dup.1 - swap.3 - swap.4 - swap.5 - swap.2 swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.0 + locaddr.11 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1 while.true + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.0 - dup.2 + movup.2 eq neq dup.0 if.true - movdn.2 - drop - drop - push.3735929054 - dup.0 + nop else - dup.2 + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -470,8 +738,16 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.4 + swap.1 add u32assert push.4 @@ -487,8 +763,16 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.5 + swap.1 add u32assert push.4 @@ -504,8 +788,16 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.6 + swap.1 add u32assert push.4 @@ -525,65 +817,76 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) swap.2 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7 + exec.::"miden:base/note-script@1.0.0"::p2id::p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7 + trace.252 + nop + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - movup.3 - u32wrapping_add push.4294967280 - movup.3 u32wrapping_add + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_add + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.3735929054 - dup.3 - dup.7 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.7 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.5 - dup.7 - swap.2 - swap.1 - cdrop push.1 push.0 - movup.7 + movup.2 cdrop push.1 u32and - swap.1 - swap.3 - swap.5 - swap.2 - swap.4 - swap.1 if.true - movup.5 - drop - movup.5 - drop - movup.5 - drop push.1 else push.0 end end - drop - drop - drop - drop - drop - push.44 - dup.1 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.11 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.28 + movup.2 add u32assert push.4 @@ -592,8 +895,6 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -601,8 +902,24 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::store_sw trace.252 nop - push.40 - dup.1 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.10 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.24 + movup.2 add u32assert push.4 @@ -611,8 +928,6 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -620,35 +935,35 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::store_sw trace.252 nop - push.16 - push.40 - dup.2 - u32wrapping_add - dup.1 - swap.2 + locaddr.4 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::::deallocate + exec.::intrinsics::mem::load_sw trace.252 nop push.16 - dup.1 + push.24 + movup.2 u32wrapping_add + dup.1 + swap.2 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id:: as core::ops::drop::Drop>::drop + exec.::"miden:base/note-script@1.0.0"::p2id::::deallocate trace.252 nop - push.16 - dup.1 - u32wrapping_add + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id:: as core::ops::drop::Drop>::drop + exec.::intrinsics::mem::load_sw trace.252 nop - push.48 + push.32 u32wrapping_add push.1114144 u32divmod.4 @@ -682,6 +997,7 @@ proc __rustc::__rust_no_alloc_shim_is_unstable_v2( nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -723,9 +1039,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::p2id::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -756,66 +1088,184 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("5") @callconv("C") proc ::alloc( i32, i32, i32 ) -> i32 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 push.0 push.16 - dup.4 + dup.3 swap.1 u32gt neq - dup.3 + movup.2 swap.1 cdrop + dup.0 + locaddr.3 push.0 - push.4294967295 - dup.2 - u32wrapping_add - dup.2 - u32and - neq - if.true - dropw - push.0 - push.3735929054 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.4294967295 + movup.2 + u32wrapping_add + movup.2 + u32and + neq + if.true + push.0 + push.3735929054 else - movup.2 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::p2id::::max + trace.252 + nop + dup.0 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::::max + exec.::intrinsics::mem::store_sw trace.252 nop push.0 push.2147483648 - dup.2 + movup.2 u32wrapping_sub - dup.4 + movup.2 swap.1 u32gt neq dup.0 if.true - movdn.3 - drop - drop - drop push.3735929054 else push.0 - dup.2 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + dup.1 u32wrapping_sub push.4294967295 - movup.5 - dup.4 + movup.3 + movup.3 u32wrapping_add u32wrapping_add u32and - dup.3 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -834,9 +1284,17 @@ proc ::alloc( if.true nop else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::intrinsics::mem::heap_base + exec.::"miden:base/note-script@1.0.0"::p2id::"intrinsics::mem::heap_base" trace.252 nop trace.240 @@ -844,7 +1302,7 @@ proc ::alloc( exec.::intrinsics::mem::memory_size trace.252 nop - dup.5 + movup.2 push.4 dup.1 swap.1 @@ -866,7 +1324,22 @@ proc ::alloc( trace.252 nop end - dup.3 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -880,31 +1353,58 @@ proc ::alloc( exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 push.4294967295 - dup.2 + movup.2 u32xor - dup.3 + movup.2 swap.1 u32gt neq if.true - drop - drop - movdn.2 - drop - drop - push.0 + nop else - movup.4 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 push.4 dup.1 swap.1 u32mod u32assert assertz - movup.2 - dup.2 + movdn.2 u32wrapping_add swap.1 u32divmod.4 @@ -914,9 +1414,40 @@ proc ::alloc( exec.::intrinsics::mem::store_sw trace.252 nop - movup.2 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop u32wrapping_add + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end push.1 push.0 @@ -947,10 +1478,19 @@ proc intrinsics::mem::heap_base( nop end +@locals("4") @callconv("C") proc >::with_capacity( i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -961,9 +1501,16 @@ proc >::with_capacity( nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.1 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -971,20 +1518,38 @@ proc >::with_capacity( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 + push.256 push.8 - dup.2 + movup.3 u32wrapping_add - dup.1 + dup.2 + swap.3 swap.2 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::::with_capacity_in + exec.::"miden:base/note-script@1.0.0"::p2id::::with_capacity_in + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.1 + swap.1 add u32assert push.8 @@ -1001,8 +1566,16 @@ proc >::with_capacity( trace.252 nop swap.1 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.4 + swap.1 add u32assert push.4 @@ -1020,7 +1593,14 @@ proc >::with_capacity( exec.::intrinsics::mem::store_sw trace.252 nop - movup.3 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -1036,6 +1616,14 @@ proc >::with_capacity( exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114144 @@ -1048,25 +1636,51 @@ proc >::with_capacity( nop end +@locals("5") @callconv("C") proc ::with_capacity_in( + i32, i32, i32, i32 ) - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.4 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1074,24 +1688,46 @@ proc ::with_capacity_in( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 - push.256 push.4 - dup.3 - u32wrapping_add - movup.4 - swap.6 - movdn.4 movup.3 - swap.5 - movdn.3 + u32wrapping_add + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::p2id::::try_allocate_in + trace.252 + nop + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::::try_allocate_in + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.1 + swap.1 add u32assert push.4 @@ -1107,8 +1743,24 @@ proc ::with_capacity_in( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.2 + swap.1 add u32assert push.4 @@ -1130,8 +1782,24 @@ proc ::with_capacity_in( neq neq if.true + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.2 + swap.1 add u32assert push.4 @@ -1148,7 +1816,7 @@ proc ::with_capacity_in( trace.252 nop push.4 - dup.4 + movup.2 add u32assert push.4 @@ -1164,7 +1832,23 @@ proc ::with_capacity_in( exec.::intrinsics::mem::store_sw trace.252 nop - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 push.4 dup.1 swap.1 @@ -1178,6 +1862,14 @@ proc ::with_capacity_in( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114144 @@ -1189,10 +1881,24 @@ proc ::with_capacity_in( trace.252 nop else - movup.2 - drop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - movup.2 + swap.1 add u32assert push.4 @@ -1211,7 +1917,7 @@ proc ::with_capacity_in( swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::alloc::raw_vec::handle_error + exec.::"miden:base/note-script@1.0.0"::p2id::alloc::raw_vec::handle_error trace.252 nop push.0 @@ -1219,8 +1925,9 @@ proc ::with_capacity_in( end end +@locals("1") @callconv("C") -proc as core::ops::drop::Drop>::drop( +proc as core::ops::drop::Drop>::drop( i32 ) push.4 @@ -1228,15 +1935,24 @@ proc as core:: swap.2 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::::deallocate + exec.::"miden:base/note-script@1.0.0"::p2id::::deallocate trace.252 nop end +@locals("2") @callconv("C") proc miden_base_sys::bindings::active_note::get_assets( i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -1247,9 +1963,16 @@ proc miden_base_sys::bindings::active_note::get_assets( nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.1 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1257,16 +1980,39 @@ proc miden_base_sys::bindings::active_note::get_assets( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 u32wrapping_add trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::>::with_capacity + exec.::"miden:base/note-script@1.0.0"::p2id::>::with_capacity + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.1 + swap.1 add u32assert push.4 @@ -1288,11 +2034,11 @@ proc miden_base_sys::bindings::active_note::get_assets( u32shr trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::miden::active_note::get_assets + exec.::"miden:base/note-script@1.0.0"::p2id::"miden::protocol::active_note::get_assets" trace.252 nop push.8 - dup.3 + movup.2 u32wrapping_add push.4 dup.1 @@ -1307,8 +2053,24 @@ proc miden_base_sys::bindings::active_note::get_assets( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + swap.1 add u32assert push.4 @@ -1325,7 +2087,7 @@ proc miden_base_sys::bindings::active_note::get_assets( trace.252 nop swap.1 - movup.3 + movup.2 push.4 dup.1 swap.1 @@ -1341,6 +2103,14 @@ proc miden_base_sys::bindings::active_note::get_assets( exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114144 @@ -1353,10 +2123,19 @@ proc miden_base_sys::bindings::active_note::get_assets( nop end +@locals("4") @callconv("C") proc miden_base_sys::bindings::active_note::get_inputs( i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -1367,9 +2146,16 @@ proc miden_base_sys::bindings::active_note::get_inputs( nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.1 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1377,37 +2163,38 @@ proc miden_base_sys::bindings::active_note::get_inputs( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 + push.1024 push.8 - dup.2 + movup.3 u32wrapping_add - dup.1 + dup.2 + swap.3 swap.2 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::::with_capacity_in + exec.::"miden:base/note-script@1.0.0"::p2id::::with_capacity_in trace.252 nop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.12 - dup.2 + push.8 + swap.1 add u32assert push.4 @@ -1423,21 +2210,36 @@ proc miden_base_sys::bindings::active_note::get_inputs( exec.::intrinsics::mem::load_sw trace.252 nop - push.2 - dup.1 + locaddr.2 + push.0 swap.1 - u32shr trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::miden::active_note::get_inputs + exec.::intrinsics::mem::store_sw trace.252 nop - push.8 - dup.5 - add - u32assert - push.4 - dup.1 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + swap.1 + add + u32assert + push.4 + dup.1 swap.1 u32mod u32assert @@ -1446,11 +2248,29 @@ proc miden_base_sys::bindings::active_note::get_inputs( swap.1 trace.240 nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop exec.::intrinsics::mem::store_sw trace.252 nop - push.4 - dup.4 + push.2 + swap.1 + swap.1 + u32shr + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::p2id::"miden::protocol::active_note::get_inputs" + trace.252 + nop + push.8 + movup.2 add u32assert push.4 @@ -1466,7 +2286,56 @@ proc miden_base_sys::bindings::active_note::get_inputs( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 push.4 dup.1 swap.1 @@ -1480,6 +2349,14 @@ proc miden_base_sys::bindings::active_note::get_inputs( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114144 @@ -1492,8 +2369,17 @@ proc miden_base_sys::bindings::active_note::get_inputs( nop end +@locals("2") @callconv("C") proc miden_base_sys::bindings::active_account::get_id(i32) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -1504,9 +2390,16 @@ proc miden_base_sys::bindings::active_account::get_id(i32) nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.1 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1514,16 +2407,39 @@ proc miden_base_sys::bindings::active_account::get_id(i32) exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.1 u32wrapping_add trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::miden::active_account::get_id + exec.::"miden:base/note-script@1.0.0"::p2id::"miden::protocol::active_account::get_id" + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.1 + swap.1 add u32assert push.4 @@ -1540,7 +2456,7 @@ proc miden_base_sys::bindings::active_account::get_id(i32) trace.252 nop swap.1 - movup.3 + movup.2 push.8 dup.1 swap.1 @@ -1556,6 +2472,14 @@ proc miden_base_sys::bindings::active_account::get_id(i32) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114144 @@ -1568,18 +2492,15 @@ proc miden_base_sys::bindings::active_account::get_id(i32) nop end +@locals("1") @callconv("C") -proc as core::ops::drop::Drop>::drop( +proc as core::ops::drop::Drop>::drop( i32 ) drop end -@callconv("C") -proc intrinsics::felt::eq(felt, felt) -> i32 - eq -end - +@locals("4") @callconv("C") proc ::alloc_impl( i32, @@ -1587,44 +2508,151 @@ proc ::alloc_impl( i32, i32 ) + locaddr.0 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 push.0 - dup.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 eq neq if.true - movup.3 - drop - swap.1 + nop else trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::__rustc::__rust_no_alloc_shim_is_unstable_v2 + exec.::"miden:base/note-script@1.0.0"::p2id::__rustc::__rust_no_alloc_shim_is_unstable_v2 + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.0 - movup.4 neq if.true + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop swap.1 - dup.2 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::__rustc::__rust_alloc_zeroed + exec.::"miden:base/note-script@1.0.0"::p2id::__rustc::__rust_alloc_zeroed + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw trace.252 nop else + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 swap.1 - dup.2 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::__rustc::__rust_alloc + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::p2id::__rustc::__rust_alloc + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw trace.252 nop end end + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.2 + movup.2 add u32assert push.4 @@ -1633,8 +2661,6 @@ proc ::alloc_impl( u32mod u32assert assertz - movup.3 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1642,6 +2668,22 @@ proc ::alloc_impl( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop swap.1 push.4 dup.1 @@ -1658,12 +2700,22 @@ proc ::alloc_impl( nop end +@locals("4") @callconv("C") proc ::deallocate( i32, i32, i32 ) + movup.2 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -1674,9 +2726,16 @@ proc ::deallocate( nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.3 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1684,21 +2743,44 @@ proc ::deallocate( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + movup.2 u32wrapping_add swap.1 - swap.4 swap.3 swap.2 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::::current_memory + exec.::"miden:base/note-script@1.0.0"::p2id::"::current_memory" + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.1 + swap.1 add u32assert push.4 @@ -1714,16 +2796,33 @@ proc ::deallocate( exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 push.0 - dup.2 + movup.2 eq neq if.true - drop + nop else + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.2 + swap.1 add u32assert push.4 @@ -1739,8 +2838,24 @@ proc ::deallocate( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.3 + swap.1 add u32assert push.4 @@ -1756,13 +2871,21 @@ proc ::deallocate( exec.::intrinsics::mem::load_sw trace.252 nop - movdn.2 + swap.2 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::::deallocate + exec.::"miden:base/note-script@1.0.0"::p2id::"::deallocate" trace.252 nop end + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114144 @@ -1775,6 +2898,7 @@ proc ::deallocate( nop end +@locals("7") @callconv("C") proc ::current_memory( i32, @@ -1782,20 +2906,80 @@ proc ::current_memory( i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.0 - dup.5 + movup.2 eq neq if.true - movdn.3 - drop - drop - drop - push.0 - push.4 + nop else - dup.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -1809,25 +2993,41 @@ proc ::current_memory( exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 push.0 - dup.2 + movup.2 eq neq - dup.0 if.true + nop + else + locaddr.0 + push.0 swap.1 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 push.0 - else + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.3 + movup.2 add u32assert push.4 @@ -1836,8 +3036,6 @@ proc ::current_memory( u32mod u32assert assertz - movup.5 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1845,8 +3043,24 @@ proc ::current_memory( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - movup.4 + swap.1 add u32assert push.4 @@ -1862,7 +3076,7 @@ proc ::current_memory( exec.::intrinsics::mem::load_sw trace.252 nop - dup.3 + swap.1 push.4 dup.1 swap.1 @@ -1876,21 +3090,71 @@ proc ::current_memory( exec.::intrinsics::mem::store_sw trace.252 nop - swap.3 + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop trace.240 nop exec.::intrinsics::i32::wrapping_mul trace.252 nop - movup.2 + locaddr.4 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.8 - push.4 - movup.3 - cdrop end - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movdn.2 u32wrapping_add push.4 dup.1 @@ -1907,38 +3171,110 @@ proc ::current_memory( nop end +@locals("3") @callconv("C") proc ::deallocate( i32, i32, i32 ) + locaddr.0 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 push.0 - dup.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 eq neq if.true - drop - drop - drop + nop else - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::__rustc::__rust_dealloc + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.2 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::p2id::__rustc::__rust_dealloc trace.252 nop end end +@locals("4") @callconv("C") proc ::allocate( i32, i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + swap.1 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -1949,9 +3285,16 @@ proc ::allocate( nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.3 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1959,24 +3302,44 @@ proc ::allocate( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.8 - dup.2 + movup.3 u32wrapping_add - movup.2 - swap.5 - movdn.2 swap.1 swap.3 - swap.4 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::::alloc_impl + exec.::"miden:base/note-script@1.0.0"::p2id::"::alloc_impl" + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.12 - dup.2 + swap.1 add u32assert push.4 @@ -1992,8 +3355,32 @@ proc ::allocate( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.3 + swap.1 add u32assert push.4 @@ -2009,7 +3396,7 @@ proc ::allocate( exec.::intrinsics::mem::load_sw trace.252 nop - dup.2 + swap.1 push.4 dup.1 swap.1 @@ -2023,6 +3410,22 @@ proc ::allocate( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 movup.2 add @@ -2040,6 +3443,14 @@ proc ::allocate( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114144 @@ -2052,6 +3463,7 @@ proc ::allocate( nop end +@locals("8") @callconv("C") proc ::try_allocate_in( i32, @@ -2060,6 +3472,46 @@ proc ::try_allocate_in( i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -2070,9 +3522,16 @@ proc ::try_allocate_in( nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.5 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -2080,14 +3539,37 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop - dup.2 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.0 - dup.7 + dup.4 u32wrapping_sub push.4294967295 - movup.9 - dup.9 + movup.5 + movup.5 u32wrapping_add u32wrapping_add u32and @@ -2097,6 +3579,18 @@ proc ::try_allocate_in( exec.::intrinsics::i64::wrapping_mul trace.252 nop + dup.1 + dup.1 + locaddr.6 + push.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop push.0 push.32 push.0 @@ -2110,64 +3604,118 @@ proc ::try_allocate_in( push.4294967295 u32lte assert - dup.3 - dup.3 + movup.3 + movup.3 movup.2 trace.240 nop - exec.::std::math::u64::shr + exec.::miden::core::math::u64::shr trace.252 nop drop neq if.true - drop - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop push.0 - push.3735929054 - dup.0 - dup.1 - swap.4 - swap.1 - swap.3 - swap.5 else + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 drop + dup.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.2147483648 - dup.7 + movup.2 u32wrapping_sub - dup.2 + movup.2 swap.1 u32lte neq dup.0 if.true + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 - dup.2 neq if.true + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 - movup.6 neq if.true + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.1 - dup.3 - dup.7 - dup.4 + movdn.3 swap.2 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::::alloc_impl + exec.::"miden:base/note-script@1.0.0"::p2id::"::alloc_impl" + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop - dup.2 push.4 dup.1 swap.1 @@ -2181,20 +3729,59 @@ proc ::try_allocate_in( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop else + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.3 + movup.3 u32wrapping_add - dup.6 - dup.3 - swap.2 + movup.2 + swap.1 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::p2id::"::allocate" + trace.252 + nop + locaddr.5 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::::allocate + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.3 + swap.1 add u32assert push.4 @@ -2210,18 +3797,44 @@ proc ::try_allocate_in( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 - dup.1 neq - dup.0 if.true - movup.7 - movup.4 - drop - drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.5 + movup.2 add u32assert push.4 @@ -2230,8 +3843,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -2239,8 +3850,24 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.4 + movup.2 add u32assert push.4 @@ -2249,8 +3876,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.5 - swap.1 u32divmod.4 swap.1 trace.240 @@ -2258,13 +3883,34 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + push.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop else - movup.6 - movup.2 - drop - drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.5 + movup.2 add u32assert push.4 @@ -2273,8 +3919,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.3 - swap.1 u32divmod.4 swap.1 trace.240 @@ -2282,8 +3926,24 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.4 + movup.2 add u32assert push.4 @@ -2292,8 +3952,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.5 - swap.1 u32divmod.4 swap.1 trace.240 @@ -2301,22 +3959,35 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + push.1 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.1 - push.0 - movup.2 - cdrop else - movup.2 - swap.5 - movdn.2 - swap.4 + locaddr.0 + push.0 swap.1 - drop - drop - drop + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.1 + movup.2 add u32assert push.4 @@ -2325,8 +3996,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.4 - swap.1 u32divmod.4 swap.1 trace.240 @@ -2334,8 +4003,25 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + push.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + swap.1 add u32assert push.4 @@ -2353,68 +4039,27 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop - push.0 - swap.1 - swap.3 - swap.2 - swap.1 end else - swap.1 - drop - movup.3 - drop - movup.3 - drop - movup.3 - drop - push.3735929054 + nop end push.0 push.1 - dup.3 - cdrop - push.3735929054 - dup.3 - dup.5 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.7 - swap.1 - cdrop - push.3735929054 - dup.5 - movup.2 - swap.7 - movdn.2 - cdrop - push.3735929054 movup.2 - swap.7 - movdn.2 - swap.1 - swap.5 cdrop - swap.1 - swap.5 - swap.4 - swap.2 - swap.3 - swap.1 end - movup.5 eq.0 if.true - movup.2 - drop - movup.2 - drop - movup.2 - drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + swap.1 add u32assert push.4 @@ -2433,11 +4078,34 @@ proc ::try_allocate_in( trace.252 nop push.1 + locaddr.3 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop else - drop - drop + nop end + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 push.4 dup.1 swap.1 @@ -2451,6 +4119,14 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114144 @@ -2463,6 +4139,7 @@ proc ::try_allocate_in( nop end +@locals("2") @callconv("C") proc alloc::raw_vec::handle_error(i32, i32) drop @@ -2471,6 +4148,7 @@ proc alloc::raw_vec::handle_error(i32, i32) assert end +@locals("2") @callconv("C") proc ::max( i32, @@ -2486,10 +4164,10 @@ proc ::max( end @callconv("C") -proc miden::active_account::get_id(i32) +proc miden::protocol::active_account::get_id(i32) trace.240 nop - exec.::miden::active_account::get_id + exec.::miden::protocol::active_account::get_id trace.252 nop movup.2 @@ -2516,10 +4194,10 @@ proc miden::active_account::get_id(i32) end @callconv("C") -proc miden::active_note::get_assets(i32) -> i32 +proc miden::protocol::active_note::get_assets(i32) -> i32 trace.240 nop - exec.::miden::active_note::get_assets + exec.::miden::protocol::active_note::get_assets trace.252 nop swap.1 @@ -2527,10 +4205,10 @@ proc miden::active_note::get_assets(i32) -> i32 end @callconv("C") -proc miden::active_note::get_inputs(i32) -> i32 +proc miden::protocol::active_note::get_inputs(i32) -> i32 trace.240 nop - exec.::miden::active_note::get_inputs + exec.::miden::protocol::active_note::get_inputs trace.252 nop swap.1 diff --git a/tests/integration/expected/examples/p2id.wat b/tests/integration/expected/examples/p2id.wat index 8216aa73f..aff43ccc4 100644 --- a/tests/integration/expected/examples/p2id.wat +++ b/tests/integration/expected/examples/p2id.wat @@ -29,8 +29,8 @@ (type (;4;) (func (param i32 i32 i32) (result i32))) (type (;5;) (func (result i32))) (type (;6;) (func (param i32))) - (type (;7;) (func (param f32 f32) (result i32))) - (type (;8;) (func (param i32 i32 i32 i32))) + (type (;7;) (func (param i32 i32 i32 i32))) + (type (;8;) (func (param f32 f32) (result i32))) (type (;9;) (func (param i32 i32 i32 i32 i32))) (type (;10;) (func (param i32 i32))) (type (;11;) (func (param i32) (result i32))) @@ -77,23 +77,23 @@ (func $miden:base/note-script@1.0.0#run (;6;) (type 0) (param f32 f32 f32 f32) (local i32 i32 f32 f32 f32 i32 i32 i32) global.get $__stack_pointer - i32.const 48 + i32.const 32 i32.sub local.tee 4 global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once local.get 4 - i32.const 16 + i32.const 12 i32.add call $miden_base_sys::bindings::active_note::get_inputs block ;; label = @1 block ;; label = @2 local.get 4 - i32.load offset=24 + i32.load offset=20 br_table 1 (;@1;) 1 (;@1;) 0 (;@2;) end local.get 4 - i32.load offset=20 + i32.load offset=16 local.tee 5 f32.load offset=4 local.set 6 @@ -101,14 +101,20 @@ f32.load local.set 7 local.get 4 - i32.const 8 + i32.const 12 + i32.add + call $ as core::ops::drop::Drop>::drop + local.get 4 + i32.const 12 i32.add + call $ as core::ops::drop::Drop>::drop + local.get 4 call $miden_base_sys::bindings::active_account::get_id local.get 4 - f32.load offset=12 + f32.load offset=4 local.set 8 local.get 4 - f32.load offset=8 + f32.load local.get 7 call $intrinsics::felt::eq i32.const 1 @@ -121,19 +127,19 @@ i32.ne br_if 0 (;@1;) local.get 4 - i32.const 28 + i32.const 12 i32.add call $miden_base_sys::bindings::active_note::get_assets local.get 4 - i32.load offset=36 + i32.load offset=20 i32.const 4 i32.shl local.set 9 local.get 4 - i32.load offset=28 + i32.load offset=12 local.set 10 local.get 4 - i32.load offset=32 + i32.load offset=16 local.tee 11 local.set 5 block ;; label = @2 @@ -163,26 +169,18 @@ end local.get 4 local.get 11 - i32.store offset=44 + i32.store offset=28 local.get 4 local.get 10 - i32.store offset=40 + i32.store offset=24 local.get 4 - i32.const 40 + i32.const 24 i32.add i32.const 16 i32.const 16 call $::deallocate local.get 4 - i32.const 16 - i32.add - call $ as core::ops::drop::Drop>::drop - local.get 4 - i32.const 16 - i32.add - call $ as core::ops::drop::Drop>::drop - local.get 4 - i32.const 48 + i32.const 32 i32.add global.set $__stack_pointer return @@ -295,6 +293,7 @@ local.get 1 i32.const 8 i32.add + i32.const 256 i32.const 16 i32.const 16 call $::with_capacity_in @@ -312,49 +311,49 @@ i32.add global.set $__stack_pointer ) - (func $::with_capacity_in (;12;) (type 3) (param i32 i32 i32) + (func $::with_capacity_in (;12;) (type 7) (param i32 i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 i32.sub - local.tee 3 + local.tee 4 global.set $__stack_pointer - local.get 3 + local.get 4 i32.const 4 i32.add - i32.const 256 - i32.const 0 local.get 1 + i32.const 0 local.get 2 - call $::try_allocate_in local.get 3 + call $::try_allocate_in + local.get 4 i32.load offset=8 - local.set 2 + local.set 3 block ;; label = @1 - local.get 3 + local.get 4 i32.load offset=4 i32.const 1 i32.ne br_if 0 (;@1;) - local.get 2 local.get 3 + local.get 4 i32.load offset=12 call $alloc::raw_vec::handle_error unreachable end local.get 0 - local.get 3 + local.get 4 i32.load offset=12 i32.store offset=4 local.get 0 - local.get 2 - i32.store local.get 3 + i32.store + local.get 4 i32.const 16 i32.add global.set $__stack_pointer ) - (func $ as core::ops::drop::Drop>::drop (;13;) (type 6) (param i32) + (func $ as core::ops::drop::Drop>::drop (;13;) (type 6) (param i32) local.get 0 i32.const 4 i32.const 4 @@ -378,7 +377,7 @@ i32.load offset=8 i32.const 2 i32.shr_u - call $miden::active_note::get_assets + call $miden::protocol::active_note::get_assets i32.store local.get 0 local.get 1 @@ -399,6 +398,7 @@ local.get 1 i32.const 8 i32.add + i32.const 1024 i32.const 4 i32.const 4 call $::with_capacity_in @@ -411,7 +411,7 @@ local.tee 3 i32.const 2 i32.shr_u - call $miden::active_note::get_inputs + call $miden::protocol::active_note::get_inputs i32.store offset=8 local.get 0 local.get 3 @@ -434,7 +434,7 @@ local.get 1 i32.const 8 i32.add - call $miden::active_account::get_id + call $miden::protocol::active_account::get_id local.get 0 local.get 1 i64.load offset=8 align=4 @@ -444,11 +444,11 @@ i32.add global.set $__stack_pointer ) - (func $ as core::ops::drop::Drop>::drop (;17;) (type 6) (param i32)) - (func $intrinsics::felt::eq (;18;) (type 7) (param f32 f32) (result i32) + (func $ as core::ops::drop::Drop>::drop (;17;) (type 6) (param i32)) + (func $intrinsics::felt::eq (;18;) (type 8) (param f32 f32) (result i32) unreachable ) - (func $::alloc_impl (;19;) (type 8) (param i32 i32 i32 i32) + (func $::alloc_impl (;19;) (type 7) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -507,7 +507,7 @@ i32.add global.set $__stack_pointer ) - (func $::current_memory (;21;) (type 8) (param i32 i32 i32 i32) + (func $::current_memory (;21;) (type 7) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -704,13 +704,13 @@ i32.gt_u select ) - (func $miden::active_account::get_id (;27;) (type 6) (param i32) + (func $miden::protocol::active_account::get_id (;27;) (type 6) (param i32) unreachable ) - (func $miden::active_note::get_assets (;28;) (type 11) (param i32) (result i32) + (func $miden::protocol::active_note::get_assets (;28;) (type 11) (param i32) (result i32) unreachable ) - (func $miden::active_note::get_inputs (;29;) (type 11) (param i32) (result i32) + (func $miden::protocol::active_note::get_inputs (;29;) (type 11) (param i32) (result i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00") diff --git a/tests/integration/expected/examples/storage_example.hir b/tests/integration/expected/examples/storage_example.hir index 7938feb44..5c8d46982 100644 --- a/tests/integration/expected/examples/storage_example.hir +++ b/tests/integration/expected/examples/storage_example.hir @@ -10,314 +10,330 @@ builtin.component miden:storage-example/foo@1.0.0 { builtin.ret ; }; - private builtin.function @miden:storage-example/foo@1.0.0#get-asset-qty(v0: felt, v1: felt, v2: felt, v3: felt) -> felt { - ^block9(v0: felt, v1: felt, v2: felt, v3: felt): - v6 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr - v7 = hir.bitcast v6 : ptr; - v8 = hir.load v7 : i32; - v9 = arith.constant 48 : i32; - v10 = arith.sub v8, v9 : i32 #[overflow = wrapping]; - v11 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr - v12 = hir.bitcast v11 : ptr; - hir.store v12, v10; + private builtin.function @::default(v0: i32) { + ^block9(v0: i32): + hir.store_local v0 #[local = lv0]; + v7 = hir.load_local : i32 #[local = lv0]; + v402 = arith.constant 12 : u32; + v10 = hir.bitcast v7 : u32; + v12 = arith.add v10, v402 : u32 #[overflow = checked]; + v401 = arith.constant 4 : u32; + v14 = arith.mod v12, v401 : u32; + hir.assertz v14 #[code = 250]; + v403 = arith.constant -6348547769199644661 : i64; + v9 = arith.trunc v403 : felt; + v15 = hir.int_to_ptr v12 : ptr; + hir.store v15, v9; + v16 = hir.load_local : i32 #[local = lv0]; + v400 = arith.constant 8 : u32; + v18 = hir.bitcast v16 : u32; + v20 = arith.add v18, v400 : u32 #[overflow = checked]; + v414 = arith.constant 4 : u32; + v22 = arith.mod v20, v414 : u32; + hir.assertz v22 #[code = 250]; + v404 = arith.constant -6475110084634595035 : i64; + v6 = arith.trunc v404 : felt; + v23 = hir.int_to_ptr v20 : ptr; + hir.store v23, v6; + v24 = hir.load_local : i32 #[local = lv0]; + v413 = arith.constant 4 : u32; + v26 = hir.bitcast v24 : u32; + v28 = arith.add v26, v413 : u32 #[overflow = checked]; + v412 = arith.constant 4 : u32; + v30 = arith.mod v28, v412 : u32; + hir.assertz v30 #[code = 250]; + v405 = arith.constant -637820373289844411 : i64; + v4 = arith.trunc v405 : felt; + v31 = hir.int_to_ptr v28 : ptr; + hir.store v31, v4; + v32 = hir.load_local : i32 #[local = lv0]; + v34 = hir.bitcast v32 : u32; + v411 = arith.constant 4 : u32; + v36 = arith.mod v34, v411 : u32; + hir.assertz v36 #[code = 250]; + v406 = arith.constant 3042002143573699788 : i64; + v2 = arith.trunc v406 : felt; + v37 = hir.int_to_ptr v34 : ptr; + hir.store v37, v2; + builtin.ret ; + }; + + private builtin.function @miden:storage-example/foo@1.0.0#get-asset-qty(v38: felt, v39: felt, v40: felt, v41: felt) -> felt { + ^block11(v38: felt, v39: felt, v40: felt, v41: felt): + hir.store_local v38 #[local = lv0]; + hir.store_local v39 #[local = lv1]; + hir.store_local v40 #[local = lv2]; + hir.store_local v41 #[local = lv3]; + v43 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr + v44 = hir.bitcast v43 : ptr; + v45 = hir.load v44 : i32; + v420 = arith.constant 32 : i32; + v47 = arith.sub v45, v420 : i32 #[overflow = wrapping]; + hir.store_local v47 #[local = lv4]; + v48 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr + v49 = hir.bitcast v48 : ptr; + hir.store v49, v47; hir.exec @miden:storage-example/foo@1.0.0/storage_example/wit_bindgen::rt::run_ctors_once() - v13 = arith.constant 1 : i32; - v14 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::from(v13) : felt - v15 = arith.constant 16 : i32; - v16 = arith.add v10, v15 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden::active_account::get_map_item(v14, v3, v2, v1, v0, v16) - v18 = arith.constant 24 : u32; - v17 = hir.bitcast v10 : u32; - v19 = arith.add v17, v18 : u32 #[overflow = checked]; - v20 = arith.constant 8 : u32; - v21 = arith.mod v19, v20 : u32; - hir.assertz v21 #[code = 250]; - v22 = hir.int_to_ptr v19 : ptr; - v23 = hir.load v22 : i64; - v25 = arith.constant 40 : u32; - v24 = hir.bitcast v10 : u32; - v26 = arith.add v24, v25 : u32 #[overflow = checked]; - v509 = arith.constant 8 : u32; - v28 = arith.mod v26, v509 : u32; - hir.assertz v28 #[code = 250]; - v29 = hir.int_to_ptr v26 : ptr; - hir.store v29, v23; - v31 = arith.constant 16 : u32; - v30 = hir.bitcast v10 : u32; - v32 = arith.add v30, v31 : u32 #[overflow = checked]; - v508 = arith.constant 8 : u32; - v34 = arith.mod v32, v508 : u32; - hir.assertz v34 #[code = 250]; - v35 = hir.int_to_ptr v32 : ptr; - v36 = hir.load v35 : i64; - v38 = arith.constant 32 : u32; - v37 = hir.bitcast v10 : u32; - v39 = arith.add v37, v38 : u32 #[overflow = checked]; - v507 = arith.constant 8 : u32; - v41 = arith.mod v39, v507 : u32; - hir.assertz v41 #[code = 250]; - v42 = hir.int_to_ptr v39 : ptr; - hir.store v42, v36; - v43 = arith.constant 32 : i32; - v44 = arith.add v10, v43 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/::reverse(v10, v44) - v46 = arith.constant 12 : u32; - v45 = hir.bitcast v10 : u32; - v47 = arith.add v45, v46 : u32 #[overflow = checked]; - v48 = arith.constant 4 : u32; - v49 = arith.mod v47, v48 : u32; - hir.assertz v49 #[code = 250]; - v50 = hir.int_to_ptr v47 : ptr; - v51 = hir.load v50 : felt; - v506 = arith.constant 48 : i32; - v53 = arith.add v10, v506 : i32 #[overflow = wrapping]; - v54 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr - v55 = hir.bitcast v54 : ptr; - hir.store v55, v53; - builtin.ret v51; + v50 = hir.load_local : i32 #[local = lv4]; + hir.exec @miden:storage-example/foo@1.0.0/storage_example/::default(v50) + v51 = hir.load_local : i32 #[local = lv4]; + v419 = arith.constant 12 : u32; + v52 = hir.bitcast v51 : u32; + v54 = arith.add v52, v419 : u32 #[overflow = checked]; + v418 = arith.constant 4 : u32; + v56 = arith.mod v54, v418 : u32; + hir.assertz v56 #[code = 250]; + v57 = hir.int_to_ptr v54 : ptr; + v58 = hir.load v57 : felt; + v59 = hir.load_local : i32 #[local = lv4]; + v417 = arith.constant 8 : u32; + v60 = hir.bitcast v59 : u32; + v62 = arith.add v60, v417 : u32 #[overflow = checked]; + v426 = arith.constant 4 : u32; + v64 = arith.mod v62, v426 : u32; + hir.assertz v64 #[code = 250]; + v65 = hir.int_to_ptr v62 : ptr; + v66 = hir.load v65 : felt; + v67 = hir.load_local : felt #[local = lv3]; + v68 = hir.load_local : felt #[local = lv2]; + v69 = hir.load_local : felt #[local = lv1]; + v70 = hir.load_local : felt #[local = lv0]; + v71 = hir.load_local : i32 #[local = lv4]; + v416 = arith.constant 16 : i32; + v73 = arith.add v71, v416 : i32 #[overflow = wrapping]; + hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden::protocol::active_account::get_map_item(v58, v66, v67, v68, v69, v70, v73) + v74 = hir.load_local : i32 #[local = lv4]; + v415 = arith.constant 16 : u32; + v75 = hir.bitcast v74 : u32; + v77 = arith.add v75, v415 : u32 #[overflow = checked]; + v425 = arith.constant 4 : u32; + v79 = arith.mod v77, v425 : u32; + hir.assertz v79 #[code = 250]; + v80 = hir.int_to_ptr v77 : ptr; + v81 = hir.load v80 : felt; + hir.store_local v81 #[local = lv0]; + v82 = hir.load_local : i32 #[local = lv4]; + v424 = arith.constant 32 : i32; + v84 = arith.add v82, v424 : i32 #[overflow = wrapping]; + v85 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr + v86 = hir.bitcast v85 : ptr; + hir.store v86, v84; + v87 = hir.load_local : felt #[local = lv0]; + builtin.ret v87; }; - private builtin.function @miden:storage-example/foo@1.0.0#set-asset-qty(v56: felt, v57: felt, v58: felt, v59: felt, v60: felt, v61: felt, v62: felt, v63: felt, v64: felt) { - ^block11(v56: felt, v57: felt, v58: felt, v59: felt, v60: felt, v61: felt, v62: felt, v63: felt, v64: felt): - v67 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr - v68 = hir.bitcast v67 : ptr; - v69 = hir.load v68 : i32; - v70 = arith.constant 128 : i32; - v71 = arith.sub v69, v70 : i32 #[overflow = wrapping]; - v72 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr - v73 = hir.bitcast v72 : ptr; - hir.store v73, v71; + private builtin.function @miden:storage-example/foo@1.0.0#set-asset-qty(v88: felt, v89: felt, v90: felt, v91: felt, v92: felt, v93: felt, v94: felt, v95: felt, v96: felt) { + ^block13(v88: felt, v89: felt, v90: felt, v91: felt, v92: felt, v93: felt, v94: felt, v95: felt, v96: felt): + hir.store_local v88 #[local = lv0]; + hir.store_local v89 #[local = lv1]; + hir.store_local v90 #[local = lv2]; + hir.store_local v91 #[local = lv3]; + hir.store_local v92 #[local = lv4]; + hir.store_local v93 #[local = lv5]; + hir.store_local v94 #[local = lv6]; + hir.store_local v95 #[local = lv7]; + hir.store_local v96 #[local = lv8]; + v97 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr + v98 = hir.bitcast v97 : ptr; + v99 = hir.load v98 : i32; + v442 = arith.constant 48 : i32; + v101 = arith.sub v99, v442 : i32 #[overflow = wrapping]; + hir.store_local v101 #[local = lv9]; + v102 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr + v103 = hir.bitcast v102 : ptr; + hir.store v103, v101; hir.exec @miden:storage-example/foo@1.0.0/storage_example/wit_bindgen::rt::run_ctors_once() - v65 = arith.constant 0 : i32; - v75 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::from(v65) : felt - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden::active_account::get_item(v75, v71) - v77 = arith.constant 8 : u32; - v76 = hir.bitcast v71 : u32; - v78 = arith.add v76, v77 : u32 #[overflow = checked]; - v549 = arith.constant 8 : u32; - v80 = arith.mod v78, v549 : u32; - hir.assertz v80 #[code = 250]; - v81 = hir.int_to_ptr v78 : ptr; - v82 = hir.load v81 : i64; - v84 = arith.constant 56 : u32; - v83 = hir.bitcast v71 : u32; - v85 = arith.add v83, v84 : u32 #[overflow = checked]; - v548 = arith.constant 8 : u32; - v87 = arith.mod v85, v548 : u32; - hir.assertz v87 #[code = 250]; - v88 = hir.int_to_ptr v85 : ptr; - hir.store v88, v82; - v89 = hir.bitcast v71 : u32; - v547 = arith.constant 8 : u32; - v91 = arith.mod v89, v547 : u32; - hir.assertz v91 #[code = 250]; - v92 = hir.int_to_ptr v89 : ptr; - v93 = hir.load v92 : i64; - v95 = arith.constant 48 : u32; - v94 = hir.bitcast v71 : u32; - v96 = arith.add v94, v95 : u32 #[overflow = checked]; - v546 = arith.constant 8 : u32; - v98 = arith.mod v96, v546 : u32; - hir.assertz v98 #[code = 250]; - v99 = hir.int_to_ptr v96 : ptr; - hir.store v99, v93; - v102 = arith.constant 48 : i32; - v103 = arith.add v71, v102 : i32 #[overflow = wrapping]; - v100 = arith.constant 112 : i32; - v101 = arith.add v71, v100 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/::reverse(v101, v103) - v105 = arith.constant 116 : u32; - v104 = hir.bitcast v71 : u32; - v106 = arith.add v104, v105 : u32 #[overflow = checked]; - v107 = arith.constant 4 : u32; - v108 = arith.mod v106, v107 : u32; - hir.assertz v108 #[code = 250]; - v109 = hir.int_to_ptr v106 : ptr; - v110 = hir.load v109 : felt; - v112 = arith.constant 120 : u32; - v111 = hir.bitcast v71 : u32; - v113 = arith.add v111, v112 : u32 #[overflow = checked]; - v545 = arith.constant 4 : u32; - v115 = arith.mod v113, v545 : u32; - hir.assertz v115 #[code = 250]; - v116 = hir.int_to_ptr v113 : ptr; - v117 = hir.load v116 : felt; - v119 = arith.constant 124 : u32; - v118 = hir.bitcast v71 : u32; - v120 = arith.add v118, v119 : u32 #[overflow = checked]; - v544 = arith.constant 4 : u32; - v122 = arith.mod v120, v544 : u32; - hir.assertz v122 #[code = 250]; - v123 = hir.int_to_ptr v120 : ptr; - v124 = hir.load v123 : felt; - v126 = arith.constant 112 : u32; - v125 = hir.bitcast v71 : u32; - v127 = arith.add v125, v126 : u32 #[overflow = checked]; - v543 = arith.constant 4 : u32; - v129 = arith.mod v127, v543 : u32; - hir.assertz v129 #[code = 250]; - v130 = hir.int_to_ptr v127 : ptr; - v131 = hir.load v130 : felt; - v132 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/intrinsics::felt::eq(v56, v131) : i32 - v542 = arith.constant 0 : i32; - v133 = arith.constant 1 : i32; - v134 = arith.neq v132, v133 : i1; - v135 = arith.zext v134 : u32; - v136 = hir.bitcast v135 : i32; - v138 = arith.neq v136, v542 : i1; - scf.if v138{ - ^block52: + v104 = hir.load_local : i32 #[local = lv9]; + hir.exec @miden:storage-example/foo@1.0.0/storage_example/::default(v104) + v105 = hir.load_local : i32 #[local = lv9]; + v441 = arith.constant 4 : u32; + v106 = hir.bitcast v105 : u32; + v108 = arith.add v106, v441 : u32 #[overflow = checked]; + v483 = arith.constant 4 : u32; + v110 = arith.mod v108, v483 : u32; + hir.assertz v110 #[code = 250]; + v111 = hir.int_to_ptr v108 : ptr; + v112 = hir.load v111 : felt; + v113 = hir.load_local : i32 #[local = lv9]; + v114 = hir.bitcast v113 : u32; + v482 = arith.constant 4 : u32; + v116 = arith.mod v114, v482 : u32; + hir.assertz v116 #[code = 250]; + v117 = hir.int_to_ptr v114 : ptr; + v118 = hir.load v117 : felt; + v119 = hir.load_local : i32 #[local = lv9]; + v440 = arith.constant 32 : i32; + v121 = arith.add v119, v440 : i32 #[overflow = wrapping]; + hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden::protocol::active_account::get_item(v112, v118, v121) + v122 = hir.load_local : i32 #[local = lv9]; + v439 = arith.constant 40 : u32; + v123 = hir.bitcast v122 : u32; + v125 = arith.add v123, v439 : u32 #[overflow = checked]; + v481 = arith.constant 4 : u32; + v127 = arith.mod v125, v481 : u32; + hir.assertz v127 #[code = 250]; + v128 = hir.int_to_ptr v125 : ptr; + v129 = hir.load v128 : felt; + hir.store_local v129 #[local = lv10]; + v130 = hir.load_local : i32 #[local = lv9]; + v438 = arith.constant 36 : u32; + v131 = hir.bitcast v130 : u32; + v133 = arith.add v131, v438 : u32 #[overflow = checked]; + v480 = arith.constant 4 : u32; + v135 = arith.mod v133, v480 : u32; + hir.assertz v135 #[code = 250]; + v136 = hir.int_to_ptr v133 : ptr; + v137 = hir.load v136 : felt; + hir.store_local v137 #[local = lv11]; + v138 = hir.load_local : i32 #[local = lv9]; + v437 = arith.constant 32 : u32; + v139 = hir.bitcast v138 : u32; + v141 = arith.add v139, v437 : u32 #[overflow = checked]; + v479 = arith.constant 4 : u32; + v143 = arith.mod v141, v479 : u32; + hir.assertz v143 #[code = 250]; + v144 = hir.int_to_ptr v141 : ptr; + v145 = hir.load v144 : felt; + hir.store_local v145 #[local = lv12]; + v146 = hir.load_local : felt #[local = lv0]; + v147 = hir.load_local : i32 #[local = lv9]; + v436 = arith.constant 44 : u32; + v148 = hir.bitcast v147 : u32; + v150 = arith.add v148, v436 : u32 #[overflow = checked]; + v478 = arith.constant 4 : u32; + v152 = arith.mod v150, v478 : u32; + hir.assertz v152 #[code = 250]; + v153 = hir.int_to_ptr v150 : ptr; + v154 = hir.load v153 : felt; + v434 = arith.constant 0 : i32; + v435 = arith.constant 1 : i32; + v155 = arith.eq v146, v154 : i1; + v156 = hir.cast v155 : i32; + v158 = arith.neq v156, v435 : i1; + v159 = arith.zext v158 : u32; + v160 = hir.bitcast v159 : i32; + v162 = arith.neq v160, v434 : i1; + scf.if v162{ + ^block43: scf.yield ; } else { - ^block14: - v139 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/intrinsics::felt::eq(v57, v110) : i32 - v540 = arith.constant 0 : i32; - v541 = arith.constant 1 : i32; - v141 = arith.neq v139, v541 : i1; - v142 = arith.zext v141 : u32; - v143 = hir.bitcast v142 : i32; - v145 = arith.neq v143, v540 : i1; - scf.if v145{ - ^block51: + ^block16: + v163 = hir.load_local : felt #[local = lv1]; + v164 = hir.load_local : felt #[local = lv10]; + v476 = arith.constant 0 : i32; + v477 = arith.constant 1 : i32; + v165 = arith.eq v163, v164 : i1; + v166 = hir.cast v165 : i32; + v168 = arith.neq v166, v477 : i1; + v169 = arith.zext v168 : u32; + v170 = hir.bitcast v169 : i32; + v172 = arith.neq v170, v476 : i1; + scf.if v172{ + ^block42: scf.yield ; } else { - ^block15: - v146 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/intrinsics::felt::eq(v58, v117) : i32 - v538 = arith.constant 0 : i32; - v539 = arith.constant 1 : i32; - v148 = arith.neq v146, v539 : i1; - v149 = arith.zext v148 : u32; - v150 = hir.bitcast v149 : i32; - v152 = arith.neq v150, v538 : i1; - scf.if v152{ - ^block50: + ^block17: + v173 = hir.load_local : felt #[local = lv2]; + v174 = hir.load_local : felt #[local = lv11]; + v474 = arith.constant 0 : i32; + v475 = arith.constant 1 : i32; + v175 = arith.eq v173, v174 : i1; + v176 = hir.cast v175 : i32; + v178 = arith.neq v176, v475 : i1; + v179 = arith.zext v178 : u32; + v180 = hir.bitcast v179 : i32; + v182 = arith.neq v180, v474 : i1; + scf.if v182{ + ^block41: scf.yield ; } else { - ^block16: - v153 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/intrinsics::felt::eq(v59, v124) : i32 - v536 = arith.constant 0 : i32; - v537 = arith.constant 1 : i32; - v155 = arith.neq v153, v537 : i1; - v156 = arith.zext v155 : u32; - v157 = hir.bitcast v156 : i32; - v159 = arith.neq v157, v536 : i1; - scf.if v159{ - ^block49: + ^block18: + v183 = hir.load_local : felt #[local = lv3]; + v184 = hir.load_local : felt #[local = lv12]; + v472 = arith.constant 0 : i32; + v473 = arith.constant 1 : i32; + v185 = arith.eq v183, v184 : i1; + v186 = hir.cast v185 : i32; + v188 = arith.neq v186, v473 : i1; + v189 = arith.zext v188 : u32; + v190 = hir.bitcast v189 : i32; + v192 = arith.neq v190, v472 : i1; + scf.if v192{ + ^block40: scf.yield ; } else { - ^block17: - v160 = arith.constant 32 : i32; - v161 = arith.add v71, v160 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::from(v161, v64) - v535 = arith.constant 1 : i32; - v163 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::from(v535) : felt - v165 = arith.constant 44 : u32; - v164 = hir.bitcast v71 : u32; - v166 = arith.add v164, v165 : u32 #[overflow = checked]; - v534 = arith.constant 4 : u32; - v168 = arith.mod v166, v534 : u32; - hir.assertz v168 #[code = 250]; - v169 = hir.int_to_ptr v166 : ptr; - v170 = hir.load v169 : felt; - v172 = arith.constant 40 : u32; - v171 = hir.bitcast v71 : u32; - v173 = arith.add v171, v172 : u32 #[overflow = checked]; - v533 = arith.constant 4 : u32; - v175 = arith.mod v173, v533 : u32; - hir.assertz v175 #[code = 250]; - v176 = hir.int_to_ptr v173 : ptr; - v177 = hir.load v176 : felt; - v179 = arith.constant 36 : u32; - v178 = hir.bitcast v71 : u32; - v180 = arith.add v178, v179 : u32 #[overflow = checked]; - v532 = arith.constant 4 : u32; - v182 = arith.mod v180, v532 : u32; - hir.assertz v182 #[code = 250]; - v183 = hir.int_to_ptr v180 : ptr; - v184 = hir.load v183 : felt; - v186 = arith.constant 32 : u32; - v185 = hir.bitcast v71 : u32; - v187 = arith.add v185, v186 : u32 #[overflow = checked]; - v531 = arith.constant 4 : u32; - v189 = arith.mod v187, v531 : u32; - hir.assertz v189 #[code = 250]; - v190 = hir.int_to_ptr v187 : ptr; - v191 = hir.load v190 : felt; - v530 = arith.constant 48 : i32; - v193 = arith.add v71, v530 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden::native_account::set_map_item(v163, v63, v62, v61, v60, v170, v177, v184, v191, v193) - v529 = arith.constant 56 : u32; - v194 = hir.bitcast v71 : u32; - v196 = arith.add v194, v529 : u32 #[overflow = checked]; - v528 = arith.constant 8 : u32; - v198 = arith.mod v196, v528 : u32; + ^block19: + v193 = hir.load_local : i32 #[local = lv9]; + v433 = arith.constant 12 : u32; + v194 = hir.bitcast v193 : u32; + v196 = arith.add v194, v433 : u32 #[overflow = checked]; + v471 = arith.constant 4 : u32; + v198 = arith.mod v196, v471 : u32; hir.assertz v198 #[code = 250]; - v199 = hir.int_to_ptr v196 : ptr; - v200 = hir.load v199 : i64; - v202 = arith.constant 88 : u32; - v201 = hir.bitcast v71 : u32; - v203 = arith.add v201, v202 : u32 #[overflow = checked]; - v527 = arith.constant 8 : u32; - v205 = arith.mod v203, v527 : u32; - hir.assertz v205 #[code = 250]; - v206 = hir.int_to_ptr v203 : ptr; - hir.store v206, v200; - v526 = arith.constant 48 : u32; - v207 = hir.bitcast v71 : u32; - v209 = arith.add v207, v526 : u32 #[overflow = checked]; - v525 = arith.constant 8 : u32; - v211 = arith.mod v209, v525 : u32; - hir.assertz v211 #[code = 250]; - v212 = hir.int_to_ptr v209 : ptr; - v213 = hir.load v212 : i64; - v215 = arith.constant 80 : u32; - v214 = hir.bitcast v71 : u32; - v216 = arith.add v214, v215 : u32 #[overflow = checked]; - v524 = arith.constant 8 : u32; - v218 = arith.mod v216, v524 : u32; - hir.assertz v218 #[code = 250]; - v219 = hir.int_to_ptr v216 : ptr; - hir.store v219, v213; - v220 = arith.constant 72 : i32; - v221 = arith.add v71, v220 : i32 #[overflow = wrapping]; - v222 = hir.bitcast v221 : u32; - v523 = arith.constant 8 : u32; - v224 = arith.mod v222, v523 : u32; + v199 = hir.int_to_ptr v196 : ptr; + v200 = hir.load v199 : felt; + hir.store_local v200 #[local = lv0]; + v201 = hir.load_local : i32 #[local = lv9]; + v432 = arith.constant 8 : u32; + v202 = hir.bitcast v201 : u32; + v204 = arith.add v202, v432 : u32 #[overflow = checked]; + v470 = arith.constant 4 : u32; + v206 = arith.mod v204, v470 : u32; + hir.assertz v206 #[code = 250]; + v207 = hir.int_to_ptr v204 : ptr; + v208 = hir.load v207 : felt; + hir.store_local v208 #[local = lv1]; + v209 = hir.load_local : i32 #[local = lv9]; + v212 = hir.load_local : felt #[local = lv8]; + v431 = arith.constant 16 : i32; + v211 = arith.add v209, v431 : i32 #[overflow = wrapping]; + hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::from(v211, v212) + v213 = hir.load_local : felt #[local = lv0]; + v214 = hir.load_local : felt #[local = lv1]; + v215 = hir.load_local : felt #[local = lv7]; + v216 = hir.load_local : felt #[local = lv6]; + v217 = hir.load_local : felt #[local = lv5]; + v218 = hir.load_local : felt #[local = lv4]; + v219 = hir.load_local : i32 #[local = lv9]; + v430 = arith.constant 28 : u32; + v220 = hir.bitcast v219 : u32; + v222 = arith.add v220, v430 : u32 #[overflow = checked]; + v469 = arith.constant 4 : u32; + v224 = arith.mod v222, v469 : u32; hir.assertz v224 #[code = 250]; - v225 = hir.int_to_ptr v222 : ptr; - v226 = hir.load v225 : i64; - v228 = arith.constant 104 : u32; - v227 = hir.bitcast v71 : u32; - v229 = arith.add v227, v228 : u32 #[overflow = checked]; - v522 = arith.constant 8 : u32; - v231 = arith.mod v229, v522 : u32; - hir.assertz v231 #[code = 250]; - v232 = hir.int_to_ptr v229 : ptr; - hir.store v232, v226; - v234 = arith.constant 64 : u32; - v233 = hir.bitcast v71 : u32; - v235 = arith.add v233, v234 : u32 #[overflow = checked]; - v521 = arith.constant 8 : u32; - v237 = arith.mod v235, v521 : u32; - hir.assertz v237 #[code = 250]; - v238 = hir.int_to_ptr v235 : ptr; - v239 = hir.load v238 : i64; - v241 = arith.constant 96 : u32; - v240 = hir.bitcast v71 : u32; - v242 = arith.add v240, v241 : u32 #[overflow = checked]; - v520 = arith.constant 8 : u32; - v244 = arith.mod v242, v520 : u32; - hir.assertz v244 #[code = 250]; - v245 = hir.int_to_ptr v242 : ptr; - hir.store v245, v239; - v246 = arith.constant 80 : i32; - v247 = arith.add v71, v246 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/::reverse(v71, v247) - v250 = arith.constant 96 : i32; - v251 = arith.add v71, v250 : i32 #[overflow = wrapping]; - v519 = arith.constant 112 : i32; - v249 = arith.add v71, v519 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/::reverse(v249, v251) + v225 = hir.int_to_ptr v222 : ptr; + v226 = hir.load v225 : felt; + v227 = hir.load_local : i32 #[local = lv9]; + v429 = arith.constant 24 : u32; + v228 = hir.bitcast v227 : u32; + v230 = arith.add v228, v429 : u32 #[overflow = checked]; + v468 = arith.constant 4 : u32; + v232 = arith.mod v230, v468 : u32; + hir.assertz v232 #[code = 250]; + v233 = hir.int_to_ptr v230 : ptr; + v234 = hir.load v233 : felt; + v235 = hir.load_local : i32 #[local = lv9]; + v428 = arith.constant 20 : u32; + v236 = hir.bitcast v235 : u32; + v238 = arith.add v236, v428 : u32 #[overflow = checked]; + v467 = arith.constant 4 : u32; + v240 = arith.mod v238, v467 : u32; + hir.assertz v240 #[code = 250]; + v241 = hir.int_to_ptr v238 : ptr; + v242 = hir.load v241 : felt; + v243 = hir.load_local : i32 #[local = lv9]; + v427 = arith.constant 16 : u32; + v244 = hir.bitcast v243 : u32; + v246 = arith.add v244, v427 : u32 #[overflow = checked]; + v466 = arith.constant 4 : u32; + v248 = arith.mod v246, v466 : u32; + hir.assertz v248 #[code = 250]; + v249 = hir.int_to_ptr v246 : ptr; + v250 = hir.load v249 : felt; + v251 = hir.load_local : i32 #[local = lv9]; + v465 = arith.constant 32 : i32; + v253 = arith.add v251, v465 : i32 #[overflow = wrapping]; + hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden::protocol::native_account::set_map_item(v213, v214, v215, v216, v217, v218, v226, v234, v242, v250, v253) scf.yield ; }; scf.yield ; @@ -326,313 +342,154 @@ builtin.component miden:storage-example/foo@1.0.0 { }; scf.yield ; }; - v518 = arith.constant 128 : i32; - v254 = arith.add v71, v518 : i32 #[overflow = wrapping]; - v255 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr - v256 = hir.bitcast v255 : ptr; - hir.store v256, v254; + v254 = hir.load_local : i32 #[local = lv9]; + v464 = arith.constant 48 : i32; + v256 = arith.add v254, v464 : i32 #[overflow = wrapping]; + v257 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr + v258 = hir.bitcast v257 : ptr; + hir.store v258, v256; builtin.ret ; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { - ^block18: - v258 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/GOT.data.internal.__memory_base : ptr - v259 = hir.bitcast v258 : ptr; - v260 = hir.load v259 : i32; - v261 = arith.constant 1048584 : i32; - v262 = arith.add v260, v261 : i32 #[overflow = wrapping]; - v263 = hir.bitcast v262 : u32; - v264 = hir.int_to_ptr v263 : ptr; - v265 = hir.load v264 : u8; - v257 = arith.constant 0 : i32; - v266 = arith.zext v265 : u32; - v267 = hir.bitcast v266 : i32; - v269 = arith.neq v267, v257 : i1; - scf.if v269{ - ^block20: + ^block20: + v259 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/GOT.data.internal.__memory_base : ptr + v260 = hir.bitcast v259 : ptr; + v261 = hir.load v260 : i32; + v488 = arith.constant 1048584 : i32; + v263 = arith.add v261, v488 : i32 #[overflow = wrapping]; + v264 = hir.bitcast v263 : u32; + v265 = hir.int_to_ptr v264 : ptr; + v266 = hir.load v265 : u8; + v487 = arith.constant 0 : i32; + v267 = arith.zext v266 : u32; + v268 = hir.bitcast v267 : i32; + v270 = arith.neq v268, v487 : i1; + scf.if v270{ + ^block22: scf.yield ; } else { - ^block21: - v270 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/GOT.data.internal.__memory_base : ptr - v271 = hir.bitcast v270 : ptr; - v272 = hir.load v271 : i32; + ^block23: + v271 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/GOT.data.internal.__memory_base : ptr + v272 = hir.bitcast v271 : ptr; + v273 = hir.load v272 : i32; + hir.store_local v273 #[local = lv0]; hir.exec @miden:storage-example/foo@1.0.0/storage_example/__wasm_call_ctors() - v551 = arith.constant 1 : u8; - v553 = arith.constant 1048584 : i32; - v274 = arith.add v272, v553 : i32 #[overflow = wrapping]; - v278 = hir.bitcast v274 : u32; - v279 = hir.int_to_ptr v278 : ptr; - hir.store v279, v551; + v274 = hir.load_local : i32 #[local = lv0]; + v486 = arith.constant 1 : u8; + v491 = arith.constant 1048584 : i32; + v276 = arith.add v274, v491 : i32 #[overflow = wrapping]; + v280 = hir.bitcast v276 : u32; + v281 = hir.int_to_ptr v280 : ptr; + hir.store v281, v486; scf.yield ; }; builtin.ret ; }; - private builtin.function @::reverse(v280: i32, v281: i32) { - ^block22(v280: i32, v281: i32): - v284 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr - v285 = hir.bitcast v284 : ptr; - v286 = hir.load v285 : i32; - v287 = arith.constant 16 : i32; - v288 = arith.sub v286, v287 : i32 #[overflow = wrapping]; - v290 = arith.constant 8 : u32; - v289 = hir.bitcast v281 : u32; - v291 = arith.add v289, v290 : u32 #[overflow = checked]; - v640 = arith.constant 8 : u32; - v293 = arith.mod v291, v640 : u32; - hir.assertz v293 #[code = 250]; - v294 = hir.int_to_ptr v291 : ptr; - v295 = hir.load v294 : i64; - v639 = arith.constant 8 : u32; - v296 = hir.bitcast v288 : u32; - v298 = arith.add v296, v639 : u32 #[overflow = checked]; - v299 = arith.constant 4 : u32; - v300 = arith.mod v298, v299 : u32; - hir.assertz v300 #[code = 250]; - v301 = hir.int_to_ptr v298 : ptr; - hir.store v301, v295; - v302 = hir.bitcast v281 : u32; - v638 = arith.constant 8 : u32; - v304 = arith.mod v302, v638 : u32; + private builtin.function @>::from(v282: i32, v283: felt) { + ^block24(v282: i32, v283: felt): + hir.store_local v282 #[local = lv0]; + v290 = hir.load_local : i32 #[local = lv0]; + v498 = arith.constant 12 : u32; + v292 = hir.bitcast v290 : u32; + v294 = arith.add v292, v498 : u32 #[overflow = checked]; + v497 = arith.constant 4 : u32; + v296 = arith.mod v294, v497 : u32; + hir.assertz v296 #[code = 250]; + v297 = hir.int_to_ptr v294 : ptr; + hir.store v297, v283; + v298 = hir.load_local : i32 #[local = lv0]; + v496 = arith.constant 8 : u32; + v300 = hir.bitcast v298 : u32; + v302 = arith.add v300, v496 : u32 #[overflow = checked]; + v510 = arith.constant 4 : u32; + v304 = arith.mod v302, v510 : u32; hir.assertz v304 #[code = 250]; - v305 = hir.int_to_ptr v302 : ptr; - v306 = hir.load v305 : i64; - v307 = hir.bitcast v288 : u32; - v637 = arith.constant 4 : u32; - v309 = arith.mod v307, v637 : u32; - hir.assertz v309 #[code = 250]; - v310 = hir.int_to_ptr v307 : ptr; - hir.store v310, v306; - v311 = arith.constant 12 : i32; - v312 = arith.add v288, v311 : i32 #[overflow = wrapping]; - v282 = arith.constant 0 : i32; - v608, v609, v610, v611, v612, v613 = scf.while v282, v288, v312, v280 : i32, i32, i32, i32, i32, i32 { - ^block65(v614: i32, v615: i32, v616: i32, v617: i32): - v636 = arith.constant 0 : i32; - v315 = arith.constant 8 : i32; - v316 = arith.eq v614, v315 : i1; - v317 = arith.zext v316 : u32; - v318 = hir.bitcast v317 : i32; - v320 = arith.neq v318, v636 : i1; - v602, v603 = scf.if v320 : i32, i32 { - ^block64: - v562 = ub.poison i32 : i32; - scf.yield v562, v562; - } else { - ^block27: - v322 = arith.add v615, v614 : i32 #[overflow = wrapping]; - v323 = hir.bitcast v322 : u32; - v635 = arith.constant 4 : u32; - v325 = arith.mod v323, v635 : u32; - hir.assertz v325 #[code = 250]; - v326 = hir.int_to_ptr v323 : ptr; - v327 = hir.load v326 : felt; - v329 = hir.bitcast v616 : u32; - v634 = arith.constant 4 : u32; - v331 = arith.mod v329, v634 : u32; - hir.assertz v331 #[code = 250]; - v332 = hir.int_to_ptr v329 : ptr; - v333 = hir.load v332 : i32; - v334 = hir.bitcast v322 : u32; - v633 = arith.constant 4 : u32; - v336 = arith.mod v334, v633 : u32; - hir.assertz v336 #[code = 250]; - v337 = hir.int_to_ptr v334 : ptr; - hir.store v337, v333; - v338 = hir.bitcast v616 : u32; - v632 = arith.constant 4 : u32; - v340 = arith.mod v338, v632 : u32; - hir.assertz v340 #[code = 250]; - v341 = hir.int_to_ptr v338 : ptr; - hir.store v341, v327; - v344 = arith.constant -4 : i32; - v345 = arith.add v616, v344 : i32 #[overflow = wrapping]; - v342 = arith.constant 4 : i32; - v343 = arith.add v614, v342 : i32 #[overflow = wrapping]; - scf.yield v343, v345; - }; - v630 = ub.poison i32 : i32; - v605 = cf.select v320, v630, v617 : i32; - v631 = ub.poison i32 : i32; - v604 = cf.select v320, v631, v615 : i32; - v561 = arith.constant 1 : u32; - v554 = arith.constant 0 : u32; - v607 = cf.select v320, v554, v561 : u32; - v595 = arith.trunc v607 : i1; - scf.condition v595, v602, v604, v603, v605, v615, v617; - } do { - ^block66(v618: i32, v619: i32, v620: i32, v621: i32, v622: i32, v623: i32): - scf.yield v618, v619, v620, v621; - }; - v629 = arith.constant 8 : u32; - v347 = hir.bitcast v612 : u32; - v349 = arith.add v347, v629 : u32 #[overflow = checked]; - v628 = arith.constant 4 : u32; - v351 = arith.mod v349, v628 : u32; - hir.assertz v351 #[code = 250]; - v352 = hir.int_to_ptr v349 : ptr; - v353 = hir.load v352 : i64; - v627 = arith.constant 8 : u32; - v354 = hir.bitcast v613 : u32; - v356 = arith.add v354, v627 : u32 #[overflow = checked]; - v626 = arith.constant 8 : u32; - v358 = arith.mod v356, v626 : u32; - hir.assertz v358 #[code = 250]; - v359 = hir.int_to_ptr v356 : ptr; - hir.store v359, v353; - v360 = hir.bitcast v612 : u32; - v625 = arith.constant 4 : u32; - v362 = arith.mod v360, v625 : u32; - hir.assertz v362 #[code = 250]; - v363 = hir.int_to_ptr v360 : ptr; - v364 = hir.load v363 : i64; - v365 = hir.bitcast v613 : u32; - v624 = arith.constant 8 : u32; - v367 = arith.mod v365, v624 : u32; - hir.assertz v367 #[code = 250]; - v368 = hir.int_to_ptr v365 : ptr; - hir.store v368, v364; + v495 = arith.constant 0 : felt; + v305 = hir.int_to_ptr v302 : ptr; + hir.store v305, v495; + v306 = hir.load_local : i32 #[local = lv0]; + v509 = arith.constant 4 : u32; + v308 = hir.bitcast v306 : u32; + v310 = arith.add v308, v509 : u32 #[overflow = checked]; + v508 = arith.constant 4 : u32; + v312 = arith.mod v310, v508 : u32; + hir.assertz v312 #[code = 250]; + v507 = arith.constant 0 : felt; + v313 = hir.int_to_ptr v310 : ptr; + hir.store v313, v507; + v314 = hir.load_local : i32 #[local = lv0]; + v316 = hir.bitcast v314 : u32; + v506 = arith.constant 4 : u32; + v318 = arith.mod v316, v506 : u32; + hir.assertz v318 #[code = 250]; + v505 = arith.constant 0 : felt; + v319 = hir.int_to_ptr v316 : ptr; + hir.store v319, v505; builtin.ret ; }; - private builtin.function @>::from(v369: i32) -> felt { - ^block28(v369: i32): - v371 = arith.constant 255 : i32; - v372 = arith.band v369, v371 : i32; - v373 = hir.bitcast v372 : felt; - builtin.ret v373; - }; - - private builtin.function @>::from(v374: i32, v375: felt) { - ^block30(v374: i32, v375: felt): - v377 = arith.constant 0 : i32; - v378 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/intrinsics::felt::from_u32(v377) : felt - v646 = arith.constant 0 : i32; - v380 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/intrinsics::felt::from_u32(v646) : felt - v645 = arith.constant 0 : i32; - v382 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/intrinsics::felt::from_u32(v645) : felt - v384 = arith.constant 12 : u32; - v383 = hir.bitcast v374 : u32; - v385 = arith.add v383, v384 : u32 #[overflow = checked]; - v386 = arith.constant 4 : u32; - v387 = arith.mod v385, v386 : u32; - hir.assertz v387 #[code = 250]; - v388 = hir.int_to_ptr v385 : ptr; - hir.store v388, v375; - v390 = arith.constant 8 : u32; - v389 = hir.bitcast v374 : u32; - v391 = arith.add v389, v390 : u32 #[overflow = checked]; - v644 = arith.constant 4 : u32; - v393 = arith.mod v391, v644 : u32; - hir.assertz v393 #[code = 250]; - v394 = hir.int_to_ptr v391 : ptr; - hir.store v394, v382; - v643 = arith.constant 4 : u32; - v395 = hir.bitcast v374 : u32; - v397 = arith.add v395, v643 : u32 #[overflow = checked]; - v642 = arith.constant 4 : u32; - v399 = arith.mod v397, v642 : u32; - hir.assertz v399 #[code = 250]; - v400 = hir.int_to_ptr v397 : ptr; - hir.store v400, v380; - v401 = hir.bitcast v374 : u32; - v641 = arith.constant 4 : u32; - v403 = arith.mod v401, v641 : u32; - hir.assertz v403 #[code = 250]; - v404 = hir.int_to_ptr v401 : ptr; - hir.store v404, v378; - builtin.ret ; - }; - - private builtin.function @intrinsics::felt::eq(v405: felt, v406: felt) -> i32 { - ^block32(v405: felt, v406: felt): - v407 = arith.eq v405, v406 : i1; - v408 = hir.cast v407 : i32; - builtin.ret v408; - }; - - private builtin.function @intrinsics::felt::from_u32(v410: i32) -> felt { - ^block34(v410: i32): - v411 = hir.bitcast v410 : felt; - builtin.ret v411; - }; - - private builtin.function @miden::active_account::get_item(v413: felt, v414: i32) { - ^block36(v413: felt, v414: i32): - v415, v416, v417, v418 = hir.exec @miden/active_account/get_item(v413) : felt, felt, felt, felt - v419 = hir.bitcast v414 : u32; - v420 = hir.int_to_ptr v419 : ptr; - hir.store v420, v415; - v421 = arith.constant 4 : u32; - v422 = arith.add v419, v421 : u32 #[overflow = checked]; - v423 = hir.int_to_ptr v422 : ptr; - hir.store v423, v416; - v424 = arith.constant 8 : u32; - v425 = arith.add v419, v424 : u32 #[overflow = checked]; - v426 = hir.int_to_ptr v425 : ptr; - hir.store v426, v417; - v427 = arith.constant 12 : u32; - v428 = arith.add v419, v427 : u32 #[overflow = checked]; - v429 = hir.int_to_ptr v428 : ptr; - hir.store v429, v418; + private builtin.function @miden::protocol::active_account::get_item(v320: felt, v321: felt, v322: i32) { + ^block26(v320: felt, v321: felt, v322: i32): + v323, v324, v325, v326 = hir.exec @miden/protocol/active_account/get_item(v320, v321) : felt, felt, felt, felt + v327 = hir.bitcast v322 : u32; + v328 = hir.int_to_ptr v327 : ptr; + hir.store v328, v323; + v513 = arith.constant 4 : u32; + v330 = arith.add v327, v513 : u32 #[overflow = checked]; + v331 = hir.int_to_ptr v330 : ptr; + hir.store v331, v324; + v512 = arith.constant 8 : u32; + v333 = arith.add v327, v512 : u32 #[overflow = checked]; + v334 = hir.int_to_ptr v333 : ptr; + hir.store v334, v325; + v511 = arith.constant 12 : u32; + v336 = arith.add v327, v511 : u32 #[overflow = checked]; + v337 = hir.int_to_ptr v336 : ptr; + hir.store v337, v326; builtin.ret ; }; - private builtin.function @miden::active_account::get_map_item(v430: felt, v431: felt, v432: felt, v433: felt, v434: felt, v435: i32) { - ^block40(v430: felt, v431: felt, v432: felt, v433: felt, v434: felt, v435: i32): - v436, v437, v438, v439 = hir.exec @miden/active_account/get_map_item(v430, v431, v432, v433, v434) : felt, felt, felt, felt - v440 = hir.bitcast v435 : u32; - v441 = hir.int_to_ptr v440 : ptr; - hir.store v441, v436; - v442 = arith.constant 4 : u32; - v443 = arith.add v440, v442 : u32 #[overflow = checked]; - v444 = hir.int_to_ptr v443 : ptr; - hir.store v444, v437; - v445 = arith.constant 8 : u32; - v446 = arith.add v440, v445 : u32 #[overflow = checked]; - v447 = hir.int_to_ptr v446 : ptr; - hir.store v447, v438; - v448 = arith.constant 12 : u32; - v449 = arith.add v440, v448 : u32 #[overflow = checked]; - v450 = hir.int_to_ptr v449 : ptr; - hir.store v450, v439; + private builtin.function @miden::protocol::active_account::get_map_item(v338: felt, v339: felt, v340: felt, v341: felt, v342: felt, v343: felt, v344: i32) { + ^block31(v338: felt, v339: felt, v340: felt, v341: felt, v342: felt, v343: felt, v344: i32): + v345, v346, v347, v348 = hir.exec @miden/protocol/active_account/get_map_item(v338, v339, v340, v341, v342, v343) : felt, felt, felt, felt + v349 = hir.bitcast v344 : u32; + v350 = hir.int_to_ptr v349 : ptr; + hir.store v350, v345; + v516 = arith.constant 4 : u32; + v352 = arith.add v349, v516 : u32 #[overflow = checked]; + v353 = hir.int_to_ptr v352 : ptr; + hir.store v353, v346; + v515 = arith.constant 8 : u32; + v355 = arith.add v349, v515 : u32 #[overflow = checked]; + v356 = hir.int_to_ptr v355 : ptr; + hir.store v356, v347; + v514 = arith.constant 12 : u32; + v358 = arith.add v349, v514 : u32 #[overflow = checked]; + v359 = hir.int_to_ptr v358 : ptr; + hir.store v359, v348; builtin.ret ; }; - private builtin.function @miden::native_account::set_map_item(v451: felt, v452: felt, v453: felt, v454: felt, v455: felt, v456: felt, v457: felt, v458: felt, v459: felt, v460: i32) { - ^block42(v451: felt, v452: felt, v453: felt, v454: felt, v455: felt, v456: felt, v457: felt, v458: felt, v459: felt, v460: i32): - v461, v462, v463, v464, v465, v466, v467, v468 = hir.exec @miden/native_account/set_map_item(v451, v452, v453, v454, v455, v456, v457, v458, v459) : felt, felt, felt, felt, felt, felt, felt, felt - v469 = hir.bitcast v460 : u32; - v470 = hir.int_to_ptr v469 : ptr; - hir.store v470, v461; - v471 = arith.constant 4 : u32; - v472 = arith.add v469, v471 : u32 #[overflow = checked]; - v473 = hir.int_to_ptr v472 : ptr; - hir.store v473, v462; - v474 = arith.constant 8 : u32; - v475 = arith.add v469, v474 : u32 #[overflow = checked]; - v476 = hir.int_to_ptr v475 : ptr; - hir.store v476, v463; - v477 = arith.constant 12 : u32; - v478 = arith.add v469, v477 : u32 #[overflow = checked]; - v479 = hir.int_to_ptr v478 : ptr; - hir.store v479, v464; - v480 = arith.constant 16 : u32; - v481 = arith.add v469, v480 : u32 #[overflow = checked]; - v482 = hir.int_to_ptr v481 : ptr; - hir.store v482, v465; - v483 = arith.constant 20 : u32; - v484 = arith.add v469, v483 : u32 #[overflow = checked]; - v485 = hir.int_to_ptr v484 : ptr; - hir.store v485, v466; - v486 = arith.constant 24 : u32; - v487 = arith.add v469, v486 : u32 #[overflow = checked]; - v488 = hir.int_to_ptr v487 : ptr; - hir.store v488, v467; - v489 = arith.constant 28 : u32; - v490 = arith.add v469, v489 : u32 #[overflow = checked]; - v491 = hir.int_to_ptr v490 : ptr; - hir.store v491, v468; + private builtin.function @miden::protocol::native_account::set_map_item(v360: felt, v361: felt, v362: felt, v363: felt, v364: felt, v365: felt, v366: felt, v367: felt, v368: felt, v369: felt, v370: i32) { + ^block33(v360: felt, v361: felt, v362: felt, v363: felt, v364: felt, v365: felt, v366: felt, v367: felt, v368: felt, v369: felt, v370: i32): + v371, v372, v373, v374 = hir.exec @miden/protocol/native_account/set_map_item(v360, v361, v362, v363, v364, v365, v366, v367, v368, v369) : felt, felt, felt, felt + v375 = hir.bitcast v370 : u32; + v376 = hir.int_to_ptr v375 : ptr; + hir.store v376, v371; + v519 = arith.constant 4 : u32; + v378 = arith.add v375, v519 : u32 #[overflow = checked]; + v379 = hir.int_to_ptr v378 : ptr; + hir.store v379, v372; + v518 = arith.constant 8 : u32; + v381 = arith.add v375, v518 : u32 #[overflow = checked]; + v382 = hir.int_to_ptr v381 : ptr; + hir.store v382, v373; + v517 = arith.constant 12 : u32; + v384 = arith.add v375, v517 : u32 #[overflow = checked]; + v385 = hir.int_to_ptr v384 : ptr; + hir.store v385, v374; builtin.ret ; }; @@ -647,15 +504,15 @@ builtin.component miden:storage-example/foo@1.0.0 { builtin.segment @1048576 = 0x0000000100000001; }; - public builtin.function @set-asset-qty(v492: felt, v493: felt, v494: felt, v495: felt, v496: felt, v497: felt, v498: felt, v499: felt, v500: felt) { - ^block45(v492: felt, v493: felt, v494: felt, v495: felt, v496: felt, v497: felt, v498: felt, v499: felt, v500: felt): - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden:storage-example/foo@1.0.0#set-asset-qty(v492, v493, v494, v495, v496, v497, v498, v499, v500) + public builtin.function @set-asset-qty(v386: felt, v387: felt, v388: felt, v389: felt, v390: felt, v391: felt, v392: felt, v393: felt, v394: felt) { + ^block36(v386: felt, v387: felt, v388: felt, v389: felt, v390: felt, v391: felt, v392: felt, v393: felt, v394: felt): + hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden:storage-example/foo@1.0.0#set-asset-qty(v386, v387, v388, v389, v390, v391, v392, v393, v394) builtin.ret ; }; - public builtin.function @get-asset-qty(v501: felt, v502: felt, v503: felt, v504: felt) -> felt { - ^block47(v501: felt, v502: felt, v503: felt, v504: felt): - v505 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden:storage-example/foo@1.0.0#get-asset-qty(v501, v502, v503, v504) : felt - builtin.ret v505; + public builtin.function @get-asset-qty(v395: felt, v396: felt, v397: felt, v398: felt) -> felt { + ^block38(v395: felt, v396: felt, v397: felt, v398: felt): + v399 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden:storage-example/foo@1.0.0#get-asset-qty(v395, v396, v397, v398) : felt + builtin.ret v399; }; }; \ No newline at end of file diff --git a/tests/integration/expected/examples/storage_example.masm b/tests/integration/expected/examples/storage_example.masm index 168718bbe..db7d3b9a2 100644 --- a/tests/integration/expected/examples/storage_example.masm +++ b/tests/integration/expected/examples/storage_example.masm @@ -1,25 +1,25 @@ -# mod miden:storage-example/foo@1.0.0 +# mod ::"miden:storage-example/foo@1.0.0" @callconv("canon-lift") pub proc set-asset-qty(felt, felt, felt, felt, felt, felt, felt, felt, felt) - exec.::miden:storage-example/foo@1.0.0::init + exec."miden:storage-example/foo@1.0.0"::init trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::miden:storage-example/foo@1.0.0#set-asset-qty + exec.::"miden:storage-example/foo@1.0.0"::storage_example::"miden:storage-example/foo@1.0.0#set-asset-qty" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end @callconv("canon-lift") pub proc get-asset-qty(felt, felt, felt, felt) -> felt - exec.::miden:storage-example/foo@1.0.0::init + exec."miden:storage-example/foo@1.0.0"::init trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::miden:storage-example/foo@1.0.0#get-asset-qty + exec.::"miden:storage-example/foo@1.0.0"::storage_example::"miden:storage-example/foo@1.0.0#get-asset-qty" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -32,7 +32,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -43,7 +43,7 @@ proc init mem_store.278537 end -# mod miden:storage-example/foo@1.0.0::storage_example +# mod ::"miden:storage-example/foo@1.0.0"::storage_example @callconv("C") proc __wasm_call_ctors( @@ -59,184 +59,177 @@ proc storage_example::bindings::__link_custom_section_describing_imports( nop end +@locals("4") @callconv("C") -proc miden:storage-example/foo@1.0.0#get-asset-qty( - felt, - felt, - felt, - felt -) -> felt - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.48 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 +proc ::default( + i32 +) + locaddr.0 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::store_sw trace.252 nop - trace.240 - nop - exec.::miden:storage-example/foo@1.0.0::storage_example::wit_bindgen::rt::run_ctors_once - trace.252 - nop - push.1 - trace.240 - nop - exec.::miden:storage-example/foo@1.0.0::storage_example::>::from - trace.252 - nop - push.16 - dup.2 - u32wrapping_add - movup.3 - swap.4 - movdn.3 - swap.5 - swap.2 - swap.6 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::miden::active_account::get_map_item + exec.::intrinsics::mem::load_sw trace.252 nop - push.24 - dup.1 + push.12 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod u32assert assertz + push.2705436683 + push.2816830832 + mul.4294967296 + add + swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 swap.1 - push.40 - dup.3 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod u32assert assertz + push.1137586469 + push.2787363247 + mul.4294967296 + add + swap.1 u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.16 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + push.4 swap.1 - push.32 - dup.3 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod u32assert assertz + push.4086120773 + push.4146463167 + mul.4294967296 + add + swap.1 u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.32 - dup.1 - u32wrapping_add - dup.1 + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::::reverse + exec.::intrinsics::mem::load_sw trace.252 nop - push.12 - dup.1 - add - u32assert push.4 dup.1 swap.1 u32mod u32assert assertz - u32divmod.4 + push.363850956 + push.708271317 + mul.4294967296 + add swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.48 - movup.2 - u32wrapping_add - push.1114144 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::store_felt trace.252 nop end +@locals("5") @callconv("C") -proc miden:storage-example/foo@1.0.0#set-asset-qty( - felt, - felt, - felt, - felt, - felt, +proc miden:storage-example/foo@1.0.0#get-asset-qty( felt, felt, felt, felt -) +) -> felt + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -245,11 +238,18 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( exec.::intrinsics::mem::load_sw trace.252 nop - push.128 + push.32 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.4 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -259,45 +259,35 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( nop trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::wit_bindgen::rt::run_ctors_once + exec.::"miden:storage-example/foo@1.0.0"::storage_example::wit_bindgen::rt::run_ctors_once trace.252 nop + locaddr.4 push.0 + swap.1 trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::>::from + exec.::intrinsics::mem::load_sw trace.252 nop - dup.1 - swap.1 trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::miden::active_account::get_item + exec.::"miden:storage-example/foo@1.0.0"::storage_example::::default trace.252 nop - push.8 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.4 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + push.12 swap.1 - push.56 - dup.3 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -305,33 +295,24 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop - dup.0 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.4 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + push.8 swap.1 - push.48 - dup.3 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -339,184 +320,548 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop - push.48 - dup.1 - u32wrapping_add - push.112 - dup.2 - u32wrapping_add + locaddr.3 + push.0 + swap.1 trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::::reverse + exec.::intrinsics::mem::load_felt trace.252 nop - push.116 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_felt trace.252 nop - push.120 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_felt trace.252 nop - push.124 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_felt trace.252 nop - push.112 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.4 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::load_sw trace.252 nop - movup.5 + push.16 + u32wrapping_add + movup.2 + swap.4 + movdn.2 + swap.1 + swap.5 + swap.1 + swap.6 trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::intrinsics::felt::eq + exec.::"miden:storage-example/foo@1.0.0"::storage_example::"miden::protocol::active_account::get_map_item" trace.252 nop + locaddr.4 push.0 - push.1 - movup.2 - neq + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop +end + +@locals("13") +@callconv("C") +proc miden:storage-example/foo@1.0.0#set-asset-qty( + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt +) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.7 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.48 + u32wrapping_sub + dup.0 + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:storage-example/foo@1.0.0"::storage_example::wit_bindgen::rt::run_ctors_once + trace.252 + nop + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:storage-example/foo@1.0.0"::storage_example::::default + trace.252 + nop + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_add + swap.2 + trace.240 + nop + exec.::"miden:storage-example/foo@1.0.0"::storage_example::"miden::protocol::active_account::get_item" + trace.252 + nop + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.40 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.10 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.36 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.11 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.12 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.44 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.1 + movup.3 + movup.3 + eq + neq neq if.true - drop - drop - drop - movdn.8 - dropw - dropw + nop else - movup.2 - movup.4 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::intrinsics::felt::eq + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.10 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt trace.252 nop push.0 push.1 - movup.2 + movup.3 + movup.3 + eq neq neq if.true - drop - drop - movdn.7 - dropw - drop - drop - drop + nop else - swap.3 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.11 + push.0 + swap.1 trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::intrinsics::felt::eq + exec.::intrinsics::mem::load_felt trace.252 nop push.0 push.1 - movup.2 + movup.3 + movup.3 + eq neq neq if.true - movdn.7 - dropw - drop - drop - drop + nop else - swap.2 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.12 + push.0 + swap.1 trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::intrinsics::felt::eq + exec.::intrinsics::mem::load_felt trace.252 nop push.0 push.1 - movup.2 + movup.3 + movup.3 + eq neq neq if.true - movdn.5 - dropw - drop + nop else - push.32 - dup.1 - u32wrapping_add - movup.6 + locaddr.9 + push.0 swap.1 trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::>::from - trace.252 - nop - push.1 - trace.240 - nop - exec.::miden:storage-example/foo@1.0.0::storage_example::>::from + exec.::intrinsics::mem::load_sw trace.252 nop - push.44 - dup.2 + push.12 + swap.1 add u32assert push.4 @@ -532,42 +877,24 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( exec.::intrinsics::mem::load_felt trace.252 nop - push.40 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::store_felt trace.252 nop - push.36 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.9 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::load_sw trace.252 nop - push.32 - dup.5 + push.8 + swap.1 add u32assert push.4 @@ -583,121 +910,99 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( exec.::intrinsics::mem::load_felt trace.252 nop - push.48 - dup.6 - u32wrapping_add - swap.1 - swap.8 - swap.3 - swap.6 - swap.10 + locaddr.1 + push.0 swap.1 - swap.9 - swap.2 - swap.7 - swap.4 - swap.5 trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::miden::native_account::set_map_item + exec.::intrinsics::mem::store_felt trace.252 nop - push.56 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.9 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.8 + push.0 swap.1 - push.88 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.16 movup.2 - movdn.3 + u32wrapping_add trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::"miden:storage-example/foo@1.0.0"::storage_example::>::from trace.252 nop - push.48 - dup.1 - add - u32assert - push.8 - dup.1 + locaddr.0 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.7 + push.0 swap.1 - push.80 - dup.3 - add - u32assert - push.8 - dup.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.6 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.5 + push.0 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop - push.72 - dup.1 - u32wrapping_add - push.8 - dup.1 + locaddr.4 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.9 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + push.28 swap.1 - push.104 - dup.3 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -705,18 +1010,24 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop - push.64 - dup.1 + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.24 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -726,15 +1037,22 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop + push.20 swap.1 - push.96 - dup.3 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -742,433 +1060,203 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop - push.80 - dup.1 - u32wrapping_add - dup.1 + locaddr.9 + push.0 + swap.1 trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::::reverse + exec.::intrinsics::mem::load_sw trace.252 nop - push.96 + push.16 + swap.1 + add + u32assert + push.4 dup.1 - u32wrapping_add - push.112 - dup.2 - u32wrapping_add + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::::reverse + exec.::intrinsics::mem::load_felt trace.252 nop - end - end - end - end - push.128 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc wit_bindgen::rt::run_ctors_once( - -) - push.1114148 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.1048584 - u32wrapping_add - u32divmod.4 - swap.1 - swap.1 - dup.1 - mem_load - swap.1 - push.8 - u32wrapping_mul - u32shr - swap.1 - drop - push.255 - u32and - push.0 - swap.1 - neq - if.true - nop - else - push.1114148 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - trace.240 - nop - exec.::miden:storage-example/foo@1.0.0::storage_example::__wasm_call_ctors - trace.252 - nop - push.1 - push.1048584 - movup.2 - u32wrapping_add - u32divmod.4 - swap.1 - dup.0 - mem_load - dup.2 - push.8 - u32wrapping_mul - push.255 - swap.1 - u32shl - u32not - swap.1 - u32and - movup.3 - movup.3 - push.8 - u32wrapping_mul - u32shl - u32or - swap.1 - mem_store - end -end - -@callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_add + movup.4 + swap.6 + movdn.4 + movup.3 + swap.7 + movdn.3 + movup.2 + swap.8 + movdn.2 + swap.1 + swap.9 + swap.1 + swap.10 + trace.240 + nop + exec.::"miden:storage-example/foo@1.0.0"::storage_example::"miden::protocol::native_account::set_map_item" + trace.252 + nop + end + end end end - drop - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.9 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop - swap.1 - push.8 - dup.4 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.48 + u32wrapping_add + push.1114144 u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz +end + +@locals("1") +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 swap.1 - movup.2 - push.8 dup.1 + mem_load swap.1 - u32mod - u32assert - assertz - u32divmod.4 + push.8 + u32wrapping_mul + u32shr swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop -end - -@callconv("C") -proc >::from( - i32 -) -> felt + drop push.255 u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:storage-example/foo@1.0.0"::storage_example::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end end +@locals("5") @callconv("C") -proc >::from( +proc >::from( i32, felt ) + locaddr.0 push.0 + swap.1 trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::intrinsics::felt::from_u32 - trace.252 - nop - push.0 - trace.240 - nop - exec.::miden:storage-example/foo@1.0.0::storage_example::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 push.0 + swap.1 trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop push.12 - dup.4 + swap.1 add u32assert push.4 @@ -1177,8 +1265,6 @@ proc i32 - eq -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc miden::active_account::get_item(felt, i32) +proc miden::protocol::active_account::get_item(felt, felt, i32) trace.240 nop - exec.::miden::active_account::get_item + exec.::miden::protocol::active_account::get_item trace.252 nop movup.4 @@ -1303,10 +1408,18 @@ proc miden::active_account::get_item(felt, i32) end @callconv("C") -proc miden::active_account::get_map_item(felt, felt, felt, felt, felt, i32) +proc miden::protocol::active_account::get_map_item( + felt, + felt, + felt, + felt, + felt, + felt, + i32 +) trace.240 nop - exec.::miden::active_account::get_map_item + exec.::miden::protocol::active_account::get_map_item trace.252 nop movup.4 @@ -1359,7 +1472,8 @@ proc miden::active_account::get_map_item(felt, felt, felt, felt, felt, i32) end @callconv("C") -proc miden::native_account::set_map_item( +proc miden::protocol::native_account::set_map_item( + felt, felt, felt, felt, @@ -1373,10 +1487,10 @@ proc miden::native_account::set_map_item( ) trace.240 nop - exec.::miden::native_account::set_map_item + exec.::miden::protocol::native_account::set_map_item trace.252 nop - movup.8 + movup.4 dup.0 movup.2 swap.1 @@ -1414,58 +1528,6 @@ proc miden::native_account::set_map_item( trace.252 nop push.12 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.16 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.20 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.24 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.28 add u32assert u32divmod.4 diff --git a/tests/integration/expected/examples/storage_example.wat b/tests/integration/expected/examples/storage_example.wat index b96f99c7a..1d221f742 100644 --- a/tests/integration/expected/examples/storage_example.wat +++ b/tests/integration/expected/examples/storage_example.wat @@ -13,15 +13,16 @@ (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) (core module $main (;0;) (type (;0;) (func)) - (type (;1;) (func (param f32 f32 f32 f32) (result f32))) - (type (;2;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32))) - (type (;3;) (func (param i32 i32))) - (type (;4;) (func (param i32) (result f32))) - (type (;5;) (func (param i32 f32))) - (type (;6;) (func (param f32 f32) (result i32))) - (type (;7;) (func (param f32 i32))) - (type (;8;) (func (param f32 f32 f32 f32 f32 i32))) - (type (;9;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32 i32))) + (type (;1;) (func (param i32))) + (type (;2;) (func (param f32 f32 f32 f32) (result f32))) + (type (;3;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32))) + (type (;4;) (func (param i32 f32))) + (type (;5;) (func (param f32 f32) (result i32))) + (type (;6;) (func (param i32) (result f32))) + (type (;7;) (func (param i64) (result f32))) + (type (;8;) (func (param f32 f32 i32))) + (type (;9;) (func (param f32 f32 f32 f32 f32 f32 i32))) + (type (;10;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -32,16 +33,45 @@ (elem (;0;) (i32.const 1) func $storage_example::bindings::__link_custom_section_describing_imports) (func $__wasm_call_ctors (;0;) (type 0)) (func $storage_example::bindings::__link_custom_section_describing_imports (;1;) (type 0)) - (func $miden:storage-example/foo@1.0.0#get-asset-qty (;2;) (type 1) (param f32 f32 f32 f32) (result f32) + (func $::default (;2;) (type 1) (param i32) + (local f32 f32 f32) + i64.const 3042002143573699788 + call $intrinsics::felt::from_u64_unchecked + local.set 1 + i64.const -637820373289844411 + call $intrinsics::felt::from_u64_unchecked + local.set 2 + i64.const -6475110084634595035 + call $intrinsics::felt::from_u64_unchecked + local.set 3 + local.get 0 + i64.const -6348547769199644661 + call $intrinsics::felt::from_u64_unchecked + f32.store offset=12 + local.get 0 + local.get 3 + f32.store offset=8 + local.get 0 + local.get 2 + f32.store offset=4 + local.get 0 + local.get 1 + f32.store + ) + (func $miden:storage-example/foo@1.0.0#get-asset-qty (;3;) (type 2) (param f32 f32 f32 f32) (result f32) (local i32) global.get $__stack_pointer - i32.const 48 + i32.const 32 i32.sub local.tee 4 global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once - i32.const 1 - call $>::from + local.get 4 + call $::default + local.get 4 + f32.load offset=12 + local.get 4 + f32.load offset=8 local.get 3 local.get 2 local.get 1 @@ -49,69 +79,47 @@ local.get 4 i32.const 16 i32.add - call $miden::active_account::get_map_item - local.get 4 + call $miden::protocol::active_account::get_map_item local.get 4 - i64.load offset=24 - i64.store offset=40 - local.get 4 - local.get 4 - i64.load offset=16 - i64.store offset=32 - local.get 4 - local.get 4 - i32.const 32 - i32.add - call $::reverse - local.get 4 - f32.load offset=12 + f32.load offset=16 local.set 0 local.get 4 - i32.const 48 + i32.const 32 i32.add global.set $__stack_pointer local.get 0 ) - (func $miden:storage-example/foo@1.0.0#set-asset-qty (;3;) (type 2) (param f32 f32 f32 f32 f32 f32 f32 f32 f32) + (func $miden:storage-example/foo@1.0.0#set-asset-qty (;4;) (type 3) (param f32 f32 f32 f32 f32 f32 f32 f32 f32) (local i32 f32 f32 f32) global.get $__stack_pointer - i32.const 128 + i32.const 48 i32.sub local.tee 9 global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once - i32.const 0 - call $>::from - local.get 9 - call $miden::active_account::get_item - local.get 9 local.get 9 - i64.load offset=8 - i64.store offset=56 + call $::default local.get 9 + f32.load offset=4 local.get 9 - i64.load - i64.store offset=48 + f32.load local.get 9 - i32.const 112 - i32.add - local.get 9 - i32.const 48 + i32.const 32 i32.add - call $::reverse + call $miden::protocol::active_account::get_item local.get 9 - f32.load offset=116 + f32.load offset=40 local.set 10 local.get 9 - f32.load offset=120 + f32.load offset=36 local.set 11 local.get 9 - f32.load offset=124 + f32.load offset=32 local.set 12 block ;; label = @1 local.get 0 local.get 9 - f32.load offset=112 + f32.load offset=44 call $intrinsics::felt::eq i32.const 1 i32.ne @@ -135,65 +143,41 @@ i32.ne br_if 0 (;@1;) local.get 9 - i32.const 32 + f32.load offset=12 + local.set 0 + local.get 9 + f32.load offset=8 + local.set 1 + local.get 9 + i32.const 16 i32.add local.get 8 - call $>::from - i32.const 1 - call $>::from + call $>::from + local.get 0 + local.get 1 local.get 7 local.get 6 local.get 5 local.get 4 local.get 9 - f32.load offset=44 - local.get 9 - f32.load offset=40 - local.get 9 - f32.load offset=36 - local.get 9 - f32.load offset=32 - local.get 9 - i32.const 48 - i32.add - call $miden::native_account::set_map_item - local.get 9 - local.get 9 - i64.load offset=56 - i64.store offset=88 + f32.load offset=28 local.get 9 + f32.load offset=24 local.get 9 - i64.load offset=48 - i64.store offset=80 + f32.load offset=20 local.get 9 + f32.load offset=16 local.get 9 - i32.const 72 - i32.add - i64.load - i64.store offset=104 - local.get 9 - local.get 9 - i64.load offset=64 - i64.store offset=96 - local.get 9 - local.get 9 - i32.const 80 - i32.add - call $::reverse - local.get 9 - i32.const 112 - i32.add - local.get 9 - i32.const 96 + i32.const 32 i32.add - call $::reverse + call $miden::protocol::native_account::set_map_item end local.get 9 - i32.const 128 + i32.const 48 i32.add global.set $__stack_pointer ) - (func $wit_bindgen::rt::run_ctors_once (;4;) (type 0) + (func $wit_bindgen::rt::run_ctors_once (;5;) (type 0) (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base @@ -211,71 +195,7 @@ i32.store8 end ) - (func $::reverse (;5;) (type 3) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store - ) - (func $>::from (;6;) (type 4) (param i32) (result f32) - local.get 0 - i32.const 255 - i32.and - f32.reinterpret_i32 - ) - (func $>::from (;7;) (type 5) (param i32 f32) + (func $>::from (;6;) (type 4) (param i32 f32) (local f32 f32 f32) i32.const 0 call $intrinsics::felt::from_u32 @@ -299,23 +219,26 @@ local.get 2 f32.store ) - (func $intrinsics::felt::eq (;8;) (type 6) (param f32 f32) (result i32) + (func $intrinsics::felt::eq (;7;) (type 5) (param f32 f32) (result i32) + unreachable + ) + (func $intrinsics::felt::from_u32 (;8;) (type 6) (param i32) (result f32) unreachable ) - (func $intrinsics::felt::from_u32 (;9;) (type 4) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;9;) (type 7) (param i64) (result f32) unreachable ) - (func $miden::active_account::get_item (;10;) (type 7) (param f32 i32) + (func $miden::protocol::active_account::get_item (;10;) (type 8) (param f32 f32 i32) unreachable ) - (func $miden::active_account::get_map_item (;11;) (type 8) (param f32 f32 f32 f32 f32 i32) + (func $miden::protocol::active_account::get_map_item (;11;) (type 9) (param f32 f32 f32 f32 f32 f32 i32) unreachable ) - (func $miden::native_account::set_map_item (;12;) (type 9) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 i32) + (func $miden::protocol::native_account::set_map_item (;12;) (type 10) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "\1fstorage-example_A simple example of a Miden account storage API\0b0.1.0\03\01\05\00\00\00!owner_public_key\01\15test value9auth::rpo_falcon512::pub_key\01\01\00\1basset_qty_map\01\11test map\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "\1fstorage-example_A simple example of a Miden account storage API\0b0.1.0\03\01\02\006miden::component::miden_storage_example::asset_qty_map\01\01%asset quantity map\00\00\09word\00\00\09word\009miden::component::miden_storage_example::owner_public_key\00\01!owner public key\00\09word\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) (alias export $miden:base/core-types@1.0.0 "word" (type $word (;2;))) diff --git a/tests/integration/expected/felt_intrinsics.hir b/tests/integration/expected/felt_intrinsics.hir index 1e5c33c21..84ad7c495 100644 --- a/tests/integration/expected/felt_intrinsics.hir +++ b/tests/integration/expected/felt_intrinsics.hir @@ -2,65 +2,79 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @felt_intrinsics { private builtin.function @__rustc::__rust_alloc(v0: i32, v1: i32) -> i32 { ^block4(v0: i32, v1: i32): - v3 = arith.constant 1048580 : i32; - v4 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/::alloc(v3, v1, v0) : i32 - builtin.ret v4; + v224 = arith.constant 1048580 : i32; + v6 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/::alloc(v224, v1, v0) : i32 + builtin.ret v6; }; - private builtin.function @__rustc::__rust_realloc(v5: i32, v6: i32, v7: i32, v8: i32) -> i32 { - ^block6(v5: i32, v6: i32, v7: i32, v8: i32): - v10 = arith.constant 1048580 : i32; - v11 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/::alloc(v10, v7, v8) : i32 - v197 = arith.constant 0 : i32; - v12 = arith.constant 0 : i32; - v13 = arith.eq v11, v12 : i1; - v14 = arith.zext v13 : u32; - v15 = hir.bitcast v14 : i32; - v17 = arith.neq v15, v197 : i1; - scf.if v17{ - ^block8: + private builtin.function @__rustc::__rust_realloc(v7: i32, v8: i32, v9: i32, v10: i32) -> i32 { + ^block6(v7: i32, v8: i32, v9: i32, v10: i32): + hir.store_local v7 #[local = lv0]; + hir.store_local v8 #[local = lv1]; + hir.store_local v9 #[local = lv2]; + hir.store_local v10 #[local = lv3]; + v13 = hir.load_local : i32 #[local = lv2]; + v14 = hir.load_local : i32 #[local = lv3]; + v226 = arith.constant 1048580 : i32; + v15 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/::alloc(v226, v13, v14) : i32 + hir.store_local v15 #[local = lv2]; + v236 = arith.constant 0 : i32; + v230 = arith.constant 0 : i32; + v17 = arith.eq v15, v230 : i1; + v18 = arith.zext v17 : u32; + v19 = hir.bitcast v18 : i32; + v21 = arith.neq v19, v236 : i1; + scf.if v21{ + ^block45: scf.yield ; } else { ^block9: - v196 = arith.constant 0 : i32; - v19 = hir.bitcast v6 : u32; - v18 = hir.bitcast v8 : u32; - v20 = arith.lt v18, v19 : i1; - v21 = arith.zext v20 : u32; - v22 = hir.bitcast v21 : i32; - v24 = arith.neq v22, v196 : i1; - v25 = cf.select v24, v8, v6 : i32; - v194 = arith.constant 0 : i32; - v195 = arith.constant 0 : i32; - v27 = arith.eq v25, v195 : i1; - v28 = arith.zext v27 : u32; - v29 = hir.bitcast v28 : i32; - v31 = arith.neq v29, v194 : i1; - scf.if v31{ - ^block52: + v22 = hir.load_local : i32 #[local = lv3]; + v23 = hir.load_local : i32 #[local = lv1]; + v235 = arith.constant 0 : i32; + v27 = hir.bitcast v23 : u32; + v26 = hir.bitcast v22 : u32; + v28 = arith.lt v26, v27 : i1; + v29 = arith.zext v28 : u32; + v30 = hir.bitcast v29 : i32; + v32 = arith.neq v30, v235 : i1; + v33 = cf.select v32, v22, v23 : i32; + hir.store_local v33 #[local = lv3]; + v233 = arith.constant 0 : i32; + v234 = arith.constant 0 : i32; + v35 = arith.eq v33, v234 : i1; + v36 = arith.zext v35 : u32; + v37 = hir.bitcast v36 : i32; + v39 = arith.neq v37, v233 : i1; + scf.if v39{ + ^block44: scf.yield ; } else { ^block10: - v32 = hir.bitcast v25 : u32; - v33 = hir.bitcast v11 : u32; - v34 = hir.int_to_ptr v33 : ptr; - v35 = hir.bitcast v5 : u32; - v36 = hir.int_to_ptr v35 : ptr; - hir.mem_cpy v36, v34, v32; + v40 = hir.load_local : i32 #[local = lv2]; + v41 = hir.load_local : i32 #[local = lv0]; + v42 = hir.load_local : i32 #[local = lv3]; + v43 = hir.bitcast v42 : u32; + v44 = hir.bitcast v40 : u32; + v45 = hir.int_to_ptr v44 : ptr; + v46 = hir.bitcast v41 : u32; + v47 = hir.int_to_ptr v46 : ptr; + hir.mem_cpy v47, v45, v43; scf.yield ; }; scf.yield ; }; - builtin.ret v11; + v48 = hir.load_local : i32 #[local = lv2]; + builtin.ret v48; }; - public builtin.function @entrypoint(v38: felt, v39: felt) -> felt { - ^block11(v38: felt, v39: felt): - v41 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/intrinsics::felt::mul(v38, v39) : felt - v42 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/intrinsics::felt::sub(v41, v38) : felt - v43 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/intrinsics::felt::add(v42, v39) : felt - v44 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/intrinsics::felt::div(v38, v43) : felt - builtin.ret v44; + public builtin.function @entrypoint(v49: felt, v50: felt) -> felt { + ^block11(v49: felt, v50: felt): + v55 = arith.mul v49, v50 : felt #[overflow = unchecked]; + v57 = arith.sub v55, v49 : felt #[overflow = unchecked]; + v59 = arith.add v57, v50 : felt #[overflow = unchecked]; + v60 = arith.div v49, v59 : felt; + builtin.ret v60; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { @@ -68,245 +82,261 @@ builtin.component root_ns:root@1.0.0 { builtin.ret ; }; - private builtin.function @::alloc(v45: i32, v46: i32, v47: i32) -> i32 { - ^block15(v45: i32, v46: i32, v47: i32): - v50 = arith.constant 16 : i32; - v49 = arith.constant 0 : i32; - v199 = arith.constant 16 : u32; - v52 = hir.bitcast v46 : u32; - v54 = arith.gt v52, v199 : i1; - v55 = arith.zext v54 : u32; - v56 = hir.bitcast v55 : i32; - v58 = arith.neq v56, v49 : i1; - v59 = cf.select v58, v46, v50 : i32; - v239 = arith.constant 0 : i32; - v60 = arith.constant -1 : i32; - v61 = arith.add v59, v60 : i32 #[overflow = wrapping]; - v62 = arith.band v59, v61 : i32; - v64 = arith.neq v62, v239 : i1; - v208, v209 = scf.if v64 : i32, u32 { - ^block57: - v200 = arith.constant 0 : u32; - v204 = ub.poison i32 : i32; - scf.yield v204, v200; + private builtin.function @::alloc(v61: i32, v62: i32, v63: i32) -> i32 { + ^block15(v61: i32, v62: i32, v63: i32): + hir.store_local v61 #[local = lv0]; + hir.store_local v62 #[local = lv1]; + hir.store_local v63 #[local = lv2]; + v65 = hir.load_local : i32 #[local = lv1]; + v244 = arith.constant 16 : i32; + v243 = arith.constant 0 : i32; + v239 = arith.constant 16 : u32; + v69 = hir.bitcast v65 : u32; + v71 = arith.gt v69, v239 : i1; + v72 = arith.zext v71 : u32; + v73 = hir.bitcast v72 : i32; + v75 = arith.neq v73, v243 : i1; + v76 = cf.select v75, v65, v244 : i32; + hir.store_local v76 #[local = lv3]; + v77 = hir.load_local : i32 #[local = lv3]; + v287 = arith.constant 0 : i32; + v242 = arith.constant -1 : i32; + v79 = arith.add v77, v242 : i32 #[overflow = wrapping]; + v80 = arith.band v76, v79 : i32; + v82 = arith.neq v80, v287 : i1; + v265, v266 = scf.if v82 : i32, u32 { + ^block51: + v257 = arith.constant 0 : u32; + v261 = ub.poison i32 : i32; + scf.yield v261, v257; } else { ^block18: - v66 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/::max(v46, v59) : i32 - v238 = arith.constant 0 : i32; - v65 = arith.constant -2147483648 : i32; - v67 = arith.sub v65, v66 : i32 #[overflow = wrapping]; - v69 = hir.bitcast v67 : u32; - v68 = hir.bitcast v47 : u32; - v70 = arith.gt v68, v69 : i1; - v71 = arith.zext v70 : u32; - v72 = hir.bitcast v71 : i32; - v74 = arith.neq v72, v238 : i1; - v223 = scf.if v74 : i32 { - ^block56: - v237 = ub.poison i32 : i32; - scf.yield v237; + v83 = hir.load_local : i32 #[local = lv2]; + v85 = hir.load_local : i32 #[local = lv1]; + v86 = hir.load_local : i32 #[local = lv3]; + v87 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/::max(v85, v86) : i32 + hir.store_local v87 #[local = lv1]; + v286 = arith.constant 0 : i32; + v241 = arith.constant -2147483648 : i32; + v88 = arith.sub v241, v87 : i32 #[overflow = wrapping]; + v90 = hir.bitcast v88 : u32; + v89 = hir.bitcast v83 : u32; + v91 = arith.gt v89, v90 : i1; + v92 = arith.zext v91 : u32; + v93 = hir.bitcast v92 : i32; + v95 = arith.neq v93, v286 : i1; + v271 = scf.if v95 : i32 { + ^block50: + v285 = ub.poison i32 : i32; + scf.yield v285; } else { ^block19: - v235 = arith.constant 0 : i32; - v80 = arith.sub v235, v66 : i32 #[overflow = wrapping]; - v236 = arith.constant -1 : i32; - v76 = arith.add v47, v66 : i32 #[overflow = wrapping]; - v78 = arith.add v76, v236 : i32 #[overflow = wrapping]; - v81 = arith.band v78, v80 : i32; - v82 = hir.bitcast v45 : u32; - v83 = arith.constant 4 : u32; - v84 = arith.mod v82, v83 : u32; - hir.assertz v84 #[code = 250]; - v85 = hir.int_to_ptr v82 : ptr; - v86 = hir.load v85 : i32; - v234 = arith.constant 0 : i32; - v88 = arith.neq v86, v234 : i1; - scf.if v88{ - ^block55: + v284 = arith.constant 0 : i32; + hir.store_local v284 #[local = lv3]; + v97 = hir.load_local : i32 #[local = lv2]; + v98 = hir.load_local : i32 #[local = lv1]; + v282 = arith.constant 0 : i32; + v104 = arith.sub v282, v98 : i32 #[overflow = wrapping]; + v283 = arith.constant -1 : i32; + v99 = arith.add v97, v98 : i32 #[overflow = wrapping]; + v101 = arith.add v99, v283 : i32 #[overflow = wrapping]; + v105 = arith.band v101, v104 : i32; + hir.store_local v105 #[local = lv2]; + v106 = hir.load_local : i32 #[local = lv0]; + v107 = hir.bitcast v106 : u32; + v240 = arith.constant 4 : u32; + v109 = arith.mod v107, v240 : u32; + hir.assertz v109 #[code = 250]; + v110 = hir.int_to_ptr v107 : ptr; + v111 = hir.load v110 : i32; + v281 = arith.constant 0 : i32; + v113 = arith.neq v111, v281 : i1; + scf.if v113{ + ^block49: scf.yield ; } else { ^block21: - v89 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/intrinsics::mem::heap_base() : i32 - v90 = hir.mem_size : u32; - v96 = hir.bitcast v45 : u32; - v233 = arith.constant 4 : u32; - v98 = arith.mod v96, v233 : u32; - hir.assertz v98 #[code = 250]; - v232 = arith.constant 16 : u32; - v91 = hir.bitcast v90 : i32; - v94 = arith.shl v91, v232 : i32; - v95 = arith.add v89, v94 : i32 #[overflow = wrapping]; - v99 = hir.int_to_ptr v96 : ptr; - hir.store v99, v95; + v114 = hir.load_local : i32 #[local = lv0]; + v115 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/intrinsics::mem::heap_base() : i32 + v116 = hir.mem_size : u32; + v122 = hir.bitcast v114 : u32; + v280 = arith.constant 4 : u32; + v124 = arith.mod v122, v280 : u32; + hir.assertz v124 #[code = 250]; + v279 = arith.constant 16 : u32; + v117 = hir.bitcast v116 : i32; + v120 = arith.shl v117, v279 : i32; + v121 = arith.add v115, v120 : i32 #[overflow = wrapping]; + v125 = hir.int_to_ptr v122 : ptr; + hir.store v125, v121; scf.yield ; }; - v102 = hir.bitcast v45 : u32; - v231 = arith.constant 4 : u32; - v104 = arith.mod v102, v231 : u32; - hir.assertz v104 #[code = 250]; - v105 = hir.int_to_ptr v102 : ptr; - v106 = hir.load v105 : i32; - v229 = arith.constant 0 : i32; - v230 = arith.constant -1 : i32; - v108 = arith.bxor v106, v230 : i32; - v110 = hir.bitcast v108 : u32; - v109 = hir.bitcast v81 : u32; - v111 = arith.gt v109, v110 : i1; - v112 = arith.zext v111 : u32; - v113 = hir.bitcast v112 : i32; - v115 = arith.neq v113, v229 : i1; - v222 = scf.if v115 : i32 { - ^block22: - v228 = arith.constant 0 : i32; - scf.yield v228; + v126 = hir.load_local : i32 #[local = lv2]; + v127 = hir.load_local : i32 #[local = lv0]; + v128 = hir.bitcast v127 : u32; + v278 = arith.constant 4 : u32; + v130 = arith.mod v128, v278 : u32; + hir.assertz v130 #[code = 250]; + v131 = hir.int_to_ptr v128 : ptr; + v132 = hir.load v131 : i32; + hir.store_local v132 #[local = lv4]; + v276 = arith.constant 0 : i32; + v277 = arith.constant -1 : i32; + v134 = arith.bxor v132, v277 : i32; + v136 = hir.bitcast v134 : u32; + v135 = hir.bitcast v126 : u32; + v137 = arith.gt v135, v136 : i1; + v138 = arith.zext v137 : u32; + v139 = hir.bitcast v138 : i32; + v141 = arith.neq v139, v276 : i1; + scf.if v141{ + ^block48: + scf.yield ; } else { ^block23: - v117 = hir.bitcast v45 : u32; - v227 = arith.constant 4 : u32; - v119 = arith.mod v117, v227 : u32; - hir.assertz v119 #[code = 250]; - v116 = arith.add v106, v81 : i32 #[overflow = wrapping]; - v120 = hir.int_to_ptr v117 : ptr; - hir.store v120, v116; - v122 = arith.add v106, v66 : i32 #[overflow = wrapping]; - scf.yield v122; + v142 = hir.load_local : i32 #[local = lv0]; + v143 = hir.load_local : i32 #[local = lv4]; + v144 = hir.load_local : i32 #[local = lv2]; + v146 = hir.bitcast v142 : u32; + v275 = arith.constant 4 : u32; + v148 = arith.mod v146, v275 : u32; + hir.assertz v148 #[code = 250]; + v145 = arith.add v143, v144 : i32 #[overflow = wrapping]; + v149 = hir.int_to_ptr v146 : ptr; + hir.store v149, v145; + v150 = hir.load_local : i32 #[local = lv4]; + v151 = hir.load_local : i32 #[local = lv1]; + v152 = arith.add v150, v151 : i32 #[overflow = wrapping]; + hir.store_local v152 #[local = lv3]; + scf.yield ; }; - scf.yield v222; + v153 = hir.load_local : i32 #[local = lv3]; + scf.yield v153; }; - v205 = arith.constant 1 : u32; - v226 = arith.constant 0 : u32; - v224 = cf.select v74, v226, v205 : u32; - scf.yield v223, v224; + v262 = arith.constant 1 : u32; + v274 = arith.constant 0 : u32; + v272 = cf.select v95, v274, v262 : u32; + scf.yield v271, v272; }; - v225 = arith.constant 0 : u32; - v221 = arith.eq v209, v225 : i1; - cf.cond_br v221 ^block17, ^block59(v208); + v273 = arith.constant 0 : u32; + v270 = arith.eq v266, v273 : i1; + cf.cond_br v270 ^block17, ^block53(v265); ^block17: ub.unreachable ; - ^block59(v201: i32): - builtin.ret v201; + ^block53(v258: i32): + builtin.ret v258; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { ^block24: - v125 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v125; - }; - - private builtin.function @intrinsics::felt::add(v127: felt, v128: felt) -> felt { - ^block28(v127: felt, v128: felt): - v129 = arith.add v127, v128 : felt #[overflow = unchecked]; - builtin.ret v129; - }; - - private builtin.function @intrinsics::felt::div(v131: felt, v132: felt) -> felt { - ^block30(v131: felt, v132: felt): - v133 = arith.div v131, v132 : felt; - builtin.ret v133; + v154 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v154; }; - private builtin.function @intrinsics::felt::mul(v135: felt, v136: felt) -> felt { - ^block32(v135: felt, v136: felt): - v137 = arith.mul v135, v136 : felt #[overflow = unchecked]; - builtin.ret v137; + private builtin.function @::max(v156: i32, v157: i32) -> i32 { + ^block28(v156: i32, v157: i32): + v288 = arith.constant 0 : i32; + v164 = hir.bitcast v157 : u32; + v163 = hir.bitcast v156 : u32; + v165 = arith.gt v163, v164 : i1; + v166 = arith.zext v165 : u32; + v167 = hir.bitcast v166 : i32; + v169 = arith.neq v167, v288 : i1; + v170 = cf.select v169, v156, v157 : i32; + builtin.ret v170; }; - private builtin.function @intrinsics::felt::sub(v139: felt, v140: felt) -> felt { - ^block34(v139: felt, v140: felt): - v141 = arith.sub v139, v140 : felt #[overflow = unchecked]; - builtin.ret v141; + public builtin.function @cabi_realloc(v171: i32, v172: i32, v173: i32, v174: i32) -> i32 { + ^block30(v171: i32, v172: i32, v173: i32, v174: i32): + v180 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/cabi_realloc_wit_bindgen_0_46_0(v171, v172, v173, v174) : i32 + builtin.ret v180; }; - private builtin.function @::max(v143: i32, v144: i32) -> i32 { - ^block36(v143: i32, v144: i32): - v151 = arith.constant 0 : i32; - v147 = hir.bitcast v144 : u32; - v146 = hir.bitcast v143 : u32; - v148 = arith.gt v146, v147 : i1; - v149 = arith.zext v148 : u32; - v150 = hir.bitcast v149 : i32; - v152 = arith.neq v150, v151 : i1; - v153 = cf.select v152, v143, v144 : i32; - builtin.ret v153; - }; - - public builtin.function @cabi_realloc(v154: i32, v155: i32, v156: i32, v157: i32) -> i32 { - ^block38(v154: i32, v155: i32, v156: i32, v157: i32): - v159 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/cabi_realloc_wit_bindgen_0_46_0(v154, v155, v156, v157) : i32 - builtin.ret v159; - }; - - private builtin.function @alloc::alloc::alloc(v160: i32, v161: i32) -> i32 { - ^block40(v160: i32, v161: i32): + private builtin.function @alloc::alloc::alloc(v181: i32, v182: i32) -> i32 { + ^block32(v181: i32, v182: i32): + hir.store_local v181 #[local = lv0]; + hir.store_local v182 #[local = lv1]; hir.exec @root_ns:root@1.0.0/felt_intrinsics/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v163 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/__rustc::__rust_alloc(v161, v160) : i32 - builtin.ret v163; + v184 = hir.load_local : i32 #[local = lv1]; + v185 = hir.load_local : i32 #[local = lv0]; + v186 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/__rustc::__rust_alloc(v184, v185) : i32 + builtin.ret v186; }; - private builtin.function @wit_bindgen::rt::cabi_realloc(v164: i32, v165: i32, v166: i32, v167: i32) -> i32 { - ^block42(v164: i32, v165: i32, v166: i32, v167: i32): - v169 = arith.constant 0 : i32; - v170 = arith.neq v165, v169 : i1; - v250, v251, v252 = scf.if v170 : i32, i32, u32 { - ^block46: - v178 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/__rustc::__rust_realloc(v164, v165, v166, v167) : i32 - v241 = arith.constant 0 : u32; - v245 = ub.poison i32 : i32; - scf.yield v178, v245, v241; + private builtin.function @wit_bindgen::rt::cabi_realloc(v187: i32, v188: i32, v189: i32, v190: i32) -> i32 { + ^block34(v187: i32, v188: i32, v189: i32, v190: i32): + hir.store_local v187 #[local = lv0]; + hir.store_local v188 #[local = lv1]; + hir.store_local v189 #[local = lv2]; + hir.store_local v190 #[local = lv3]; + v192 = hir.load_local : i32 #[local = lv1]; + v289 = arith.constant 0 : i32; + v194 = arith.neq v192, v289 : i1; + v298 = scf.if v194 : u32 { + ^block38: + v205 = hir.load_local : i32 #[local = lv0]; + v206 = hir.load_local : i32 #[local = lv1]; + v207 = hir.load_local : i32 #[local = lv2]; + v208 = hir.load_local : i32 #[local = lv3]; + v209 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/__rustc::__rust_realloc(v205, v206, v207, v208) : i32 + hir.store_local v209 #[local = lv2]; + v294 = arith.constant 0 : u32; + scf.yield v294; } else { - ^block47: - v280 = arith.constant 0 : i32; - v281 = arith.constant 0 : i32; - v172 = arith.eq v167, v281 : i1; - v173 = arith.zext v172 : u32; - v174 = hir.bitcast v173 : i32; - v176 = arith.neq v174, v280 : i1; - v268 = scf.if v176 : i32 { - ^block63: - v279 = ub.poison i32 : i32; - scf.yield v279; + ^block39: + v195 = hir.load_local : i32 #[local = lv3]; + v314 = arith.constant 0 : i32; + v315 = arith.constant 0 : i32; + v197 = arith.eq v195, v315 : i1; + v198 = arith.zext v197 : u32; + v199 = hir.bitcast v198 : i32; + v201 = arith.neq v199, v314 : i1; + scf.if v201{ + ^block56: + scf.yield ; } else { - ^block48: - v177 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/alloc::alloc::alloc(v166, v167) : i32 - scf.yield v177; + ^block40: + v202 = hir.load_local : i32 #[local = lv2]; + v203 = hir.load_local : i32 #[local = lv3]; + v204 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/alloc::alloc::alloc(v202, v203) : i32 + hir.store_local v204 #[local = lv2]; + scf.yield ; }; - v277 = arith.constant 0 : u32; - v246 = arith.constant 1 : u32; - v270 = cf.select v176, v246, v277 : u32; - v278 = ub.poison i32 : i32; - v269 = cf.select v176, v166, v278 : i32; - scf.yield v268, v269, v270; + v313 = arith.constant 0 : u32; + v296 = arith.constant 1 : u32; + v307 = cf.select v201, v296, v313 : u32; + scf.yield v307; }; - v257, v258 = scf.index_switch v252 : i32, u32 + v301 = scf.index_switch v298 : u32 case 0 { - ^block45: - v275 = arith.constant 0 : i32; - v181 = arith.neq v250, v275 : i1; - v272 = arith.constant 1 : u32; - v273 = arith.constant 0 : u32; - v267 = cf.select v181, v273, v272 : u32; - v274 = ub.poison i32 : i32; - v266 = cf.select v181, v250, v274 : i32; - scf.yield v266, v267; + ^block37: + v210 = hir.load_local : i32 #[local = lv2]; + v309 = arith.constant 1 : u32; + v310 = arith.constant 0 : u32; + v311 = arith.constant 0 : i32; + v212 = arith.neq v210, v311 : i1; + v306 = cf.select v212, v310, v309 : u32; + scf.yield v306; } default { - ^block70: - v276 = arith.constant 0 : u32; - scf.yield v251, v276; + ^block63: + v312 = arith.constant 0 : u32; + scf.yield v312; }; - v271 = arith.constant 0 : u32; - v265 = arith.eq v258, v271 : i1; - cf.cond_br v265 ^block65, ^block66; - ^block65: - builtin.ret v257; - ^block66: + v308 = arith.constant 0 : u32; + v305 = arith.eq v301, v308 : i1; + cf.cond_br v305 ^block36, ^block59; + ^block36: + v213 = hir.load_local : i32 #[local = lv2]; + builtin.ret v213; + ^block59: ub.unreachable ; }; - public builtin.function @cabi_realloc_wit_bindgen_0_46_0(v183: i32, v184: i32, v185: i32, v186: i32) -> i32 { - ^block50(v183: i32, v184: i32, v185: i32, v186: i32): - v188 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/wit_bindgen::rt::cabi_realloc(v183, v184, v185, v186) : i32 - builtin.ret v188; + public builtin.function @cabi_realloc_wit_bindgen_0_46_0(v214: i32, v215: i32, v216: i32, v217: i32) -> i32 { + ^block42(v214: i32, v215: i32, v216: i32, v217: i32): + v223 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/wit_bindgen::rt::cabi_realloc(v214, v215, v216, v217) : i32 + builtin.ret v223; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/func_arg_same.hir b/tests/integration/expected/func_arg_same.hir index 21c7284a4..baf1830ae 100644 --- a/tests/integration/expected/func_arg_same.hir +++ b/tests/integration/expected/func_arg_same.hir @@ -2,13 +2,13 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @func_arg_same { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block4(v0: i32, v1: i32): - v3 = hir.exec @root_ns:root@1.0.0/func_arg_same/intrinsic(v0, v0) : i32 - builtin.ret v3; + v5 = hir.exec @root_ns:root@1.0.0/func_arg_same/intrinsic(v0, v0) : i32 + builtin.ret v5; }; - public builtin.function @intrinsic(v4: i32, v5: i32) -> i32 { - ^block6(v4: i32, v5: i32): - builtin.ret v4; + public builtin.function @intrinsic(v6: i32, v7: i32) -> i32 { + ^block6(v6: i32, v7: i32): + builtin.ret v6; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/func_arg_same.masm b/tests/integration/expected/func_arg_same.masm index c569bfd27..091612f85 100644 --- a/tests/integration/expected/func_arg_same.masm +++ b/tests/integration/expected/func_arg_same.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,8 +10,9 @@ proc init mem_store.278528 end -# mod root_ns:root@1.0.0::func_arg_same +# mod ::"root_ns:root@1.0.0"::func_arg_same +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 swap.1 @@ -19,11 +20,12 @@ pub proc entrypoint(i32, i32) -> i32 dup.0 trace.240 nop - exec.::root_ns:root@1.0.0::func_arg_same::intrinsic + exec.::"root_ns:root@1.0.0"::func_arg_same::intrinsic trace.252 nop end +@locals("2") @callconv("C") pub proc intrinsic(i32, i32) -> i32 swap.1 diff --git a/tests/integration/expected/function_call_hir2.hir b/tests/integration/expected/function_call_hir2.hir index a13cf1eda..878ad13ae 100644 --- a/tests/integration/expected/function_call_hir2.hir +++ b/tests/integration/expected/function_call_hir2.hir @@ -2,14 +2,14 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @function_call_hir2 { public builtin.function @add(v0: i32, v1: i32) -> i32 { ^block4(v0: i32, v1: i32): - v3 = arith.add v1, v0 : i32 #[overflow = wrapping]; - builtin.ret v3; + v5 = arith.add v1, v0 : i32 #[overflow = wrapping]; + builtin.ret v5; }; - public builtin.function @entrypoint(v4: i32, v5: i32) -> i32 { - ^block6(v4: i32, v5: i32): - v7 = hir.exec @root_ns:root@1.0.0/function_call_hir2/add(v4, v5) : i32 - builtin.ret v7; + public builtin.function @entrypoint(v6: i32, v7: i32) -> i32 { + ^block6(v6: i32, v7: i32): + v11 = hir.exec @root_ns:root@1.0.0/function_call_hir2/add(v6, v7) : i32 + builtin.ret v11; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/ge_felt.hir b/tests/integration/expected/ge_felt.hir index 25206f0ae..f128eebe9 100644 --- a/tests/integration/expected/ge_felt.hir +++ b/tests/integration/expected/ge_felt.hir @@ -2,19 +2,13 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @ge_felt { public builtin.function @entrypoint(v0: felt, v1: felt) -> i32 { ^block4(v0: felt, v1: felt): - v3 = hir.exec @root_ns:root@1.0.0/ge_felt/intrinsics::felt::ge(v0, v1) : i32 - v4 = arith.constant 0 : i32; - v5 = arith.neq v3, v4 : i1; - v6 = arith.zext v5 : u32; - v7 = hir.bitcast v6 : i32; - builtin.ret v7; - }; - - private builtin.function @intrinsics::felt::ge(v8: felt, v9: felt) -> i32 { - ^block6(v8: felt, v9: felt): - v10 = arith.gte v8, v9 : i1; - v11 = hir.cast v10 : i32; - builtin.ret v11; + v11 = arith.constant 0 : i32; + v5 = arith.gte v0, v1 : i1; + v6 = hir.cast v5 : i32; + v8 = arith.neq v6, v11 : i1; + v9 = arith.zext v8 : u32; + v10 = hir.bitcast v9 : i32; + builtin.ret v10; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/ge_felt.masm b/tests/integration/expected/ge_felt.masm index 8cf3645ef..ed581a9bf 100644 --- a/tests/integration/expected/ge_felt.masm +++ b/tests/integration/expected/ge_felt.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,22 +10,14 @@ proc init mem_store.278528 end -# mod root_ns:root@1.0.0::ge_felt +# mod ::"root_ns:root@1.0.0"::ge_felt +@locals("2") @callconv("C") pub proc entrypoint(felt, felt) -> i32 - trace.240 - nop - exec.::root_ns:root@1.0.0::ge_felt::intrinsics::felt::ge - trace.252 - nop push.0 - neq -end - -@callconv("C") -proc intrinsics::felt::ge(felt, felt) -> i32 - swap.1 + swap.2 gte + neq end diff --git a/tests/integration/expected/ge_i32.hir b/tests/integration/expected/ge_i32.hir index f3ccd89ae..23f98c8ec 100644 --- a/tests/integration/expected/ge_i32.hir +++ b/tests/integration/expected/ge_i32.hir @@ -2,10 +2,10 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_1e76175a91b5fc3090baafa017f5a38c53c37f1e1a73be7ebaa886f57b9f86fb { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.gte v0, v1 : i1; - v4 = arith.zext v3 : u32; - v5 = hir.bitcast v4 : i32; - builtin.ret v5; + v5 = arith.gte v0, v1 : i1; + v6 = arith.zext v5 : u32; + v7 = hir.bitcast v6 : i32; + builtin.ret v7; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/ge_i32.masm b/tests/integration/expected/ge_i32.masm index bc792fac1..bf1bc35a2 100644 --- a/tests/integration/expected/ge_i32.masm +++ b/tests/integration/expected/ge_i32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_1e76175a91b5fc3090baafa017f5a38c53c37f1e1a73be7ebaa886f57b9f86fb +# mod ::"root_ns:root@1.0.0"::test_rust_1e76175a91b5fc3090baafa017f5a38c53c37f1e1a73be7ebaa886f57b9f86fb +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 swap.1 diff --git a/tests/integration/expected/ge_i64.hir b/tests/integration/expected/ge_i64.hir index 1f78218e9..ead41ba06 100644 --- a/tests/integration/expected/ge_i64.hir +++ b/tests/integration/expected/ge_i64.hir @@ -2,10 +2,10 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_9edabb66d927b03a3d0e64c65bad79cd5488a5bf59a9059a832f3582c7184d6b { public builtin.function @entrypoint(v0: i64, v1: i64) -> i32 { ^block6(v0: i64, v1: i64): - v3 = arith.gte v0, v1 : i1; - v4 = arith.zext v3 : u32; - v5 = hir.bitcast v4 : i32; - builtin.ret v5; + v5 = arith.gte v0, v1 : i1; + v6 = arith.zext v5 : u32; + v7 = hir.bitcast v6 : i32; + builtin.ret v7; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/ge_i64.masm b/tests/integration/expected/ge_i64.masm index 7d6aee4b8..a18ef6599 100644 --- a/tests/integration/expected/ge_i64.masm +++ b/tests/integration/expected/ge_i64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_9edabb66d927b03a3d0e64c65bad79cd5488a5bf59a9059a832f3582c7184d6b +# mod ::"root_ns:root@1.0.0"::test_rust_9edabb66d927b03a3d0e64c65bad79cd5488a5bf59a9059a832f3582c7184d6b +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> i32 movdn.3 diff --git a/tests/integration/expected/ge_u16.hir b/tests/integration/expected/ge_u16.hir index 013c945bf..41d0f1690 100644 --- a/tests/integration/expected/ge_u16.hir +++ b/tests/integration/expected/ge_u16.hir @@ -2,12 +2,12 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_6b89d656eff2711a9ee50d11f22845c4cbbc0df54339492d30dcf628910850d2 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v4 = hir.bitcast v1 : u32; - v3 = hir.bitcast v0 : u32; - v5 = arith.gte v3, v4 : i1; - v6 = arith.zext v5 : u32; - v7 = hir.bitcast v6 : i32; - builtin.ret v7; + v6 = hir.bitcast v1 : u32; + v5 = hir.bitcast v0 : u32; + v7 = arith.gte v5, v6 : i1; + v8 = arith.zext v7 : u32; + v9 = hir.bitcast v8 : i32; + builtin.ret v9; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/ge_u16.masm b/tests/integration/expected/ge_u16.masm index 5052d7455..706335898 100644 --- a/tests/integration/expected/ge_u16.masm +++ b/tests/integration/expected/ge_u16.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_6b89d656eff2711a9ee50d11f22845c4cbbc0df54339492d30dcf628910850d2 +# mod ::"root_ns:root@1.0.0"::test_rust_6b89d656eff2711a9ee50d11f22845c4cbbc0df54339492d30dcf628910850d2 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 swap.1 diff --git a/tests/integration/expected/ge_u32.hir b/tests/integration/expected/ge_u32.hir index aa3054ee5..94b9ec408 100644 --- a/tests/integration/expected/ge_u32.hir +++ b/tests/integration/expected/ge_u32.hir @@ -2,12 +2,12 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_a6a04660dda2007e5b39d22340b438c2120c4114b075c90883d9b212365eb5fe { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v4 = hir.bitcast v1 : u32; - v3 = hir.bitcast v0 : u32; - v5 = arith.gte v3, v4 : i1; - v6 = arith.zext v5 : u32; - v7 = hir.bitcast v6 : i32; - builtin.ret v7; + v6 = hir.bitcast v1 : u32; + v5 = hir.bitcast v0 : u32; + v7 = arith.gte v5, v6 : i1; + v8 = arith.zext v7 : u32; + v9 = hir.bitcast v8 : i32; + builtin.ret v9; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/ge_u32.masm b/tests/integration/expected/ge_u32.masm index 208f360d8..c798405c4 100644 --- a/tests/integration/expected/ge_u32.masm +++ b/tests/integration/expected/ge_u32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_a6a04660dda2007e5b39d22340b438c2120c4114b075c90883d9b212365eb5fe +# mod ::"root_ns:root@1.0.0"::test_rust_a6a04660dda2007e5b39d22340b438c2120c4114b075c90883d9b212365eb5fe +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 swap.1 diff --git a/tests/integration/expected/ge_u64.hir b/tests/integration/expected/ge_u64.hir index 94e1bb434..ea72d16ff 100644 --- a/tests/integration/expected/ge_u64.hir +++ b/tests/integration/expected/ge_u64.hir @@ -2,12 +2,12 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_b008d40be4d6e94465c1a26de42c380b06e09a3774e7a937bf5c338fd437b333 { public builtin.function @entrypoint(v0: i64, v1: i64) -> i32 { ^block6(v0: i64, v1: i64): - v4 = hir.bitcast v1 : u64; - v3 = hir.bitcast v0 : u64; - v5 = arith.gte v3, v4 : i1; - v6 = arith.zext v5 : u32; - v7 = hir.bitcast v6 : i32; - builtin.ret v7; + v6 = hir.bitcast v1 : u64; + v5 = hir.bitcast v0 : u64; + v7 = arith.gte v5, v6 : i1; + v8 = arith.zext v7 : u32; + v9 = hir.bitcast v8 : i32; + builtin.ret v9; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/ge_u64.masm b/tests/integration/expected/ge_u64.masm index 3fbaabd8f..90b53f248 100644 --- a/tests/integration/expected/ge_u64.masm +++ b/tests/integration/expected/ge_u64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_b008d40be4d6e94465c1a26de42c380b06e09a3774e7a937bf5c338fd437b333 +# mod ::"root_ns:root@1.0.0"::test_rust_b008d40be4d6e94465c1a26de42c380b06e09a3774e7a937bf5c338fd437b333 +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> i32 movdn.3 @@ -28,7 +29,7 @@ pub proc entrypoint([u32; 2], [u32; 2]) -> i32 movdn.3 trace.240 nop - exec.::std::math::u64::gte + exec.::miden::core::math::u64::gte trace.252 nop end diff --git a/tests/integration/expected/ge_u8.hir b/tests/integration/expected/ge_u8.hir index 300baa6cc..3c69d1c86 100644 --- a/tests/integration/expected/ge_u8.hir +++ b/tests/integration/expected/ge_u8.hir @@ -2,12 +2,12 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_a7d66021fee4ca04dff85edcc2a0482cfea1494683ab39c1ae381746dfbf0d98 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v4 = hir.bitcast v1 : u32; - v3 = hir.bitcast v0 : u32; - v5 = arith.gte v3, v4 : i1; - v6 = arith.zext v5 : u32; - v7 = hir.bitcast v6 : i32; - builtin.ret v7; + v6 = hir.bitcast v1 : u32; + v5 = hir.bitcast v0 : u32; + v7 = arith.gte v5, v6 : i1; + v8 = arith.zext v7 : u32; + v9 = hir.bitcast v8 : i32; + builtin.ret v9; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/ge_u8.masm b/tests/integration/expected/ge_u8.masm index 3324f0da7..695272719 100644 --- a/tests/integration/expected/ge_u8.masm +++ b/tests/integration/expected/ge_u8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_a7d66021fee4ca04dff85edcc2a0482cfea1494683ab39c1ae381746dfbf0d98 +# mod ::"root_ns:root@1.0.0"::test_rust_a7d66021fee4ca04dff85edcc2a0482cfea1494683ab39c1ae381746dfbf0d98 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 swap.1 diff --git a/tests/integration/expected/gt_felt.hir b/tests/integration/expected/gt_felt.hir index 481aa55f1..d5d39bb62 100644 --- a/tests/integration/expected/gt_felt.hir +++ b/tests/integration/expected/gt_felt.hir @@ -2,19 +2,13 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @gt_felt { public builtin.function @entrypoint(v0: felt, v1: felt) -> i32 { ^block4(v0: felt, v1: felt): - v3 = hir.exec @root_ns:root@1.0.0/gt_felt/intrinsics::felt::gt(v0, v1) : i32 - v4 = arith.constant 0 : i32; - v5 = arith.neq v3, v4 : i1; - v6 = arith.zext v5 : u32; - v7 = hir.bitcast v6 : i32; - builtin.ret v7; - }; - - private builtin.function @intrinsics::felt::gt(v8: felt, v9: felt) -> i32 { - ^block6(v8: felt, v9: felt): - v10 = arith.gt v8, v9 : i1; - v11 = hir.cast v10 : i32; - builtin.ret v11; + v11 = arith.constant 0 : i32; + v5 = arith.gt v0, v1 : i1; + v6 = hir.cast v5 : i32; + v8 = arith.neq v6, v11 : i1; + v9 = arith.zext v8 : u32; + v10 = hir.bitcast v9 : i32; + builtin.ret v10; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/gt_felt.masm b/tests/integration/expected/gt_felt.masm index f32deecff..d69e52752 100644 --- a/tests/integration/expected/gt_felt.masm +++ b/tests/integration/expected/gt_felt.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,22 +10,14 @@ proc init mem_store.278528 end -# mod root_ns:root@1.0.0::gt_felt +# mod ::"root_ns:root@1.0.0"::gt_felt +@locals("2") @callconv("C") pub proc entrypoint(felt, felt) -> i32 - trace.240 - nop - exec.::root_ns:root@1.0.0::gt_felt::intrinsics::felt::gt - trace.252 - nop push.0 - neq -end - -@callconv("C") -proc intrinsics::felt::gt(felt, felt) -> i32 - swap.1 + swap.2 gt + neq end diff --git a/tests/integration/expected/gt_i32.hir b/tests/integration/expected/gt_i32.hir index b3c630c71..945abc63c 100644 --- a/tests/integration/expected/gt_i32.hir +++ b/tests/integration/expected/gt_i32.hir @@ -2,10 +2,10 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_9d2e8775109dcfc1c935f1f5d3649375cc140aedefb7659a7c1d3720c82086ec { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.gt v0, v1 : i1; - v4 = arith.zext v3 : u32; - v5 = hir.bitcast v4 : i32; - builtin.ret v5; + v5 = arith.gt v0, v1 : i1; + v6 = arith.zext v5 : u32; + v7 = hir.bitcast v6 : i32; + builtin.ret v7; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/gt_i32.masm b/tests/integration/expected/gt_i32.masm index d1e9a5c66..3ae572c88 100644 --- a/tests/integration/expected/gt_i32.masm +++ b/tests/integration/expected/gt_i32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_9d2e8775109dcfc1c935f1f5d3649375cc140aedefb7659a7c1d3720c82086ec +# mod ::"root_ns:root@1.0.0"::test_rust_9d2e8775109dcfc1c935f1f5d3649375cc140aedefb7659a7c1d3720c82086ec +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 swap.1 diff --git a/tests/integration/expected/gt_i64.hir b/tests/integration/expected/gt_i64.hir index d62c5b788..ada6cf99a 100644 --- a/tests/integration/expected/gt_i64.hir +++ b/tests/integration/expected/gt_i64.hir @@ -2,10 +2,10 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_7d82f2e08b811f59ed036f725c1b72ca685b95ee301d765a74b8f7da3048058b { public builtin.function @entrypoint(v0: i64, v1: i64) -> i32 { ^block6(v0: i64, v1: i64): - v3 = arith.gt v0, v1 : i1; - v4 = arith.zext v3 : u32; - v5 = hir.bitcast v4 : i32; - builtin.ret v5; + v5 = arith.gt v0, v1 : i1; + v6 = arith.zext v5 : u32; + v7 = hir.bitcast v6 : i32; + builtin.ret v7; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/gt_i64.masm b/tests/integration/expected/gt_i64.masm index b3a406ee1..306840ede 100644 --- a/tests/integration/expected/gt_i64.masm +++ b/tests/integration/expected/gt_i64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_7d82f2e08b811f59ed036f725c1b72ca685b95ee301d765a74b8f7da3048058b +# mod ::"root_ns:root@1.0.0"::test_rust_7d82f2e08b811f59ed036f725c1b72ca685b95ee301d765a74b8f7da3048058b +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> i32 movdn.3 diff --git a/tests/integration/expected/gt_u16.hir b/tests/integration/expected/gt_u16.hir index 88e5bfa25..845f75d1e 100644 --- a/tests/integration/expected/gt_u16.hir +++ b/tests/integration/expected/gt_u16.hir @@ -2,12 +2,12 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_cacaae112ac2013d020f0f82f9c334edde1d01c5854d6174ba2ebf34c2a8fc37 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v4 = hir.bitcast v1 : u32; - v3 = hir.bitcast v0 : u32; - v5 = arith.gt v3, v4 : i1; - v6 = arith.zext v5 : u32; - v7 = hir.bitcast v6 : i32; - builtin.ret v7; + v6 = hir.bitcast v1 : u32; + v5 = hir.bitcast v0 : u32; + v7 = arith.gt v5, v6 : i1; + v8 = arith.zext v7 : u32; + v9 = hir.bitcast v8 : i32; + builtin.ret v9; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/gt_u16.masm b/tests/integration/expected/gt_u16.masm index 9e2a8872e..5e65f4caa 100644 --- a/tests/integration/expected/gt_u16.masm +++ b/tests/integration/expected/gt_u16.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_cacaae112ac2013d020f0f82f9c334edde1d01c5854d6174ba2ebf34c2a8fc37 +# mod ::"root_ns:root@1.0.0"::test_rust_cacaae112ac2013d020f0f82f9c334edde1d01c5854d6174ba2ebf34c2a8fc37 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 swap.1 diff --git a/tests/integration/expected/gt_u32.hir b/tests/integration/expected/gt_u32.hir index 05cc07890..6f7394349 100644 --- a/tests/integration/expected/gt_u32.hir +++ b/tests/integration/expected/gt_u32.hir @@ -2,12 +2,12 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_35873b6ce3c76e068032779fcd1e75617c26429a13cc7bcd687d3302885cf1f1 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v4 = hir.bitcast v1 : u32; - v3 = hir.bitcast v0 : u32; - v5 = arith.gt v3, v4 : i1; - v6 = arith.zext v5 : u32; - v7 = hir.bitcast v6 : i32; - builtin.ret v7; + v6 = hir.bitcast v1 : u32; + v5 = hir.bitcast v0 : u32; + v7 = arith.gt v5, v6 : i1; + v8 = arith.zext v7 : u32; + v9 = hir.bitcast v8 : i32; + builtin.ret v9; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/gt_u32.masm b/tests/integration/expected/gt_u32.masm index 142f33f64..ebaa8b419 100644 --- a/tests/integration/expected/gt_u32.masm +++ b/tests/integration/expected/gt_u32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_35873b6ce3c76e068032779fcd1e75617c26429a13cc7bcd687d3302885cf1f1 +# mod ::"root_ns:root@1.0.0"::test_rust_35873b6ce3c76e068032779fcd1e75617c26429a13cc7bcd687d3302885cf1f1 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 swap.1 diff --git a/tests/integration/expected/gt_u64.hir b/tests/integration/expected/gt_u64.hir index 05ee32996..d0e213648 100644 --- a/tests/integration/expected/gt_u64.hir +++ b/tests/integration/expected/gt_u64.hir @@ -2,12 +2,12 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_6489ee5460bd7aa58670638ded1591ff3f7c6abbcc5423cc0a2f5a4feb1ca663 { public builtin.function @entrypoint(v0: i64, v1: i64) -> i32 { ^block6(v0: i64, v1: i64): - v4 = hir.bitcast v1 : u64; - v3 = hir.bitcast v0 : u64; - v5 = arith.gt v3, v4 : i1; - v6 = arith.zext v5 : u32; - v7 = hir.bitcast v6 : i32; - builtin.ret v7; + v6 = hir.bitcast v1 : u64; + v5 = hir.bitcast v0 : u64; + v7 = arith.gt v5, v6 : i1; + v8 = arith.zext v7 : u32; + v9 = hir.bitcast v8 : i32; + builtin.ret v9; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/gt_u64.masm b/tests/integration/expected/gt_u64.masm index fecbb3311..46c2a4f9f 100644 --- a/tests/integration/expected/gt_u64.masm +++ b/tests/integration/expected/gt_u64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_6489ee5460bd7aa58670638ded1591ff3f7c6abbcc5423cc0a2f5a4feb1ca663 +# mod ::"root_ns:root@1.0.0"::test_rust_6489ee5460bd7aa58670638ded1591ff3f7c6abbcc5423cc0a2f5a4feb1ca663 +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> i32 movdn.3 @@ -28,7 +29,7 @@ pub proc entrypoint([u32; 2], [u32; 2]) -> i32 movdn.3 trace.240 nop - exec.::std::math::u64::gt + exec.::miden::core::math::u64::gt trace.252 nop end diff --git a/tests/integration/expected/gt_u8.hir b/tests/integration/expected/gt_u8.hir index 7d0725a8b..d9872071d 100644 --- a/tests/integration/expected/gt_u8.hir +++ b/tests/integration/expected/gt_u8.hir @@ -2,12 +2,12 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_455aa9bc12d63425df846020b1734fc76252696200bb44305ecdb2dacce6f789 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v4 = hir.bitcast v1 : u32; - v3 = hir.bitcast v0 : u32; - v5 = arith.gt v3, v4 : i1; - v6 = arith.zext v5 : u32; - v7 = hir.bitcast v6 : i32; - builtin.ret v7; + v6 = hir.bitcast v1 : u32; + v5 = hir.bitcast v0 : u32; + v7 = arith.gt v5, v6 : i1; + v8 = arith.zext v7 : u32; + v9 = hir.bitcast v8 : i32; + builtin.ret v9; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/gt_u8.masm b/tests/integration/expected/gt_u8.masm index 8f99b7c66..6aeb0ab00 100644 --- a/tests/integration/expected/gt_u8.masm +++ b/tests/integration/expected/gt_u8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_455aa9bc12d63425df846020b1734fc76252696200bb44305ecdb2dacce6f789 +# mod ::"root_ns:root@1.0.0"::test_rust_455aa9bc12d63425df846020b1734fc76252696200bb44305ecdb2dacce6f789 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 swap.1 diff --git a/tests/integration/expected/hash_elements.hir b/tests/integration/expected/hash_elements.hir index f3dc1f906..1dc49fbc9 100644 --- a/tests/integration/expected/hash_elements.hir +++ b/tests/integration/expected/hash_elements.hir @@ -7,440 +7,315 @@ builtin.component root_ns:root@1.0.0 { public builtin.function @entrypoint(v3: i32) -> felt { ^block6(v3: i32): - v7 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr - v8 = hir.bitcast v7 : ptr; - v9 = hir.load v8 : i32; - v10 = arith.constant 48 : i32; - v11 = arith.sub v9, v10 : i32 #[overflow = wrapping]; - v12 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr - v13 = hir.bitcast v12 : ptr; - hir.store v13, v11; - v15 = arith.constant 8 : u32; - v14 = hir.bitcast v3 : u32; - v16 = arith.add v14, v15 : u32 #[overflow = checked]; - v17 = arith.constant 4 : u32; - v18 = arith.mod v16, v17 : u32; - hir.assertz v18 #[code = 250]; - v19 = hir.int_to_ptr v16 : ptr; - v20 = hir.load v19 : i32; - v343 = arith.constant 4 : u32; - v21 = hir.bitcast v3 : u32; - v23 = arith.add v21, v343 : u32 #[overflow = checked]; - v342 = arith.constant 4 : u32; - v25 = arith.mod v23, v342 : u32; + hir.store_local v3 #[local = lv0]; + v5 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr + v6 = hir.bitcast v5 : ptr; + v7 = hir.load v6 : i32; + v241 = arith.constant 16 : i32; + v9 = arith.sub v7, v241 : i32 #[overflow = wrapping]; + hir.store_local v9 #[local = lv1]; + v10 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr + v11 = hir.bitcast v10 : ptr; + hir.store v11, v9; + v12 = hir.load_local : i32 #[local = lv0]; + v240 = arith.constant 8 : u32; + v13 = hir.bitcast v12 : u32; + v15 = arith.add v13, v240 : u32 #[overflow = checked]; + v239 = arith.constant 4 : u32; + v17 = arith.mod v15, v239 : u32; + hir.assertz v17 #[code = 250]; + v18 = hir.int_to_ptr v15 : ptr; + v19 = hir.load v18 : i32; + hir.store_local v19 #[local = lv2]; + v20 = hir.load_local : i32 #[local = lv0]; + v255 = arith.constant 4 : u32; + v21 = hir.bitcast v20 : u32; + v23 = arith.add v21, v255 : u32 #[overflow = checked]; + v254 = arith.constant 4 : u32; + v25 = arith.mod v23, v254 : u32; hir.assertz v25 #[code = 250]; v26 = hir.int_to_ptr v23 : ptr; v27 = hir.load v26 : i32; - v327 = arith.constant 2 : u32; + v234 = arith.constant 2 : u32; v29 = hir.bitcast v27 : u32; - v31 = arith.shr v29, v327 : u32; + v31 = arith.shr v29, v234 : u32; v32 = hir.bitcast v31 : i32; - v33 = arith.constant 3 : i32; - v34 = arith.band v32, v33 : i32; - v35 = hir.exec @root_ns:root@1.0.0/hash_elements/intrinsics::felt::from_u32(v34) : felt - v5 = arith.constant 0 : i32; - v37 = hir.exec @root_ns:root@1.0.0/hash_elements/intrinsics::felt::from_u32(v5) : felt - hir.exec @root_ns:root@1.0.0/hash_elements/intrinsics::felt::assert_eq(v35, v37) - v339 = arith.constant 0 : i32; - v340 = arith.constant 0 : i32; - v341 = arith.constant 3 : i32; - v39 = arith.band v20, v341 : i32; - v41 = arith.eq v39, v340 : i1; - v42 = arith.zext v41 : u32; - v43 = hir.bitcast v42 : i32; - v45 = arith.neq v43, v339 : i1; - scf.if v45{ + hir.store_local v32 #[local = lv3]; + v233 = arith.constant 0 : felt; + v238 = arith.constant 3 : i32; + v34 = arith.band v32, v238 : i32; + v35 = hir.bitcast v34 : felt; + hir.assert_eq v35, v233; + v38 = hir.load_local : i32 #[local = lv2]; + v252 = arith.constant 0 : i32; + v244 = arith.constant 0 : i32; + v253 = arith.constant 3 : i32; + v40 = arith.band v38, v253 : i32; + v42 = arith.eq v40, v244 : i1; + v43 = arith.zext v42 : u32; + v44 = hir.bitcast v43 : i32; + v46 = arith.neq v44, v252 : i1; + scf.if v46{ ^block9: - v49 = arith.constant 16 : i32; - v50 = arith.add v11, v49 : i32 #[overflow = wrapping]; - v48 = arith.add v32, v20 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/hash_elements/std::crypto::hashes::rpo::hash_memory_words(v32, v48, v50) + v50 = hir.load_local : i32 #[local = lv3]; + v52 = hir.load_local : i32 #[local = lv2]; + v54 = hir.load_local : i32 #[local = lv1]; + v53 = arith.add v50, v52 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/hash_elements/miden::core::crypto::hashes::rpo256::hash_words(v50, v53, v54) scf.yield ; } else { ^block10: - v338 = arith.constant 16 : i32; - v47 = arith.add v11, v338 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/hash_elements/std::crypto::hashes::rpo::hash_memory(v32, v20, v47) + v47 = hir.load_local : i32 #[local = lv3]; + v48 = hir.load_local : i32 #[local = lv2]; + v49 = hir.load_local : i32 #[local = lv1]; + hir.exec @root_ns:root@1.0.0/hash_elements/miden::core::crypto::hashes::rpo256::hash_elements(v47, v48, v49) scf.yield ; }; - v53 = arith.constant 24 : u32; - v52 = hir.bitcast v11 : u32; - v54 = arith.add v52, v53 : u32 #[overflow = checked]; - v337 = arith.constant 8 : u32; - v56 = arith.mod v54, v337 : u32; - hir.assertz v56 #[code = 250]; - v57 = hir.int_to_ptr v54 : ptr; - v58 = hir.load v57 : i64; - v60 = arith.constant 40 : u32; - v59 = hir.bitcast v11 : u32; - v61 = arith.add v59, v60 : u32 #[overflow = checked]; - v336 = arith.constant 8 : u32; - v63 = arith.mod v61, v336 : u32; - hir.assertz v63 #[code = 250]; - v64 = hir.int_to_ptr v61 : ptr; - hir.store v64, v58; - v66 = arith.constant 16 : u32; - v65 = hir.bitcast v11 : u32; - v67 = arith.add v65, v66 : u32 #[overflow = checked]; - v335 = arith.constant 8 : u32; - v69 = arith.mod v67, v335 : u32; - hir.assertz v69 #[code = 250]; - v70 = hir.int_to_ptr v67 : ptr; - v71 = hir.load v70 : i64; - v73 = arith.constant 32 : u32; - v72 = hir.bitcast v11 : u32; - v74 = arith.add v72, v73 : u32 #[overflow = checked]; - v334 = arith.constant 8 : u32; - v76 = arith.mod v74, v334 : u32; - hir.assertz v76 #[code = 250]; - v77 = hir.int_to_ptr v74 : ptr; - hir.store v77, v71; - v78 = arith.constant 32 : i32; - v79 = arith.add v11, v78 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/hash_elements/::reverse(v11, v79) - v81 = arith.constant 4 : i32; - hir.exec @root_ns:root@1.0.0/hash_elements/::deallocate(v3, v81, v81) - v83 = hir.bitcast v11 : u32; - v333 = arith.constant 4 : u32; - v85 = arith.mod v83, v333 : u32; - hir.assertz v85 #[code = 250]; - v86 = hir.int_to_ptr v83 : ptr; - v87 = hir.load v86 : felt; - v332 = arith.constant 48 : i32; - v89 = arith.add v11, v332 : i32 #[overflow = wrapping]; - v90 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr - v91 = hir.bitcast v90 : ptr; - hir.store v91, v89; - builtin.ret v87; + v55 = hir.load_local : i32 #[local = lv1]; + v236 = arith.constant 12 : u32; + v56 = hir.bitcast v55 : u32; + v58 = arith.add v56, v236 : u32 #[overflow = checked]; + v251 = arith.constant 4 : u32; + v60 = arith.mod v58, v251 : u32; + hir.assertz v60 #[code = 250]; + v61 = hir.int_to_ptr v58 : ptr; + v62 = hir.load v61 : felt; + hir.store_local v62 #[local = lv4]; + v63 = hir.load_local : i32 #[local = lv0]; + v235 = arith.constant 4 : i32; + hir.exec @root_ns:root@1.0.0/hash_elements/::deallocate(v63, v235, v235) + v66 = hir.load_local : i32 #[local = lv1]; + v250 = arith.constant 16 : i32; + v68 = arith.add v66, v250 : i32 #[overflow = wrapping]; + v69 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr + v70 = hir.bitcast v69 : ptr; + hir.store v70, v68; + v71 = hir.load_local : felt #[local = lv4]; + builtin.ret v71; }; - private builtin.function @::reverse(v92: i32, v93: i32) { - ^block11(v92: i32, v93: i32): - v96 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr - v97 = hir.bitcast v96 : ptr; - v98 = hir.load v97 : i32; - v99 = arith.constant 16 : i32; - v100 = arith.sub v98, v99 : i32 #[overflow = wrapping]; - v102 = arith.constant 8 : u32; - v101 = hir.bitcast v93 : u32; - v103 = arith.add v101, v102 : u32 #[overflow = checked]; - v430 = arith.constant 8 : u32; - v105 = arith.mod v103, v430 : u32; - hir.assertz v105 #[code = 250]; - v106 = hir.int_to_ptr v103 : ptr; - v107 = hir.load v106 : i64; - v429 = arith.constant 8 : u32; - v108 = hir.bitcast v100 : u32; - v110 = arith.add v108, v429 : u32 #[overflow = checked]; - v111 = arith.constant 4 : u32; - v112 = arith.mod v110, v111 : u32; - hir.assertz v112 #[code = 250]; - v113 = hir.int_to_ptr v110 : ptr; - hir.store v113, v107; - v114 = hir.bitcast v93 : u32; - v428 = arith.constant 8 : u32; - v116 = arith.mod v114, v428 : u32; - hir.assertz v116 #[code = 250]; - v117 = hir.int_to_ptr v114 : ptr; - v118 = hir.load v117 : i64; - v119 = hir.bitcast v100 : u32; - v427 = arith.constant 4 : u32; - v121 = arith.mod v119, v427 : u32; - hir.assertz v121 #[code = 250]; - v122 = hir.int_to_ptr v119 : ptr; - hir.store v122, v118; - v123 = arith.constant 12 : i32; - v124 = arith.add v100, v123 : i32 #[overflow = wrapping]; - v94 = arith.constant 0 : i32; - v398, v399, v400, v401, v402, v403 = scf.while v94, v100, v124, v92 : i32, i32, i32, i32, i32, i32 { - ^block50(v404: i32, v405: i32, v406: i32, v407: i32): - v426 = arith.constant 0 : i32; - v127 = arith.constant 8 : i32; - v128 = arith.eq v404, v127 : i1; - v129 = arith.zext v128 : u32; - v130 = hir.bitcast v129 : i32; - v132 = arith.neq v130, v426 : i1; - v392, v393 = scf.if v132 : i32, i32 { - ^block49: - v352 = ub.poison i32 : i32; - scf.yield v352, v352; - } else { - ^block16: - v134 = arith.add v405, v404 : i32 #[overflow = wrapping]; - v135 = hir.bitcast v134 : u32; - v425 = arith.constant 4 : u32; - v137 = arith.mod v135, v425 : u32; - hir.assertz v137 #[code = 250]; - v138 = hir.int_to_ptr v135 : ptr; - v139 = hir.load v138 : felt; - v141 = hir.bitcast v406 : u32; - v424 = arith.constant 4 : u32; - v143 = arith.mod v141, v424 : u32; - hir.assertz v143 #[code = 250]; - v144 = hir.int_to_ptr v141 : ptr; - v145 = hir.load v144 : i32; - v146 = hir.bitcast v134 : u32; - v423 = arith.constant 4 : u32; - v148 = arith.mod v146, v423 : u32; - hir.assertz v148 #[code = 250]; - v149 = hir.int_to_ptr v146 : ptr; - hir.store v149, v145; - v150 = hir.bitcast v406 : u32; - v422 = arith.constant 4 : u32; - v152 = arith.mod v150, v422 : u32; - hir.assertz v152 #[code = 250]; - v153 = hir.int_to_ptr v150 : ptr; - hir.store v153, v139; - v156 = arith.constant -4 : i32; - v157 = arith.add v406, v156 : i32 #[overflow = wrapping]; - v154 = arith.constant 4 : i32; - v155 = arith.add v404, v154 : i32 #[overflow = wrapping]; - scf.yield v155, v157; - }; - v420 = ub.poison i32 : i32; - v395 = cf.select v132, v420, v407 : i32; - v421 = ub.poison i32 : i32; - v394 = cf.select v132, v421, v405 : i32; - v351 = arith.constant 1 : u32; - v344 = arith.constant 0 : u32; - v397 = cf.select v132, v344, v351 : u32; - v385 = arith.trunc v397 : i1; - scf.condition v385, v392, v394, v393, v395, v405, v407; - } do { - ^block51(v408: i32, v409: i32, v410: i32, v411: i32, v412: i32, v413: i32): - scf.yield v408, v409, v410, v411; - }; - v419 = arith.constant 8 : u32; - v159 = hir.bitcast v402 : u32; - v161 = arith.add v159, v419 : u32 #[overflow = checked]; - v418 = arith.constant 4 : u32; - v163 = arith.mod v161, v418 : u32; - hir.assertz v163 #[code = 250]; - v164 = hir.int_to_ptr v161 : ptr; - v165 = hir.load v164 : i64; - v417 = arith.constant 8 : u32; - v166 = hir.bitcast v403 : u32; - v168 = arith.add v166, v417 : u32 #[overflow = checked]; - v416 = arith.constant 8 : u32; - v170 = arith.mod v168, v416 : u32; - hir.assertz v170 #[code = 250]; - v171 = hir.int_to_ptr v168 : ptr; - hir.store v171, v165; - v172 = hir.bitcast v402 : u32; - v415 = arith.constant 4 : u32; - v174 = arith.mod v172, v415 : u32; - hir.assertz v174 #[code = 250]; - v175 = hir.int_to_ptr v172 : ptr; - v176 = hir.load v175 : i64; - v177 = hir.bitcast v403 : u32; - v414 = arith.constant 8 : u32; - v179 = arith.mod v177, v414 : u32; - hir.assertz v179 #[code = 250]; - v180 = hir.int_to_ptr v177 : ptr; - hir.store v180, v176; - builtin.ret ; - }; - - private builtin.function @intrinsics::felt::assert_eq(v181: felt, v182: felt) { - ^block17(v181: felt, v182: felt): - hir.assert_eq v181, v182; + private builtin.function @miden::core::crypto::hashes::rpo256::hash_elements(v72: i32, v73: i32, v74: i32) { + ^block11(v72: i32, v73: i32, v74: i32): + v75, v76, v77, v78 = hir.exec @miden/core/crypto/hashes/rpo256/hash_elements(v72, v73) : felt, felt, felt, felt + v79 = hir.bitcast v74 : u32; + v80 = hir.int_to_ptr v79 : ptr; + hir.store v80, v75; + v258 = arith.constant 4 : u32; + v82 = arith.add v79, v258 : u32 #[overflow = checked]; + v83 = hir.int_to_ptr v82 : ptr; + hir.store v83, v76; + v257 = arith.constant 8 : u32; + v85 = arith.add v79, v257 : u32 #[overflow = checked]; + v86 = hir.int_to_ptr v85 : ptr; + hir.store v86, v77; + v256 = arith.constant 12 : u32; + v88 = arith.add v79, v256 : u32 #[overflow = checked]; + v89 = hir.int_to_ptr v88 : ptr; + hir.store v89, v78; builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v183: i32) -> felt { - ^block19(v183: i32): - v184 = hir.bitcast v183 : felt; - builtin.ret v184; - }; - - private builtin.function @std::crypto::hashes::rpo::hash_memory(v186: i32, v187: i32, v188: i32) { - ^block21(v186: i32, v187: i32, v188: i32): - v189, v190, v191, v192 = hir.exec @std/crypto/hashes/rpo/hash_memory(v186, v187) : felt, felt, felt, felt - v193 = hir.bitcast v188 : u32; - v194 = hir.int_to_ptr v193 : ptr; - hir.store v194, v189; - v195 = arith.constant 4 : u32; - v196 = arith.add v193, v195 : u32 #[overflow = checked]; - v197 = hir.int_to_ptr v196 : ptr; - hir.store v197, v190; - v198 = arith.constant 8 : u32; - v199 = arith.add v193, v198 : u32 #[overflow = checked]; - v200 = hir.int_to_ptr v199 : ptr; - hir.store v200, v191; - v201 = arith.constant 12 : u32; - v202 = arith.add v193, v201 : u32 #[overflow = checked]; - v203 = hir.int_to_ptr v202 : ptr; - hir.store v203, v192; + private builtin.function @miden::core::crypto::hashes::rpo256::hash_words(v90: i32, v91: i32, v92: i32) { + ^block18(v90: i32, v91: i32, v92: i32): + v93, v94, v95, v96 = hir.exec @miden/core/crypto/hashes/rpo256/hash_words(v90, v91) : felt, felt, felt, felt + v97 = hir.bitcast v92 : u32; + v98 = hir.int_to_ptr v97 : ptr; + hir.store v98, v93; + v261 = arith.constant 4 : u32; + v100 = arith.add v97, v261 : u32 #[overflow = checked]; + v101 = hir.int_to_ptr v100 : ptr; + hir.store v101, v94; + v260 = arith.constant 8 : u32; + v103 = arith.add v97, v260 : u32 #[overflow = checked]; + v104 = hir.int_to_ptr v103 : ptr; + hir.store v104, v95; + v259 = arith.constant 12 : u32; + v106 = arith.add v97, v259 : u32 #[overflow = checked]; + v107 = hir.int_to_ptr v106 : ptr; + hir.store v107, v96; builtin.ret ; }; - private builtin.function @std::crypto::hashes::rpo::hash_memory_words(v204: i32, v205: i32, v206: i32) { - ^block27(v204: i32, v205: i32, v206: i32): - v207, v208, v209, v210 = hir.exec @std/crypto/hashes/rpo/hash_memory_words(v204, v205) : felt, felt, felt, felt - v211 = hir.bitcast v206 : u32; - v212 = hir.int_to_ptr v211 : ptr; - hir.store v212, v207; - v213 = arith.constant 4 : u32; - v214 = arith.add v211, v213 : u32 #[overflow = checked]; - v215 = hir.int_to_ptr v214 : ptr; - hir.store v215, v208; - v216 = arith.constant 8 : u32; - v217 = arith.add v211, v216 : u32 #[overflow = checked]; - v218 = hir.int_to_ptr v217 : ptr; - hir.store v218, v209; - v219 = arith.constant 12 : u32; - v220 = arith.add v211, v219 : u32 #[overflow = checked]; - v221 = hir.int_to_ptr v220 : ptr; - hir.store v221, v210; - builtin.ret ; - }; - - private builtin.function @::deallocate(v222: i32, v223: i32, v224: i32) { - ^block29(v222: i32, v223: i32, v224: i32): - v226 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr - v227 = hir.bitcast v226 : ptr; - v228 = hir.load v227 : i32; - v229 = arith.constant 16 : i32; - v230 = arith.sub v228, v229 : i32 #[overflow = wrapping]; - v231 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr - v232 = hir.bitcast v231 : ptr; - hir.store v232, v230; - v233 = arith.constant 4 : i32; - v234 = arith.add v230, v233 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/hash_elements/::current_memory(v234, v222, v223, v224) - v236 = arith.constant 8 : u32; - v235 = hir.bitcast v230 : u32; - v237 = arith.add v235, v236 : u32 #[overflow = checked]; - v238 = arith.constant 4 : u32; - v239 = arith.mod v237, v238 : u32; - hir.assertz v239 #[code = 250]; - v240 = hir.int_to_ptr v237 : ptr; - v241 = hir.load v240 : i32; - v437 = arith.constant 0 : i32; - v225 = arith.constant 0 : i32; - v243 = arith.eq v241, v225 : i1; - v244 = arith.zext v243 : u32; - v245 = hir.bitcast v244 : i32; - v247 = arith.neq v245, v437 : i1; - scf.if v247{ - ^block52: + private builtin.function @::deallocate(v108: i32, v109: i32, v110: i32) { + ^block20(v108: i32, v109: i32, v110: i32): + hir.store_local v110 #[local = lv2]; + v111 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr + v112 = hir.bitcast v111 : ptr; + v113 = hir.load v112 : i32; + v267 = arith.constant 16 : i32; + v115 = arith.sub v113, v267 : i32 #[overflow = wrapping]; + hir.store_local v115 #[local = lv3]; + v116 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr + v117 = hir.bitcast v116 : ptr; + hir.store v117, v115; + v118 = hir.load_local : i32 #[local = lv3]; + v123 = hir.load_local : i32 #[local = lv2]; + v266 = arith.constant 4 : i32; + v120 = arith.add v118, v266 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/hash_elements/::current_memory(v120, v108, v109, v123) + v124 = hir.load_local : i32 #[local = lv3]; + v265 = arith.constant 8 : u32; + v125 = hir.bitcast v124 : u32; + v127 = arith.add v125, v265 : u32 #[overflow = checked]; + v264 = arith.constant 4 : u32; + v129 = arith.mod v127, v264 : u32; + hir.assertz v129 #[code = 250]; + v130 = hir.int_to_ptr v127 : ptr; + v131 = hir.load v130 : i32; + hir.store_local v131 #[local = lv2]; + v278 = arith.constant 0 : i32; + v272 = arith.constant 0 : i32; + v133 = arith.eq v131, v272 : i1; + v134 = arith.zext v133 : u32; + v135 = hir.bitcast v134 : i32; + v137 = arith.neq v135, v278 : i1; + scf.if v137{ + ^block34: scf.yield ; } else { - ^block32: - v436 = arith.constant 4 : u32; - v248 = hir.bitcast v230 : u32; - v250 = arith.add v248, v436 : u32 #[overflow = checked]; - v435 = arith.constant 4 : u32; - v252 = arith.mod v250, v435 : u32; - hir.assertz v252 #[code = 250]; - v253 = hir.int_to_ptr v250 : ptr; - v254 = hir.load v253 : i32; - v256 = arith.constant 12 : u32; - v255 = hir.bitcast v230 : u32; - v257 = arith.add v255, v256 : u32 #[overflow = checked]; - v434 = arith.constant 4 : u32; - v259 = arith.mod v257, v434 : u32; - hir.assertz v259 #[code = 250]; - v260 = hir.int_to_ptr v257 : ptr; - v261 = hir.load v260 : i32; - hir.exec @root_ns:root@1.0.0/hash_elements/::deallocate(v254, v241, v261) + ^block23: + v138 = hir.load_local : i32 #[local = lv3]; + v277 = arith.constant 4 : u32; + v139 = hir.bitcast v138 : u32; + v141 = arith.add v139, v277 : u32 #[overflow = checked]; + v276 = arith.constant 4 : u32; + v143 = arith.mod v141, v276 : u32; + hir.assertz v143 #[code = 250]; + v144 = hir.int_to_ptr v141 : ptr; + v145 = hir.load v144 : i32; + v146 = hir.load_local : i32 #[local = lv2]; + v147 = hir.load_local : i32 #[local = lv3]; + v262 = arith.constant 12 : u32; + v148 = hir.bitcast v147 : u32; + v150 = arith.add v148, v262 : u32 #[overflow = checked]; + v275 = arith.constant 4 : u32; + v152 = arith.mod v150, v275 : u32; + hir.assertz v152 #[code = 250]; + v153 = hir.int_to_ptr v150 : ptr; + v154 = hir.load v153 : i32; + hir.exec @root_ns:root@1.0.0/hash_elements/::deallocate(v145, v146, v154) scf.yield ; }; - v433 = arith.constant 16 : i32; - v264 = arith.add v230, v433 : i32 #[overflow = wrapping]; - v265 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr - v266 = hir.bitcast v265 : ptr; - hir.store v266, v264; + v155 = hir.load_local : i32 #[local = lv3]; + v274 = arith.constant 16 : i32; + v157 = arith.add v155, v274 : i32 #[overflow = wrapping]; + v158 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr + v159 = hir.bitcast v158 : ptr; + hir.store v159, v157; builtin.ret ; }; - private builtin.function @::current_memory(v267: i32, v268: i32, v269: i32, v270: i32) { - ^block33(v267: i32, v268: i32, v269: i32, v270: i32): - v463 = arith.constant 0 : i32; - v271 = arith.constant 0 : i32; - v275 = arith.eq v270, v271 : i1; - v276 = arith.zext v275 : u32; - v277 = hir.bitcast v276 : i32; - v279 = arith.neq v277, v463 : i1; - v450, v451 = scf.if v279 : i32, i32 { - ^block55: - v462 = arith.constant 0 : i32; - v273 = arith.constant 4 : i32; - scf.yield v273, v462; + private builtin.function @::current_memory(v160: i32, v161: i32, v162: i32, v163: i32) { + ^block24(v160: i32, v161: i32, v162: i32, v163: i32): + hir.store_local v160 #[local = lv0]; + hir.store_local v161 #[local = lv1]; + hir.store_local v162 #[local = lv2]; + hir.store_local v163 #[local = lv3]; + v282 = arith.constant 0 : i32; + hir.store_local v282 #[local = lv4]; + v281 = arith.constant 4 : i32; + hir.store_local v281 #[local = lv5]; + v166 = hir.load_local : i32 #[local = lv3]; + v302 = arith.constant 0 : i32; + v303 = arith.constant 0 : i32; + v168 = arith.eq v166, v303 : i1; + v169 = arith.zext v168 : u32; + v170 = hir.bitcast v169 : i32; + v172 = arith.neq v170, v302 : i1; + scf.if v172{ + ^block37: + scf.yield ; } else { - ^block36: - v280 = hir.bitcast v268 : u32; - v315 = arith.constant 4 : u32; - v282 = arith.mod v280, v315 : u32; - hir.assertz v282 #[code = 250]; - v283 = hir.int_to_ptr v280 : ptr; - v284 = hir.load v283 : i32; - v460 = arith.constant 0 : i32; - v461 = arith.constant 0 : i32; - v286 = arith.eq v284, v461 : i1; - v287 = arith.zext v286 : u32; - v288 = hir.bitcast v287 : i32; - v290 = arith.neq v288, v460 : i1; - v448 = scf.if v290 : i32 { - ^block54: - v459 = arith.constant 0 : i32; - scf.yield v459; + ^block27: + v173 = hir.load_local : i32 #[local = lv1]; + v174 = hir.bitcast v173 : u32; + v290 = arith.constant 4 : u32; + v176 = arith.mod v174, v290 : u32; + hir.assertz v176 #[code = 250]; + v177 = hir.int_to_ptr v174 : ptr; + v178 = hir.load v177 : i32; + hir.store_local v178 #[local = lv6]; + v300 = arith.constant 0 : i32; + v301 = arith.constant 0 : i32; + v180 = arith.eq v178, v301 : i1; + v181 = arith.zext v180 : u32; + v182 = hir.bitcast v181 : i32; + v184 = arith.neq v182, v300 : i1; + scf.if v184{ + ^block36: + scf.yield ; } else { - ^block37: - v458 = arith.constant 4 : u32; - v291 = hir.bitcast v267 : u32; - v293 = arith.add v291, v458 : u32 #[overflow = checked]; - v457 = arith.constant 4 : u32; - v295 = arith.mod v293, v457 : u32; - hir.assertz v295 #[code = 250]; - v296 = hir.int_to_ptr v293 : ptr; - hir.store v296, v269; - v456 = arith.constant 4 : u32; - v297 = hir.bitcast v268 : u32; - v299 = arith.add v297, v456 : u32 #[overflow = checked]; - v455 = arith.constant 4 : u32; - v301 = arith.mod v299, v455 : u32; - hir.assertz v301 #[code = 250]; - v302 = hir.int_to_ptr v299 : ptr; - v303 = hir.load v302 : i32; - v304 = hir.bitcast v267 : u32; - v454 = arith.constant 4 : u32; - v306 = arith.mod v304, v454 : u32; - hir.assertz v306 #[code = 250]; - v307 = hir.int_to_ptr v304 : ptr; - hir.store v307, v303; - v308 = arith.mul v284, v270 : i32 #[overflow = wrapping]; - scf.yield v308; + ^block28: + v185 = hir.load_local : i32 #[local = lv0]; + v186 = hir.load_local : i32 #[local = lv2]; + v299 = arith.constant 4 : u32; + v187 = hir.bitcast v185 : u32; + v189 = arith.add v187, v299 : u32 #[overflow = checked]; + v298 = arith.constant 4 : u32; + v191 = arith.mod v189, v298 : u32; + hir.assertz v191 #[code = 250]; + v192 = hir.int_to_ptr v189 : ptr; + hir.store v192, v186; + v193 = hir.load_local : i32 #[local = lv0]; + v194 = hir.load_local : i32 #[local = lv1]; + v297 = arith.constant 4 : u32; + v195 = hir.bitcast v194 : u32; + v197 = arith.add v195, v297 : u32 #[overflow = checked]; + v296 = arith.constant 4 : u32; + v199 = arith.mod v197, v296 : u32; + hir.assertz v199 #[code = 250]; + v200 = hir.int_to_ptr v197 : ptr; + v201 = hir.load v200 : i32; + v202 = hir.bitcast v193 : u32; + v295 = arith.constant 4 : u32; + v204 = arith.mod v202, v295 : u32; + hir.assertz v204 #[code = 250]; + v205 = hir.int_to_ptr v202 : ptr; + hir.store v205, v201; + v206 = hir.load_local : i32 #[local = lv6]; + v207 = hir.load_local : i32 #[local = lv3]; + v208 = arith.mul v206, v207 : i32 #[overflow = wrapping]; + hir.store_local v208 #[local = lv4]; + v279 = arith.constant 8 : i32; + hir.store_local v279 #[local = lv5]; + scf.yield ; }; - v309 = arith.constant 8 : i32; - v453 = arith.constant 4 : i32; - v449 = cf.select v290, v453, v309 : i32; - scf.yield v449, v448; + scf.yield ; }; - v312 = arith.add v267, v450 : i32 #[overflow = wrapping]; - v314 = hir.bitcast v312 : u32; - v452 = arith.constant 4 : u32; - v316 = arith.mod v314, v452 : u32; - hir.assertz v316 #[code = 250]; - v317 = hir.int_to_ptr v314 : ptr; - hir.store v317, v451; + v210 = hir.load_local : i32 #[local = lv0]; + v211 = hir.load_local : i32 #[local = lv5]; + v213 = hir.load_local : i32 #[local = lv4]; + v212 = arith.add v210, v211 : i32 #[overflow = wrapping]; + v214 = hir.bitcast v212 : u32; + v294 = arith.constant 4 : u32; + v216 = arith.mod v214, v294 : u32; + hir.assertz v216 #[code = 250]; + v217 = hir.int_to_ptr v214 : ptr; + hir.store v217, v213; builtin.ret ; }; - private builtin.function @::deallocate(v318: i32, v319: i32, v320: i32) { - ^block38(v318: i32, v319: i32, v320: i32): - v465 = arith.constant 0 : i32; - v321 = arith.constant 0 : i32; - v322 = arith.eq v320, v321 : i1; - v323 = arith.zext v322 : u32; - v324 = hir.bitcast v323 : i32; - v326 = arith.neq v324, v465 : i1; - scf.if v326{ - ^block40: + private builtin.function @::deallocate(v218: i32, v219: i32, v220: i32) { + ^block29(v218: i32, v219: i32, v220: i32): + hir.store_local v218 #[local = lv0]; + hir.store_local v219 #[local = lv1]; + hir.store_local v220 #[local = lv2]; + v221 = hir.load_local : i32 #[local = lv2]; + v307 = arith.constant 0 : i32; + v305 = arith.constant 0 : i32; + v223 = arith.eq v221, v305 : i1; + v224 = arith.zext v223 : u32; + v225 = hir.bitcast v224 : i32; + v227 = arith.neq v225, v307 : i1; + scf.if v227{ + ^block31: scf.yield ; } else { - ^block41: - hir.exec @root_ns:root@1.0.0/hash_elements/__rustc::__rust_dealloc(v318, v320, v319) + ^block32: + v228 = hir.load_local : i32 #[local = lv0]; + v229 = hir.load_local : i32 #[local = lv2]; + v230 = hir.load_local : i32 #[local = lv1]; + hir.exec @root_ns:root@1.0.0/hash_elements/__rustc::__rust_dealloc(v228, v229, v230) scf.yield ; }; builtin.ret ; diff --git a/tests/integration/expected/hash_elements.masm b/tests/integration/expected/hash_elements.masm index 79abe2ac1..328455c5c 100644 --- a/tests/integration/expected/hash_elements.masm +++ b/tests/integration/expected/hash_elements.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,8 +10,9 @@ proc init mem_store.278528 end -# mod root_ns:root@1.0.0::hash_elements +# mod ::"root_ns:root@1.0.0"::hash_elements +@locals("3") @callconv("C") proc __rustc::__rust_dealloc(i32, i32, i32) drop @@ -19,8 +20,17 @@ proc __rustc::__rust_dealloc(i32, i32, i32) drop end +@locals("5") @callconv("C") pub proc entrypoint(i32) -> felt + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114112 u32divmod.4 swap.1 @@ -29,11 +39,18 @@ pub proc entrypoint(i32) -> felt exec.::intrinsics::mem::load_sw trace.252 nop - push.48 + push.16 u32wrapping_sub - push.1114112 - dup.1 + dup.0 + locaddr.1 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114112 u32divmod.4 swap.1 trace.240 @@ -41,8 +58,16 @@ pub proc entrypoint(i32) -> felt exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.2 + swap.1 add u32assert push.4 @@ -58,8 +83,24 @@ pub proc entrypoint(i32) -> felt exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.3 + swap.1 add u32assert push.4 @@ -79,80 +120,114 @@ pub proc entrypoint(i32) -> felt swap.1 swap.1 u32shr - push.3 - dup.1 - u32and - trace.240 - nop - exec.::root_ns:root@1.0.0::hash_elements::intrinsics::felt::from_u32 - trace.252 - nop + dup.0 + locaddr.3 push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::hash_elements::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_sw trace.252 nop + push.0 + push.3 + movup.2 + u32and + assert_eq + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::hash_elements::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_sw trace.252 nop push.0 push.0 push.3 - dup.4 + movup.3 u32and eq neq if.true - push.16 - dup.3 - u32wrapping_add - movup.2 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 dup.2 u32wrapping_add movup.2 trace.240 nop - exec.::root_ns:root@1.0.0::hash_elements::std::crypto::hashes::rpo::hash_memory_words + exec.::"root_ns:root@1.0.0"::hash_elements::"miden::core::crypto::hashes::rpo256::hash_words" trace.252 nop else - push.16 - dup.3 - u32wrapping_add - movdn.2 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::hash_elements::std::crypto::hashes::rpo::hash_memory + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.2 + trace.240 + nop + exec.::"root_ns:root@1.0.0"::hash_elements::"miden::core::crypto::hashes::rpo256::hash_elements" trace.252 nop end - push.24 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + push.12 swap.1 - push.40 - dup.3 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -160,84 +235,44 @@ pub proc entrypoint(i32) -> felt assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop - push.16 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.4 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.0 + push.0 swap.1 - push.32 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.32 - dup.1 - u32wrapping_add - dup.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::hash_elements::::reverse + exec.::intrinsics::mem::load_sw trace.252 nop push.4 dup.0 swap.2 - swap.3 trace.240 nop - exec.::root_ns:root@1.0.0::hash_elements::::deallocate + exec.::"root_ns:root@1.0.0"::hash_elements::::deallocate trace.252 nop - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::load_sw trace.252 nop - push.48 - movup.2 + push.16 u32wrapping_add push.1114112 u32divmod.4 @@ -247,300 +282,21 @@ pub proc entrypoint(i32) -> felt exec.::intrinsics::mem::store_sw trace.252 nop -end - -@callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114112 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.12 - dup.1 - u32wrapping_add + locaddr.4 push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.4 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop end @callconv("C") -proc intrinsics::felt::assert_eq(felt, felt) - assert_eq -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc std::crypto::hashes::rpo::hash_memory(i32, i32, i32) +proc miden::core::crypto::hashes::rpo256::hash_elements(i32, i32, i32) trace.240 nop - exec.::std::crypto::hashes::rpo::hash_memory + exec.::miden::core::crypto::hashes::rpo256::hash_elements trace.252 nop movup.4 @@ -593,10 +349,10 @@ proc std::crypto::hashes::rpo::hash_memory(i32, i32, i32) end @callconv("C") -proc std::crypto::hashes::rpo::hash_memory_words(i32, i32, i32) +proc miden::core::crypto::hashes::rpo256::hash_words(i32, i32, i32) trace.240 nop - exec.::std::crypto::hashes::rpo::hash_memory_words + exec.::miden::core::crypto::hashes::rpo256::hash_words trace.252 nop movup.4 @@ -648,12 +404,22 @@ proc std::crypto::hashes::rpo::hash_memory_words(i32, i32, i32) nop end +@locals("4") @callconv("C") proc ::deallocate( i32, i32, i32 ) + movup.2 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114112 u32divmod.4 swap.1 @@ -664,9 +430,16 @@ proc ::deallocate( nop push.16 u32wrapping_sub - push.1114112 - dup.1 + dup.0 + locaddr.3 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114112 u32divmod.4 swap.1 trace.240 @@ -674,21 +447,44 @@ proc ::deallocate( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + movup.2 u32wrapping_add swap.1 - swap.4 swap.3 swap.2 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::hash_elements::::current_memory + exec.::"root_ns:root@1.0.0"::hash_elements::"::current_memory" + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.1 + swap.1 add u32assert push.4 @@ -704,16 +500,33 @@ proc ::deallocate( exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 push.0 - dup.2 + movup.2 eq neq if.true - drop + nop else + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.2 + swap.1 add u32assert push.4 @@ -729,8 +542,24 @@ proc ::deallocate( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.3 + swap.1 add u32assert push.4 @@ -746,13 +575,21 @@ proc ::deallocate( exec.::intrinsics::mem::load_sw trace.252 nop - movdn.2 + swap.2 trace.240 nop - exec.::root_ns:root@1.0.0::hash_elements::::deallocate + exec.::"root_ns:root@1.0.0"::hash_elements::"::deallocate" trace.252 nop end + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114112 @@ -765,6 +602,7 @@ proc ::deallocate( nop end +@locals("7") @callconv("C") proc ::current_memory( i32, @@ -772,20 +610,80 @@ proc ::current_memory( i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 - dup.5 + push.0 + movup.2 eq neq if.true - movdn.3 - drop - drop - drop - push.0 - push.4 + nop else - dup.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -799,25 +697,41 @@ proc ::current_memory( exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 push.0 - dup.2 + movup.2 eq neq - dup.0 if.true + nop + else + locaddr.0 + push.0 swap.1 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 push.0 - else + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.3 + movup.2 add u32assert push.4 @@ -826,8 +740,6 @@ proc ::current_memory( u32mod u32assert assertz - movup.5 - swap.1 u32divmod.4 swap.1 trace.240 @@ -835,8 +747,24 @@ proc ::current_memory( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - movup.4 + swap.1 add u32assert push.4 @@ -852,7 +780,7 @@ proc ::current_memory( exec.::intrinsics::mem::load_sw trace.252 nop - dup.3 + swap.1 push.4 dup.1 swap.1 @@ -866,21 +794,71 @@ proc ::current_memory( exec.::intrinsics::mem::store_sw trace.252 nop - swap.3 + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop trace.240 nop exec.::intrinsics::i32::wrapping_mul trace.252 nop - movup.2 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + locaddr.5 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.8 - push.4 - movup.3 - cdrop end - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movdn.2 u32wrapping_add push.4 dup.1 @@ -897,27 +875,81 @@ proc ::current_memory( nop end +@locals("3") @callconv("C") proc ::deallocate( i32, i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.0 - dup.4 + movup.2 eq neq if.true - drop - drop - drop + nop else - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::hash_elements::__rustc::__rust_dealloc + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.2 + trace.240 + nop + exec.::"root_ns:root@1.0.0"::hash_elements::__rustc::__rust_dealloc trace.252 nop end diff --git a/tests/integration/expected/hash_elements.wat b/tests/integration/expected/hash_elements.wat index 094889413..a8c241dc4 100644 --- a/tests/integration/expected/hash_elements.wat +++ b/tests/integration/expected/hash_elements.wat @@ -1,9 +1,8 @@ (module $hash_elements.wasm (type (;0;) (func (param i32 i32 i32))) (type (;1;) (func (param i32) (result f32))) - (type (;2;) (func (param i32 i32))) - (type (;3;) (func (param f32 f32))) - (type (;4;) (func (param i32 i32 i32 i32))) + (type (;2;) (func (param f32 f32))) + (type (;3;) (func (param i32 i32 i32 i32))) (table (;0;) 1 1 funcref) (memory (;0;) 16) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -13,7 +12,7 @@ (func $entrypoint (;1;) (type 1) (param i32) (result f32) (local i32 i32 i32 f32) global.get $__stack_pointer - i32.const 48 + i32.const 16 i32.sub local.tee 1 global.set $__stack_pointer @@ -41,9 +40,7 @@ local.get 3 local.get 2 local.get 1 - i32.const 16 - i32.add - call $std::crypto::hashes::rpo::hash_memory + call $miden::core::crypto::hashes::rpo256::hash_elements br 1 (;@1;) end local.get 3 @@ -51,107 +48,34 @@ local.get 2 i32.add local.get 1 - i32.const 16 - i32.add - call $std::crypto::hashes::rpo::hash_memory_words + call $miden::core::crypto::hashes::rpo256::hash_words end local.get 1 - local.get 1 - i64.load offset=24 - i64.store offset=40 - local.get 1 - local.get 1 - i64.load offset=16 - i64.store offset=32 - local.get 1 - local.get 1 - i32.const 32 - i32.add - call $::reverse + f32.load offset=12 + local.set 4 local.get 0 i32.const 4 i32.const 4 call $::deallocate local.get 1 - f32.load - local.set 4 - local.get 1 - i32.const 48 + i32.const 16 i32.add global.set $__stack_pointer local.get 4 ) - (func $::reverse (;2;) (type 2) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store - ) - (func $intrinsics::felt::assert_eq (;3;) (type 3) (param f32 f32) + (func $intrinsics::felt::assert_eq (;2;) (type 2) (param f32 f32) unreachable ) - (func $intrinsics::felt::from_u32 (;4;) (type 1) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;3;) (type 1) (param i32) (result f32) unreachable ) - (func $std::crypto::hashes::rpo::hash_memory (;5;) (type 0) (param i32 i32 i32) + (func $miden::core::crypto::hashes::rpo256::hash_elements (;4;) (type 0) (param i32 i32 i32) unreachable ) - (func $std::crypto::hashes::rpo::hash_memory_words (;6;) (type 0) (param i32 i32 i32) + (func $miden::core::crypto::hashes::rpo256::hash_words (;5;) (type 0) (param i32 i32 i32) unreachable ) - (func $::deallocate (;7;) (type 0) (param i32 i32 i32) + (func $::deallocate (;6;) (type 0) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -183,7 +107,7 @@ i32.add global.set $__stack_pointer ) - (func $::current_memory (;8;) (type 4) (param i32 i32 i32 i32) + (func $::current_memory (;7;) (type 3) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -218,7 +142,7 @@ local.get 4 i32.store ) - (func $::deallocate (;9;) (type 0) (param i32 i32 i32) + (func $::deallocate (;8;) (type 0) (param i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz diff --git a/tests/integration/expected/hash_words.hir b/tests/integration/expected/hash_words.hir index 52f69ede5..5c7ecf2b8 100644 --- a/tests/integration/expected/hash_words.hir +++ b/tests/integration/expected/hash_words.hir @@ -7,402 +7,273 @@ builtin.component root_ns:root@1.0.0 { public builtin.function @entrypoint(v3: i32) -> felt { ^block6(v3: i32): - v7 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr - v8 = hir.bitcast v7 : ptr; - v9 = hir.load v8 : i32; - v10 = arith.constant 48 : i32; - v11 = arith.sub v9, v10 : i32 #[overflow = wrapping]; - v12 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr - v13 = hir.bitcast v12 : ptr; - hir.store v13, v11; - v15 = arith.constant 4 : u32; - v14 = hir.bitcast v3 : u32; - v16 = arith.add v14, v15 : u32 #[overflow = checked]; - v311 = arith.constant 4 : u32; - v18 = arith.mod v16, v311 : u32; - hir.assertz v18 #[code = 250]; - v19 = hir.int_to_ptr v16 : ptr; - v20 = hir.load v19 : i32; - v22 = arith.constant 8 : u32; - v21 = hir.bitcast v3 : u32; - v23 = arith.add v21, v22 : u32 #[overflow = checked]; - v310 = arith.constant 4 : u32; - v25 = arith.mod v23, v310 : u32; + hir.store_local v3 #[local = lv0]; + v5 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr + v6 = hir.bitcast v5 : ptr; + v7 = hir.load v6 : i32; + v212 = arith.constant 16 : i32; + v9 = arith.sub v7, v212 : i32 #[overflow = wrapping]; + hir.store_local v9 #[local = lv1]; + v10 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr + v11 = hir.bitcast v10 : ptr; + hir.store v11, v9; + v12 = hir.load_local : i32 #[local = lv0]; + v211 = arith.constant 4 : u32; + v13 = hir.bitcast v12 : u32; + v15 = arith.add v13, v211 : u32 #[overflow = checked]; + v224 = arith.constant 4 : u32; + v17 = arith.mod v15, v224 : u32; + hir.assertz v17 #[code = 250]; + v18 = hir.int_to_ptr v15 : ptr; + v19 = hir.load v18 : i32; + hir.store_local v19 #[local = lv2]; + v20 = hir.load_local : i32 #[local = lv0]; + v210 = arith.constant 8 : u32; + v21 = hir.bitcast v20 : u32; + v23 = arith.add v21, v210 : u32 #[overflow = checked]; + v223 = arith.constant 4 : u32; + v25 = arith.mod v23, v223 : u32; hir.assertz v25 #[code = 250]; v26 = hir.int_to_ptr v23 : ptr; v27 = hir.load v26 : i32; - v5 = arith.constant 0 : i32; - v29 = hir.exec @root_ns:root@1.0.0/hash_words/intrinsics::felt::from_u32(v5) : felt - v309 = arith.constant 0 : i32; - v31 = hir.exec @root_ns:root@1.0.0/hash_words/intrinsics::felt::from_u32(v309) : felt - hir.exec @root_ns:root@1.0.0/hash_words/intrinsics::felt::assert_eq(v29, v31) - v300 = arith.constant 2 : u32; - v33 = hir.bitcast v20 : u32; - v35 = arith.shr v33, v300 : u32; - v36 = hir.bitcast v35 : i32; - v41 = arith.constant 16 : i32; - v42 = arith.add v11, v41 : i32 #[overflow = wrapping]; - v308 = arith.constant 2 : u32; - v39 = arith.shl v27, v308 : i32; - v40 = arith.add v36, v39 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/hash_words/std::crypto::hashes::rpo::hash_memory_words(v36, v40, v42) - v44 = arith.constant 24 : u32; - v43 = hir.bitcast v11 : u32; - v45 = arith.add v43, v44 : u32 #[overflow = checked]; - v307 = arith.constant 8 : u32; - v47 = arith.mod v45, v307 : u32; - hir.assertz v47 #[code = 250]; - v48 = hir.int_to_ptr v45 : ptr; - v49 = hir.load v48 : i64; - v51 = arith.constant 40 : u32; - v50 = hir.bitcast v11 : u32; - v52 = arith.add v50, v51 : u32 #[overflow = checked]; - v306 = arith.constant 8 : u32; - v54 = arith.mod v52, v306 : u32; - hir.assertz v54 #[code = 250]; - v55 = hir.int_to_ptr v52 : ptr; - hir.store v55, v49; - v57 = arith.constant 16 : u32; - v56 = hir.bitcast v11 : u32; - v58 = arith.add v56, v57 : u32 #[overflow = checked]; - v305 = arith.constant 8 : u32; - v60 = arith.mod v58, v305 : u32; - hir.assertz v60 #[code = 250]; - v61 = hir.int_to_ptr v58 : ptr; - v62 = hir.load v61 : i64; - v64 = arith.constant 32 : u32; - v63 = hir.bitcast v11 : u32; - v65 = arith.add v63, v64 : u32 #[overflow = checked]; - v304 = arith.constant 8 : u32; - v67 = arith.mod v65, v304 : u32; - hir.assertz v67 #[code = 250]; - v68 = hir.int_to_ptr v65 : ptr; - hir.store v68, v62; - v69 = arith.constant 32 : i32; - v70 = arith.add v11, v69 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/hash_words/::reverse(v11, v70) - v71 = hir.bitcast v11 : u32; - v303 = arith.constant 4 : u32; - v73 = arith.mod v71, v303 : u32; - hir.assertz v73 #[code = 250]; - v74 = hir.int_to_ptr v71 : ptr; - v75 = hir.load v74 : felt; - v302 = arith.constant 16 : i32; - hir.exec @root_ns:root@1.0.0/hash_words/::deallocate(v3, v302, v302) - v301 = arith.constant 48 : i32; - v79 = arith.add v11, v301 : i32 #[overflow = wrapping]; - v80 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr - v81 = hir.bitcast v80 : ptr; - hir.store v81, v79; - builtin.ret v75; + v208 = arith.constant 0 : felt; + hir.assert_eq v208, v208; + v32 = hir.load_local : i32 #[local = lv2]; + v207 = arith.constant 2 : u32; + v34 = hir.bitcast v32 : u32; + v36 = arith.shr v34, v207 : u32; + v37 = hir.bitcast v36 : i32; + hir.store_local v37 #[local = lv2]; + v38 = hir.load_local : i32 #[local = lv2]; + v44 = hir.load_local : i32 #[local = lv1]; + v222 = arith.constant 2 : u32; + v42 = arith.shl v27, v222 : i32; + v43 = arith.add v38, v42 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/hash_words/miden::core::crypto::hashes::rpo256::hash_words(v37, v43, v44) + v45 = hir.load_local : i32 #[local = lv1]; + v209 = arith.constant 12 : u32; + v46 = hir.bitcast v45 : u32; + v48 = arith.add v46, v209 : u32 #[overflow = checked]; + v221 = arith.constant 4 : u32; + v50 = arith.mod v48, v221 : u32; + hir.assertz v50 #[code = 250]; + v51 = hir.int_to_ptr v48 : ptr; + v52 = hir.load v51 : felt; + hir.store_local v52 #[local = lv4]; + v53 = hir.load_local : i32 #[local = lv0]; + v220 = arith.constant 16 : i32; + hir.exec @root_ns:root@1.0.0/hash_words/::deallocate(v53, v220, v220) + v56 = hir.load_local : i32 #[local = lv1]; + v219 = arith.constant 16 : i32; + v58 = arith.add v56, v219 : i32 #[overflow = wrapping]; + v59 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr + v60 = hir.bitcast v59 : ptr; + hir.store v60, v58; + v61 = hir.load_local : felt #[local = lv4]; + builtin.ret v61; }; - private builtin.function @::reverse(v82: i32, v83: i32) { - ^block8(v82: i32, v83: i32): - v86 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr - v87 = hir.bitcast v86 : ptr; - v88 = hir.load v87 : i32; - v89 = arith.constant 16 : i32; - v90 = arith.sub v88, v89 : i32 #[overflow = wrapping]; - v92 = arith.constant 8 : u32; - v91 = hir.bitcast v83 : u32; - v93 = arith.add v91, v92 : u32 #[overflow = checked]; - v398 = arith.constant 8 : u32; - v95 = arith.mod v93, v398 : u32; - hir.assertz v95 #[code = 250]; - v96 = hir.int_to_ptr v93 : ptr; - v97 = hir.load v96 : i64; - v397 = arith.constant 8 : u32; - v98 = hir.bitcast v90 : u32; - v100 = arith.add v98, v397 : u32 #[overflow = checked]; - v101 = arith.constant 4 : u32; - v102 = arith.mod v100, v101 : u32; - hir.assertz v102 #[code = 250]; - v103 = hir.int_to_ptr v100 : ptr; - hir.store v103, v97; - v104 = hir.bitcast v83 : u32; - v396 = arith.constant 8 : u32; - v106 = arith.mod v104, v396 : u32; - hir.assertz v106 #[code = 250]; - v107 = hir.int_to_ptr v104 : ptr; - v108 = hir.load v107 : i64; - v109 = hir.bitcast v90 : u32; - v395 = arith.constant 4 : u32; - v111 = arith.mod v109, v395 : u32; - hir.assertz v111 #[code = 250]; - v112 = hir.int_to_ptr v109 : ptr; - hir.store v112, v108; - v113 = arith.constant 12 : i32; - v114 = arith.add v90, v113 : i32 #[overflow = wrapping]; - v84 = arith.constant 0 : i32; - v366, v367, v368, v369, v370, v371 = scf.while v84, v90, v114, v82 : i32, i32, i32, i32, i32, i32 { - ^block44(v372: i32, v373: i32, v374: i32, v375: i32): - v394 = arith.constant 0 : i32; - v117 = arith.constant 8 : i32; - v118 = arith.eq v372, v117 : i1; - v119 = arith.zext v118 : u32; - v120 = hir.bitcast v119 : i32; - v122 = arith.neq v120, v394 : i1; - v360, v361 = scf.if v122 : i32, i32 { - ^block43: - v320 = ub.poison i32 : i32; - scf.yield v320, v320; - } else { - ^block13: - v124 = arith.add v373, v372 : i32 #[overflow = wrapping]; - v125 = hir.bitcast v124 : u32; - v393 = arith.constant 4 : u32; - v127 = arith.mod v125, v393 : u32; - hir.assertz v127 #[code = 250]; - v128 = hir.int_to_ptr v125 : ptr; - v129 = hir.load v128 : felt; - v131 = hir.bitcast v374 : u32; - v392 = arith.constant 4 : u32; - v133 = arith.mod v131, v392 : u32; - hir.assertz v133 #[code = 250]; - v134 = hir.int_to_ptr v131 : ptr; - v135 = hir.load v134 : i32; - v136 = hir.bitcast v124 : u32; - v391 = arith.constant 4 : u32; - v138 = arith.mod v136, v391 : u32; - hir.assertz v138 #[code = 250]; - v139 = hir.int_to_ptr v136 : ptr; - hir.store v139, v135; - v140 = hir.bitcast v374 : u32; - v390 = arith.constant 4 : u32; - v142 = arith.mod v140, v390 : u32; - hir.assertz v142 #[code = 250]; - v143 = hir.int_to_ptr v140 : ptr; - hir.store v143, v129; - v146 = arith.constant -4 : i32; - v147 = arith.add v374, v146 : i32 #[overflow = wrapping]; - v144 = arith.constant 4 : i32; - v145 = arith.add v372, v144 : i32 #[overflow = wrapping]; - scf.yield v145, v147; - }; - v388 = ub.poison i32 : i32; - v363 = cf.select v122, v388, v375 : i32; - v389 = ub.poison i32 : i32; - v362 = cf.select v122, v389, v373 : i32; - v319 = arith.constant 1 : u32; - v312 = arith.constant 0 : u32; - v365 = cf.select v122, v312, v319 : u32; - v353 = arith.trunc v365 : i1; - scf.condition v353, v360, v362, v361, v363, v373, v375; - } do { - ^block45(v376: i32, v377: i32, v378: i32, v379: i32, v380: i32, v381: i32): - scf.yield v376, v377, v378, v379; - }; - v387 = arith.constant 8 : u32; - v149 = hir.bitcast v370 : u32; - v151 = arith.add v149, v387 : u32 #[overflow = checked]; - v386 = arith.constant 4 : u32; - v153 = arith.mod v151, v386 : u32; - hir.assertz v153 #[code = 250]; - v154 = hir.int_to_ptr v151 : ptr; - v155 = hir.load v154 : i64; - v385 = arith.constant 8 : u32; - v156 = hir.bitcast v371 : u32; - v158 = arith.add v156, v385 : u32 #[overflow = checked]; - v384 = arith.constant 8 : u32; - v160 = arith.mod v158, v384 : u32; - hir.assertz v160 #[code = 250]; - v161 = hir.int_to_ptr v158 : ptr; - hir.store v161, v155; - v162 = hir.bitcast v370 : u32; - v383 = arith.constant 4 : u32; - v164 = arith.mod v162, v383 : u32; - hir.assertz v164 #[code = 250]; - v165 = hir.int_to_ptr v162 : ptr; - v166 = hir.load v165 : i64; - v167 = hir.bitcast v371 : u32; - v382 = arith.constant 8 : u32; - v169 = arith.mod v167, v382 : u32; - hir.assertz v169 #[code = 250]; - v170 = hir.int_to_ptr v167 : ptr; - hir.store v170, v166; + private builtin.function @miden::core::crypto::hashes::rpo256::hash_words(v62: i32, v63: i32, v64: i32) { + ^block8(v62: i32, v63: i32, v64: i32): + v65, v66, v67, v68 = hir.exec @miden/core/crypto/hashes/rpo256/hash_words(v62, v63) : felt, felt, felt, felt + v69 = hir.bitcast v64 : u32; + v70 = hir.int_to_ptr v69 : ptr; + hir.store v70, v65; + v227 = arith.constant 4 : u32; + v72 = arith.add v69, v227 : u32 #[overflow = checked]; + v73 = hir.int_to_ptr v72 : ptr; + hir.store v73, v66; + v226 = arith.constant 8 : u32; + v75 = arith.add v69, v226 : u32 #[overflow = checked]; + v76 = hir.int_to_ptr v75 : ptr; + hir.store v76, v67; + v225 = arith.constant 12 : u32; + v78 = arith.add v69, v225 : u32 #[overflow = checked]; + v79 = hir.int_to_ptr v78 : ptr; + hir.store v79, v68; builtin.ret ; }; - private builtin.function @intrinsics::felt::assert_eq(v171: felt, v172: felt) { - ^block14(v171: felt, v172: felt): - hir.assert_eq v171, v172; - builtin.ret ; - }; - - private builtin.function @intrinsics::felt::from_u32(v173: i32) -> felt { - ^block16(v173: i32): - v174 = hir.bitcast v173 : felt; - builtin.ret v174; - }; - - private builtin.function @std::crypto::hashes::rpo::hash_memory_words(v176: i32, v177: i32, v178: i32) { - ^block18(v176: i32, v177: i32, v178: i32): - v179, v180, v181, v182 = hir.exec @std/crypto/hashes/rpo/hash_memory_words(v176, v177) : felt, felt, felt, felt - v183 = hir.bitcast v178 : u32; - v184 = hir.int_to_ptr v183 : ptr; - hir.store v184, v179; - v185 = arith.constant 4 : u32; - v186 = arith.add v183, v185 : u32 #[overflow = checked]; - v187 = hir.int_to_ptr v186 : ptr; - hir.store v187, v180; - v188 = arith.constant 8 : u32; - v189 = arith.add v183, v188 : u32 #[overflow = checked]; - v190 = hir.int_to_ptr v189 : ptr; - hir.store v190, v181; - v191 = arith.constant 12 : u32; - v192 = arith.add v183, v191 : u32 #[overflow = checked]; - v193 = hir.int_to_ptr v192 : ptr; - hir.store v193, v182; - builtin.ret ; - }; - - private builtin.function @::deallocate(v194: i32, v195: i32, v196: i32) { - ^block24(v194: i32, v195: i32, v196: i32): - v198 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr - v199 = hir.bitcast v198 : ptr; - v200 = hir.load v199 : i32; - v201 = arith.constant 16 : i32; - v202 = arith.sub v200, v201 : i32 #[overflow = wrapping]; - v203 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr - v204 = hir.bitcast v203 : ptr; - hir.store v204, v202; - v205 = arith.constant 4 : i32; - v206 = arith.add v202, v205 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/hash_words/::current_memory(v206, v194, v195, v196) - v208 = arith.constant 8 : u32; - v207 = hir.bitcast v202 : u32; - v209 = arith.add v207, v208 : u32 #[overflow = checked]; - v210 = arith.constant 4 : u32; - v211 = arith.mod v209, v210 : u32; - hir.assertz v211 #[code = 250]; - v212 = hir.int_to_ptr v209 : ptr; - v213 = hir.load v212 : i32; - v405 = arith.constant 0 : i32; - v197 = arith.constant 0 : i32; - v215 = arith.eq v213, v197 : i1; - v216 = arith.zext v215 : u32; - v217 = hir.bitcast v216 : i32; - v219 = arith.neq v217, v405 : i1; - scf.if v219{ - ^block46: + private builtin.function @::deallocate(v80: i32, v81: i32, v82: i32) { + ^block15(v80: i32, v81: i32, v82: i32): + hir.store_local v82 #[local = lv2]; + v83 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr + v84 = hir.bitcast v83 : ptr; + v85 = hir.load v84 : i32; + v233 = arith.constant 16 : i32; + v87 = arith.sub v85, v233 : i32 #[overflow = wrapping]; + hir.store_local v87 #[local = lv3]; + v88 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr + v89 = hir.bitcast v88 : ptr; + hir.store v89, v87; + v90 = hir.load_local : i32 #[local = lv3]; + v95 = hir.load_local : i32 #[local = lv2]; + v232 = arith.constant 4 : i32; + v92 = arith.add v90, v232 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/hash_words/::current_memory(v92, v80, v81, v95) + v96 = hir.load_local : i32 #[local = lv3]; + v231 = arith.constant 8 : u32; + v97 = hir.bitcast v96 : u32; + v99 = arith.add v97, v231 : u32 #[overflow = checked]; + v230 = arith.constant 4 : u32; + v101 = arith.mod v99, v230 : u32; + hir.assertz v101 #[code = 250]; + v102 = hir.int_to_ptr v99 : ptr; + v103 = hir.load v102 : i32; + hir.store_local v103 #[local = lv2]; + v244 = arith.constant 0 : i32; + v238 = arith.constant 0 : i32; + v105 = arith.eq v103, v238 : i1; + v106 = arith.zext v105 : u32; + v107 = hir.bitcast v106 : i32; + v109 = arith.neq v107, v244 : i1; + scf.if v109{ + ^block28: scf.yield ; } else { - ^block27: - v404 = arith.constant 4 : u32; - v220 = hir.bitcast v202 : u32; - v222 = arith.add v220, v404 : u32 #[overflow = checked]; - v403 = arith.constant 4 : u32; - v224 = arith.mod v222, v403 : u32; - hir.assertz v224 #[code = 250]; - v225 = hir.int_to_ptr v222 : ptr; - v226 = hir.load v225 : i32; + ^block18: + v110 = hir.load_local : i32 #[local = lv3]; + v243 = arith.constant 4 : u32; + v111 = hir.bitcast v110 : u32; + v113 = arith.add v111, v243 : u32 #[overflow = checked]; + v242 = arith.constant 4 : u32; + v115 = arith.mod v113, v242 : u32; + hir.assertz v115 #[code = 250]; + v116 = hir.int_to_ptr v113 : ptr; + v117 = hir.load v116 : i32; + v118 = hir.load_local : i32 #[local = lv2]; + v119 = hir.load_local : i32 #[local = lv3]; v228 = arith.constant 12 : u32; - v227 = hir.bitcast v202 : u32; - v229 = arith.add v227, v228 : u32 #[overflow = checked]; - v402 = arith.constant 4 : u32; - v231 = arith.mod v229, v402 : u32; - hir.assertz v231 #[code = 250]; - v232 = hir.int_to_ptr v229 : ptr; - v233 = hir.load v232 : i32; - hir.exec @root_ns:root@1.0.0/hash_words/::deallocate(v226, v213, v233) + v120 = hir.bitcast v119 : u32; + v122 = arith.add v120, v228 : u32 #[overflow = checked]; + v241 = arith.constant 4 : u32; + v124 = arith.mod v122, v241 : u32; + hir.assertz v124 #[code = 250]; + v125 = hir.int_to_ptr v122 : ptr; + v126 = hir.load v125 : i32; + hir.exec @root_ns:root@1.0.0/hash_words/::deallocate(v117, v118, v126) scf.yield ; }; - v401 = arith.constant 16 : i32; - v236 = arith.add v202, v401 : i32 #[overflow = wrapping]; - v237 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr - v238 = hir.bitcast v237 : ptr; - hir.store v238, v236; + v127 = hir.load_local : i32 #[local = lv3]; + v240 = arith.constant 16 : i32; + v129 = arith.add v127, v240 : i32 #[overflow = wrapping]; + v130 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr + v131 = hir.bitcast v130 : ptr; + hir.store v131, v129; builtin.ret ; }; - private builtin.function @::current_memory(v239: i32, v240: i32, v241: i32, v242: i32) { - ^block28(v239: i32, v240: i32, v241: i32, v242: i32): - v431 = arith.constant 0 : i32; - v243 = arith.constant 0 : i32; - v247 = arith.eq v242, v243 : i1; - v248 = arith.zext v247 : u32; - v249 = hir.bitcast v248 : i32; - v251 = arith.neq v249, v431 : i1; - v418, v419 = scf.if v251 : i32, i32 { - ^block49: - v430 = arith.constant 0 : i32; - v245 = arith.constant 4 : i32; - scf.yield v245, v430; - } else { + private builtin.function @::current_memory(v132: i32, v133: i32, v134: i32, v135: i32) { + ^block19(v132: i32, v133: i32, v134: i32, v135: i32): + hir.store_local v132 #[local = lv0]; + hir.store_local v133 #[local = lv1]; + hir.store_local v134 #[local = lv2]; + hir.store_local v135 #[local = lv3]; + v248 = arith.constant 0 : i32; + hir.store_local v248 #[local = lv4]; + v247 = arith.constant 4 : i32; + hir.store_local v247 #[local = lv5]; + v138 = hir.load_local : i32 #[local = lv3]; + v268 = arith.constant 0 : i32; + v269 = arith.constant 0 : i32; + v140 = arith.eq v138, v269 : i1; + v141 = arith.zext v140 : u32; + v142 = hir.bitcast v141 : i32; + v144 = arith.neq v142, v268 : i1; + scf.if v144{ ^block31: - v252 = hir.bitcast v240 : u32; - v287 = arith.constant 4 : u32; - v254 = arith.mod v252, v287 : u32; - hir.assertz v254 #[code = 250]; - v255 = hir.int_to_ptr v252 : ptr; - v256 = hir.load v255 : i32; - v428 = arith.constant 0 : i32; - v429 = arith.constant 0 : i32; - v258 = arith.eq v256, v429 : i1; - v259 = arith.zext v258 : u32; - v260 = hir.bitcast v259 : i32; - v262 = arith.neq v260, v428 : i1; - v416 = scf.if v262 : i32 { - ^block48: - v427 = arith.constant 0 : i32; - scf.yield v427; + scf.yield ; + } else { + ^block22: + v145 = hir.load_local : i32 #[local = lv1]; + v146 = hir.bitcast v145 : u32; + v256 = arith.constant 4 : u32; + v148 = arith.mod v146, v256 : u32; + hir.assertz v148 #[code = 250]; + v149 = hir.int_to_ptr v146 : ptr; + v150 = hir.load v149 : i32; + hir.store_local v150 #[local = lv6]; + v266 = arith.constant 0 : i32; + v267 = arith.constant 0 : i32; + v152 = arith.eq v150, v267 : i1; + v153 = arith.zext v152 : u32; + v154 = hir.bitcast v153 : i32; + v156 = arith.neq v154, v266 : i1; + scf.if v156{ + ^block30: + scf.yield ; } else { - ^block32: - v426 = arith.constant 4 : u32; - v263 = hir.bitcast v239 : u32; - v265 = arith.add v263, v426 : u32 #[overflow = checked]; - v425 = arith.constant 4 : u32; - v267 = arith.mod v265, v425 : u32; - hir.assertz v267 #[code = 250]; - v268 = hir.int_to_ptr v265 : ptr; - hir.store v268, v241; - v424 = arith.constant 4 : u32; - v269 = hir.bitcast v240 : u32; - v271 = arith.add v269, v424 : u32 #[overflow = checked]; - v423 = arith.constant 4 : u32; - v273 = arith.mod v271, v423 : u32; - hir.assertz v273 #[code = 250]; - v274 = hir.int_to_ptr v271 : ptr; - v275 = hir.load v274 : i32; - v276 = hir.bitcast v239 : u32; - v422 = arith.constant 4 : u32; - v278 = arith.mod v276, v422 : u32; - hir.assertz v278 #[code = 250]; - v279 = hir.int_to_ptr v276 : ptr; - hir.store v279, v275; - v280 = arith.mul v256, v242 : i32 #[overflow = wrapping]; - scf.yield v280; + ^block23: + v157 = hir.load_local : i32 #[local = lv0]; + v158 = hir.load_local : i32 #[local = lv2]; + v265 = arith.constant 4 : u32; + v159 = hir.bitcast v157 : u32; + v161 = arith.add v159, v265 : u32 #[overflow = checked]; + v264 = arith.constant 4 : u32; + v163 = arith.mod v161, v264 : u32; + hir.assertz v163 #[code = 250]; + v164 = hir.int_to_ptr v161 : ptr; + hir.store v164, v158; + v165 = hir.load_local : i32 #[local = lv0]; + v166 = hir.load_local : i32 #[local = lv1]; + v263 = arith.constant 4 : u32; + v167 = hir.bitcast v166 : u32; + v169 = arith.add v167, v263 : u32 #[overflow = checked]; + v262 = arith.constant 4 : u32; + v171 = arith.mod v169, v262 : u32; + hir.assertz v171 #[code = 250]; + v172 = hir.int_to_ptr v169 : ptr; + v173 = hir.load v172 : i32; + v174 = hir.bitcast v165 : u32; + v261 = arith.constant 4 : u32; + v176 = arith.mod v174, v261 : u32; + hir.assertz v176 #[code = 250]; + v177 = hir.int_to_ptr v174 : ptr; + hir.store v177, v173; + v178 = hir.load_local : i32 #[local = lv6]; + v179 = hir.load_local : i32 #[local = lv3]; + v180 = arith.mul v178, v179 : i32 #[overflow = wrapping]; + hir.store_local v180 #[local = lv4]; + v245 = arith.constant 8 : i32; + hir.store_local v245 #[local = lv5]; + scf.yield ; }; - v281 = arith.constant 8 : i32; - v421 = arith.constant 4 : i32; - v417 = cf.select v262, v421, v281 : i32; - scf.yield v417, v416; + scf.yield ; }; - v284 = arith.add v239, v418 : i32 #[overflow = wrapping]; - v286 = hir.bitcast v284 : u32; - v420 = arith.constant 4 : u32; - v288 = arith.mod v286, v420 : u32; - hir.assertz v288 #[code = 250]; - v289 = hir.int_to_ptr v286 : ptr; - hir.store v289, v419; + v182 = hir.load_local : i32 #[local = lv0]; + v183 = hir.load_local : i32 #[local = lv5]; + v185 = hir.load_local : i32 #[local = lv4]; + v184 = arith.add v182, v183 : i32 #[overflow = wrapping]; + v186 = hir.bitcast v184 : u32; + v260 = arith.constant 4 : u32; + v188 = arith.mod v186, v260 : u32; + hir.assertz v188 #[code = 250]; + v189 = hir.int_to_ptr v186 : ptr; + hir.store v189, v185; builtin.ret ; }; - private builtin.function @::deallocate(v290: i32, v291: i32, v292: i32) { - ^block33(v290: i32, v291: i32, v292: i32): - v433 = arith.constant 0 : i32; - v293 = arith.constant 0 : i32; - v294 = arith.eq v292, v293 : i1; - v295 = arith.zext v294 : u32; - v296 = hir.bitcast v295 : i32; - v298 = arith.neq v296, v433 : i1; - scf.if v298{ - ^block35: + private builtin.function @::deallocate(v190: i32, v191: i32, v192: i32) { + ^block24(v190: i32, v191: i32, v192: i32): + hir.store_local v190 #[local = lv0]; + hir.store_local v191 #[local = lv1]; + hir.store_local v192 #[local = lv2]; + v193 = hir.load_local : i32 #[local = lv2]; + v273 = arith.constant 0 : i32; + v271 = arith.constant 0 : i32; + v195 = arith.eq v193, v271 : i1; + v196 = arith.zext v195 : u32; + v197 = hir.bitcast v196 : i32; + v199 = arith.neq v197, v273 : i1; + scf.if v199{ + ^block26: scf.yield ; } else { - ^block36: - hir.exec @root_ns:root@1.0.0/hash_words/__rustc::__rust_dealloc(v290, v292, v291) + ^block27: + v200 = hir.load_local : i32 #[local = lv0]; + v201 = hir.load_local : i32 #[local = lv2]; + v202 = hir.load_local : i32 #[local = lv1]; + hir.exec @root_ns:root@1.0.0/hash_words/__rustc::__rust_dealloc(v200, v201, v202) scf.yield ; }; builtin.ret ; diff --git a/tests/integration/expected/hash_words.masm b/tests/integration/expected/hash_words.masm index 00cfe9024..d109bcd74 100644 --- a/tests/integration/expected/hash_words.masm +++ b/tests/integration/expected/hash_words.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,8 +10,9 @@ proc init mem_store.278528 end -# mod root_ns:root@1.0.0::hash_words +# mod ::"root_ns:root@1.0.0"::hash_words +@locals("3") @callconv("C") proc __rustc::__rust_dealloc(i32, i32, i32) drop @@ -19,104 +20,57 @@ proc __rustc::__rust_dealloc(i32, i32, i32) drop end +@locals("5") @callconv("C") pub proc entrypoint(i32) -> felt - push.1114112 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::store_sw trace.252 nop - push.48 - u32wrapping_sub push.1114112 - dup.1 - swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop - push.4 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + push.16 + u32wrapping_sub + dup.0 + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::store_sw trace.252 nop - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.1114112 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - trace.240 - nop - exec.::root_ns:root@1.0.0::hash_words::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 push.0 - trace.240 - nop - exec.::root_ns:root@1.0.0::hash_words::intrinsics::felt::from_u32 - trace.252 - nop swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::hash_words::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_sw trace.252 nop - push.2 - movup.2 - swap.1 - u32shr - push.16 - dup.3 - u32wrapping_add - push.2 - movup.3 + push.4 swap.1 - u32shl - dup.2 - u32wrapping_add - movup.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::hash_words::std::crypto::hashes::rpo::hash_memory_words - trace.252 - nop - push.24 - dup.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -126,52 +80,30 @@ pub proc entrypoint(i32) -> felt swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 swap.1 - push.40 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop - push.16 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + push.8 swap.1 - push.32 - dup.3 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -179,92 +111,73 @@ pub proc entrypoint(i32) -> felt assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.32 - dup.1 - u32wrapping_add - dup.1 + push.0 + dup.0 + assert_eq + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::hash_words::::reverse + exec.::intrinsics::mem::load_sw trace.252 nop - dup.0 - push.4 - dup.1 + push.2 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + swap.1 + u32shr + dup.0 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::store_sw trace.252 nop - push.16 - dup.0 - swap.2 - swap.4 + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::hash_words::::deallocate + exec.::intrinsics::mem::load_sw trace.252 nop - push.48 - u32wrapping_add - push.1114112 - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop -end - -@callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114112 - u32divmod.4 + push.2 + movup.4 swap.1 + u32shl + movup.2 + u32wrapping_add + movup.2 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::"root_ns:root@1.0.0"::hash_words::"miden::core::crypto::hashes::rpo256::hash_words" trace.252 nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + push.12 swap.1 - push.8 - dup.3 add u32assert push.4 @@ -275,253 +188,68 @@ proc ::reverse( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.4 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.0 + push.0 swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 + push.16 + dup.0 + swap.2 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::"root_ns:root@1.0.0"::hash_words::::deallocate trace.252 nop + locaddr.1 + push.0 swap.1 - push.8 - dup.4 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.16 + u32wrapping_add + push.1114112 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.4 + push.0 swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop end @callconv("C") -proc intrinsics::felt::assert_eq(felt, felt) - assert_eq -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc std::crypto::hashes::rpo::hash_memory_words(i32, i32, i32) +proc miden::core::crypto::hashes::rpo256::hash_words(i32, i32, i32) trace.240 nop - exec.::std::crypto::hashes::rpo::hash_memory_words + exec.::miden::core::crypto::hashes::rpo256::hash_words trace.252 nop movup.4 @@ -573,12 +301,22 @@ proc std::crypto::hashes::rpo::hash_memory_words(i32, i32, i32) nop end +@locals("4") @callconv("C") proc ::deallocate( i32, i32, i32 ) + movup.2 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114112 u32divmod.4 swap.1 @@ -589,9 +327,16 @@ proc ::deallocate( nop push.16 u32wrapping_sub - push.1114112 - dup.1 + dup.0 + locaddr.3 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114112 u32divmod.4 swap.1 trace.240 @@ -599,21 +344,44 @@ proc ::deallocate( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + movup.2 u32wrapping_add swap.1 - swap.4 swap.3 swap.2 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::hash_words::::current_memory + exec.::"root_ns:root@1.0.0"::hash_words::"::current_memory" + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.1 + swap.1 add u32assert push.4 @@ -629,16 +397,33 @@ proc ::deallocate( exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 push.0 - dup.2 + movup.2 eq neq if.true - drop + nop else + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.2 + swap.1 add u32assert push.4 @@ -654,8 +439,24 @@ proc ::deallocate( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.3 + swap.1 add u32assert push.4 @@ -671,13 +472,21 @@ proc ::deallocate( exec.::intrinsics::mem::load_sw trace.252 nop - movdn.2 + swap.2 trace.240 nop - exec.::root_ns:root@1.0.0::hash_words::::deallocate + exec.::"root_ns:root@1.0.0"::hash_words::"::deallocate" trace.252 nop end + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114112 @@ -690,6 +499,7 @@ proc ::deallocate( nop end +@locals("7") @callconv("C") proc ::current_memory( i32, @@ -697,20 +507,80 @@ proc ::current_memory( i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.0 - dup.5 + movup.2 eq neq if.true - movdn.3 - drop - drop - drop - push.0 - push.4 + nop else - dup.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -724,25 +594,41 @@ proc ::current_memory( exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 push.0 - dup.2 + movup.2 eq neq - dup.0 if.true + nop + else + locaddr.0 + push.0 swap.1 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 push.0 - else + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.3 + movup.2 add u32assert push.4 @@ -751,8 +637,6 @@ proc ::current_memory( u32mod u32assert assertz - movup.5 - swap.1 u32divmod.4 swap.1 trace.240 @@ -760,8 +644,24 @@ proc ::current_memory( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - movup.4 + swap.1 add u32assert push.4 @@ -777,7 +677,7 @@ proc ::current_memory( exec.::intrinsics::mem::load_sw trace.252 nop - dup.3 + swap.1 push.4 dup.1 swap.1 @@ -791,21 +691,71 @@ proc ::current_memory( exec.::intrinsics::mem::store_sw trace.252 nop - swap.3 + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop trace.240 nop exec.::intrinsics::i32::wrapping_mul trace.252 nop - movup.2 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + locaddr.5 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.8 - push.4 - movup.3 - cdrop end - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movdn.2 u32wrapping_add push.4 dup.1 @@ -822,27 +772,81 @@ proc ::current_memory( nop end +@locals("3") @callconv("C") proc ::deallocate( i32, i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.0 - dup.4 + movup.2 eq neq if.true - drop - drop - drop + nop else - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::hash_words::__rustc::__rust_dealloc + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.2 + trace.240 + nop + exec.::"root_ns:root@1.0.0"::hash_words::__rustc::__rust_dealloc trace.252 nop end diff --git a/tests/integration/expected/hash_words.wat b/tests/integration/expected/hash_words.wat index 8829a42e4..9705a3c84 100644 --- a/tests/integration/expected/hash_words.wat +++ b/tests/integration/expected/hash_words.wat @@ -1,9 +1,8 @@ (module $hash_words.wasm (type (;0;) (func (param i32 i32 i32))) (type (;1;) (func (param i32) (result f32))) - (type (;2;) (func (param i32 i32))) - (type (;3;) (func (param f32 f32))) - (type (;4;) (func (param i32 i32 i32 i32))) + (type (;2;) (func (param f32 f32))) + (type (;3;) (func (param i32 i32 i32 i32))) (table (;0;) 1 1 funcref) (memory (;0;) 16) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -13,7 +12,7 @@ (func $entrypoint (;1;) (type 1) (param i32) (result f32) (local i32 i32 i32 f32) global.get $__stack_pointer - i32.const 48 + i32.const 16 i32.sub local.tee 1 global.set $__stack_pointer @@ -38,103 +37,30 @@ i32.shl i32.add local.get 1 - i32.const 16 - i32.add - call $std::crypto::hashes::rpo::hash_memory_words - local.get 1 - local.get 1 - i64.load offset=24 - i64.store offset=40 - local.get 1 - local.get 1 - i64.load offset=16 - i64.store offset=32 - local.get 1 + call $miden::core::crypto::hashes::rpo256::hash_words local.get 1 - i32.const 32 - i32.add - call $::reverse - local.get 1 - f32.load + f32.load offset=12 local.set 4 local.get 0 i32.const 16 i32.const 16 call $::deallocate local.get 1 - i32.const 48 + i32.const 16 i32.add global.set $__stack_pointer local.get 4 ) - (func $::reverse (;2;) (type 2) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store - ) - (func $intrinsics::felt::assert_eq (;3;) (type 3) (param f32 f32) + (func $intrinsics::felt::assert_eq (;2;) (type 2) (param f32 f32) unreachable ) - (func $intrinsics::felt::from_u32 (;4;) (type 1) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;3;) (type 1) (param i32) (result f32) unreachable ) - (func $std::crypto::hashes::rpo::hash_memory_words (;5;) (type 0) (param i32 i32 i32) + (func $miden::core::crypto::hashes::rpo256::hash_words (;4;) (type 0) (param i32 i32 i32) unreachable ) - (func $::deallocate (;6;) (type 0) (param i32 i32 i32) + (func $::deallocate (;5;) (type 0) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -166,7 +92,7 @@ i32.add global.set $__stack_pointer ) - (func $::current_memory (;7;) (type 4) (param i32 i32 i32 i32) + (func $::current_memory (;6;) (type 3) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -201,7 +127,7 @@ local.get 4 i32.store ) - (func $::deallocate (;8;) (type 0) (param i32 i32 i32) + (func $::deallocate (;7;) (type 0) (param i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz diff --git a/tests/integration/expected/hmerge.hir b/tests/integration/expected/hmerge.hir index 187e6634e..8aca01a7b 100644 --- a/tests/integration/expected/hmerge.hir +++ b/tests/integration/expected/hmerge.hir @@ -2,98 +2,114 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @hmerge { public builtin.function @entrypoint(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: felt, v6: felt, v7: felt) -> felt { ^block4(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: felt, v6: felt, v7: felt): - v10 = builtin.global_symbol @root_ns:root@1.0.0/hmerge/__stack_pointer : ptr - v11 = hir.bitcast v10 : ptr; - v12 = hir.load v11 : i32; - v13 = arith.constant 48 : i32; - v14 = arith.sub v12, v13 : i32 #[overflow = wrapping]; - v15 = builtin.global_symbol @root_ns:root@1.0.0/hmerge/__stack_pointer : ptr - v16 = hir.bitcast v15 : ptr; - hir.store v16, v14; - v18 = arith.constant 28 : u32; - v17 = hir.bitcast v14 : u32; - v19 = arith.add v17, v18 : u32 #[overflow = checked]; - v20 = arith.constant 4 : u32; - v21 = arith.mod v19, v20 : u32; - hir.assertz v21 #[code = 250]; - v22 = hir.int_to_ptr v19 : ptr; - hir.store v22, v7; - v24 = arith.constant 24 : u32; - v23 = hir.bitcast v14 : u32; - v25 = arith.add v23, v24 : u32 #[overflow = checked]; - v87 = arith.constant 4 : u32; - v27 = arith.mod v25, v87 : u32; - hir.assertz v27 #[code = 250]; - v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v6; - v30 = arith.constant 20 : u32; - v29 = hir.bitcast v14 : u32; - v31 = arith.add v29, v30 : u32 #[overflow = checked]; - v86 = arith.constant 4 : u32; - v33 = arith.mod v31, v86 : u32; - hir.assertz v33 #[code = 250]; - v34 = hir.int_to_ptr v31 : ptr; - hir.store v34, v5; - v36 = arith.constant 16 : u32; - v35 = hir.bitcast v14 : u32; - v37 = arith.add v35, v36 : u32 #[overflow = checked]; - v85 = arith.constant 4 : u32; - v39 = arith.mod v37, v85 : u32; - hir.assertz v39 #[code = 250]; - v40 = hir.int_to_ptr v37 : ptr; - hir.store v40, v4; - v42 = arith.constant 12 : u32; - v41 = hir.bitcast v14 : u32; - v43 = arith.add v41, v42 : u32 #[overflow = checked]; - v84 = arith.constant 4 : u32; - v45 = arith.mod v43, v84 : u32; - hir.assertz v45 #[code = 250]; - v46 = hir.int_to_ptr v43 : ptr; - hir.store v46, v3; - v48 = arith.constant 8 : u32; - v47 = hir.bitcast v14 : u32; - v49 = arith.add v47, v48 : u32 #[overflow = checked]; - v83 = arith.constant 4 : u32; - v51 = arith.mod v49, v83 : u32; - hir.assertz v51 #[code = 250]; - v52 = hir.int_to_ptr v49 : ptr; - hir.store v52, v2; - v82 = arith.constant 4 : u32; - v53 = hir.bitcast v14 : u32; - v55 = arith.add v53, v82 : u32 #[overflow = checked]; - v81 = arith.constant 4 : u32; - v57 = arith.mod v55, v81 : u32; - hir.assertz v57 #[code = 250]; - v58 = hir.int_to_ptr v55 : ptr; - hir.store v58, v1; - v59 = hir.bitcast v14 : u32; - v80 = arith.constant 4 : u32; - v61 = arith.mod v59, v80 : u32; - hir.assertz v61 #[code = 250]; - v62 = hir.int_to_ptr v59 : ptr; - hir.store v62, v0; - v63 = arith.constant 32 : i32; - v64 = arith.add v14, v63 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/hmerge/intrinsics::crypto::hmerge(v14, v64) - v66 = arith.constant 32 : u32; - v65 = hir.bitcast v14 : u32; - v67 = arith.add v65, v66 : u32 #[overflow = checked]; - v79 = arith.constant 4 : u32; - v69 = arith.mod v67, v79 : u32; - hir.assertz v69 #[code = 250]; - v70 = hir.int_to_ptr v67 : ptr; - v71 = hir.load v70 : felt; - v78 = arith.constant 48 : i32; - v73 = arith.add v14, v78 : i32 #[overflow = wrapping]; - v74 = builtin.global_symbol @root_ns:root@1.0.0/hmerge/__stack_pointer : ptr - v75 = hir.bitcast v74 : ptr; - hir.store v75, v73; - builtin.ret v71; + hir.store_local v7 #[local = lv7]; + v9 = builtin.global_symbol @root_ns:root@1.0.0/hmerge/__stack_pointer : ptr + v10 = hir.bitcast v9 : ptr; + v11 = hir.load v10 : i32; + v107 = arith.constant 48 : i32; + v13 = arith.sub v11, v107 : i32 #[overflow = wrapping]; + hir.store_local v13 #[local = lv8]; + v14 = builtin.global_symbol @root_ns:root@1.0.0/hmerge/__stack_pointer : ptr + v15 = hir.bitcast v14 : ptr; + hir.store v15, v13; + v16 = hir.load_local : i32 #[local = lv8]; + v17 = hir.load_local : felt #[local = lv7]; + v106 = arith.constant 28 : u32; + v18 = hir.bitcast v16 : u32; + v20 = arith.add v18, v106 : u32 #[overflow = checked]; + v105 = arith.constant 4 : u32; + v22 = arith.mod v20, v105 : u32; + hir.assertz v22 #[code = 250]; + v23 = hir.int_to_ptr v20 : ptr; + hir.store v23, v17; + v24 = hir.load_local : i32 #[local = lv8]; + v104 = arith.constant 24 : u32; + v26 = hir.bitcast v24 : u32; + v28 = arith.add v26, v104 : u32 #[overflow = checked]; + v127 = arith.constant 4 : u32; + v30 = arith.mod v28, v127 : u32; + hir.assertz v30 #[code = 250]; + v31 = hir.int_to_ptr v28 : ptr; + hir.store v31, v6; + v32 = hir.load_local : i32 #[local = lv8]; + v103 = arith.constant 20 : u32; + v34 = hir.bitcast v32 : u32; + v36 = arith.add v34, v103 : u32 #[overflow = checked]; + v126 = arith.constant 4 : u32; + v38 = arith.mod v36, v126 : u32; + hir.assertz v38 #[code = 250]; + v39 = hir.int_to_ptr v36 : ptr; + hir.store v39, v5; + v40 = hir.load_local : i32 #[local = lv8]; + v102 = arith.constant 16 : u32; + v42 = hir.bitcast v40 : u32; + v44 = arith.add v42, v102 : u32 #[overflow = checked]; + v125 = arith.constant 4 : u32; + v46 = arith.mod v44, v125 : u32; + hir.assertz v46 #[code = 250]; + v47 = hir.int_to_ptr v44 : ptr; + hir.store v47, v4; + v48 = hir.load_local : i32 #[local = lv8]; + v101 = arith.constant 12 : u32; + v50 = hir.bitcast v48 : u32; + v52 = arith.add v50, v101 : u32 #[overflow = checked]; + v124 = arith.constant 4 : u32; + v54 = arith.mod v52, v124 : u32; + hir.assertz v54 #[code = 250]; + v55 = hir.int_to_ptr v52 : ptr; + hir.store v55, v3; + v56 = hir.load_local : i32 #[local = lv8]; + v100 = arith.constant 8 : u32; + v58 = hir.bitcast v56 : u32; + v60 = arith.add v58, v100 : u32 #[overflow = checked]; + v123 = arith.constant 4 : u32; + v62 = arith.mod v60, v123 : u32; + hir.assertz v62 #[code = 250]; + v63 = hir.int_to_ptr v60 : ptr; + hir.store v63, v2; + v64 = hir.load_local : i32 #[local = lv8]; + v122 = arith.constant 4 : u32; + v66 = hir.bitcast v64 : u32; + v68 = arith.add v66, v122 : u32 #[overflow = checked]; + v121 = arith.constant 4 : u32; + v70 = arith.mod v68, v121 : u32; + hir.assertz v70 #[code = 250]; + v71 = hir.int_to_ptr v68 : ptr; + hir.store v71, v1; + v72 = hir.load_local : i32 #[local = lv8]; + v74 = hir.bitcast v72 : u32; + v120 = arith.constant 4 : u32; + v76 = arith.mod v74, v120 : u32; + hir.assertz v76 #[code = 250]; + v77 = hir.int_to_ptr v74 : ptr; + hir.store v77, v0; + v78 = hir.load_local : i32 #[local = lv8]; + v99 = arith.constant 32 : i32; + v81 = arith.add v78, v99 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/hmerge/intrinsics::crypto::hmerge(v78, v81) + v82 = hir.load_local : i32 #[local = lv8]; + v98 = arith.constant 32 : u32; + v83 = hir.bitcast v82 : u32; + v85 = arith.add v83, v98 : u32 #[overflow = checked]; + v119 = arith.constant 4 : u32; + v87 = arith.mod v85, v119 : u32; + hir.assertz v87 #[code = 250]; + v88 = hir.int_to_ptr v85 : ptr; + v89 = hir.load v88 : felt; + hir.store_local v89 #[local = lv7]; + v90 = hir.load_local : i32 #[local = lv8]; + v118 = arith.constant 48 : i32; + v92 = arith.add v90, v118 : i32 #[overflow = wrapping]; + v93 = builtin.global_symbol @root_ns:root@1.0.0/hmerge/__stack_pointer : ptr + v94 = hir.bitcast v93 : ptr; + hir.store v94, v92; + v95 = hir.load_local : felt #[local = lv7]; + builtin.ret v95; }; - private builtin.function @intrinsics::crypto::hmerge(v76: i32, v77: i32) { - ^block6(v76: i32, v77: i32): - hir.exec @intrinsics/crypto/hmerge(v76, v77) + private builtin.function @intrinsics::crypto::hmerge(v96: i32, v97: i32) { + ^block6(v96: i32, v97: i32): + hir.exec @intrinsics/crypto/hmerge(v96, v97) builtin.ret ; }; diff --git a/tests/integration/expected/hmerge.masm b/tests/integration/expected/hmerge.masm index 55e4fc9b6..d8bb710ca 100644 --- a/tests/integration/expected/hmerge.masm +++ b/tests/integration/expected/hmerge.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,10 +10,20 @@ proc init mem_store.278528 end -# mod root_ns:root@1.0.0::hmerge +# mod ::"root_ns:root@1.0.0"::hmerge +@locals("9") @callconv("C") pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt + movup.7 + locaddr.7 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1114112 u32divmod.4 swap.1 @@ -24,9 +34,16 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt nop push.48 u32wrapping_sub - push.1114112 - dup.1 + dup.0 + locaddr.8 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114112 u32divmod.4 swap.1 trace.240 @@ -34,8 +51,24 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.7 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.28 - dup.1 + movup.2 add u32assert push.4 @@ -44,8 +77,6 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt u32mod u32assert assertz - movup.9 - swap.1 u32divmod.4 swap.1 trace.240 @@ -53,8 +84,16 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.24 - dup.1 + swap.1 add u32assert push.4 @@ -63,7 +102,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt u32mod u32assert assertz - movup.8 + movup.7 swap.1 u32divmod.4 swap.1 @@ -72,8 +111,16 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.20 - dup.1 + swap.1 add u32assert push.4 @@ -82,7 +129,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt u32mod u32assert assertz - movup.7 + movup.6 swap.1 u32divmod.4 swap.1 @@ -91,8 +138,16 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - dup.1 + swap.1 add u32assert push.4 @@ -101,7 +156,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt u32mod u32assert assertz - movup.6 + movup.5 swap.1 u32divmod.4 swap.1 @@ -110,8 +165,16 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.1 + swap.1 add u32assert push.4 @@ -120,7 +183,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt u32mod u32assert assertz - movup.5 + movup.4 swap.1 u32divmod.4 swap.1 @@ -129,8 +192,16 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.1 + swap.1 add u32assert push.4 @@ -139,7 +210,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt u32mod u32assert assertz - movup.4 + movup.3 swap.1 u32divmod.4 swap.1 @@ -148,8 +219,16 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + swap.1 add u32assert push.4 @@ -158,7 +237,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt u32mod u32assert assertz - movup.3 + movup.2 swap.1 u32divmod.4 swap.1 @@ -167,15 +246,20 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt exec.::intrinsics::mem::store_felt trace.252 nop - dup.0 + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -183,17 +267,33 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.32 dup.1 u32wrapping_add - dup.1 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::hmerge::intrinsics::crypto::hmerge + exec.::"root_ns:root@1.0.0"::hmerge::"intrinsics::crypto::hmerge" + trace.252 + nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.32 - dup.1 + swap.1 add u32assert push.4 @@ -209,8 +309,23 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.7 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.48 - movup.2 u32wrapping_add push.1114112 u32divmod.4 @@ -220,6 +335,14 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.7 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop end @callconv("C") diff --git a/tests/integration/expected/is_prime.hir b/tests/integration/expected/is_prime.hir index 7766bea6e..3ba244fa6 100644 --- a/tests/integration/expected/is_prime.hir +++ b/tests/integration/expected/is_prime.hir @@ -2,220 +2,249 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @is_prime { public builtin.function @entrypoint(v0: i32) -> i32 { ^block4(v0: i32): - v2 = arith.constant 0 : i32; - v96 = arith.constant 2 : u32; - v4 = hir.bitcast v0 : u32; - v6 = arith.lt v4, v96 : i1; + hir.store_local v0 #[local = lv0]; + v2 = hir.load_local : i32 #[local = lv0]; + v106 = arith.constant 0 : i32; + v130 = arith.constant 2 : u32; + v4 = hir.bitcast v2 : u32; + v6 = arith.lt v4, v130 : i1; v7 = arith.zext v6 : u32; v8 = hir.bitcast v7 : i32; - v10 = arith.neq v8, v2 : i1; - v128, v129 = scf.if v10 : i32, u32 { + v10 = arith.neq v8, v106 : i1; + v147, v148 = scf.if v10 : i32, u32 { ^block6: - v89 = arith.constant 0 : u32; - v247 = arith.constant 0 : i32; - scf.yield v247, v89; + v126 = arith.constant 0 : u32; + v255 = arith.constant 0 : i32; + scf.yield v255, v126; } else { ^block7: - v246 = arith.constant 0 : i32; - v98 = arith.constant 4 : u32; - v13 = hir.bitcast v0 : u32; - v15 = arith.lt v13, v98 : i1; - v16 = arith.zext v15 : u32; - v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v246 : i1; - v132, v133 = scf.if v19 : i32, u32 { - ^block9: - v245 = arith.constant 0 : u32; - v11 = arith.constant 1 : i32; - scf.yield v11, v245; + v105 = arith.constant 1 : i32; + hir.store_local v105 #[local = lv1]; + v12 = hir.load_local : i32 #[local = lv0]; + v254 = arith.constant 0 : i32; + v132 = arith.constant 4 : u32; + v14 = hir.bitcast v12 : u32; + v16 = arith.lt v14, v132 : i1; + v17 = arith.zext v16 : u32; + v18 = hir.bitcast v17 : i32; + v20 = arith.neq v18, v254 : i1; + v155, v156, v157 = scf.if v20 : i32, u32, u32 { + ^block27: + v253 = arith.constant 0 : u32; + v136 = ub.poison u32 : u32; + v144 = ub.poison i32 : i32; + scf.yield v144, v136, v253; } else { ^block10: - v242 = arith.constant 0 : i32; - v243 = arith.constant 0 : i32; - v244 = arith.constant 1 : i32; - v26 = arith.band v0, v244 : i32; - v28 = arith.eq v26, v243 : i1; - v29 = arith.zext v28 : u32; - v30 = hir.bitcast v29 : i32; - v32 = arith.neq v30, v242 : i1; - v136, v137 = scf.if v32 : i32, u32 { + v21 = hir.load_local : i32 #[local = lv0]; + v131 = arith.constant 3 : u32; + v23 = hir.bitcast v21 : u32; + v25 = arith.mod v23, v131 : u32; + v26 = hir.bitcast v25 : i32; + hir.store_local v26 #[local = lv2]; + v27 = hir.load_local : i32 #[local = lv0]; + v250 = arith.constant 0 : i32; + v251 = arith.constant 0 : i32; + v252 = arith.constant 1 : i32; + v29 = arith.band v27, v252 : i32; + v31 = arith.eq v29, v251 : i1; + v32 = arith.zext v31 : u32; + v33 = hir.bitcast v32 : i32; + v35 = arith.neq v33, v250 : i1; + v209, v210 = scf.if v35 : u32, u32 { ^block26: - v240 = arith.constant 0 : u32; - v241 = arith.constant 0 : i32; - scf.yield v241, v240; + v129 = arith.constant 1 : u32; + v249 = arith.constant 0 : u32; + scf.yield v249, v129; } else { ^block11: - v238 = arith.constant 0 : i32; - v239 = arith.constant 0 : i32; - v97 = arith.constant 3 : u32; - v21 = hir.bitcast v0 : u32; - v23 = arith.mod v21, v97 : u32; - v24 = hir.bitcast v23 : i32; - v35 = arith.eq v24, v239 : i1; - v36 = arith.zext v35 : u32; - v37 = hir.bitcast v36 : i32; - v39 = arith.neq v37, v238 : i1; - v140, v141 = scf.if v39 : i32, u32 { + v248 = arith.constant 0 : i32; + hir.store_local v248 #[local = lv1]; + v37 = hir.load_local : i32 #[local = lv2]; + v246 = arith.constant 0 : i32; + v247 = arith.constant 0 : i32; + v39 = arith.eq v37, v247 : i1; + v40 = arith.zext v39 : u32; + v41 = hir.bitcast v40 : i32; + v43 = arith.neq v41, v246 : i1; + v207, v208 = scf.if v43 : u32, u32 { ^block25: - v236 = arith.constant 0 : u32; - v237 = arith.constant 0 : i32; - scf.yield v237, v236; + v244 = arith.constant 0 : u32; + v245 = ub.poison u32 : u32; + scf.yield v245, v244; } else { ^block12: - v40 = arith.constant 5 : i32; - v192, v193, v194, v195 = scf.while v40, v0 : i32, i32, i32, u32 { - ^block50(v196: i32, v197: i32): - v45 = hir.bitcast v197 : u32; - v42 = arith.mul v196, v196 : i32 #[overflow = wrapping]; - v44 = hir.bitcast v42 : u32; - v46 = arith.gt v44, v45 : i1; - v47 = arith.zext v46 : u32; - v48 = hir.bitcast v47 : i32; - v235 = arith.constant 0 : i32; - v50 = arith.neq v48, v235 : i1; - v154, v155, v156, v157 = scf.if v50 : i32, i32, u32, u32 { - ^block41: - v234 = arith.constant 0 : u32; - v99 = arith.constant 5 : u32; - v95 = ub.poison i32 : i32; - scf.yield v95, v95, v99, v234; + v103 = arith.constant 5 : i32; + hir.store_local v103 #[local = lv2]; + v205 = scf.while : u32 { + ^block53: + v45 = hir.load_local : i32 #[local = lv2]; + v48 = hir.load_local : i32 #[local = lv0]; + v50 = hir.bitcast v48 : u32; + v47 = arith.mul v45, v45 : i32 #[overflow = wrapping]; + v49 = hir.bitcast v47 : u32; + v51 = arith.gt v49, v50 : i1; + v52 = arith.zext v51 : u32; + v53 = hir.bitcast v52 : i32; + hir.store_local v53 #[local = lv1]; + v243 = arith.constant 0 : i32; + v55 = arith.neq v53, v243 : i1; + v185, v186 = scf.if v55 : u32, u32 { + ^block44: + v242 = arith.constant 0 : u32; + v133 = arith.constant 5 : u32; + scf.yield v133, v242; } else { ^block15: - v232 = arith.constant 0 : i32; - v233 = arith.constant 0 : i32; - v52 = arith.eq v196, v233 : i1; - v53 = arith.zext v52 : u32; - v54 = hir.bitcast v53 : i32; - v56 = arith.neq v54, v232 : i1; - v162, v163, v164, v165 = scf.if v56 : i32, i32, u32, u32 { - ^block43: - v229 = arith.constant 0 : u32; - v230 = arith.constant 4 : u32; - v231 = ub.poison i32 : i32; - scf.yield v231, v231, v230, v229; + v56 = hir.load_local : i32 #[local = lv2]; + v240 = arith.constant 0 : i32; + v241 = arith.constant 0 : i32; + v58 = arith.eq v56, v241 : i1; + v59 = arith.zext v58 : u32; + v60 = hir.bitcast v59 : i32; + v62 = arith.neq v60, v240 : i1; + v189, v190 = scf.if v62 : u32, u32 { + ^block46: + v238 = arith.constant 0 : u32; + v239 = arith.constant 4 : u32; + scf.yield v239, v238; } else { ^block16: - v227 = arith.constant 0 : i32; - v228 = arith.constant 0 : i32; - v58 = hir.bitcast v196 : u32; - v57 = hir.bitcast v197 : u32; - v59 = arith.mod v57, v58 : u32; - v60 = hir.bitcast v59 : i32; - v62 = arith.eq v60, v228 : i1; - v63 = arith.zext v62 : u32; - v64 = hir.bitcast v63 : i32; - v66 = arith.neq v64, v227 : i1; - v170, v171, v172, v173 = scf.if v66 : i32, i32, u32, u32 { - ^block45: - v224 = arith.constant 0 : u32; - v225 = arith.constant 3 : u32; - v226 = ub.poison i32 : i32; - scf.yield v226, v226, v225, v224; + v63 = hir.load_local : i32 #[local = lv0]; + v64 = hir.load_local : i32 #[local = lv2]; + v236 = arith.constant 0 : i32; + v237 = arith.constant 0 : i32; + v66 = hir.bitcast v64 : u32; + v65 = hir.bitcast v63 : u32; + v67 = arith.mod v65, v66 : u32; + v68 = hir.bitcast v67 : i32; + v70 = arith.eq v68, v237 : i1; + v71 = arith.zext v70 : u32; + v72 = hir.bitcast v71 : i32; + v74 = arith.neq v72, v236 : i1; + v193, v194 = scf.if v74 : u32, u32 { + ^block48: + v234 = arith.constant 0 : u32; + v235 = arith.constant 3 : u32; + scf.yield v235, v234; } else { ^block17: - v3 = arith.constant 2 : i32; - v68 = arith.add v196, v3 : i32 #[overflow = wrapping]; - v222 = arith.constant 0 : i32; - v223 = arith.constant 0 : i32; - v70 = arith.eq v68, v223 : i1; - v71 = arith.zext v70 : u32; - v72 = hir.bitcast v71 : i32; - v74 = arith.neq v72, v222 : i1; - v178, v179, v180, v181 = scf.if v74 : i32, i32, u32, u32 { - ^block47: - v219 = arith.constant 0 : u32; - v220 = arith.constant 2 : u32; - v221 = ub.poison i32 : i32; - scf.yield v221, v221, v220, v219; + v75 = hir.load_local : i32 #[local = lv2]; + v107 = arith.constant 2 : i32; + v77 = arith.add v75, v107 : i32 #[overflow = wrapping]; + hir.store_local v77 #[local = lv3]; + v232 = arith.constant 0 : i32; + v233 = arith.constant 0 : i32; + v79 = arith.eq v77, v233 : i1; + v80 = arith.zext v79 : u32; + v81 = hir.bitcast v80 : i32; + v83 = arith.neq v81, v232 : i1; + v197, v198 = scf.if v83 : u32, u32 { + ^block50: + v230 = arith.constant 0 : u32; + v231 = arith.constant 2 : u32; + scf.yield v231, v230; } else { ^block18: - v218 = arith.constant 0 : i32; - v78 = hir.bitcast v68 : u32; - v77 = hir.bitcast v197 : u32; - v79 = arith.mod v77, v78 : u32; - v80 = hir.bitcast v79 : i32; - v82 = arith.neq v80, v218 : i1; - v213 = arith.constant 0 : u32; - v214 = arith.constant 1 : u32; - v191 = cf.select v82, v214, v213 : u32; - v94 = arith.constant 1 : u32; - v215 = arith.constant 0 : u32; - v190 = cf.select v82, v215, v94 : u32; - v216 = ub.poison i32 : i32; - v189 = cf.select v82, v197, v216 : i32; - v217 = ub.poison i32 : i32; - v12 = arith.constant 4 : i32; - v76 = arith.add v68, v12 : i32 #[overflow = wrapping]; - v188 = cf.select v82, v76, v217 : i32; - scf.yield v188, v189, v190, v191; + v84 = hir.load_local : i32 #[local = lv3]; + v104 = arith.constant 4 : i32; + v86 = arith.add v84, v104 : i32 #[overflow = wrapping]; + hir.store_local v86 #[local = lv2]; + v87 = hir.load_local : i32 #[local = lv0]; + v88 = hir.load_local : i32 #[local = lv3]; + v229 = arith.constant 0 : i32; + v90 = hir.bitcast v88 : u32; + v89 = hir.bitcast v87 : u32; + v91 = arith.mod v89, v90 : u32; + v92 = hir.bitcast v91 : i32; + v94 = arith.neq v92, v229 : i1; + v225 = arith.constant 0 : u32; + v226 = arith.constant 1 : u32; + v204 = cf.select v94, v226, v225 : u32; + v227 = arith.constant 1 : u32; + v228 = arith.constant 0 : u32; + v203 = cf.select v94, v228, v227 : u32; + scf.yield v203, v204; }; - scf.yield v178, v179, v180, v181; + scf.yield v197, v198; }; - scf.yield v170, v171, v172, v173; + scf.yield v193, v194; }; - scf.yield v162, v163, v164, v165; + scf.yield v189, v190; }; - v123 = arith.trunc v157 : i1; - scf.condition v123, v154, v155, v48, v156; + v141 = arith.trunc v186 : i1; + scf.condition v141, v185; } do { - ^block51(v198: i32, v199: i32, v200: i32, v201: u32): - scf.yield v198, v199; + ^block54(v206: u32): + scf.yield ; }; - v145, v146, v147 = scf.index_switch v195 : i32, u32, u32 + v178, v179 = scf.index_switch v205 : u32, u32 case 1 { ^block19: - v211 = arith.constant 0 : u32; - scf.yield v194, v211, v211; + v223 = arith.constant 0 : u32; + scf.yield v223, v223; } case 2 { ^block21: - v209 = arith.constant 1 : u32; - v106 = ub.poison u32 : u32; - v210 = ub.poison i32 : i32; - scf.yield v210, v106, v209; + v221 = arith.constant 1 : u32; + v222 = ub.poison u32 : u32; + scf.yield v222, v221; } case 3 { ^block22: - v208 = arith.constant 0 : u32; - scf.yield v194, v208, v208; + v220 = arith.constant 0 : u32; + scf.yield v220, v220; } case 4 { ^block23: - v205 = arith.constant 1 : u32; - v206 = ub.poison u32 : u32; - v207 = ub.poison i32 : i32; - scf.yield v207, v206, v205; + v218 = arith.constant 1 : u32; + v219 = ub.poison u32 : u32; + scf.yield v219, v218; } default { ^block24: - v212 = arith.constant 0 : u32; - scf.yield v194, v212, v212; + v224 = arith.constant 0 : u32; + scf.yield v224, v224; }; - v148, v149 = scf.index_switch v147 : i32, u32 + v181, v182 = scf.index_switch v179 : u32, u32 case 0 { - ^block40: - scf.yield v145, v146; + ^block43: + v216 = ub.poison u32 : u32; + scf.yield v216, v178; } default { ^block8: - v203 = arith.constant 1 : u32; - v204 = ub.poison i32 : i32; - scf.yield v204, v203; + v217 = arith.constant 1 : u32; + scf.yield v217, v217; }; - scf.yield v148, v149; + scf.yield v181, v182; }; - scf.yield v140, v141; + scf.yield v207, v208; }; - scf.yield v136, v137; + v214 = ub.poison i32 : i32; + v215 = arith.constant 0 : i32; + v211 = cf.select v35, v215, v214 : i32; + scf.yield v211, v209, v210; + }; + v158, v159 = scf.index_switch v157 : i32, u32 + case 0 { + ^block9: + v95 = hir.load_local : i32 #[local = lv1]; + v213 = arith.constant 0 : u32; + scf.yield v95, v213; + } + default { + ^block39: + scf.yield v155, v156; }; - scf.yield v132, v133; + scf.yield v158, v159; }; - v202 = arith.constant 0 : u32; - v187 = arith.eq v129, v202 : i1; - cf.cond_br v187 ^block27, ^block28; - ^block27: - builtin.ret v128; + v212 = arith.constant 0 : u32; + v202 = arith.eq v148, v212 : i1; + cf.cond_br v202 ^block28, ^block29; ^block28: + builtin.ret v147; + ^block29: ub.unreachable ; }; diff --git a/tests/integration/expected/is_prime.masm b/tests/integration/expected/is_prime.masm index 23a26c588..18084dd16 100644 --- a/tests/integration/expected/is_prime.masm +++ b/tests/integration/expected/is_prime.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,63 +10,160 @@ proc init mem_store.278528 end -# mod root_ns:root@1.0.0::is_prime +# mod ::"root_ns:root@1.0.0"::is_prime +@locals("4") @callconv("C") pub proc entrypoint(i32) -> i32 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.2 - dup.2 + movup.2 swap.1 u32lt neq if.true - drop push.0 push.0 else + push.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.4 - dup.2 + movup.2 swap.1 u32lt neq if.true - drop push.0 - push.1 + push.3735929054 + push.3735929054 else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.3 + swap.1 + swap.1 + u32mod + u32assert + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.0 push.1 - dup.3 + movup.3 u32and eq neq + dup.0 if.true - drop - push.0 + push.1 push.0 else push.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 push.0 - push.3 - dup.3 swap.1 - u32mod - u32assert + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 eq neq if.true - drop - push.0 push.0 + push.3735929054 else push.5 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1 while.true - dup.1 - dup.1 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 dup.0 trace.240 nop @@ -75,74 +172,132 @@ pub proc entrypoint(i32) -> i32 nop swap.1 u32gt + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 - dup.1 neq if.true - movdn.2 - drop - drop push.0 push.5 - push.3735929054 - dup.0 - swap.1 else + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.0 - dup.3 + movup.2 eq neq if.true - movdn.2 - drop - drop push.0 push.4 - push.3735929054 - dup.0 - swap.1 else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.0 - dup.3 - dup.5 + movup.2 + movup.3 swap.1 u32mod u32assert eq neq if.true - movdn.2 - drop - drop push.0 push.3 - push.3735929054 - dup.0 - swap.1 else + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.2 - movup.2 u32wrapping_add + dup.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 push.0 - dup.2 + movup.2 eq neq if.true - drop - swap.1 - drop push.0 push.2 - push.3735929054 - dup.0 - swap.1 else + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + u32wrapping_add + locaddr.2 push.0 - dup.1 - dup.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + swap.1 + movup.2 swap.1 u32mod u32assert @@ -153,48 +308,22 @@ pub proc entrypoint(i32) -> i32 cdrop push.1 push.0 - dup.3 + movup.3 cdrop - push.3735929054 - dup.3 - swap.1 - swap.2 - swap.7 - swap.1 - cdrop - push.3735929054 - push.4 - movup.5 - u32wrapping_add - movup.4 - cdrop - movup.2 - swap.3 - swap.4 - movdn.2 end end end end - movup.3 + swap.1 push.1 u32and - movup.3 - swap.4 - movdn.3 if.true - movup.2 - drop - movup.2 drop push.1 else push.0 end end - drop - drop - swap.1 dup.0 push.2 u32lte @@ -203,12 +332,9 @@ pub proc entrypoint(i32) -> i32 if.true push.0 dup.0 - swap.2 else - drop push.1 push.3735929054 - push.3735929054 end else dup.0 @@ -219,32 +345,49 @@ pub proc entrypoint(i32) -> i32 if.true push.0 dup.0 - swap.2 else - drop push.1 push.3735929054 - push.3735929054 end else drop push.0 dup.0 - swap.2 end end - movup.2 + swap.1 eq.0 if.true - nop + push.3735929054 else - drop drop push.1 - push.3735929054 + dup.0 end end end + push.3735929054 + push.0 + movup.4 + cdrop + end + movup.2 + eq.0 + if.true + drop + drop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + swap.1 + else + nop end end push.0 diff --git a/tests/integration/expected/le_felt.hir b/tests/integration/expected/le_felt.hir index 24ed8c61c..bc5ec48fb 100644 --- a/tests/integration/expected/le_felt.hir +++ b/tests/integration/expected/le_felt.hir @@ -2,19 +2,13 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @le_felt { public builtin.function @entrypoint(v0: felt, v1: felt) -> i32 { ^block4(v0: felt, v1: felt): - v3 = hir.exec @root_ns:root@1.0.0/le_felt/intrinsics::felt::le(v1, v0) : i32 - v4 = arith.constant 0 : i32; - v5 = arith.neq v3, v4 : i1; - v6 = arith.zext v5 : u32; - v7 = hir.bitcast v6 : i32; - builtin.ret v7; - }; - - private builtin.function @intrinsics::felt::le(v8: felt, v9: felt) -> i32 { - ^block6(v8: felt, v9: felt): - v10 = arith.lte v8, v9 : i1; - v11 = hir.cast v10 : i32; - builtin.ret v11; + v11 = arith.constant 0 : i32; + v5 = arith.lte v0, v1 : i1; + v6 = hir.cast v5 : i32; + v8 = arith.neq v6, v11 : i1; + v9 = arith.zext v8 : u32; + v10 = hir.bitcast v9 : i32; + builtin.ret v10; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/le_felt.masm b/tests/integration/expected/le_felt.masm index 2ed564b0f..6a9424fd5 100644 --- a/tests/integration/expected/le_felt.masm +++ b/tests/integration/expected/le_felt.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,23 +10,14 @@ proc init mem_store.278528 end -# mod root_ns:root@1.0.0::le_felt +# mod ::"root_ns:root@1.0.0"::le_felt +@locals("2") @callconv("C") pub proc entrypoint(felt, felt) -> i32 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::le_felt::intrinsics::felt::le - trace.252 - nop push.0 - neq -end - -@callconv("C") -proc intrinsics::felt::le(felt, felt) -> i32 - swap.1 + swap.2 lte + neq end diff --git a/tests/integration/expected/le_felt.wat b/tests/integration/expected/le_felt.wat index 2d1ccc487..777bf8e88 100644 --- a/tests/integration/expected/le_felt.wat +++ b/tests/integration/expected/le_felt.wat @@ -6,8 +6,8 @@ (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) (func $entrypoint (;0;) (type 0) (param f32 f32) (result i32) - local.get 1 local.get 0 + local.get 1 call $intrinsics::felt::le i32.const 0 i32.ne diff --git a/tests/integration/expected/le_i32.hir b/tests/integration/expected/le_i32.hir index 6e781e95d..6ec19dd46 100644 --- a/tests/integration/expected/le_i32.hir +++ b/tests/integration/expected/le_i32.hir @@ -2,10 +2,10 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_92cb575434e29cb53446988749bb020eaeee06891c154db71ddd9e1df57a151a { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.lte v0, v1 : i1; - v4 = arith.zext v3 : u32; - v5 = hir.bitcast v4 : i32; - builtin.ret v5; + v5 = arith.lte v0, v1 : i1; + v6 = arith.zext v5 : u32; + v7 = hir.bitcast v6 : i32; + builtin.ret v7; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/le_i32.masm b/tests/integration/expected/le_i32.masm index aef1ccaba..b14d93a6b 100644 --- a/tests/integration/expected/le_i32.masm +++ b/tests/integration/expected/le_i32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_92cb575434e29cb53446988749bb020eaeee06891c154db71ddd9e1df57a151a +# mod ::"root_ns:root@1.0.0"::test_rust_92cb575434e29cb53446988749bb020eaeee06891c154db71ddd9e1df57a151a +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 swap.1 diff --git a/tests/integration/expected/le_i64.hir b/tests/integration/expected/le_i64.hir index 1e8fc9974..4e9076460 100644 --- a/tests/integration/expected/le_i64.hir +++ b/tests/integration/expected/le_i64.hir @@ -2,10 +2,10 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_d1d5c9c08b80e76c14cb392695a30c0d0f06df4b14bd1301c713918bb7259fd5 { public builtin.function @entrypoint(v0: i64, v1: i64) -> i32 { ^block6(v0: i64, v1: i64): - v3 = arith.lte v0, v1 : i1; - v4 = arith.zext v3 : u32; - v5 = hir.bitcast v4 : i32; - builtin.ret v5; + v5 = arith.lte v0, v1 : i1; + v6 = arith.zext v5 : u32; + v7 = hir.bitcast v6 : i32; + builtin.ret v7; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/le_i64.masm b/tests/integration/expected/le_i64.masm index 09b724b0f..f7bae6a09 100644 --- a/tests/integration/expected/le_i64.masm +++ b/tests/integration/expected/le_i64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_d1d5c9c08b80e76c14cb392695a30c0d0f06df4b14bd1301c713918bb7259fd5 +# mod ::"root_ns:root@1.0.0"::test_rust_d1d5c9c08b80e76c14cb392695a30c0d0f06df4b14bd1301c713918bb7259fd5 +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> i32 movdn.3 diff --git a/tests/integration/expected/le_u16.hir b/tests/integration/expected/le_u16.hir index bf19c926c..018029f0f 100644 --- a/tests/integration/expected/le_u16.hir +++ b/tests/integration/expected/le_u16.hir @@ -2,12 +2,12 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_8e5b56cf449e682f0de4180f5e5ed7f7dd36f7d96e84a0c17bc979aa91efca6e { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v4 = hir.bitcast v1 : u32; - v3 = hir.bitcast v0 : u32; - v5 = arith.lte v3, v4 : i1; - v6 = arith.zext v5 : u32; - v7 = hir.bitcast v6 : i32; - builtin.ret v7; + v6 = hir.bitcast v1 : u32; + v5 = hir.bitcast v0 : u32; + v7 = arith.lte v5, v6 : i1; + v8 = arith.zext v7 : u32; + v9 = hir.bitcast v8 : i32; + builtin.ret v9; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/le_u16.masm b/tests/integration/expected/le_u16.masm index e901be650..9d69f5f14 100644 --- a/tests/integration/expected/le_u16.masm +++ b/tests/integration/expected/le_u16.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_8e5b56cf449e682f0de4180f5e5ed7f7dd36f7d96e84a0c17bc979aa91efca6e +# mod ::"root_ns:root@1.0.0"::test_rust_8e5b56cf449e682f0de4180f5e5ed7f7dd36f7d96e84a0c17bc979aa91efca6e +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 swap.1 diff --git a/tests/integration/expected/le_u32.hir b/tests/integration/expected/le_u32.hir index 3c43308bf..48544581b 100644 --- a/tests/integration/expected/le_u32.hir +++ b/tests/integration/expected/le_u32.hir @@ -2,12 +2,12 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_bb7287e639f21ae334cbe77ea9953a6971d3586eb3527866fb5a973c6a9d7999 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v4 = hir.bitcast v1 : u32; - v3 = hir.bitcast v0 : u32; - v5 = arith.lte v3, v4 : i1; - v6 = arith.zext v5 : u32; - v7 = hir.bitcast v6 : i32; - builtin.ret v7; + v6 = hir.bitcast v1 : u32; + v5 = hir.bitcast v0 : u32; + v7 = arith.lte v5, v6 : i1; + v8 = arith.zext v7 : u32; + v9 = hir.bitcast v8 : i32; + builtin.ret v9; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/le_u32.masm b/tests/integration/expected/le_u32.masm index 141017fb8..ad8754962 100644 --- a/tests/integration/expected/le_u32.masm +++ b/tests/integration/expected/le_u32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_bb7287e639f21ae334cbe77ea9953a6971d3586eb3527866fb5a973c6a9d7999 +# mod ::"root_ns:root@1.0.0"::test_rust_bb7287e639f21ae334cbe77ea9953a6971d3586eb3527866fb5a973c6a9d7999 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 swap.1 diff --git a/tests/integration/expected/le_u64.hir b/tests/integration/expected/le_u64.hir index e0d02b77d..205631268 100644 --- a/tests/integration/expected/le_u64.hir +++ b/tests/integration/expected/le_u64.hir @@ -2,12 +2,12 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_175cf1929f30f3603a14a8443c3a31ee62ac12c89cd674c497750d11c4b1fcb6 { public builtin.function @entrypoint(v0: i64, v1: i64) -> i32 { ^block6(v0: i64, v1: i64): - v4 = hir.bitcast v1 : u64; - v3 = hir.bitcast v0 : u64; - v5 = arith.lte v3, v4 : i1; - v6 = arith.zext v5 : u32; - v7 = hir.bitcast v6 : i32; - builtin.ret v7; + v6 = hir.bitcast v1 : u64; + v5 = hir.bitcast v0 : u64; + v7 = arith.lte v5, v6 : i1; + v8 = arith.zext v7 : u32; + v9 = hir.bitcast v8 : i32; + builtin.ret v9; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/le_u64.masm b/tests/integration/expected/le_u64.masm index 99531ccf9..f01695637 100644 --- a/tests/integration/expected/le_u64.masm +++ b/tests/integration/expected/le_u64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_175cf1929f30f3603a14a8443c3a31ee62ac12c89cd674c497750d11c4b1fcb6 +# mod ::"root_ns:root@1.0.0"::test_rust_175cf1929f30f3603a14a8443c3a31ee62ac12c89cd674c497750d11c4b1fcb6 +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> i32 movdn.3 @@ -28,7 +29,7 @@ pub proc entrypoint([u32; 2], [u32; 2]) -> i32 movdn.3 trace.240 nop - exec.::std::math::u64::lte + exec.::miden::core::math::u64::lte trace.252 nop end diff --git a/tests/integration/expected/le_u8.hir b/tests/integration/expected/le_u8.hir index 908dc8369..c1ae54b46 100644 --- a/tests/integration/expected/le_u8.hir +++ b/tests/integration/expected/le_u8.hir @@ -2,12 +2,12 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_6b31118a71e100e1653e01e16012428a3ef4b388ea4b8aa8f00a0e4ff40c4ad9 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v4 = hir.bitcast v1 : u32; - v3 = hir.bitcast v0 : u32; - v5 = arith.lte v3, v4 : i1; - v6 = arith.zext v5 : u32; - v7 = hir.bitcast v6 : i32; - builtin.ret v7; + v6 = hir.bitcast v1 : u32; + v5 = hir.bitcast v0 : u32; + v7 = arith.lte v5, v6 : i1; + v8 = arith.zext v7 : u32; + v9 = hir.bitcast v8 : i32; + builtin.ret v9; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/le_u8.masm b/tests/integration/expected/le_u8.masm index 331209ff2..0b776a5e9 100644 --- a/tests/integration/expected/le_u8.masm +++ b/tests/integration/expected/le_u8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_6b31118a71e100e1653e01e16012428a3ef4b388ea4b8aa8f00a0e4ff40c4ad9 +# mod ::"root_ns:root@1.0.0"::test_rust_6b31118a71e100e1653e01e16012428a3ef4b388ea4b8aa8f00a0e4ff40c4ad9 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 swap.1 diff --git a/tests/integration/expected/lt_felt.hir b/tests/integration/expected/lt_felt.hir index f7d15f7ca..7799eeeff 100644 --- a/tests/integration/expected/lt_felt.hir +++ b/tests/integration/expected/lt_felt.hir @@ -2,19 +2,13 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @lt_felt { public builtin.function @entrypoint(v0: felt, v1: felt) -> i32 { ^block4(v0: felt, v1: felt): - v3 = hir.exec @root_ns:root@1.0.0/lt_felt/intrinsics::felt::lt(v1, v0) : i32 - v4 = arith.constant 0 : i32; - v5 = arith.neq v3, v4 : i1; - v6 = arith.zext v5 : u32; - v7 = hir.bitcast v6 : i32; - builtin.ret v7; - }; - - private builtin.function @intrinsics::felt::lt(v8: felt, v9: felt) -> i32 { - ^block6(v8: felt, v9: felt): - v10 = arith.lt v8, v9 : i1; - v11 = hir.cast v10 : i32; - builtin.ret v11; + v11 = arith.constant 0 : i32; + v5 = arith.lt v0, v1 : i1; + v6 = hir.cast v5 : i32; + v8 = arith.neq v6, v11 : i1; + v9 = arith.zext v8 : u32; + v10 = hir.bitcast v9 : i32; + builtin.ret v10; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/lt_felt.masm b/tests/integration/expected/lt_felt.masm index 755e85297..1a30cdfb8 100644 --- a/tests/integration/expected/lt_felt.masm +++ b/tests/integration/expected/lt_felt.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,23 +10,14 @@ proc init mem_store.278528 end -# mod root_ns:root@1.0.0::lt_felt +# mod ::"root_ns:root@1.0.0"::lt_felt +@locals("2") @callconv("C") pub proc entrypoint(felt, felt) -> i32 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::lt_felt::intrinsics::felt::lt - trace.252 - nop push.0 - neq -end - -@callconv("C") -proc intrinsics::felt::lt(felt, felt) -> i32 - swap.1 + swap.2 lt + neq end diff --git a/tests/integration/expected/lt_felt.wat b/tests/integration/expected/lt_felt.wat index 0ae010705..8d47e9a3d 100644 --- a/tests/integration/expected/lt_felt.wat +++ b/tests/integration/expected/lt_felt.wat @@ -6,8 +6,8 @@ (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) (func $entrypoint (;0;) (type 0) (param f32 f32) (result i32) - local.get 1 local.get 0 + local.get 1 call $intrinsics::felt::lt i32.const 0 i32.ne diff --git a/tests/integration/expected/lt_i32.hir b/tests/integration/expected/lt_i32.hir index b38279292..7c307c165 100644 --- a/tests/integration/expected/lt_i32.hir +++ b/tests/integration/expected/lt_i32.hir @@ -2,10 +2,10 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_5693119d28cd4640a4976d9000775e22d586752187efa219aae5739cf37d894a { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.lt v0, v1 : i1; - v4 = arith.zext v3 : u32; - v5 = hir.bitcast v4 : i32; - builtin.ret v5; + v5 = arith.lt v0, v1 : i1; + v6 = arith.zext v5 : u32; + v7 = hir.bitcast v6 : i32; + builtin.ret v7; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/lt_i32.masm b/tests/integration/expected/lt_i32.masm index 48a017559..d33116def 100644 --- a/tests/integration/expected/lt_i32.masm +++ b/tests/integration/expected/lt_i32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_5693119d28cd4640a4976d9000775e22d586752187efa219aae5739cf37d894a +# mod ::"root_ns:root@1.0.0"::test_rust_5693119d28cd4640a4976d9000775e22d586752187efa219aae5739cf37d894a +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 swap.1 diff --git a/tests/integration/expected/lt_i64.hir b/tests/integration/expected/lt_i64.hir index 0f025716c..b83e7187c 100644 --- a/tests/integration/expected/lt_i64.hir +++ b/tests/integration/expected/lt_i64.hir @@ -2,10 +2,10 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_193ef2ef135ab65a9e3987e493e8cf00a81359975e6bffaf693a15c44afbf24b { public builtin.function @entrypoint(v0: i64, v1: i64) -> i32 { ^block6(v0: i64, v1: i64): - v3 = arith.lt v0, v1 : i1; - v4 = arith.zext v3 : u32; - v5 = hir.bitcast v4 : i32; - builtin.ret v5; + v5 = arith.lt v0, v1 : i1; + v6 = arith.zext v5 : u32; + v7 = hir.bitcast v6 : i32; + builtin.ret v7; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/lt_i64.masm b/tests/integration/expected/lt_i64.masm index 56271ef55..d3e39510c 100644 --- a/tests/integration/expected/lt_i64.masm +++ b/tests/integration/expected/lt_i64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_193ef2ef135ab65a9e3987e493e8cf00a81359975e6bffaf693a15c44afbf24b +# mod ::"root_ns:root@1.0.0"::test_rust_193ef2ef135ab65a9e3987e493e8cf00a81359975e6bffaf693a15c44afbf24b +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> i32 movdn.3 diff --git a/tests/integration/expected/lt_u16.hir b/tests/integration/expected/lt_u16.hir index 688656c59..7728422fd 100644 --- a/tests/integration/expected/lt_u16.hir +++ b/tests/integration/expected/lt_u16.hir @@ -2,12 +2,12 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_66380427a6137e56f56ac9060dff040ec50d21b1cf2dab70538313874bc4a594 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v4 = hir.bitcast v1 : u32; - v3 = hir.bitcast v0 : u32; - v5 = arith.lt v3, v4 : i1; - v6 = arith.zext v5 : u32; - v7 = hir.bitcast v6 : i32; - builtin.ret v7; + v6 = hir.bitcast v1 : u32; + v5 = hir.bitcast v0 : u32; + v7 = arith.lt v5, v6 : i1; + v8 = arith.zext v7 : u32; + v9 = hir.bitcast v8 : i32; + builtin.ret v9; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/lt_u16.masm b/tests/integration/expected/lt_u16.masm index 6c41d77da..2b9148755 100644 --- a/tests/integration/expected/lt_u16.masm +++ b/tests/integration/expected/lt_u16.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_66380427a6137e56f56ac9060dff040ec50d21b1cf2dab70538313874bc4a594 +# mod ::"root_ns:root@1.0.0"::test_rust_66380427a6137e56f56ac9060dff040ec50d21b1cf2dab70538313874bc4a594 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 swap.1 diff --git a/tests/integration/expected/lt_u32.hir b/tests/integration/expected/lt_u32.hir index 5955651c9..57888c399 100644 --- a/tests/integration/expected/lt_u32.hir +++ b/tests/integration/expected/lt_u32.hir @@ -2,12 +2,12 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_1fcb2f151e54a93413cfbf27b720161db50a02b59d060ed448c3ffe2c3c9cc6c { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v4 = hir.bitcast v1 : u32; - v3 = hir.bitcast v0 : u32; - v5 = arith.lt v3, v4 : i1; - v6 = arith.zext v5 : u32; - v7 = hir.bitcast v6 : i32; - builtin.ret v7; + v6 = hir.bitcast v1 : u32; + v5 = hir.bitcast v0 : u32; + v7 = arith.lt v5, v6 : i1; + v8 = arith.zext v7 : u32; + v9 = hir.bitcast v8 : i32; + builtin.ret v9; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/lt_u32.masm b/tests/integration/expected/lt_u32.masm index 830a9d789..64679e8db 100644 --- a/tests/integration/expected/lt_u32.masm +++ b/tests/integration/expected/lt_u32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_1fcb2f151e54a93413cfbf27b720161db50a02b59d060ed448c3ffe2c3c9cc6c +# mod ::"root_ns:root@1.0.0"::test_rust_1fcb2f151e54a93413cfbf27b720161db50a02b59d060ed448c3ffe2c3c9cc6c +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 swap.1 diff --git a/tests/integration/expected/lt_u64.hir b/tests/integration/expected/lt_u64.hir index 2ba49078e..ee6842ad4 100644 --- a/tests/integration/expected/lt_u64.hir +++ b/tests/integration/expected/lt_u64.hir @@ -2,12 +2,12 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_416d83d84b3ae500f053222602966b59099d85bd2706dbbaf20b4eb34e76cf0e { public builtin.function @entrypoint(v0: i64, v1: i64) -> i32 { ^block6(v0: i64, v1: i64): - v4 = hir.bitcast v1 : u64; - v3 = hir.bitcast v0 : u64; - v5 = arith.lt v3, v4 : i1; - v6 = arith.zext v5 : u32; - v7 = hir.bitcast v6 : i32; - builtin.ret v7; + v6 = hir.bitcast v1 : u64; + v5 = hir.bitcast v0 : u64; + v7 = arith.lt v5, v6 : i1; + v8 = arith.zext v7 : u32; + v9 = hir.bitcast v8 : i32; + builtin.ret v9; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/lt_u64.masm b/tests/integration/expected/lt_u64.masm index 94e201f85..ee48060f4 100644 --- a/tests/integration/expected/lt_u64.masm +++ b/tests/integration/expected/lt_u64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_416d83d84b3ae500f053222602966b59099d85bd2706dbbaf20b4eb34e76cf0e +# mod ::"root_ns:root@1.0.0"::test_rust_416d83d84b3ae500f053222602966b59099d85bd2706dbbaf20b4eb34e76cf0e +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> i32 movdn.3 @@ -28,7 +29,7 @@ pub proc entrypoint([u32; 2], [u32; 2]) -> i32 movdn.3 trace.240 nop - exec.::std::math::u64::lt + exec.::miden::core::math::u64::lt trace.252 nop end diff --git a/tests/integration/expected/lt_u8.hir b/tests/integration/expected/lt_u8.hir index 23eb80cce..63564b592 100644 --- a/tests/integration/expected/lt_u8.hir +++ b/tests/integration/expected/lt_u8.hir @@ -2,12 +2,12 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_b8700ecc87997bcf6eefb8bf0b6e645582a0ad9339bbe24fccc168e4c61e746e { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v4 = hir.bitcast v1 : u32; - v3 = hir.bitcast v0 : u32; - v5 = arith.lt v3, v4 : i1; - v6 = arith.zext v5 : u32; - v7 = hir.bitcast v6 : i32; - builtin.ret v7; + v6 = hir.bitcast v1 : u32; + v5 = hir.bitcast v0 : u32; + v7 = arith.lt v5, v6 : i1; + v8 = arith.zext v7 : u32; + v9 = hir.bitcast v8 : i32; + builtin.ret v9; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/lt_u8.masm b/tests/integration/expected/lt_u8.masm index 059bb7c32..1fced5100 100644 --- a/tests/integration/expected/lt_u8.masm +++ b/tests/integration/expected/lt_u8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_b8700ecc87997bcf6eefb8bf0b6e645582a0ad9339bbe24fccc168e4c61e746e +# mod ::"root_ns:root@1.0.0"::test_rust_b8700ecc87997bcf6eefb8bf0b6e645582a0ad9339bbe24fccc168e4c61e746e +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 swap.1 diff --git a/tests/integration/expected/mem_intrinsics_heap_base.hir b/tests/integration/expected/mem_intrinsics_heap_base.hir index 1d3a89ec6..6d68da403 100644 --- a/tests/integration/expected/mem_intrinsics_heap_base.hir +++ b/tests/integration/expected/mem_intrinsics_heap_base.hir @@ -2,56 +2,65 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @mem_intrinsics_heap_base { private builtin.function @__rustc::__rust_alloc(v0: i32, v1: i32) -> i32 { ^block4(v0: i32, v1: i32): - v3 = arith.constant 1048576 : i32; - v4 = hir.exec @root_ns:root@1.0.0/mem_intrinsics_heap_base/::alloc(v3, v1, v0) : i32 - builtin.ret v4; + v159 = arith.constant 1048576 : i32; + v6 = hir.exec @root_ns:root@1.0.0/mem_intrinsics_heap_base/::alloc(v159, v1, v0) : i32 + builtin.ret v6; }; - public builtin.function @entrypoint(v5: i32, v6: i32) { - ^block6(v5: i32, v6: i32): + public builtin.function @entrypoint(v7: i32, v8: i32) { + ^block6(v7: i32, v8: i32): + hir.store_local v7 #[local = lv0]; + hir.store_local v8 #[local = lv1]; hir.exec @root_ns:root@1.0.0/mem_intrinsics_heap_base/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v8 = arith.constant 4 : i32; - v10 = hir.exec @root_ns:root@1.0.0/mem_intrinsics_heap_base/__rustc::__rust_alloc(v8, v8) : i32 - v7 = arith.constant 0 : i32; - v12 = arith.neq v10, v7 : i1; - cf.cond_br v12 ^block8, ^block9; + v166 = arith.constant 4 : i32; + v11 = hir.exec @root_ns:root@1.0.0/mem_intrinsics_heap_base/__rustc::__rust_alloc(v166, v166) : i32 + hir.store_local v11 #[local = lv2]; + v165 = arith.constant 0 : i32; + v13 = arith.neq v11, v165 : i1; + cf.cond_br v13 ^block8, ^block9; ^block8: - v17 = arith.constant 8 : u32; - v16 = hir.bitcast v5 : u32; - v18 = arith.add v16, v17 : u32 #[overflow = checked]; - v19 = arith.constant 4 : u32; - v20 = arith.mod v18, v19 : u32; - hir.assertz v20 #[code = 250]; - v15 = arith.constant 1 : i32; - v21 = hir.int_to_ptr v18 : ptr; - hir.store v21, v15; - v142 = arith.constant 4 : u32; - v22 = hir.bitcast v5 : u32; - v24 = arith.add v22, v142 : u32 #[overflow = checked]; - v141 = arith.constant 4 : u32; - v26 = arith.mod v24, v141 : u32; - hir.assertz v26 #[code = 250]; - v27 = hir.int_to_ptr v24 : ptr; - hir.store v27, v10; - v29 = hir.bitcast v5 : u32; - v140 = arith.constant 4 : u32; - v31 = arith.mod v29, v140 : u32; - hir.assertz v31 #[code = 250]; - v139 = arith.constant 1 : i32; - v32 = hir.int_to_ptr v29 : ptr; - hir.store v32, v139; - v36 = hir.bitcast v10 : u32; - v138 = arith.constant 4 : u32; - v38 = arith.mod v36, v138 : u32; - hir.assertz v38 #[code = 250]; - v135 = arith.constant 1 : u32; - v35 = arith.shl v6, v135 : i32; - v39 = hir.int_to_ptr v36 : ptr; - hir.store v39, v35; + v16 = hir.load_local : i32 #[local = lv0]; + v163 = arith.constant 8 : u32; + v18 = hir.bitcast v16 : u32; + v20 = arith.add v18, v163 : u32 #[overflow = checked]; + v162 = arith.constant 4 : u32; + v22 = arith.mod v20, v162 : u32; + hir.assertz v22 #[code = 250]; + v164 = arith.constant 1 : i32; + v23 = hir.int_to_ptr v20 : ptr; + hir.store v23, v164; + v24 = hir.load_local : i32 #[local = lv0]; + v25 = hir.load_local : i32 #[local = lv2]; + v179 = arith.constant 4 : u32; + v26 = hir.bitcast v24 : u32; + v28 = arith.add v26, v179 : u32 #[overflow = checked]; + v178 = arith.constant 4 : u32; + v30 = arith.mod v28, v178 : u32; + hir.assertz v30 #[code = 250]; + v31 = hir.int_to_ptr v28 : ptr; + hir.store v31, v25; + v32 = hir.load_local : i32 #[local = lv0]; + v34 = hir.bitcast v32 : u32; + v177 = arith.constant 4 : u32; + v36 = arith.mod v34, v177 : u32; + hir.assertz v36 #[code = 250]; + v176 = arith.constant 1 : i32; + v37 = hir.int_to_ptr v34 : ptr; + hir.store v37, v176; + v38 = hir.load_local : i32 #[local = lv2]; + v39 = hir.load_local : i32 #[local = lv1]; + v43 = hir.bitcast v38 : u32; + v175 = arith.constant 4 : u32; + v45 = arith.mod v43, v175 : u32; + hir.assertz v45 #[code = 250]; + v161 = arith.constant 1 : u32; + v42 = arith.shl v39, v161 : i32; + v46 = hir.int_to_ptr v43 : ptr; + hir.store v46, v42; builtin.ret ; ^block9: - v137 = arith.constant 4 : i32; - hir.exec @root_ns:root@1.0.0/mem_intrinsics_heap_base/alloc::alloc::handle_alloc_error(v137, v137) + v174 = arith.constant 4 : i32; + hir.exec @root_ns:root@1.0.0/mem_intrinsics_heap_base/alloc::alloc::handle_alloc_error(v174, v174) ub.unreachable ; }; @@ -60,147 +69,173 @@ builtin.component root_ns:root@1.0.0 { builtin.ret ; }; - private builtin.function @::alloc(v40: i32, v41: i32, v42: i32) -> i32 { - ^block12(v40: i32, v41: i32, v42: i32): - v45 = arith.constant 16 : i32; - v44 = arith.constant 0 : i32; - v144 = arith.constant 16 : u32; - v47 = hir.bitcast v41 : u32; - v49 = arith.gt v47, v144 : i1; - v50 = arith.zext v49 : u32; - v51 = hir.bitcast v50 : i32; - v53 = arith.neq v51, v44 : i1; - v54 = cf.select v53, v41, v45 : i32; - v184 = arith.constant 0 : i32; - v55 = arith.constant -1 : i32; - v56 = arith.add v54, v55 : i32 #[overflow = wrapping]; - v57 = arith.band v54, v56 : i32; - v59 = arith.neq v57, v184 : i1; - v153, v154 = scf.if v59 : i32, u32 { - ^block33: - v145 = arith.constant 0 : u32; - v149 = ub.poison i32 : i32; - scf.yield v149, v145; + private builtin.function @::alloc(v47: i32, v48: i32, v49: i32) -> i32 { + ^block12(v47: i32, v48: i32, v49: i32): + hir.store_local v47 #[local = lv0]; + hir.store_local v48 #[local = lv1]; + hir.store_local v49 #[local = lv2]; + v51 = hir.load_local : i32 #[local = lv1]; + v187 = arith.constant 16 : i32; + v186 = arith.constant 0 : i32; + v182 = arith.constant 16 : u32; + v55 = hir.bitcast v51 : u32; + v57 = arith.gt v55, v182 : i1; + v58 = arith.zext v57 : u32; + v59 = hir.bitcast v58 : i32; + v61 = arith.neq v59, v186 : i1; + v62 = cf.select v61, v51, v187 : i32; + hir.store_local v62 #[local = lv3]; + v63 = hir.load_local : i32 #[local = lv3]; + v230 = arith.constant 0 : i32; + v185 = arith.constant -1 : i32; + v65 = arith.add v63, v185 : i32 #[overflow = wrapping]; + v66 = arith.band v62, v65 : i32; + v68 = arith.neq v66, v230 : i1; + v208, v209 = scf.if v68 : i32, u32 { + ^block34: + v200 = arith.constant 0 : u32; + v204 = ub.poison i32 : i32; + scf.yield v204, v200; } else { ^block15: - v61 = hir.exec @root_ns:root@1.0.0/mem_intrinsics_heap_base/::max(v41, v54) : i32 - v183 = arith.constant 0 : i32; - v60 = arith.constant -2147483648 : i32; - v62 = arith.sub v60, v61 : i32 #[overflow = wrapping]; - v64 = hir.bitcast v62 : u32; - v63 = hir.bitcast v42 : u32; - v65 = arith.gt v63, v64 : i1; - v66 = arith.zext v65 : u32; - v67 = hir.bitcast v66 : i32; - v69 = arith.neq v67, v183 : i1; - v168 = scf.if v69 : i32 { - ^block32: - v182 = ub.poison i32 : i32; - scf.yield v182; + v69 = hir.load_local : i32 #[local = lv2]; + v71 = hir.load_local : i32 #[local = lv1]; + v72 = hir.load_local : i32 #[local = lv3]; + v73 = hir.exec @root_ns:root@1.0.0/mem_intrinsics_heap_base/::max(v71, v72) : i32 + hir.store_local v73 #[local = lv1]; + v229 = arith.constant 0 : i32; + v184 = arith.constant -2147483648 : i32; + v74 = arith.sub v184, v73 : i32 #[overflow = wrapping]; + v76 = hir.bitcast v74 : u32; + v75 = hir.bitcast v69 : u32; + v77 = arith.gt v75, v76 : i1; + v78 = arith.zext v77 : u32; + v79 = hir.bitcast v78 : i32; + v81 = arith.neq v79, v229 : i1; + v214 = scf.if v81 : i32 { + ^block33: + v228 = ub.poison i32 : i32; + scf.yield v228; } else { ^block16: - v180 = arith.constant 0 : i32; - v75 = arith.sub v180, v61 : i32 #[overflow = wrapping]; - v181 = arith.constant -1 : i32; - v71 = arith.add v42, v61 : i32 #[overflow = wrapping]; - v73 = arith.add v71, v181 : i32 #[overflow = wrapping]; - v76 = arith.band v73, v75 : i32; - v77 = hir.bitcast v40 : u32; - v78 = arith.constant 4 : u32; - v79 = arith.mod v77, v78 : u32; - hir.assertz v79 #[code = 250]; - v80 = hir.int_to_ptr v77 : ptr; - v81 = hir.load v80 : i32; - v179 = arith.constant 0 : i32; - v83 = arith.neq v81, v179 : i1; - scf.if v83{ - ^block31: + v227 = arith.constant 0 : i32; + hir.store_local v227 #[local = lv3]; + v83 = hir.load_local : i32 #[local = lv2]; + v84 = hir.load_local : i32 #[local = lv1]; + v225 = arith.constant 0 : i32; + v90 = arith.sub v225, v84 : i32 #[overflow = wrapping]; + v226 = arith.constant -1 : i32; + v85 = arith.add v83, v84 : i32 #[overflow = wrapping]; + v87 = arith.add v85, v226 : i32 #[overflow = wrapping]; + v91 = arith.band v87, v90 : i32; + hir.store_local v91 #[local = lv2]; + v92 = hir.load_local : i32 #[local = lv0]; + v93 = hir.bitcast v92 : u32; + v183 = arith.constant 4 : u32; + v95 = arith.mod v93, v183 : u32; + hir.assertz v95 #[code = 250]; + v96 = hir.int_to_ptr v93 : ptr; + v97 = hir.load v96 : i32; + v224 = arith.constant 0 : i32; + v99 = arith.neq v97, v224 : i1; + scf.if v99{ + ^block32: scf.yield ; } else { ^block18: - v84 = hir.exec @root_ns:root@1.0.0/mem_intrinsics_heap_base/intrinsics::mem::heap_base() : i32 - v85 = hir.mem_size : u32; - v91 = hir.bitcast v40 : u32; - v178 = arith.constant 4 : u32; - v93 = arith.mod v91, v178 : u32; - hir.assertz v93 #[code = 250]; - v177 = arith.constant 16 : u32; - v86 = hir.bitcast v85 : i32; - v89 = arith.shl v86, v177 : i32; - v90 = arith.add v84, v89 : i32 #[overflow = wrapping]; - v94 = hir.int_to_ptr v91 : ptr; - hir.store v94, v90; + v100 = hir.load_local : i32 #[local = lv0]; + v101 = hir.exec @root_ns:root@1.0.0/mem_intrinsics_heap_base/intrinsics::mem::heap_base() : i32 + v102 = hir.mem_size : u32; + v108 = hir.bitcast v100 : u32; + v223 = arith.constant 4 : u32; + v110 = arith.mod v108, v223 : u32; + hir.assertz v110 #[code = 250]; + v222 = arith.constant 16 : u32; + v103 = hir.bitcast v102 : i32; + v106 = arith.shl v103, v222 : i32; + v107 = arith.add v101, v106 : i32 #[overflow = wrapping]; + v111 = hir.int_to_ptr v108 : ptr; + hir.store v111, v107; scf.yield ; }; - v97 = hir.bitcast v40 : u32; - v176 = arith.constant 4 : u32; - v99 = arith.mod v97, v176 : u32; - hir.assertz v99 #[code = 250]; - v100 = hir.int_to_ptr v97 : ptr; - v101 = hir.load v100 : i32; - v174 = arith.constant 0 : i32; - v175 = arith.constant -1 : i32; - v103 = arith.bxor v101, v175 : i32; - v105 = hir.bitcast v103 : u32; - v104 = hir.bitcast v76 : u32; - v106 = arith.gt v104, v105 : i1; - v107 = arith.zext v106 : u32; - v108 = hir.bitcast v107 : i32; - v110 = arith.neq v108, v174 : i1; - v167 = scf.if v110 : i32 { - ^block19: - v173 = arith.constant 0 : i32; - scf.yield v173; + v112 = hir.load_local : i32 #[local = lv2]; + v113 = hir.load_local : i32 #[local = lv0]; + v114 = hir.bitcast v113 : u32; + v221 = arith.constant 4 : u32; + v116 = arith.mod v114, v221 : u32; + hir.assertz v116 #[code = 250]; + v117 = hir.int_to_ptr v114 : ptr; + v118 = hir.load v117 : i32; + hir.store_local v118 #[local = lv4]; + v219 = arith.constant 0 : i32; + v220 = arith.constant -1 : i32; + v120 = arith.bxor v118, v220 : i32; + v122 = hir.bitcast v120 : u32; + v121 = hir.bitcast v112 : u32; + v123 = arith.gt v121, v122 : i1; + v124 = arith.zext v123 : u32; + v125 = hir.bitcast v124 : i32; + v127 = arith.neq v125, v219 : i1; + scf.if v127{ + ^block31: + scf.yield ; } else { ^block20: - v112 = hir.bitcast v40 : u32; - v172 = arith.constant 4 : u32; - v114 = arith.mod v112, v172 : u32; - hir.assertz v114 #[code = 250]; - v111 = arith.add v101, v76 : i32 #[overflow = wrapping]; - v115 = hir.int_to_ptr v112 : ptr; - hir.store v115, v111; - v117 = arith.add v101, v61 : i32 #[overflow = wrapping]; - scf.yield v117; + v128 = hir.load_local : i32 #[local = lv0]; + v129 = hir.load_local : i32 #[local = lv4]; + v130 = hir.load_local : i32 #[local = lv2]; + v132 = hir.bitcast v128 : u32; + v218 = arith.constant 4 : u32; + v134 = arith.mod v132, v218 : u32; + hir.assertz v134 #[code = 250]; + v131 = arith.add v129, v130 : i32 #[overflow = wrapping]; + v135 = hir.int_to_ptr v132 : ptr; + hir.store v135, v131; + v136 = hir.load_local : i32 #[local = lv4]; + v137 = hir.load_local : i32 #[local = lv1]; + v138 = arith.add v136, v137 : i32 #[overflow = wrapping]; + hir.store_local v138 #[local = lv3]; + scf.yield ; }; - scf.yield v167; + v139 = hir.load_local : i32 #[local = lv3]; + scf.yield v139; }; - v150 = arith.constant 1 : u32; - v171 = arith.constant 0 : u32; - v169 = cf.select v69, v171, v150 : u32; - scf.yield v168, v169; + v205 = arith.constant 1 : u32; + v217 = arith.constant 0 : u32; + v215 = cf.select v81, v217, v205 : u32; + scf.yield v214, v215; }; - v170 = arith.constant 0 : u32; - v166 = arith.eq v154, v170 : i1; - cf.cond_br v166 ^block14, ^block35(v153); + v216 = arith.constant 0 : u32; + v213 = arith.eq v209, v216 : i1; + cf.cond_br v213 ^block14, ^block36(v208); ^block14: ub.unreachable ; - ^block35(v146: i32): - builtin.ret v146; + ^block36(v201: i32): + builtin.ret v201; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { ^block21: - v120 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v120; + v140 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v140; }; - private builtin.function @alloc::alloc::handle_alloc_error(v122: i32, v123: i32) { - ^block25(v122: i32, v123: i32): + private builtin.function @alloc::alloc::handle_alloc_error(v142: i32, v143: i32) { + ^block25(v142: i32, v143: i32): ub.unreachable ; }; - private builtin.function @::max(v124: i32, v125: i32) -> i32 { - ^block27(v124: i32, v125: i32): - v132 = arith.constant 0 : i32; - v128 = hir.bitcast v125 : u32; - v127 = hir.bitcast v124 : u32; - v129 = arith.gt v127, v128 : i1; - v130 = arith.zext v129 : u32; - v131 = hir.bitcast v130 : i32; - v133 = arith.neq v131, v132 : i1; - v134 = cf.select v133, v124, v125 : i32; - builtin.ret v134; + private builtin.function @::max(v144: i32, v145: i32) -> i32 { + ^block27(v144: i32, v145: i32): + v231 = arith.constant 0 : i32; + v152 = hir.bitcast v145 : u32; + v151 = hir.bitcast v144 : u32; + v153 = arith.gt v151, v152 : i1; + v154 = arith.zext v153 : u32; + v155 = hir.bitcast v154 : i32; + v157 = arith.neq v155, v231 : i1; + v158 = cf.select v157, v144, v145 : i32; + builtin.ret v158; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/mul_felt.hir b/tests/integration/expected/mul_felt.hir index 49de5efab..2405f6258 100644 --- a/tests/integration/expected/mul_felt.hir +++ b/tests/integration/expected/mul_felt.hir @@ -2,14 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @mul_felt { public builtin.function @entrypoint(v0: felt, v1: felt) -> felt { ^block4(v0: felt, v1: felt): - v3 = hir.exec @root_ns:root@1.0.0/mul_felt/intrinsics::felt::mul(v0, v1) : felt - builtin.ret v3; - }; - - private builtin.function @intrinsics::felt::mul(v4: felt, v5: felt) -> felt { - ^block6(v4: felt, v5: felt): - v6 = arith.mul v4, v5 : felt #[overflow = unchecked]; - builtin.ret v6; + v5 = arith.mul v0, v1 : felt #[overflow = unchecked]; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/mul_felt.masm b/tests/integration/expected/mul_felt.masm index ad5311040..61944fd98 100644 --- a/tests/integration/expected/mul_felt.masm +++ b/tests/integration/expected/mul_felt.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,19 +10,11 @@ proc init mem_store.278528 end -# mod root_ns:root@1.0.0::mul_felt +# mod ::"root_ns:root@1.0.0"::mul_felt +@locals("2") @callconv("C") pub proc entrypoint(felt, felt) -> felt - trace.240 - nop - exec.::root_ns:root@1.0.0::mul_felt::intrinsics::felt::mul - trace.252 - nop -end - -@callconv("C") -proc intrinsics::felt::mul(felt, felt) -> felt mul end diff --git a/tests/integration/expected/mul_i128.hir b/tests/integration/expected/mul_i128.hir index 44fd35d96..1bf3c4de8 100644 --- a/tests/integration/expected/mul_i128.hir +++ b/tests/integration/expected/mul_i128.hir @@ -2,32 +2,41 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_aef84d8c0f31ef839006490963a826949aaedc9315fd0ca99dc18ddcd7c7205b { public builtin.function @entrypoint(v0: i32, v1: i64, v2: i64, v3: i64, v4: i64) { ^block6(v0: i32, v1: i64, v2: i64, v3: i64, v4: i64): - v8 = hir.bitcast v1 : u64; + hir.store_local v0 #[local = lv0]; + hir.store_local v1 #[local = lv1]; + hir.store_local v3 #[local = lv3]; + v5 = hir.load_local : i32 #[local = lv0]; + v6 = hir.load_local : i64 #[local = lv3]; + v7 = hir.load_local : i64 #[local = lv1]; + v10 = hir.bitcast v7 : u64; + v11 = arith.zext v10 : u128; + v8 = hir.bitcast v6 : u64; v9 = arith.zext v8 : u128; - v6 = hir.bitcast v3 : u64; - hir.store_local v3 #[local = lv0]; - v7 = arith.zext v6 : u128; - v10 = arith.mul v7, v9 : u128 #[overflow = wrapping]; - v11, v12 = arith.split v10 : i64, i64; - v13 = hir.bitcast v0 : u32; - v14 = arith.constant 8 : u32; - v15 = arith.mod v13, v14 : u32; - hir.assertz v15 #[code = 250]; - v16 = hir.int_to_ptr v13 : ptr; - hir.store v16, v12; - v28 = arith.constant 8 : u32; - v21 = hir.bitcast v0 : u32; - v23 = arith.add v21, v28 : u32 #[overflow = checked]; - v27 = arith.constant 8 : u32; - v25 = arith.mod v23, v27 : u32; - hir.assertz v25 #[code = 250]; - v19 = arith.mul v4, v1 : i64 #[overflow = wrapping]; - v30 = hir.load_local : i64 #[local = lv0]; - v17 = arith.mul v30, v2 : i64 #[overflow = wrapping]; - v18 = arith.add v11, v17 : i64 #[overflow = wrapping]; - v20 = arith.add v18, v19 : i64 #[overflow = wrapping]; - v26 = hir.int_to_ptr v23 : ptr; - hir.store v26, v20; + v12 = arith.mul v9, v11 : u128 #[overflow = wrapping]; + v13, v14 = arith.split v12 : u64, u64; + v17 = hir.bitcast v5 : u32; + v37 = arith.constant 8 : u32; + v19 = arith.mod v17, v37 : u32; + hir.assertz v19 #[code = 250]; + v16 = hir.bitcast v14 : i64; + v20 = hir.int_to_ptr v17 : ptr; + hir.store v20, v16; + v21 = hir.load_local : i32 #[local = lv0]; + v23 = hir.load_local : i64 #[local = lv3]; + v28 = hir.load_local : i64 #[local = lv1]; + v41 = arith.constant 8 : u32; + v31 = hir.bitcast v21 : u32; + v33 = arith.add v31, v41 : u32 #[overflow = checked]; + v40 = arith.constant 8 : u32; + v35 = arith.mod v33, v40 : u32; + hir.assertz v35 #[code = 250]; + v29 = arith.mul v4, v28 : i64 #[overflow = wrapping]; + v25 = arith.mul v23, v2 : i64 #[overflow = wrapping]; + v15 = hir.bitcast v13 : i64; + v26 = arith.add v15, v25 : i64 #[overflow = wrapping]; + v30 = arith.add v26, v29 : i64 #[overflow = wrapping]; + v36 = hir.int_to_ptr v33 : ptr; + hir.store v36, v30; builtin.ret ; }; diff --git a/tests/integration/expected/mul_i128.masm b/tests/integration/expected/mul_i128.masm index e88022a8f..be9b14152 100644 --- a/tests/integration/expected/mul_i128.masm +++ b/tests/integration/expected/mul_i128.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,19 +16,32 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_aef84d8c0f31ef839006490963a826949aaedc9315fd0ca99dc18ddcd7c7205b +# mod ::"root_ns:root@1.0.0"::test_rust_aef84d8c0f31ef839006490963a826949aaedc9315fd0ca99dc18ddcd7c7205b +@locals("11") @callconv("C") -pub proc entrypoint.2(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) - dup.2 - dup.2 +pub proc entrypoint(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) + locaddr.0 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 push.0 - dup.10 - dup.10 - movup.12 - movup.12 - locaddr.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movdn.3 + movdn.3 + locaddr.5 push.0 swap.1 movup.2 @@ -38,6 +51,38 @@ pub proc entrypoint.2(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.0 + push.0 + movdn.5 + movdn.5 + movdn.5 + movdn.5 push.0 push.0 trace.240 @@ -45,7 +90,7 @@ pub proc entrypoint.2(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) exec.::intrinsics::i128::mul trace.252 nop - dup.4 + movup.4 push.8 dup.1 swap.1 @@ -64,8 +109,34 @@ pub proc entrypoint.2(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 push.8 - movup.3 + movup.5 add u32assert push.8 @@ -74,24 +145,17 @@ pub proc entrypoint.2(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) u32mod u32assert assertz - movup.8 - movup.8 - movup.6 - movup.6 + movup.10 + movup.10 + movup.4 + movup.4 trace.240 nop exec.::intrinsics::i64::wrapping_mul trace.252 nop - locaddr.0 - push.0 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 + movup.4 + movup.4 movup.8 movup.8 trace.240 @@ -103,12 +167,12 @@ pub proc entrypoint.2(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) movup.6 trace.240 nop - exec.::std::math::u64::wrapping_add + exec.::miden::core::math::u64::wrapping_add trace.252 nop trace.240 nop - exec.::std::math::u64::wrapping_add + exec.::miden::core::math::u64::wrapping_add trace.252 nop movup.2 diff --git a/tests/integration/expected/mul_i32.hir b/tests/integration/expected/mul_i32.hir index 7ab7d0f78..cb214c179 100644 --- a/tests/integration/expected/mul_i32.hir +++ b/tests/integration/expected/mul_i32.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_4a870fe7a144fba5513f0d246ed1179aba172aab8f12afb574634dd1bb298024 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.mul v1, v0 : i32 #[overflow = wrapping]; - builtin.ret v3; + v5 = arith.mul v1, v0 : i32 #[overflow = wrapping]; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/mul_i32.masm b/tests/integration/expected/mul_i32.masm index dbc78ec73..7cdbb4662 100644 --- a/tests/integration/expected/mul_i32.masm +++ b/tests/integration/expected/mul_i32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_4a870fe7a144fba5513f0d246ed1179aba172aab8f12afb574634dd1bb298024 +# mod ::"root_ns:root@1.0.0"::test_rust_4a870fe7a144fba5513f0d246ed1179aba172aab8f12afb574634dd1bb298024 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 trace.240 diff --git a/tests/integration/expected/mul_i64.hir b/tests/integration/expected/mul_i64.hir index 49c839997..3e7fbb355 100644 --- a/tests/integration/expected/mul_i64.hir +++ b/tests/integration/expected/mul_i64.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_ee95318918a451f864b66b576532b422841bcd75ad8a62c4d4d3489a9158c08d { public builtin.function @entrypoint(v0: i64, v1: i64) -> i64 { ^block6(v0: i64, v1: i64): - v3 = arith.mul v1, v0 : i64 #[overflow = wrapping]; - builtin.ret v3; + v5 = arith.mul v1, v0 : i64 #[overflow = wrapping]; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/mul_i64.masm b/tests/integration/expected/mul_i64.masm index 6270f1d6f..118b94204 100644 --- a/tests/integration/expected/mul_i64.masm +++ b/tests/integration/expected/mul_i64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_ee95318918a451f864b66b576532b422841bcd75ad8a62c4d4d3489a9158c08d +# mod ::"root_ns:root@1.0.0"::test_rust_ee95318918a451f864b66b576532b422841bcd75ad8a62c4d4d3489a9158c08d +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] trace.240 diff --git a/tests/integration/expected/mul_u128.hir b/tests/integration/expected/mul_u128.hir index 53723c3ce..7c1d75140 100644 --- a/tests/integration/expected/mul_u128.hir +++ b/tests/integration/expected/mul_u128.hir @@ -2,32 +2,41 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_47451efa7b59553058cbdbb88f5ae77d281126afc1fd9ca385bcdeb64d64800e { public builtin.function @entrypoint(v0: i32, v1: i64, v2: i64, v3: i64, v4: i64) { ^block6(v0: i32, v1: i64, v2: i64, v3: i64, v4: i64): - v8 = hir.bitcast v1 : u64; + hir.store_local v0 #[local = lv0]; + hir.store_local v1 #[local = lv1]; + hir.store_local v3 #[local = lv3]; + v5 = hir.load_local : i32 #[local = lv0]; + v6 = hir.load_local : i64 #[local = lv3]; + v7 = hir.load_local : i64 #[local = lv1]; + v10 = hir.bitcast v7 : u64; + v11 = arith.zext v10 : u128; + v8 = hir.bitcast v6 : u64; v9 = arith.zext v8 : u128; - v6 = hir.bitcast v3 : u64; - hir.store_local v3 #[local = lv0]; - v7 = arith.zext v6 : u128; - v10 = arith.mul v7, v9 : u128 #[overflow = wrapping]; - v11, v12 = arith.split v10 : i64, i64; - v13 = hir.bitcast v0 : u32; - v14 = arith.constant 8 : u32; - v15 = arith.mod v13, v14 : u32; - hir.assertz v15 #[code = 250]; - v16 = hir.int_to_ptr v13 : ptr; - hir.store v16, v12; - v28 = arith.constant 8 : u32; - v21 = hir.bitcast v0 : u32; - v23 = arith.add v21, v28 : u32 #[overflow = checked]; - v27 = arith.constant 8 : u32; - v25 = arith.mod v23, v27 : u32; - hir.assertz v25 #[code = 250]; - v19 = arith.mul v4, v1 : i64 #[overflow = wrapping]; - v30 = hir.load_local : i64 #[local = lv0]; - v17 = arith.mul v30, v2 : i64 #[overflow = wrapping]; - v18 = arith.add v11, v17 : i64 #[overflow = wrapping]; - v20 = arith.add v18, v19 : i64 #[overflow = wrapping]; - v26 = hir.int_to_ptr v23 : ptr; - hir.store v26, v20; + v12 = arith.mul v9, v11 : u128 #[overflow = wrapping]; + v13, v14 = arith.split v12 : u64, u64; + v17 = hir.bitcast v5 : u32; + v37 = arith.constant 8 : u32; + v19 = arith.mod v17, v37 : u32; + hir.assertz v19 #[code = 250]; + v16 = hir.bitcast v14 : i64; + v20 = hir.int_to_ptr v17 : ptr; + hir.store v20, v16; + v21 = hir.load_local : i32 #[local = lv0]; + v23 = hir.load_local : i64 #[local = lv3]; + v28 = hir.load_local : i64 #[local = lv1]; + v41 = arith.constant 8 : u32; + v31 = hir.bitcast v21 : u32; + v33 = arith.add v31, v41 : u32 #[overflow = checked]; + v40 = arith.constant 8 : u32; + v35 = arith.mod v33, v40 : u32; + hir.assertz v35 #[code = 250]; + v29 = arith.mul v4, v28 : i64 #[overflow = wrapping]; + v25 = arith.mul v23, v2 : i64 #[overflow = wrapping]; + v15 = hir.bitcast v13 : i64; + v26 = arith.add v15, v25 : i64 #[overflow = wrapping]; + v30 = arith.add v26, v29 : i64 #[overflow = wrapping]; + v36 = hir.int_to_ptr v33 : ptr; + hir.store v36, v30; builtin.ret ; }; diff --git a/tests/integration/expected/mul_u128.masm b/tests/integration/expected/mul_u128.masm index 4cc632bb2..0df58e4e9 100644 --- a/tests/integration/expected/mul_u128.masm +++ b/tests/integration/expected/mul_u128.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,19 +16,32 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_47451efa7b59553058cbdbb88f5ae77d281126afc1fd9ca385bcdeb64d64800e +# mod ::"root_ns:root@1.0.0"::test_rust_47451efa7b59553058cbdbb88f5ae77d281126afc1fd9ca385bcdeb64d64800e +@locals("11") @callconv("C") -pub proc entrypoint.2(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) - dup.2 - dup.2 +pub proc entrypoint(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) + locaddr.0 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 push.0 - dup.10 - dup.10 - movup.12 - movup.12 - locaddr.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movdn.3 + movdn.3 + locaddr.5 push.0 swap.1 movup.2 @@ -38,6 +51,38 @@ pub proc entrypoint.2(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.0 + push.0 + movdn.5 + movdn.5 + movdn.5 + movdn.5 push.0 push.0 trace.240 @@ -45,7 +90,7 @@ pub proc entrypoint.2(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) exec.::intrinsics::i128::mul trace.252 nop - dup.4 + movup.4 push.8 dup.1 swap.1 @@ -64,8 +109,34 @@ pub proc entrypoint.2(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 push.8 - movup.3 + movup.5 add u32assert push.8 @@ -74,24 +145,17 @@ pub proc entrypoint.2(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) u32mod u32assert assertz - movup.8 - movup.8 - movup.6 - movup.6 + movup.10 + movup.10 + movup.4 + movup.4 trace.240 nop exec.::intrinsics::i64::wrapping_mul trace.252 nop - locaddr.0 - push.0 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 + movup.4 + movup.4 movup.8 movup.8 trace.240 @@ -103,12 +167,12 @@ pub proc entrypoint.2(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) movup.6 trace.240 nop - exec.::std::math::u64::wrapping_add + exec.::miden::core::math::u64::wrapping_add trace.252 nop trace.240 nop - exec.::std::math::u64::wrapping_add + exec.::miden::core::math::u64::wrapping_add trace.252 nop movup.2 diff --git a/tests/integration/expected/mul_u16.hir b/tests/integration/expected/mul_u16.hir index 06c8866c8..fce215b36 100644 --- a/tests/integration/expected/mul_u16.hir +++ b/tests/integration/expected/mul_u16.hir @@ -2,10 +2,10 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_1503849cd0d258094fa54f6a7e16334db70e5daa56a5858f344d2a2c90b757d6 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v4 = arith.constant 65535 : i32; - v3 = arith.mul v1, v0 : i32 #[overflow = wrapping]; - v5 = arith.band v3, v4 : i32; - builtin.ret v5; + v8 = arith.constant 65535 : i32; + v5 = arith.mul v1, v0 : i32 #[overflow = wrapping]; + v7 = arith.band v5, v8 : i32; + builtin.ret v7; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/mul_u16.masm b/tests/integration/expected/mul_u16.masm index 6d2108a1f..63a5b9a1c 100644 --- a/tests/integration/expected/mul_u16.masm +++ b/tests/integration/expected/mul_u16.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_1503849cd0d258094fa54f6a7e16334db70e5daa56a5858f344d2a2c90b757d6 +# mod ::"root_ns:root@1.0.0"::test_rust_1503849cd0d258094fa54f6a7e16334db70e5daa56a5858f344d2a2c90b757d6 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 push.65535 diff --git a/tests/integration/expected/mul_u32.hir b/tests/integration/expected/mul_u32.hir index 186db2b96..22f901ace 100644 --- a/tests/integration/expected/mul_u32.hir +++ b/tests/integration/expected/mul_u32.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_774ac315a535180c25b481293c43de2ad5b38b8ed718ccd906a367b8df969453 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.mul v1, v0 : i32 #[overflow = wrapping]; - builtin.ret v3; + v5 = arith.mul v1, v0 : i32 #[overflow = wrapping]; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/mul_u32.masm b/tests/integration/expected/mul_u32.masm index b4ba6bb17..a2154efa4 100644 --- a/tests/integration/expected/mul_u32.masm +++ b/tests/integration/expected/mul_u32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_774ac315a535180c25b481293c43de2ad5b38b8ed718ccd906a367b8df969453 +# mod ::"root_ns:root@1.0.0"::test_rust_774ac315a535180c25b481293c43de2ad5b38b8ed718ccd906a367b8df969453 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 trace.240 diff --git a/tests/integration/expected/mul_u64.hir b/tests/integration/expected/mul_u64.hir index da7557cb9..a56004621 100644 --- a/tests/integration/expected/mul_u64.hir +++ b/tests/integration/expected/mul_u64.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_ef43647914852c132ded20e7ab9569f69610af521a6074095544ea088f8908ae { public builtin.function @entrypoint(v0: i64, v1: i64) -> i64 { ^block6(v0: i64, v1: i64): - v3 = arith.mul v1, v0 : i64 #[overflow = wrapping]; - builtin.ret v3; + v5 = arith.mul v1, v0 : i64 #[overflow = wrapping]; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/mul_u64.masm b/tests/integration/expected/mul_u64.masm index 2a281e9b2..f0f7cca29 100644 --- a/tests/integration/expected/mul_u64.masm +++ b/tests/integration/expected/mul_u64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_ef43647914852c132ded20e7ab9569f69610af521a6074095544ea088f8908ae +# mod ::"root_ns:root@1.0.0"::test_rust_ef43647914852c132ded20e7ab9569f69610af521a6074095544ea088f8908ae +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] trace.240 diff --git a/tests/integration/expected/mul_u8.hir b/tests/integration/expected/mul_u8.hir index 4236c9b8b..b20d50520 100644 --- a/tests/integration/expected/mul_u8.hir +++ b/tests/integration/expected/mul_u8.hir @@ -2,10 +2,10 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_3332f4e22611553fee6834bdfb5edc7af11b545fb7a55941be9fef2efaecf059 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v4 = arith.constant 255 : i32; - v3 = arith.mul v1, v0 : i32 #[overflow = wrapping]; - v5 = arith.band v3, v4 : i32; - builtin.ret v5; + v8 = arith.constant 255 : i32; + v5 = arith.mul v1, v0 : i32 #[overflow = wrapping]; + v7 = arith.band v5, v8 : i32; + builtin.ret v7; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/mul_u8.masm b/tests/integration/expected/mul_u8.masm index 358c99b1a..ec730fd75 100644 --- a/tests/integration/expected/mul_u8.masm +++ b/tests/integration/expected/mul_u8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_3332f4e22611553fee6834bdfb5edc7af11b545fb7a55941be9fef2efaecf059 +# mod ::"root_ns:root@1.0.0"::test_rust_3332f4e22611553fee6834bdfb5edc7af11b545fb7a55941be9fef2efaecf059 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 push.255 diff --git a/tests/integration/expected/neg_felt.hir b/tests/integration/expected/neg_felt.hir index f29547876..519d3d555 100644 --- a/tests/integration/expected/neg_felt.hir +++ b/tests/integration/expected/neg_felt.hir @@ -2,14 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @neg_felt { public builtin.function @entrypoint(v0: felt, v1: felt) -> felt { ^block4(v0: felt, v1: felt): - v3 = hir.exec @root_ns:root@1.0.0/neg_felt/intrinsics::felt::sub(v0, v1) : felt - builtin.ret v3; - }; - - private builtin.function @intrinsics::felt::sub(v4: felt, v5: felt) -> felt { - ^block6(v4: felt, v5: felt): - v6 = arith.sub v4, v5 : felt #[overflow = unchecked]; - builtin.ret v6; + v5 = arith.sub v0, v1 : felt #[overflow = unchecked]; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/neg_felt.masm b/tests/integration/expected/neg_felt.masm index 66631fc4f..5833f3b55 100644 --- a/tests/integration/expected/neg_felt.masm +++ b/tests/integration/expected/neg_felt.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,19 +10,11 @@ proc init mem_store.278528 end -# mod root_ns:root@1.0.0::neg_felt +# mod ::"root_ns:root@1.0.0"::neg_felt +@locals("2") @callconv("C") pub proc entrypoint(felt, felt) -> felt - trace.240 - nop - exec.::root_ns:root@1.0.0::neg_felt::intrinsics::felt::sub - trace.252 - nop -end - -@callconv("C") -proc intrinsics::felt::sub(felt, felt) -> felt swap.1 sub end diff --git a/tests/integration/expected/neg_i16.hir b/tests/integration/expected/neg_i16.hir index bd46ce3b9..658cd525e 100644 --- a/tests/integration/expected/neg_i16.hir +++ b/tests/integration/expected/neg_i16.hir @@ -2,10 +2,10 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_ff799fd5021c298afc16f98dda4d174c028df9b4ad9e425d365d3c1fb3cef25a { public builtin.function @entrypoint(v0: i32) -> i32 { ^block6(v0: i32): - v2 = arith.constant 0 : i32; - v3 = arith.sub v2, v0 : i32 #[overflow = wrapping]; - v4 = arith.sext v3 : i32; - builtin.ret v4; + v6 = arith.constant 0 : i32; + v4 = arith.sub v6, v0 : i32 #[overflow = wrapping]; + v5 = arith.sext v4 : i32; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/neg_i16.masm b/tests/integration/expected/neg_i16.masm index 013982c33..4070acb21 100644 --- a/tests/integration/expected/neg_i16.masm +++ b/tests/integration/expected/neg_i16.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_ff799fd5021c298afc16f98dda4d174c028df9b4ad9e425d365d3c1fb3cef25a +# mod ::"root_ns:root@1.0.0"::test_rust_ff799fd5021c298afc16f98dda4d174c028df9b4ad9e425d365d3c1fb3cef25a +@locals("1") @callconv("C") pub proc entrypoint(i32) -> i32 push.0 diff --git a/tests/integration/expected/neg_i32.hir b/tests/integration/expected/neg_i32.hir index 00805aeca..00083d222 100644 --- a/tests/integration/expected/neg_i32.hir +++ b/tests/integration/expected/neg_i32.hir @@ -2,9 +2,9 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_ad225f3904404156f79b92bcde2daa108dc69c4c2e00a61030a898c2fcb6f87c { public builtin.function @entrypoint(v0: i32) -> i32 { ^block6(v0: i32): - v2 = arith.constant 0 : i32; - v3 = arith.sub v2, v0 : i32 #[overflow = wrapping]; - builtin.ret v3; + v5 = arith.constant 0 : i32; + v4 = arith.sub v5, v0 : i32 #[overflow = wrapping]; + builtin.ret v4; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/neg_i32.masm b/tests/integration/expected/neg_i32.masm index dd43b7e8e..2c60e0ab8 100644 --- a/tests/integration/expected/neg_i32.masm +++ b/tests/integration/expected/neg_i32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_ad225f3904404156f79b92bcde2daa108dc69c4c2e00a61030a898c2fcb6f87c +# mod ::"root_ns:root@1.0.0"::test_rust_ad225f3904404156f79b92bcde2daa108dc69c4c2e00a61030a898c2fcb6f87c +@locals("1") @callconv("C") pub proc entrypoint(i32) -> i32 push.0 diff --git a/tests/integration/expected/neg_i64.hir b/tests/integration/expected/neg_i64.hir index b9a239ca8..00e4c4014 100644 --- a/tests/integration/expected/neg_i64.hir +++ b/tests/integration/expected/neg_i64.hir @@ -2,9 +2,9 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_7e6ecbf37c062a73130e37145b77eb9dd3cce8aa16128ac9fcca7dc837ca562c { public builtin.function @entrypoint(v0: i64) -> i64 { ^block6(v0: i64): - v2 = arith.constant 0 : i64; - v3 = arith.sub v2, v0 : i64 #[overflow = wrapping]; - builtin.ret v3; + v5 = arith.constant 0 : i64; + v4 = arith.sub v5, v0 : i64 #[overflow = wrapping]; + builtin.ret v4; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/neg_i64.masm b/tests/integration/expected/neg_i64.masm index 525c58ddc..a9877fe57 100644 --- a/tests/integration/expected/neg_i64.masm +++ b/tests/integration/expected/neg_i64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_7e6ecbf37c062a73130e37145b77eb9dd3cce8aa16128ac9fcca7dc837ca562c +# mod ::"root_ns:root@1.0.0"::test_rust_7e6ecbf37c062a73130e37145b77eb9dd3cce8aa16128ac9fcca7dc837ca562c +@locals("2") @callconv("C") pub proc entrypoint([u32; 2]) -> [u32; 2] push.0 @@ -26,7 +27,7 @@ pub proc entrypoint([u32; 2]) -> [u32; 2] movdn.3 trace.240 nop - exec.::std::math::u64::wrapping_sub + exec.::miden::core::math::u64::wrapping_sub trace.252 nop end diff --git a/tests/integration/expected/neg_i8.hir b/tests/integration/expected/neg_i8.hir index 1eca2fdab..6c70b2fcc 100644 --- a/tests/integration/expected/neg_i8.hir +++ b/tests/integration/expected/neg_i8.hir @@ -2,10 +2,10 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_7564589530886ab89f7963543a4d7e1529e7436aaa330e5e742ddde3149deefe { public builtin.function @entrypoint(v0: i32) -> i32 { ^block6(v0: i32): - v2 = arith.constant 0 : i32; - v3 = arith.sub v2, v0 : i32 #[overflow = wrapping]; - v4 = arith.sext v3 : i32; - builtin.ret v4; + v6 = arith.constant 0 : i32; + v4 = arith.sub v6, v0 : i32 #[overflow = wrapping]; + v5 = arith.sext v4 : i32; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/neg_i8.masm b/tests/integration/expected/neg_i8.masm index 8d0194e5f..1bcde10d4 100644 --- a/tests/integration/expected/neg_i8.masm +++ b/tests/integration/expected/neg_i8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_7564589530886ab89f7963543a4d7e1529e7436aaa330e5e742ddde3149deefe +# mod ::"root_ns:root@1.0.0"::test_rust_7564589530886ab89f7963543a4d7e1529e7436aaa330e5e742ddde3149deefe +@locals("1") @callconv("C") pub proc entrypoint(i32) -> i32 push.0 diff --git a/tests/integration/expected/or_bool.hir b/tests/integration/expected/or_bool.hir index 7d5bbc643..9cf6a0670 100644 --- a/tests/integration/expected/or_bool.hir +++ b/tests/integration/expected/or_bool.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_f1d36010a1862f085dfb5f246228723fc87e291a764ca76107b03554afd7db26 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.bor v0, v1 : i32; - builtin.ret v3; + v5 = arith.bor v0, v1 : i32; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/or_bool.masm b/tests/integration/expected/or_bool.masm index 35833fa9d..36bbab6ae 100644 --- a/tests/integration/expected/or_bool.masm +++ b/tests/integration/expected/or_bool.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_f1d36010a1862f085dfb5f246228723fc87e291a764ca76107b03554afd7db26 +# mod ::"root_ns:root@1.0.0"::test_rust_f1d36010a1862f085dfb5f246228723fc87e291a764ca76107b03554afd7db26 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32or diff --git a/tests/integration/expected/rust_sdk/component_macros_account.hir b/tests/integration/expected/rust_sdk/component_macros_account.hir index f6847e040..811c32170 100644 --- a/tests/integration/expected/rust_sdk/component_macros_account.hir +++ b/tests/integration/expected/rust_sdk/component_macros_account.hir @@ -12,83 +12,103 @@ builtin.component miden:component-macros-account/component-macros-account@0.1.0 private builtin.function @miden:component-macros-account/component-macros-account@0.1.0#test-custom-types(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: felt, v6: felt, v7: felt, v8: felt, v9: felt, v10: felt, v11: felt) -> i32 { ^block9(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: felt, v6: felt, v7: felt, v8: felt, v9: felt, v10: felt, v11: felt): - v14 = builtin.global_symbol @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/GOT.data.internal.__memory_base : ptr - v15 = hir.bitcast v14 : ptr; - v16 = hir.load v15 : i32; + hir.store_local v0 #[local = lv0]; + hir.store_local v8 #[local = lv8]; + v13 = builtin.global_symbol @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/GOT.data.internal.__memory_base : ptr + v14 = hir.bitcast v13 : ptr; + v15 = hir.load v14 : i32; + hir.store_local v15 #[local = lv12]; hir.exec @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/wit_bindgen::rt::run_ctors_once() - v17 = arith.constant 1048584 : i32; - v18 = arith.add v16, v17 : i32 #[overflow = wrapping]; - v20 = arith.constant 4 : u32; - v19 = hir.bitcast v18 : u32; - v21 = arith.add v19, v20 : u32 #[overflow = checked]; - v136 = arith.constant 4 : u32; - v23 = arith.mod v21, v136 : u32; - hir.assertz v23 #[code = 250]; - v24 = hir.int_to_ptr v21 : ptr; - hir.store v24, v8; - v25 = hir.bitcast v18 : u32; - v135 = arith.constant 4 : u32; - v27 = arith.mod v25, v135 : u32; - hir.assertz v27 #[code = 250]; - v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v0; - builtin.ret v18; + v16 = hir.load_local : i32 #[local = lv12]; + v144 = arith.constant 1048584 : i32; + v18 = arith.add v16, v144 : i32 #[overflow = wrapping]; + hir.store_local v18 #[local = lv12]; + v19 = hir.load_local : felt #[local = lv8]; + v143 = arith.constant 4 : u32; + v20 = hir.bitcast v18 : u32; + v22 = arith.add v20, v143 : u32 #[overflow = checked]; + v148 = arith.constant 4 : u32; + v24 = arith.mod v22, v148 : u32; + hir.assertz v24 #[code = 250]; + v25 = hir.int_to_ptr v22 : ptr; + hir.store v25, v19; + v26 = hir.load_local : i32 #[local = lv12]; + v27 = hir.load_local : felt #[local = lv0]; + v28 = hir.bitcast v26 : u32; + v147 = arith.constant 4 : u32; + v30 = arith.mod v28, v147 : u32; + hir.assertz v30 #[code = 250]; + v31 = hir.int_to_ptr v28 : ptr; + hir.store v31, v27; + v32 = hir.load_local : i32 #[local = lv12]; + builtin.ret v32; }; - private builtin.function @miden:component-macros-account/component-macros-account@0.1.0#test-custom-types2(v29: felt, v30: felt, v31: felt, v32: felt, v33: felt, v34: felt, v35: felt, v36: felt, v37: felt, v38: felt, v39: felt, v40: felt) -> i32 { - ^block11(v29: felt, v30: felt, v31: felt, v32: felt, v33: felt, v34: felt, v35: felt, v36: felt, v37: felt, v38: felt, v39: felt, v40: felt): - v43 = builtin.global_symbol @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/GOT.data.internal.__memory_base : ptr - v44 = hir.bitcast v43 : ptr; - v45 = hir.load v44 : i32; + private builtin.function @miden:component-macros-account/component-macros-account@0.1.0#test-custom-types2(v33: felt, v34: felt, v35: felt, v36: felt, v37: felt, v38: felt, v39: felt, v40: felt, v41: felt, v42: felt, v43: felt, v44: felt) -> i32 { + ^block11(v33: felt, v34: felt, v35: felt, v36: felt, v37: felt, v38: felt, v39: felt, v40: felt, v41: felt, v42: felt, v43: felt, v44: felt): + hir.store_local v33 #[local = lv0]; + hir.store_local v34 #[local = lv1]; + v46 = builtin.global_symbol @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/GOT.data.internal.__memory_base : ptr + v47 = hir.bitcast v46 : ptr; + v48 = hir.load v47 : i32; + hir.store_local v48 #[local = lv12]; hir.exec @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/wit_bindgen::rt::run_ctors_once() - v46 = arith.constant 1048584 : i32; - v47 = arith.add v45, v46 : i32 #[overflow = wrapping]; - v49 = arith.constant 4 : u32; - v48 = hir.bitcast v47 : u32; - v50 = arith.add v48, v49 : u32 #[overflow = checked]; - v138 = arith.constant 4 : u32; - v52 = arith.mod v50, v138 : u32; - hir.assertz v52 #[code = 250]; - v53 = hir.int_to_ptr v50 : ptr; - hir.store v53, v30; - v54 = hir.bitcast v47 : u32; - v137 = arith.constant 4 : u32; - v56 = arith.mod v54, v137 : u32; - hir.assertz v56 #[code = 250]; - v57 = hir.int_to_ptr v54 : ptr; - hir.store v57, v29; - builtin.ret v47; + v49 = hir.load_local : i32 #[local = lv12]; + v150 = arith.constant 1048584 : i32; + v51 = arith.add v49, v150 : i32 #[overflow = wrapping]; + hir.store_local v51 #[local = lv12]; + v52 = hir.load_local : felt #[local = lv1]; + v149 = arith.constant 4 : u32; + v53 = hir.bitcast v51 : u32; + v55 = arith.add v53, v149 : u32 #[overflow = checked]; + v154 = arith.constant 4 : u32; + v57 = arith.mod v55, v154 : u32; + hir.assertz v57 #[code = 250]; + v58 = hir.int_to_ptr v55 : ptr; + hir.store v58, v52; + v59 = hir.load_local : i32 #[local = lv12]; + v60 = hir.load_local : felt #[local = lv0]; + v61 = hir.bitcast v59 : u32; + v153 = arith.constant 4 : u32; + v63 = arith.mod v61, v153 : u32; + hir.assertz v63 #[code = 250]; + v64 = hir.int_to_ptr v61 : ptr; + hir.store v64, v60; + v65 = hir.load_local : i32 #[local = lv12]; + builtin.ret v65; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block13: - v59 = builtin.global_symbol @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/GOT.data.internal.__memory_base : ptr - v60 = hir.bitcast v59 : ptr; - v61 = hir.load v60 : i32; - v62 = arith.constant 1048592 : i32; - v63 = arith.add v61, v62 : i32 #[overflow = wrapping]; - v64 = hir.bitcast v63 : u32; - v65 = hir.int_to_ptr v64 : ptr; - v66 = hir.load v65 : u8; - v58 = arith.constant 0 : i32; - v67 = arith.zext v66 : u32; - v68 = hir.bitcast v67 : i32; - v70 = arith.neq v68, v58 : i1; - scf.if v70{ + v66 = builtin.global_symbol @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/GOT.data.internal.__memory_base : ptr + v67 = hir.bitcast v66 : ptr; + v68 = hir.load v67 : i32; + v159 = arith.constant 1048592 : i32; + v70 = arith.add v68, v159 : i32 #[overflow = wrapping]; + v71 = hir.bitcast v70 : u32; + v72 = hir.int_to_ptr v71 : ptr; + v73 = hir.load v72 : u8; + v158 = arith.constant 0 : i32; + v74 = arith.zext v73 : u32; + v75 = hir.bitcast v74 : i32; + v77 = arith.neq v75, v158 : i1; + scf.if v77{ ^block15: scf.yield ; } else { ^block16: - v71 = builtin.global_symbol @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/GOT.data.internal.__memory_base : ptr - v72 = hir.bitcast v71 : ptr; - v73 = hir.load v72 : i32; + v78 = builtin.global_symbol @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/GOT.data.internal.__memory_base : ptr + v79 = hir.bitcast v78 : ptr; + v80 = hir.load v79 : i32; + hir.store_local v80 #[local = lv0]; hir.exec @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/__wasm_call_ctors() - v140 = arith.constant 1 : u8; - v142 = arith.constant 1048592 : i32; - v75 = arith.add v73, v142 : i32 #[overflow = wrapping]; - v79 = hir.bitcast v75 : u32; - v80 = hir.int_to_ptr v79 : ptr; - hir.store v80, v140; + v81 = hir.load_local : i32 #[local = lv0]; + v157 = arith.constant 1 : u8; + v162 = arith.constant 1048592 : i32; + v83 = arith.add v81, v162 : i32 #[overflow = wrapping]; + v87 = hir.bitcast v83 : u32; + v88 = hir.int_to_ptr v87 : ptr; + hir.store v88, v157; scf.yield ; }; builtin.ret ; @@ -105,39 +125,39 @@ builtin.component miden:component-macros-account/component-macros-account@0.1.0 builtin.segment @1048576 = 0x0000000100000001; }; - public builtin.function @test-custom-types(v81: felt, v82: felt, v83: felt, v84: felt, v85: felt, v86: felt, v87: felt, v88: felt, v89: felt, v90: felt, v91: felt, v92: felt) -> felt, felt { - ^block17(v81: felt, v82: felt, v83: felt, v84: felt, v85: felt, v86: felt, v87: felt, v88: felt, v89: felt, v90: felt, v91: felt, v92: felt): - v93 = hir.exec @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/miden:component-macros-account/component-macros-account@0.1.0#test-custom-types(v81, v82, v83, v84, v85, v86, v87, v88, v89, v90, v91, v92) : i32 - v144 = arith.constant 0 : i32; - v94 = arith.constant 0 : i32; - v95 = arith.add v93, v94 : i32 #[overflow = unchecked]; - v97 = arith.add v95, v144 : i32 #[overflow = unchecked]; - v98 = hir.int_to_ptr v97 : ptr; - v99 = hir.load v98 : felt; - v143 = arith.constant 0 : i32; - v100 = arith.constant 4 : i32; - v101 = arith.add v93, v100 : i32 #[overflow = unchecked]; - v103 = arith.add v101, v143 : i32 #[overflow = unchecked]; - v104 = hir.int_to_ptr v103 : ptr; - v105 = hir.load v104 : felt; - builtin.ret v99, v105; + public builtin.function @test-custom-types(v89: felt, v90: felt, v91: felt, v92: felt, v93: felt, v94: felt, v95: felt, v96: felt, v97: felt, v98: felt, v99: felt, v100: felt) -> felt, felt { + ^block17(v89: felt, v90: felt, v91: felt, v92: felt, v93: felt, v94: felt, v95: felt, v96: felt, v97: felt, v98: felt, v99: felt, v100: felt): + v101 = hir.exec @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/miden:component-macros-account/component-macros-account@0.1.0#test-custom-types(v89, v90, v91, v92, v93, v94, v95, v96, v97, v98, v99, v100) : i32 + v168 = arith.constant 0 : i32; + v166 = arith.constant 0 : i32; + v103 = arith.add v101, v166 : i32 #[overflow = unchecked]; + v105 = arith.add v103, v168 : i32 #[overflow = unchecked]; + v106 = hir.int_to_ptr v105 : ptr; + v107 = hir.load v106 : felt; + v167 = arith.constant 0 : i32; + v163 = arith.constant 4 : i32; + v109 = arith.add v101, v163 : i32 #[overflow = unchecked]; + v111 = arith.add v109, v167 : i32 #[overflow = unchecked]; + v112 = hir.int_to_ptr v111 : ptr; + v113 = hir.load v112 : felt; + builtin.ret v107, v113; }; - public builtin.function @test-custom-types2(v108: felt, v109: felt, v110: felt, v111: felt, v112: felt, v113: felt, v114: felt, v115: felt, v116: felt, v117: felt, v118: felt, v119: felt) -> felt, felt { - ^block19(v108: felt, v109: felt, v110: felt, v111: felt, v112: felt, v113: felt, v114: felt, v115: felt, v116: felt, v117: felt, v118: felt, v119: felt): - v120 = hir.exec @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/miden:component-macros-account/component-macros-account@0.1.0#test-custom-types2(v108, v109, v110, v111, v112, v113, v114, v115, v116, v117, v118, v119) : i32 - v146 = arith.constant 0 : i32; - v121 = arith.constant 0 : i32; - v122 = arith.add v120, v121 : i32 #[overflow = unchecked]; - v124 = arith.add v122, v146 : i32 #[overflow = unchecked]; - v125 = hir.int_to_ptr v124 : ptr; - v126 = hir.load v125 : felt; - v145 = arith.constant 0 : i32; - v127 = arith.constant 4 : i32; - v128 = arith.add v120, v127 : i32 #[overflow = unchecked]; - v130 = arith.add v128, v145 : i32 #[overflow = unchecked]; - v131 = hir.int_to_ptr v130 : ptr; - v132 = hir.load v131 : felt; - builtin.ret v126, v132; + public builtin.function @test-custom-types2(v116: felt, v117: felt, v118: felt, v119: felt, v120: felt, v121: felt, v122: felt, v123: felt, v124: felt, v125: felt, v126: felt, v127: felt) -> felt, felt { + ^block19(v116: felt, v117: felt, v118: felt, v119: felt, v120: felt, v121: felt, v122: felt, v123: felt, v124: felt, v125: felt, v126: felt, v127: felt): + v128 = hir.exec @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/miden:component-macros-account/component-macros-account@0.1.0#test-custom-types2(v116, v117, v118, v119, v120, v121, v122, v123, v124, v125, v126, v127) : i32 + v174 = arith.constant 0 : i32; + v172 = arith.constant 0 : i32; + v130 = arith.add v128, v172 : i32 #[overflow = unchecked]; + v132 = arith.add v130, v174 : i32 #[overflow = unchecked]; + v133 = hir.int_to_ptr v132 : ptr; + v134 = hir.load v133 : felt; + v173 = arith.constant 0 : i32; + v169 = arith.constant 4 : i32; + v136 = arith.add v128, v169 : i32 #[overflow = unchecked]; + v138 = arith.add v136, v173 : i32 #[overflow = unchecked]; + v139 = hir.int_to_ptr v138 : ptr; + v140 = hir.load v139 : felt; + builtin.ret v134, v140; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/component_macros_account.masm b/tests/integration/expected/rust_sdk/component_macros_account.masm index 57457c550..f669503b5 100644 --- a/tests/integration/expected/rust_sdk/component_macros_account.masm +++ b/tests/integration/expected/rust_sdk/component_macros_account.masm @@ -1,4 +1,4 @@ -# mod miden:component-macros-account/component-macros-account@0.1.0 +# mod ::"miden:component-macros-account/component-macros-account@0.1.0" @callconv("canon-lift") pub proc test-custom-types( @@ -15,10 +15,10 @@ pub proc test-custom-types( felt, felt ) -> (felt, felt) - exec.::miden:component-macros-account/component-macros-account@0.1.0::init + exec."miden:component-macros-account/component-macros-account@0.1.0"::init trace.240 nop - exec.::miden:component-macros-account/component-macros-account@0.1.0::component_macros_account::miden:component-macros-account/component-macros-account@0.1.0#test-custom-types + exec.::"miden:component-macros-account/component-macros-account@0.1.0"::component_macros_account::"miden:component-macros-account/component-macros-account@0.1.0#test-custom-types" trace.252 nop push.0 @@ -46,7 +46,7 @@ pub proc test-custom-types( trace.252 nop swap.1 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end @callconv("canon-lift") @@ -64,10 +64,10 @@ pub proc test-custom-types2( felt, felt ) -> (felt, felt) - exec.::miden:component-macros-account/component-macros-account@0.1.0::init + exec."miden:component-macros-account/component-macros-account@0.1.0"::init trace.240 nop - exec.::miden:component-macros-account/component-macros-account@0.1.0::component_macros_account::miden:component-macros-account/component-macros-account@0.1.0#test-custom-types2 + exec.::"miden:component-macros-account/component-macros-account@0.1.0"::component_macros_account::"miden:component-macros-account/component-macros-account@0.1.0#test-custom-types2" trace.252 nop push.0 @@ -95,7 +95,7 @@ pub proc test-custom-types2( trace.252 nop swap.1 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -108,7 +108,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -119,7 +119,7 @@ proc init mem_store.278537 end -# mod miden:component-macros-account/component-macros-account@0.1.0::component_macros_account +# mod ::"miden:component-macros-account/component-macros-account@0.1.0"::component_macros_account @callconv("C") proc __wasm_call_ctors( @@ -135,6 +135,7 @@ proc component_macros_account::bindings::__link_custom_section_describing_import nop end +@locals("13") @callconv("C") proc miden:component-macros-account/component-macros-account@0.1.0#test-custom-types( felt, @@ -170,6 +171,22 @@ proc miden:component-macros-account/component-macros-account@0.1.0#test-custom-t drop movup.2 drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1114148 u32divmod.4 swap.1 @@ -178,15 +195,48 @@ proc miden:component-macros-account/component-macros-account@0.1.0#test-custom-t exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.12 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:component-macros-account/component-macros-account@0.1.0"::component_macros_account::wit_bindgen::rt::run_ctors_once + trace.252 + nop + locaddr.12 + push.0 + swap.1 trace.240 nop - exec.::miden:component-macros-account/component-macros-account@0.1.0::component_macros_account::wit_bindgen::rt::run_ctors_once + exec.::intrinsics::mem::load_sw trace.252 nop push.1048584 u32wrapping_add + dup.0 + locaddr.12 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.4 - dup.1 + movup.2 add u32assert push.4 @@ -195,8 +245,6 @@ proc miden:component-macros-account/component-macros-account@0.1.0#test-custom-t u32mod u32assert assertz - movup.3 - swap.1 u32divmod.4 swap.1 trace.240 @@ -204,15 +252,29 @@ proc miden:component-macros-account/component-macros-account@0.1.0#test-custom-t exec.::intrinsics::mem::store_felt trace.252 nop - dup.0 + locaddr.12 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.1 push.4 dup.1 swap.1 u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -220,8 +282,17 @@ proc miden:component-macros-account/component-macros-account@0.1.0#test-custom-t exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.12 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("13") @callconv("C") proc miden:component-macros-account/component-macros-account@0.1.0#test-custom-types2( felt, @@ -257,6 +328,22 @@ proc miden:component-macros-account/component-macros-account@0.1.0#test-custom-t drop movup.2 drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1114148 u32divmod.4 swap.1 @@ -265,15 +352,48 @@ proc miden:component-macros-account/component-macros-account@0.1.0#test-custom-t exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.12 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:component-macros-account/component-macros-account@0.1.0"::component_macros_account::wit_bindgen::rt::run_ctors_once + trace.252 + nop + locaddr.12 + push.0 + swap.1 trace.240 nop - exec.::miden:component-macros-account/component-macros-account@0.1.0::component_macros_account::wit_bindgen::rt::run_ctors_once + exec.::intrinsics::mem::load_sw trace.252 nop push.1048584 u32wrapping_add + dup.0 + locaddr.12 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.4 - dup.1 + movup.2 add u32assert push.4 @@ -282,8 +402,6 @@ proc miden:component-macros-account/component-macros-account@0.1.0#test-custom-t u32mod u32assert assertz - movup.3 - swap.1 u32divmod.4 swap.1 trace.240 @@ -291,15 +409,29 @@ proc miden:component-macros-account/component-macros-account@0.1.0#test-custom-t exec.::intrinsics::mem::store_felt trace.252 nop - dup.0 + locaddr.12 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.1 push.4 dup.1 swap.1 u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -307,8 +439,17 @@ proc miden:component-macros-account/component-macros-account@0.1.0#test-custom-t exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.12 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -350,9 +491,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop trace.240 nop - exec.::miden:component-macros-account/component-macros-account@0.1.0::component_macros_account::__wasm_call_ctors + exec.::"miden:component-macros-account/component-macros-account@0.1.0"::component_macros_account::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 diff --git a/tests/integration/expected/rust_sdk/component_macros_account.wat b/tests/integration/expected/rust_sdk/component_macros_account.wat index be40331a3..5c96bac3e 100644 --- a/tests/integration/expected/rust_sdk/component_macros_account.wat +++ b/tests/integration/expected/rust_sdk/component_macros_account.wat @@ -75,7 +75,7 @@ end ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "1component_macros_account\01\0b0.1.0\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "1component_macros_account\01\0b0.1.0\03\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "asset" (type $asset (;1;))) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;2;))) diff --git a/tests/integration/expected/rust_sdk/component_macros_note.hir b/tests/integration/expected/rust_sdk/component_macros_note.hir index 1f4bacdfa..d8ff05846 100644 --- a/tests/integration/expected/rust_sdk/component_macros_note.hir +++ b/tests/integration/expected/rust_sdk/component_macros_note.hir @@ -3,16 +3,16 @@ builtin.component miden:base/note-script@1.0.0 { private builtin.function @component_macros_note::bindings::miden::component_macros_account::component_macros_account::test_custom_types::wit_import22(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: felt, v6: felt, v7: felt, v8: felt, v9: felt, v10: felt, v11: felt, v12: i32) { ^block3(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: felt, v6: felt, v7: felt, v8: felt, v9: felt, v10: felt, v11: felt, v12: i32): v13, v14 = hir.call v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11 : felt, felt #[callee = miden:component-macros-account/component-macros-account@0.1.0/test-custom-types] #[signature = (cc canon-lower) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (result felt felt)]; - v131 = arith.constant 0 : i32; - v15 = arith.constant 0 : i32; - v16 = arith.add v12, v15 : i32 #[overflow = unchecked]; - v18 = arith.add v16, v131 : i32 #[overflow = unchecked]; + v147 = arith.constant 0 : i32; + v145 = arith.constant 0 : i32; + v16 = arith.add v12, v145 : i32 #[overflow = unchecked]; + v18 = arith.add v16, v147 : i32 #[overflow = unchecked]; v19 = hir.int_to_ptr v18 : ptr; hir.store v19, v13; - v130 = arith.constant 0 : i32; - v20 = arith.constant 4 : i32; - v21 = arith.add v12, v20 : i32 #[overflow = unchecked]; - v23 = arith.add v21, v130 : i32 #[overflow = unchecked]; + v146 = arith.constant 0 : i32; + v142 = arith.constant 4 : i32; + v21 = arith.add v12, v142 : i32 #[overflow = unchecked]; + v23 = arith.add v21, v146 : i32 #[overflow = unchecked]; v24 = hir.int_to_ptr v23 : ptr; hir.store v24, v14; builtin.ret ; @@ -30,152 +30,155 @@ builtin.component miden:base/note-script@1.0.0 { private builtin.function @miden:base/note-script@1.0.0#run(v25: felt, v26: felt, v27: felt, v28: felt) { ^block12(v25: felt, v26: felt, v27: felt, v28: felt): - v31 = builtin.global_symbol @miden:base/note-script@1.0.0/component_macros_note/__stack_pointer : ptr - v32 = hir.bitcast v31 : ptr; - v33 = hir.load v32 : i32; - v34 = arith.constant 16 : i32; - v35 = arith.sub v33, v34 : i32 #[overflow = wrapping]; - v36 = builtin.global_symbol @miden:base/note-script@1.0.0/component_macros_note/__stack_pointer : ptr - v37 = hir.bitcast v36 : ptr; - hir.store v37, v35; + v29 = builtin.global_symbol @miden:base/note-script@1.0.0/component_macros_note/__stack_pointer : ptr + v30 = hir.bitcast v29 : ptr; + v31 = hir.load v30 : i32; + v167 = arith.constant 16 : i32; + v33 = arith.sub v31, v167 : i32 #[overflow = wrapping]; + hir.store_local v33 #[local = lv4]; + v34 = builtin.global_symbol @miden:base/note-script@1.0.0/component_macros_note/__stack_pointer : ptr + v35 = hir.bitcast v34 : ptr; + hir.store v35, v33; hir.exec @miden:base/note-script@1.0.0/component_macros_note/wit_bindgen::rt::run_ctors_once() - v38 = arith.constant 11 : i32; - v39 = hir.exec @miden:base/note-script@1.0.0/component_macros_note/intrinsics::felt::from_u32(v38) : felt - v40 = arith.constant 22 : i32; - v41 = hir.exec @miden:base/note-script@1.0.0/component_macros_note/intrinsics::felt::from_u32(v40) : felt - v42 = arith.constant 33 : i32; - v43 = hir.exec @miden:base/note-script@1.0.0/component_macros_note/intrinsics::felt::from_u32(v42) : felt - v44 = arith.constant 44 : i32; - v45 = hir.exec @miden:base/note-script@1.0.0/component_macros_note/intrinsics::felt::from_u32(v44) : felt - v46 = arith.constant 99 : i32; - v47 = hir.exec @miden:base/note-script@1.0.0/component_macros_note/intrinsics::felt::from_u32(v46) : felt - v48 = arith.constant 88 : i32; - v49 = hir.exec @miden:base/note-script@1.0.0/component_macros_note/intrinsics::felt::from_u32(v48) : felt - v50 = arith.constant 77 : i32; - v51 = hir.exec @miden:base/note-script@1.0.0/component_macros_note/intrinsics::felt::from_u32(v50) : felt - v52 = arith.constant 66 : i32; - v53 = hir.exec @miden:base/note-script@1.0.0/component_macros_note/intrinsics::felt::from_u32(v52) : felt - v56 = arith.constant 8 : u32; - v55 = hir.bitcast v35 : u32; - v57 = arith.add v55, v56 : u32 #[overflow = checked]; - v148 = arith.constant 8 : u32; - v59 = arith.mod v57, v148 : u32; - hir.assertz v59 #[code = 250]; - v54 = arith.constant 0 : i64; - v60 = hir.int_to_ptr v57 : ptr; - hir.store v60, v54; - v61 = arith.constant 8 : i32; - v62 = arith.add v35, v61 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/component_macros_note/component_macros_note::bindings::miden::component_macros_account::component_macros_account::test_custom_types::wit_import22(v39, v41, v43, v45, v47, v49, v51, v53, v47, v49, v51, v53, v62) - v64 = arith.constant 12 : u32; - v63 = hir.bitcast v35 : u32; - v65 = arith.add v63, v64 : u32 #[overflow = checked]; - v66 = arith.constant 4 : u32; - v67 = arith.mod v65, v66 : u32; - hir.assertz v67 #[code = 250]; - v68 = hir.int_to_ptr v65 : ptr; - v69 = hir.load v68 : felt; - v147 = arith.constant 8 : u32; - v70 = hir.bitcast v35 : u32; - v72 = arith.add v70, v147 : u32 #[overflow = checked]; - v146 = arith.constant 4 : u32; - v74 = arith.mod v72, v146 : u32; - hir.assertz v74 #[code = 250]; - v75 = hir.int_to_ptr v72 : ptr; - v76 = hir.load v75 : felt; - v77 = hir.exec @miden:base/note-script@1.0.0/component_macros_note/intrinsics::felt::eq(v76, v39) : i32 - v29 = arith.constant 0 : i32; - v78 = arith.constant 1 : i32; - v79 = arith.neq v77, v78 : i1; - v80 = arith.zext v79 : u32; - v81 = hir.bitcast v80 : i32; - v83 = arith.neq v81, v29 : i1; - v136 = scf.if v83 : u32 { - ^block28: - v132 = arith.constant 0 : u32; - scf.yield v132; + v166 = arith.constant 11 : i64; + v37 = arith.trunc v166 : felt; + hir.store_local v37 #[local = lv5]; + v155 = arith.constant 99 : felt; + hir.store_local v155 #[local = lv9]; + v154 = arith.constant 88 : felt; + hir.store_local v154 #[local = lv10]; + v52 = hir.load_local : i32 #[local = lv4]; + v161 = arith.constant 8 : u32; + v54 = hir.bitcast v52 : u32; + v56 = arith.add v54, v161 : u32 #[overflow = checked]; + v190 = arith.constant 8 : u32; + v58 = arith.mod v56, v190 : u32; + hir.assertz v58 #[code = 250]; + v162 = arith.constant 0 : i64; + v59 = hir.int_to_ptr v56 : ptr; + hir.store v59, v162; + v60 = hir.load_local : felt #[local = lv5]; + v64 = hir.load_local : felt #[local = lv9]; + v65 = hir.load_local : felt #[local = lv10]; + v72 = hir.load_local : i32 #[local = lv4]; + v160 = arith.constant 8 : i32; + v74 = arith.add v72, v160 : i32 #[overflow = wrapping]; + v152 = arith.constant 66 : felt; + v153 = arith.constant 77 : felt; + v163 = arith.constant 44 : i64; + v43 = arith.trunc v163 : felt; + v164 = arith.constant 33 : i64; + v41 = arith.trunc v164 : felt; + v165 = arith.constant 22 : i64; + v39 = arith.trunc v165 : felt; + hir.exec @miden:base/note-script@1.0.0/component_macros_note/component_macros_note::bindings::miden::component_macros_account::component_macros_account::test_custom_types::wit_import22(v60, v39, v41, v43, v64, v65, v153, v152, v64, v65, v153, v152, v74) + v75 = hir.load_local : i32 #[local = lv4]; + v159 = arith.constant 12 : u32; + v76 = hir.bitcast v75 : u32; + v78 = arith.add v76, v159 : u32 #[overflow = checked]; + v158 = arith.constant 4 : u32; + v80 = arith.mod v78, v158 : u32; + hir.assertz v80 #[code = 250]; + v81 = hir.int_to_ptr v78 : ptr; + v82 = hir.load v81 : felt; + hir.store_local v82 #[local = lv10]; + v83 = hir.load_local : i32 #[local = lv4]; + v189 = arith.constant 8 : u32; + v84 = hir.bitcast v83 : u32; + v86 = arith.add v84, v189 : u32 #[overflow = checked]; + v188 = arith.constant 4 : u32; + v88 = arith.mod v86, v188 : u32; + hir.assertz v88 #[code = 250]; + v89 = hir.int_to_ptr v86 : ptr; + v90 = hir.load v89 : felt; + v91 = hir.load_local : felt #[local = lv5]; + v156 = arith.constant 0 : i32; + v157 = arith.constant 1 : i32; + v92 = arith.eq v90, v91 : i1; + v93 = hir.cast v92 : i32; + v95 = arith.neq v93, v157 : i1; + v96 = arith.zext v95 : u32; + v97 = hir.bitcast v96 : i32; + v99 = arith.neq v97, v156 : i1; + v178 = scf.if v99 : u32 { + ^block24: + v174 = arith.constant 0 : u32; + scf.yield v174; } else { ^block15: - v84 = hir.exec @miden:base/note-script@1.0.0/component_macros_note/intrinsics::felt::eq(v69, v47) : i32 - v144 = arith.constant 0 : i32; - v145 = arith.constant 1 : i32; - v86 = arith.neq v84, v145 : i1; - v87 = arith.zext v86 : u32; - v88 = hir.bitcast v87 : i32; - v90 = arith.neq v88, v144 : i1; - scf.if v90{ - ^block27: + v100 = hir.load_local : felt #[local = lv10]; + v101 = hir.load_local : felt #[local = lv9]; + v186 = arith.constant 0 : i32; + v187 = arith.constant 1 : i32; + v102 = arith.eq v100, v101 : i1; + v103 = hir.cast v102 : i32; + v105 = arith.neq v103, v187 : i1; + v106 = arith.zext v105 : u32; + v107 = hir.bitcast v106 : i32; + v109 = arith.neq v107, v186 : i1; + scf.if v109{ + ^block23: scf.yield ; } else { ^block16: - v143 = arith.constant 16 : i32; - v92 = arith.add v35, v143 : i32 #[overflow = wrapping]; - v93 = builtin.global_symbol @miden:base/note-script@1.0.0/component_macros_note/__stack_pointer : ptr - v94 = hir.bitcast v93 : ptr; - hir.store v94, v92; + v110 = hir.load_local : i32 #[local = lv4]; + v185 = arith.constant 16 : i32; + v112 = arith.add v110, v185 : i32 #[overflow = wrapping]; + v113 = builtin.global_symbol @miden:base/note-script@1.0.0/component_macros_note/__stack_pointer : ptr + v114 = hir.bitcast v113 : ptr; + hir.store v114, v112; scf.yield ; }; - v134 = arith.constant 1 : u32; - v142 = arith.constant 0 : u32; - v140 = cf.select v90, v142, v134 : u32; - scf.yield v140; + v176 = arith.constant 1 : u32; + v184 = arith.constant 0 : u32; + v182 = cf.select v109, v184, v176 : u32; + scf.yield v182; }; - v141 = arith.constant 0 : u32; - v139 = arith.eq v136, v141 : i1; - cf.cond_br v139 ^block14, ^block30; + v183 = arith.constant 0 : u32; + v181 = arith.eq v178, v183 : i1; + cf.cond_br v181 ^block14, ^block26; ^block14: ub.unreachable ; - ^block30: + ^block26: builtin.ret ; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block17: - v96 = builtin.global_symbol @miden:base/note-script@1.0.0/component_macros_note/GOT.data.internal.__memory_base : ptr - v97 = hir.bitcast v96 : ptr; - v98 = hir.load v97 : i32; - v99 = arith.constant 1048588 : i32; - v100 = arith.add v98, v99 : i32 #[overflow = wrapping]; - v101 = hir.bitcast v100 : u32; - v102 = hir.int_to_ptr v101 : ptr; - v103 = hir.load v102 : u8; - v95 = arith.constant 0 : i32; - v104 = arith.zext v103 : u32; - v105 = hir.bitcast v104 : i32; - v107 = arith.neq v105, v95 : i1; - scf.if v107{ + v115 = builtin.global_symbol @miden:base/note-script@1.0.0/component_macros_note/GOT.data.internal.__memory_base : ptr + v116 = hir.bitcast v115 : ptr; + v117 = hir.load v116 : i32; + v195 = arith.constant 1048588 : i32; + v119 = arith.add v117, v195 : i32 #[overflow = wrapping]; + v120 = hir.bitcast v119 : u32; + v121 = hir.int_to_ptr v120 : ptr; + v122 = hir.load v121 : u8; + v194 = arith.constant 0 : i32; + v123 = arith.zext v122 : u32; + v124 = hir.bitcast v123 : i32; + v126 = arith.neq v124, v194 : i1; + scf.if v126{ ^block19: scf.yield ; } else { ^block20: - v108 = builtin.global_symbol @miden:base/note-script@1.0.0/component_macros_note/GOT.data.internal.__memory_base : ptr - v109 = hir.bitcast v108 : ptr; - v110 = hir.load v109 : i32; + v127 = builtin.global_symbol @miden:base/note-script@1.0.0/component_macros_note/GOT.data.internal.__memory_base : ptr + v128 = hir.bitcast v127 : ptr; + v129 = hir.load v128 : i32; + hir.store_local v129 #[local = lv0]; hir.exec @miden:base/note-script@1.0.0/component_macros_note/__wasm_call_ctors() - v150 = arith.constant 1 : u8; - v152 = arith.constant 1048588 : i32; - v112 = arith.add v110, v152 : i32 #[overflow = wrapping]; - v116 = hir.bitcast v112 : u32; - v117 = hir.int_to_ptr v116 : ptr; - hir.store v117, v150; + v130 = hir.load_local : i32 #[local = lv0]; + v193 = arith.constant 1 : u8; + v198 = arith.constant 1048588 : i32; + v132 = arith.add v130, v198 : i32 #[overflow = wrapping]; + v136 = hir.bitcast v132 : u32; + v137 = hir.int_to_ptr v136 : ptr; + hir.store v137, v193; scf.yield ; }; builtin.ret ; }; - private builtin.function @intrinsics::felt::eq(v118: felt, v119: felt) -> i32 { - ^block21(v118: felt, v119: felt): - v120 = arith.eq v118, v119 : i1; - v121 = hir.cast v120 : i32; - builtin.ret v121; - }; - - private builtin.function @intrinsics::felt::from_u32(v123: i32) -> felt { - ^block23(v123: i32): - v124 = hir.bitcast v123 : felt; - builtin.ret v124; - }; - builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; @@ -187,9 +190,9 @@ builtin.component miden:base/note-script@1.0.0 { builtin.segment @1048576 = 0x000000010000000100000001; }; - public builtin.function @run(v126: felt, v127: felt, v128: felt, v129: felt) { - ^block25(v126: felt, v127: felt, v128: felt, v129: felt): - hir.exec @miden:base/note-script@1.0.0/component_macros_note/miden:base/note-script@1.0.0#run(v126, v127, v128, v129) + public builtin.function @run(v138: felt, v139: felt, v140: felt, v141: felt) { + ^block21(v138: felt, v139: felt, v140: felt, v141: felt): + hir.exec @miden:base/note-script@1.0.0/component_macros_note/miden:base/note-script@1.0.0#run(v138, v139, v140, v141) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/component_macros_note.masm b/tests/integration/expected/rust_sdk/component_macros_note.masm index 633f975a0..987888adb 100644 --- a/tests/integration/expected/rust_sdk/component_macros_note.masm +++ b/tests/integration/expected/rust_sdk/component_macros_note.masm @@ -1,14 +1,14 @@ -# mod miden:base/note-script@1.0.0 +# mod ::"miden:base/note-script@1.0.0" @callconv("canon-lift") pub proc run(felt, felt, felt, felt) - exec.::miden:base/note-script@1.0.0::init + exec."miden:base/note-script@1.0.0"::init trace.240 nop - exec.::miden:base/note-script@1.0.0::component_macros_note::miden:base/note-script@1.0.0#run + exec.::"miden:base/note-script@1.0.0"::component_macros_note::"miden:base/note-script@1.0.0#run" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -21,7 +21,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -32,7 +32,7 @@ proc init mem_store.278537 end -# mod miden:base/note-script@1.0.0::component_macros_note +# mod ::"miden:base/note-script@1.0.0"::component_macros_note @callconv("C") proc component_macros_note::bindings::miden::component_macros_account::component_macros_account::test_custom_types::wit_import22( @@ -52,7 +52,7 @@ proc component_macros_note::bindings::miden::component_macros_account::component ) trace.240 nop - call.::miden:component-macros-account/component-macros-account@0.1.0::test-custom-types + call.::"miden:component-macros-account/component-macros-account@0.1.0"::"test-custom-types" trace.252 nop push.0 @@ -95,6 +95,7 @@ proc component_macros_note::bindings::__link_custom_section_describing_imports( nop end +@locals("13") @callconv("C") proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop @@ -111,71 +112,68 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) nop push.16 u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 + dup.0 + locaddr.4 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::store_sw trace.252 nop + push.1114144 + u32divmod.4 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::component_macros_note::wit_bindgen::rt::run_ctors_once - trace.252 - nop - push.11 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::component_macros_note::intrinsics::felt::from_u32 - trace.252 - nop - push.22 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::component_macros_note::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_sw trace.252 nop - push.33 trace.240 nop - exec.::miden:base/note-script@1.0.0::component_macros_note::intrinsics::felt::from_u32 + exec.::"miden:base/note-script@1.0.0"::component_macros_note::wit_bindgen::rt::run_ctors_once trace.252 nop - push.44 + push.11 + push.0 + mul.4294967296 + add + locaddr.5 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::component_macros_note::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop push.99 + locaddr.9 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::component_macros_note::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop push.88 + locaddr.10 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::component_macros_note::intrinsics::felt::from_u32 - trace.252 - nop - push.77 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::component_macros_note::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop - push.66 + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::component_macros_note::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.9 + swap.1 add u32assert push.8 @@ -196,34 +194,86 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.10 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.9 u32wrapping_add - dup.8 + push.66 + push.77 + push.44 + push.0 + mul.4294967296 + add + push.33 + push.0 + mul.4294967296 + add + push.22 + push.0 + mul.4294967296 + add + dup.7 + dup.7 dup.5 - dup.6 - dup.6 - dup.6 - dup.6 - swap.1 - swap.10 - swap.13 - swap.1 - swap.11 - swap.3 + dup.7 + movup.3 swap.8 + swap.7 swap.6 - swap.12 + movdn.3 + swap.11 + swap.4 + swap.1 + swap.10 + swap.5 swap.2 swap.9 - swap.5 + swap.12 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::component_macros_note::component_macros_note::bindings::miden::component_macros_account::component_macros_account::test_custom_types::wit_import22 + trace.252 + nop + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::component_macros_note::component_macros_note::bindings::miden::component_macros_account::component_macros_account::test_custom_types::wit_import22 + exec.::intrinsics::mem::load_sw trace.252 nop push.12 - dup.3 + swap.1 add u32assert push.4 @@ -239,8 +289,24 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.10 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.4 + swap.1 add u32assert push.4 @@ -256,41 +322,60 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop - movup.3 + locaddr.5 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::component_macros_note::intrinsics::felt::eq + exec.::intrinsics::mem::load_felt trace.252 nop push.0 push.1 - movup.2 + movup.3 + movup.3 + eq neq neq if.true - drop - drop - drop push.0 else + locaddr.10 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::component_macros_note::intrinsics::felt::eq + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt trace.252 nop push.0 push.1 - movup.2 + movup.3 + movup.3 + eq neq neq dup.0 if.true - swap.1 - drop + nop else + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - movup.2 u32wrapping_add push.1114144 u32divmod.4 @@ -316,6 +401,7 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) end end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -357,9 +443,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::component_macros_note::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::component_macros_note::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -390,13 +492,3 @@ proc wit_bindgen::rt::run_ctors_once( end end -@callconv("C") -proc intrinsics::felt::eq(felt, felt) -> i32 - eq -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - diff --git a/tests/integration/expected/rust_sdk/component_macros_note.wat b/tests/integration/expected/rust_sdk/component_macros_note.wat index fc5a23a16..5a551b2bf 100644 --- a/tests/integration/expected/rust_sdk/component_macros_note.wat +++ b/tests/integration/expected/rust_sdk/component_macros_note.wat @@ -37,6 +37,7 @@ (type (;2;) (func (param f32 f32 f32 f32))) (type (;3;) (func (param f32 f32) (result i32))) (type (;4;) (func (param i32) (result f32))) + (type (;5;) (func (param i64) (result f32))) (import "miden:component-macros-account/component-macros-account@0.1.0" "test-custom-types" (func $component_macros_note::bindings::miden::component_macros_account::component_macros_account::test_custom_types::wit_import22 (;0;) (type 0))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -55,17 +56,17 @@ local.tee 4 global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once - i32.const 11 - call $intrinsics::felt::from_u32 + i64.const 11 + call $intrinsics::felt::from_u64_unchecked local.set 5 - i32.const 22 - call $intrinsics::felt::from_u32 + i64.const 22 + call $intrinsics::felt::from_u64_unchecked local.set 6 - i32.const 33 - call $intrinsics::felt::from_u32 + i64.const 33 + call $intrinsics::felt::from_u64_unchecked local.set 7 - i32.const 44 - call $intrinsics::felt::from_u32 + i64.const 44 + call $intrinsics::felt::from_u64_unchecked local.set 8 i32.const 99 call $intrinsics::felt::from_u32 @@ -147,6 +148,9 @@ (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) unreachable ) + (func $intrinsics::felt::from_u64_unchecked (;7;) (type 5) (param i64) (result f32) + unreachable + ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00") ) (core module $wit-component-shim-module (;1;) diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account.hir b/tests/integration/expected/rust_sdk/cross_ctx_account.hir index 6a5ea7266..8dab0669f 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account.hir +++ b/tests/integration/expected/rust_sdk/cross_ctx_account.hir @@ -12,84 +12,74 @@ builtin.component miden:cross-ctx-account/foo@1.0.0 { private builtin.function @miden:cross-ctx-account/foo@1.0.0#process-felt(v0: felt) -> felt { ^block9(v0: felt): - v3 = builtin.global_symbol @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/GOT.data.internal.__memory_base : ptr - v4 = hir.bitcast v3 : ptr; - v5 = hir.load v4 : i32; - v6 = arith.constant 1048584 : i32; - v7 = arith.add v5, v6 : i32 #[overflow = wrapping]; + hir.store_local v0 #[local = lv0]; + v2 = builtin.global_symbol @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/GOT.data.internal.__memory_base : ptr + v3 = hir.bitcast v2 : ptr; + v4 = hir.load v3 : i32; + v51 = arith.constant 1048584 : i32; + v6 = arith.add v4, v51 : i32 #[overflow = wrapping]; + hir.store_local v6 #[local = lv1]; hir.exec @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/wit_bindgen::rt::run_ctors_once() - v8 = hir.bitcast v7 : u32; - v9 = arith.constant 4 : u32; - v10 = arith.mod v8, v9 : u32; - hir.assertz v10 #[code = 250]; - v11 = hir.int_to_ptr v8 : ptr; - v12 = hir.load v11 : i32; - v13 = hir.exec @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/intrinsics::felt::from_u32(v12) : felt - v14 = hir.exec @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/intrinsics::felt::add(v0, v13) : felt - v15 = hir.exec @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/intrinsics::felt::as_u64(v14) : i64 - v18 = hir.bitcast v7 : u32; - v57 = arith.constant 4 : u32; - v20 = arith.mod v18, v57 : u32; - hir.assertz v20 #[code = 250]; - v16 = hir.bitcast v15 : u64; - v17 = arith.trunc v16 : u32; - v21 = hir.int_to_ptr v18 : ptr; - hir.store v21, v17; - builtin.ret v14; + v7 = hir.load_local : i32 #[local = lv1]; + v8 = hir.load_local : felt #[local = lv0]; + v10 = hir.bitcast v7 : u32; + v50 = arith.constant 4 : u32; + v12 = arith.mod v10, v50 : u32; + hir.assertz v12 #[code = 250]; + v13 = hir.int_to_ptr v10 : ptr; + v14 = hir.load v13 : i32; + v15 = hir.bitcast v14 : felt; + v16 = arith.add v8, v15 : felt #[overflow = unchecked]; + hir.store_local v16 #[local = lv0]; + v20 = hir.bitcast v7 : u32; + v53 = arith.constant 4 : u32; + v22 = arith.mod v20, v53 : u32; + hir.assertz v22 #[code = 250]; + v17 = hir.cast v16 : i64; + v18 = hir.bitcast v17 : u64; + v19 = arith.trunc v18 : u32; + v23 = hir.int_to_ptr v20 : ptr; + hir.store v23, v19; + v24 = hir.load_local : felt #[local = lv0]; + builtin.ret v24; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v23 = builtin.global_symbol @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/GOT.data.internal.__memory_base : ptr - v24 = hir.bitcast v23 : ptr; - v25 = hir.load v24 : i32; - v26 = arith.constant 1048588 : i32; - v27 = arith.add v25, v26 : i32 #[overflow = wrapping]; - v28 = hir.bitcast v27 : u32; - v29 = hir.int_to_ptr v28 : ptr; - v30 = hir.load v29 : u8; - v22 = arith.constant 0 : i32; - v31 = arith.zext v30 : u32; - v32 = hir.bitcast v31 : i32; - v34 = arith.neq v32, v22 : i1; - scf.if v34{ + v25 = builtin.global_symbol @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/GOT.data.internal.__memory_base : ptr + v26 = hir.bitcast v25 : ptr; + v27 = hir.load v26 : i32; + v58 = arith.constant 1048588 : i32; + v29 = arith.add v27, v58 : i32 #[overflow = wrapping]; + v30 = hir.bitcast v29 : u32; + v31 = hir.int_to_ptr v30 : ptr; + v32 = hir.load v31 : u8; + v57 = arith.constant 0 : i32; + v33 = arith.zext v32 : u32; + v34 = hir.bitcast v33 : i32; + v36 = arith.neq v34, v57 : i1; + scf.if v36{ ^block13: scf.yield ; } else { ^block14: - v35 = builtin.global_symbol @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/GOT.data.internal.__memory_base : ptr - v36 = hir.bitcast v35 : ptr; - v37 = hir.load v36 : i32; + v37 = builtin.global_symbol @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/GOT.data.internal.__memory_base : ptr + v38 = hir.bitcast v37 : ptr; + v39 = hir.load v38 : i32; + hir.store_local v39 #[local = lv0]; hir.exec @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/__wasm_call_ctors() - v59 = arith.constant 1 : u8; + v40 = hir.load_local : i32 #[local = lv0]; + v56 = arith.constant 1 : u8; v61 = arith.constant 1048588 : i32; - v39 = arith.add v37, v61 : i32 #[overflow = wrapping]; - v43 = hir.bitcast v39 : u32; - v44 = hir.int_to_ptr v43 : ptr; - hir.store v44, v59; + v42 = arith.add v40, v61 : i32 #[overflow = wrapping]; + v46 = hir.bitcast v42 : u32; + v47 = hir.int_to_ptr v46 : ptr; + hir.store v47, v56; scf.yield ; }; builtin.ret ; }; - private builtin.function @intrinsics::felt::add(v45: felt, v46: felt) -> felt { - ^block15(v45: felt, v46: felt): - v47 = arith.add v45, v46 : felt #[overflow = unchecked]; - builtin.ret v47; - }; - - private builtin.function @intrinsics::felt::as_u64(v49: felt) -> i64 { - ^block17(v49: felt): - v50 = hir.cast v49 : i64; - builtin.ret v50; - }; - - private builtin.function @intrinsics::felt::from_u32(v52: i32) -> felt { - ^block19(v52: i32): - v53 = hir.bitcast v52 : felt; - builtin.ret v53; - }; - builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; @@ -101,9 +91,9 @@ builtin.component miden:cross-ctx-account/foo@1.0.0 { builtin.segment @1048576 = 0x0000002a0000000100000001; }; - public builtin.function @process-felt(v55: felt) -> felt { - ^block21(v55: felt): - v56 = hir.exec @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/miden:cross-ctx-account/foo@1.0.0#process-felt(v55) : felt - builtin.ret v56; + public builtin.function @process-felt(v48: felt) -> felt { + ^block15(v48: felt): + v49 = hir.exec @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/miden:cross-ctx-account/foo@1.0.0#process-felt(v48) : felt + builtin.ret v49; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account.masm b/tests/integration/expected/rust_sdk/cross_ctx_account.masm index ec2620d40..61ab74c19 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_account.masm @@ -1,14 +1,14 @@ -# mod miden:cross-ctx-account/foo@1.0.0 +# mod ::"miden:cross-ctx-account/foo@1.0.0" @callconv("canon-lift") pub proc process-felt(felt) -> felt - exec.::miden:cross-ctx-account/foo@1.0.0::init + exec."miden:cross-ctx-account/foo@1.0.0"::init trace.240 nop - exec.::miden:cross-ctx-account/foo@1.0.0::cross_ctx_account::miden:cross-ctx-account/foo@1.0.0#process-felt + exec.::"miden:cross-ctx-account/foo@1.0.0"::cross_ctx_account::"miden:cross-ctx-account/foo@1.0.0#process-felt" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -21,7 +21,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -32,7 +32,7 @@ proc init mem_store.278537 end -# mod miden:cross-ctx-account/foo@1.0.0::cross_ctx_account +# mod ::"miden:cross-ctx-account/foo@1.0.0"::cross_ctx_account @callconv("C") proc __wasm_call_ctors( @@ -48,8 +48,17 @@ proc cross_ctx_account::bindings::__link_custom_section_describing_imports( nop end +@locals("2") @callconv("C") proc miden:cross-ctx-account/foo@1.0.0#process-felt(felt) -> felt + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1114148 u32divmod.4 swap.1 @@ -60,50 +69,68 @@ proc miden:cross-ctx-account/foo@1.0.0#process-felt(felt) -> felt nop push.1048584 u32wrapping_add + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account/foo@1.0.0::cross_ctx_account::wit_bindgen::rt::run_ctors_once + exec.::intrinsics::mem::store_sw trace.252 nop - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::"miden:cross-ctx-account/foo@1.0.0"::cross_ctx_account::wit_bindgen::rt::run_ctors_once + trace.252 + nop + locaddr.1 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account/foo@1.0.0::cross_ctx_account::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_felt trace.252 nop - movup.2 + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account/foo@1.0.0::cross_ctx_account::intrinsics::felt::add + exec.::intrinsics::mem::load_sw trace.252 nop + add dup.0 + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account/foo@1.0.0::cross_ctx_account::intrinsics::felt::as_u64 + exec.::intrinsics::mem::store_felt trace.252 nop - movup.3 + swap.1 push.4 dup.1 swap.1 u32mod u32assert assertz - movdn.2 + swap.1 + u32split drop swap.1 u32divmod.4 @@ -113,8 +140,17 @@ proc miden:cross-ctx-account/foo@1.0.0#process-felt(felt) -> felt exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -156,9 +192,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:cross-ctx-account/foo@1.0.0"::cross_ctx_account::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account/foo@1.0.0::cross_ctx_account::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -189,18 +241,3 @@ proc wit_bindgen::rt::run_ctors_once( end end -@callconv("C") -proc intrinsics::felt::add(felt, felt) -> felt - add -end - -@callconv("C") -proc intrinsics::felt::as_u64(felt) -> [u32; 2] - u32split -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account_word.hir b/tests/integration/expected/rust_sdk/cross_ctx_account_word.hir index ea5ed2692..bba959175 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account_word.hir +++ b/tests/integration/expected/rust_sdk/cross_ctx_account_word.hir @@ -12,365 +12,451 @@ builtin.component miden:cross-ctx-account-word/foo@1.0.0 { private builtin.function @miden:cross-ctx-account-word/foo@1.0.0#process-another-word(v0: felt, v1: felt, v2: felt, v3: felt) -> i32 { ^block9(v0: felt, v1: felt, v2: felt, v3: felt): - v6 = builtin.global_symbol @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/GOT.data.internal.__memory_base : ptr - v7 = hir.bitcast v6 : ptr; - v8 = hir.load v7 : i32; + hir.store_local v0 #[local = lv0]; + hir.store_local v1 #[local = lv1]; + hir.store_local v2 #[local = lv2]; + hir.store_local v3 #[local = lv3]; + v5 = builtin.global_symbol @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/GOT.data.internal.__memory_base : ptr + v6 = hir.bitcast v5 : ptr; + v7 = hir.load v6 : i32; + hir.store_local v7 #[local = lv4]; hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/wit_bindgen::rt::run_ctors_once() - v9 = arith.constant 2 : i32; - v10 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v9) : felt - v11 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v0, v10) : felt - v12 = arith.constant 3 : i32; - v13 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v12) : felt - v14 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v1, v13) : felt - v15 = arith.constant 4 : i32; - v16 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v15) : felt - v17 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v2, v16) : felt - v18 = arith.constant 1048584 : i32; - v19 = arith.add v8, v18 : i32 #[overflow = wrapping]; - v20 = arith.constant 5 : i32; - v21 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v20) : felt - v22 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v3, v21) : felt - v24 = arith.constant 12 : u32; - v23 = hir.bitcast v19 : u32; - v25 = arith.add v23, v24 : u32 #[overflow = checked]; - v26 = arith.constant 4 : u32; - v27 = arith.mod v25, v26 : u32; - hir.assertz v27 #[code = 250]; - v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v22; - v30 = arith.constant 8 : u32; - v29 = hir.bitcast v19 : u32; - v31 = arith.add v29, v30 : u32 #[overflow = checked]; - v487 = arith.constant 4 : u32; - v33 = arith.mod v31, v487 : u32; - hir.assertz v33 #[code = 250]; - v34 = hir.int_to_ptr v31 : ptr; - hir.store v34, v17; - v486 = arith.constant 4 : u32; - v35 = hir.bitcast v19 : u32; - v37 = arith.add v35, v486 : u32 #[overflow = checked]; - v485 = arith.constant 4 : u32; - v39 = arith.mod v37, v485 : u32; + v8 = hir.load_local : felt #[local = lv0]; + v544 = arith.constant 2 : felt; + v11 = arith.add v8, v544 : felt #[overflow = unchecked]; + hir.store_local v11 #[local = lv0]; + v12 = hir.load_local : felt #[local = lv1]; + v543 = arith.constant 3 : felt; + v15 = arith.add v12, v543 : felt #[overflow = unchecked]; + hir.store_local v15 #[local = lv1]; + v16 = hir.load_local : felt #[local = lv2]; + v542 = arith.constant 4 : felt; + v19 = arith.add v16, v542 : felt #[overflow = unchecked]; + hir.store_local v19 #[local = lv2]; + v20 = hir.load_local : i32 #[local = lv4]; + v548 = arith.constant 1048584 : i32; + v22 = arith.add v20, v548 : i32 #[overflow = wrapping]; + hir.store_local v22 #[local = lv4]; + v23 = hir.load_local : felt #[local = lv3]; + v547 = arith.constant 12 : u32; + v27 = hir.bitcast v22 : u32; + v29 = arith.add v27, v547 : u32 #[overflow = checked]; + v546 = arith.constant 4 : u32; + v31 = arith.mod v29, v546 : u32; + hir.assertz v31 #[code = 250]; + v541 = arith.constant 5 : felt; + v26 = arith.add v23, v541 : felt #[overflow = unchecked]; + v32 = hir.int_to_ptr v29 : ptr; + hir.store v32, v26; + v33 = hir.load_local : i32 #[local = lv4]; + v34 = hir.load_local : felt #[local = lv2]; + v545 = arith.constant 8 : u32; + v35 = hir.bitcast v33 : u32; + v37 = arith.add v35, v545 : u32 #[overflow = checked]; + v556 = arith.constant 4 : u32; + v39 = arith.mod v37, v556 : u32; hir.assertz v39 #[code = 250]; v40 = hir.int_to_ptr v37 : ptr; - hir.store v40, v14; - v41 = hir.bitcast v19 : u32; - v484 = arith.constant 4 : u32; - v43 = arith.mod v41, v484 : u32; - hir.assertz v43 #[code = 250]; - v44 = hir.int_to_ptr v41 : ptr; - hir.store v44, v11; - builtin.ret v19; + hir.store v40, v34; + v41 = hir.load_local : i32 #[local = lv4]; + v42 = hir.load_local : felt #[local = lv1]; + v555 = arith.constant 4 : u32; + v43 = hir.bitcast v41 : u32; + v45 = arith.add v43, v555 : u32 #[overflow = checked]; + v554 = arith.constant 4 : u32; + v47 = arith.mod v45, v554 : u32; + hir.assertz v47 #[code = 250]; + v48 = hir.int_to_ptr v45 : ptr; + hir.store v48, v42; + v49 = hir.load_local : i32 #[local = lv4]; + v50 = hir.load_local : felt #[local = lv0]; + v51 = hir.bitcast v49 : u32; + v553 = arith.constant 4 : u32; + v53 = arith.mod v51, v553 : u32; + hir.assertz v53 #[code = 250]; + v54 = hir.int_to_ptr v51 : ptr; + hir.store v54, v50; + v55 = hir.load_local : i32 #[local = lv4]; + builtin.ret v55; }; - private builtin.function @miden:cross-ctx-account-word/foo@1.0.0#process-felt(v45: felt) -> felt { - ^block11(v45: felt): + private builtin.function @miden:cross-ctx-account-word/foo@1.0.0#process-felt(v56: felt) -> felt { + ^block11(v56: felt): + hir.store_local v56 #[local = lv0]; hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/wit_bindgen::rt::run_ctors_once() - v47 = arith.constant 3 : i32; - v48 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v47) : felt - v49 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v45, v48) : felt - builtin.ret v49; + v58 = hir.load_local : felt #[local = lv0]; + v558 = arith.constant 3 : felt; + v61 = arith.add v58, v558 : felt #[overflow = unchecked]; + builtin.ret v61; }; - private builtin.function @miden:cross-ctx-account-word/foo@1.0.0#process-mixed(v50: i64, v51: felt, v52: i32, v53: felt, v54: i32, v55: i32, v56: i32) -> i32 { - ^block13(v50: i64, v51: felt, v52: i32, v53: felt, v54: i32, v55: i32, v56: i32): - v59 = builtin.global_symbol @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/GOT.data.internal.__memory_base : ptr - v60 = hir.bitcast v59 : ptr; - v61 = hir.load v60 : i32; + private builtin.function @miden:cross-ctx-account-word/foo@1.0.0#process-mixed(v62: i64, v63: felt, v64: i32, v65: felt, v66: i32, v67: i32, v68: i32) -> i32 { + ^block13(v62: i64, v63: felt, v64: i32, v65: felt, v66: i32, v67: i32, v68: i32): + hir.store_local v62 #[local = lv0]; + hir.store_local v63 #[local = lv1]; + hir.store_local v64 #[local = lv2]; + hir.store_local v65 #[local = lv3]; + hir.store_local v66 #[local = lv4]; + hir.store_local v67 #[local = lv5]; + hir.store_local v68 #[local = lv6]; + v70 = builtin.global_symbol @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/GOT.data.internal.__memory_base : ptr + v71 = hir.bitcast v70 : ptr; + v72 = hir.load v71 : i32; + hir.store_local v72 #[local = lv7]; hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/wit_bindgen::rt::run_ctors_once() - v62 = arith.constant 6 : i32; - v63 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v62) : felt - v64 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v51, v63) : felt - v65 = arith.constant 7 : i32; - v66 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v65) : felt - v67 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v53, v66) : felt - v68 = arith.constant 1048584 : i32; - v69 = arith.add v61, v68 : i32 #[overflow = wrapping]; - v75 = arith.constant 22 : u32; - v74 = hir.bitcast v69 : u32; - v76 = arith.add v74, v75 : u32 #[overflow = checked]; - v77 = arith.constant 2 : u32; - v78 = arith.mod v76, v77 : u32; - hir.assertz v78 #[code = 250]; - v70 = arith.constant 9 : i32; - v71 = arith.add v56, v70 : i32 #[overflow = wrapping]; - v72 = hir.bitcast v71 : u32; - v73 = arith.trunc v72 : u16; - v79 = hir.int_to_ptr v76 : ptr; - hir.store v79, v73; - v58 = arith.constant 0 : i32; - v80 = arith.constant 255 : i32; - v81 = arith.band v55, v80 : i32; - v83 = arith.eq v81, v58 : i1; - v84 = arith.zext v83 : u32; - v85 = hir.bitcast v84 : i32; - v86 = hir.bitcast v85 : u32; - v87 = arith.trunc v86 : u8; - v89 = arith.constant 21 : u32; - v88 = hir.bitcast v69 : u32; - v90 = arith.add v88, v89 : u32 #[overflow = checked]; - v91 = hir.int_to_ptr v90 : ptr; - hir.store v91, v87; - v92 = arith.constant 11 : i32; - v93 = arith.add v54, v92 : i32 #[overflow = wrapping]; - v94 = hir.bitcast v93 : u32; - v95 = arith.trunc v94 : u8; - v97 = arith.constant 20 : u32; - v96 = hir.bitcast v69 : u32; - v98 = arith.add v96, v97 : u32 #[overflow = checked]; - v99 = hir.int_to_ptr v98 : ptr; - hir.store v99, v95; - v101 = arith.constant 16 : u32; - v100 = hir.bitcast v69 : u32; - v102 = arith.add v100, v101 : u32 #[overflow = checked]; - v103 = arith.constant 4 : u32; - v104 = arith.mod v102, v103 : u32; - hir.assertz v104 #[code = 250]; - v105 = hir.int_to_ptr v102 : ptr; - hir.store v105, v67; - v109 = arith.constant 12 : u32; - v108 = hir.bitcast v69 : u32; - v110 = arith.add v108, v109 : u32 #[overflow = checked]; - v490 = arith.constant 4 : u32; - v112 = arith.mod v110, v490 : u32; - hir.assertz v112 #[code = 250]; - v106 = arith.constant 10 : i32; - v107 = arith.add v52, v106 : i32 #[overflow = wrapping]; - v113 = hir.int_to_ptr v110 : ptr; - hir.store v113, v107; - v115 = arith.constant 8 : u32; - v114 = hir.bitcast v69 : u32; - v116 = arith.add v114, v115 : u32 #[overflow = checked]; - v489 = arith.constant 4 : u32; - v118 = arith.mod v116, v489 : u32; - hir.assertz v118 #[code = 250]; - v119 = hir.int_to_ptr v116 : ptr; - hir.store v119, v64; - v122 = hir.bitcast v69 : u32; - v488 = arith.constant 8 : u32; - v124 = arith.mod v122, v488 : u32; - hir.assertz v124 #[code = 250]; - v120 = arith.constant 1000 : i64; - v121 = arith.add v50, v120 : i64 #[overflow = wrapping]; - v125 = hir.int_to_ptr v122 : ptr; - hir.store v125, v121; - builtin.ret v69; + v73 = hir.load_local : felt #[local = lv1]; + v562 = arith.constant 6 : felt; + v76 = arith.add v73, v562 : felt #[overflow = unchecked]; + hir.store_local v76 #[local = lv1]; + v77 = hir.load_local : felt #[local = lv3]; + v561 = arith.constant 7 : felt; + v80 = arith.add v77, v561 : felt #[overflow = unchecked]; + hir.store_local v80 #[local = lv3]; + v81 = hir.load_local : i32 #[local = lv7]; + v577 = arith.constant 1048584 : i32; + v83 = arith.add v81, v577 : i32 #[overflow = wrapping]; + hir.store_local v83 #[local = lv7]; + v84 = hir.load_local : i32 #[local = lv6]; + v575 = arith.constant 22 : u32; + v89 = hir.bitcast v83 : u32; + v91 = arith.add v89, v575 : u32 #[overflow = checked]; + v574 = arith.constant 2 : u32; + v93 = arith.mod v91, v574 : u32; + hir.assertz v93 #[code = 250]; + v576 = arith.constant 9 : i32; + v86 = arith.add v84, v576 : i32 #[overflow = wrapping]; + v87 = hir.bitcast v86 : u32; + v88 = arith.trunc v87 : u16; + v94 = hir.int_to_ptr v91 : ptr; + hir.store v94, v88; + v95 = hir.load_local : i32 #[local = lv7]; + v96 = hir.load_local : i32 #[local = lv5]; + v572 = arith.constant 0 : i32; + v573 = arith.constant 255 : i32; + v98 = arith.band v96, v573 : i32; + v100 = arith.eq v98, v572 : i1; + v101 = arith.zext v100 : u32; + v102 = hir.bitcast v101 : i32; + v103 = hir.bitcast v102 : u32; + v104 = arith.trunc v103 : u8; + v571 = arith.constant 21 : u32; + v105 = hir.bitcast v95 : u32; + v107 = arith.add v105, v571 : u32 #[overflow = checked]; + v108 = hir.int_to_ptr v107 : ptr; + hir.store v108, v104; + v109 = hir.load_local : i32 #[local = lv7]; + v110 = hir.load_local : i32 #[local = lv4]; + v570 = arith.constant 11 : i32; + v112 = arith.add v110, v570 : i32 #[overflow = wrapping]; + v113 = hir.bitcast v112 : u32; + v114 = arith.trunc v113 : u8; + v569 = arith.constant 20 : u32; + v115 = hir.bitcast v109 : u32; + v117 = arith.add v115, v569 : u32 #[overflow = checked]; + v118 = hir.int_to_ptr v117 : ptr; + hir.store v118, v114; + v119 = hir.load_local : i32 #[local = lv7]; + v120 = hir.load_local : felt #[local = lv3]; + v568 = arith.constant 16 : u32; + v121 = hir.bitcast v119 : u32; + v123 = arith.add v121, v568 : u32 #[overflow = checked]; + v567 = arith.constant 4 : u32; + v125 = arith.mod v123, v567 : u32; + hir.assertz v125 #[code = 250]; + v126 = hir.int_to_ptr v123 : ptr; + hir.store v126, v120; + v127 = hir.load_local : i32 #[local = lv7]; + v128 = hir.load_local : i32 #[local = lv2]; + v565 = arith.constant 12 : u32; + v131 = hir.bitcast v127 : u32; + v133 = arith.add v131, v565 : u32 #[overflow = checked]; + v583 = arith.constant 4 : u32; + v135 = arith.mod v133, v583 : u32; + hir.assertz v135 #[code = 250]; + v566 = arith.constant 10 : i32; + v130 = arith.add v128, v566 : i32 #[overflow = wrapping]; + v136 = hir.int_to_ptr v133 : ptr; + hir.store v136, v130; + v137 = hir.load_local : i32 #[local = lv7]; + v138 = hir.load_local : felt #[local = lv1]; + v564 = arith.constant 8 : u32; + v139 = hir.bitcast v137 : u32; + v141 = arith.add v139, v564 : u32 #[overflow = checked]; + v582 = arith.constant 4 : u32; + v143 = arith.mod v141, v582 : u32; + hir.assertz v143 #[code = 250]; + v144 = hir.int_to_ptr v141 : ptr; + hir.store v144, v138; + v145 = hir.load_local : i32 #[local = lv7]; + v146 = hir.load_local : i64 #[local = lv0]; + v149 = hir.bitcast v145 : u32; + v581 = arith.constant 8 : u32; + v151 = arith.mod v149, v581 : u32; + hir.assertz v151 #[code = 250]; + v563 = arith.constant 1000 : i64; + v148 = arith.add v146, v563 : i64 #[overflow = wrapping]; + v152 = hir.int_to_ptr v149 : ptr; + hir.store v152, v148; + v153 = hir.load_local : i32 #[local = lv7]; + builtin.ret v153; }; - private builtin.function @miden:cross-ctx-account-word/foo@1.0.0#process-nested(v126: felt, v127: felt, v128: felt) -> i32 { - ^block15(v126: felt, v127: felt, v128: felt): - v131 = builtin.global_symbol @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/GOT.data.internal.__memory_base : ptr - v132 = hir.bitcast v131 : ptr; - v133 = hir.load v132 : i32; + private builtin.function @miden:cross-ctx-account-word/foo@1.0.0#process-nested(v154: felt, v155: felt, v156: felt) -> i32 { + ^block15(v154: felt, v155: felt, v156: felt): + hir.store_local v154 #[local = lv0]; + hir.store_local v155 #[local = lv1]; + hir.store_local v156 #[local = lv2]; + v158 = builtin.global_symbol @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/GOT.data.internal.__memory_base : ptr + v159 = hir.bitcast v158 : ptr; + v160 = hir.load v159 : i32; + hir.store_local v160 #[local = lv3]; hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/wit_bindgen::rt::run_ctors_once() - v134 = arith.constant 8 : i32; - v135 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v134) : felt - v136 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v126, v135) : felt - v495 = arith.constant 8 : i32; - v138 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v495) : felt - v139 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v127, v138) : felt - v140 = arith.constant 1048584 : i32; - v141 = arith.add v133, v140 : i32 #[overflow = wrapping]; - v494 = arith.constant 8 : i32; - v143 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v494) : felt - v144 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v128, v143) : felt - v146 = arith.constant 8 : u32; - v145 = hir.bitcast v141 : u32; - v147 = arith.add v145, v146 : u32 #[overflow = checked]; - v148 = arith.constant 4 : u32; - v149 = arith.mod v147, v148 : u32; - hir.assertz v149 #[code = 250]; - v150 = hir.int_to_ptr v147 : ptr; - hir.store v150, v144; - v493 = arith.constant 4 : u32; - v151 = hir.bitcast v141 : u32; - v153 = arith.add v151, v493 : u32 #[overflow = checked]; - v492 = arith.constant 4 : u32; - v155 = arith.mod v153, v492 : u32; - hir.assertz v155 #[code = 250]; - v156 = hir.int_to_ptr v153 : ptr; - hir.store v156, v139; - v157 = hir.bitcast v141 : u32; - v491 = arith.constant 4 : u32; - v159 = arith.mod v157, v491 : u32; - hir.assertz v159 #[code = 250]; - v160 = hir.int_to_ptr v157 : ptr; - hir.store v160, v136; - builtin.ret v141; - }; - - private builtin.function @miden:cross-ctx-account-word/foo@1.0.0#process-pair(v161: felt, v162: felt) -> i32 { - ^block17(v161: felt, v162: felt): - v165 = builtin.global_symbol @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/GOT.data.internal.__memory_base : ptr - v166 = hir.bitcast v165 : ptr; - v167 = hir.load v166 : i32; - hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/wit_bindgen::rt::run_ctors_once() - v168 = arith.constant 4 : i32; - v169 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v168) : felt - v170 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v161, v169) : felt - v171 = arith.constant 1048584 : i32; - v172 = arith.add v167, v171 : i32 #[overflow = wrapping]; - v498 = arith.constant 4 : i32; - v174 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v498) : felt - v175 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v162, v174) : felt - v177 = arith.constant 4 : u32; - v176 = hir.bitcast v172 : u32; - v178 = arith.add v176, v177 : u32 #[overflow = checked]; - v497 = arith.constant 4 : u32; - v180 = arith.mod v178, v497 : u32; + v161 = hir.load_local : felt #[local = lv0]; + v587 = arith.constant 8 : felt; + v164 = arith.add v161, v587 : felt #[overflow = unchecked]; + hir.store_local v164 #[local = lv0]; + v165 = hir.load_local : felt #[local = lv1]; + v600 = arith.constant 8 : felt; + v168 = arith.add v165, v600 : felt #[overflow = unchecked]; + hir.store_local v168 #[local = lv1]; + v169 = hir.load_local : i32 #[local = lv3]; + v590 = arith.constant 1048584 : i32; + v171 = arith.add v169, v590 : i32 #[overflow = wrapping]; + hir.store_local v171 #[local = lv3]; + v172 = hir.load_local : felt #[local = lv2]; + v589 = arith.constant 8 : u32; + v176 = hir.bitcast v171 : u32; + v178 = arith.add v176, v589 : u32 #[overflow = checked]; + v588 = arith.constant 4 : u32; + v180 = arith.mod v178, v588 : u32; hir.assertz v180 #[code = 250]; + v599 = arith.constant 8 : felt; + v175 = arith.add v172, v599 : felt #[overflow = unchecked]; v181 = hir.int_to_ptr v178 : ptr; hir.store v181, v175; - v182 = hir.bitcast v172 : u32; - v496 = arith.constant 4 : u32; - v184 = arith.mod v182, v496 : u32; - hir.assertz v184 #[code = 250]; - v185 = hir.int_to_ptr v182 : ptr; - hir.store v185, v170; - builtin.ret v172; + v182 = hir.load_local : i32 #[local = lv3]; + v183 = hir.load_local : felt #[local = lv1]; + v598 = arith.constant 4 : u32; + v184 = hir.bitcast v182 : u32; + v186 = arith.add v184, v598 : u32 #[overflow = checked]; + v597 = arith.constant 4 : u32; + v188 = arith.mod v186, v597 : u32; + hir.assertz v188 #[code = 250]; + v189 = hir.int_to_ptr v186 : ptr; + hir.store v189, v183; + v190 = hir.load_local : i32 #[local = lv3]; + v191 = hir.load_local : felt #[local = lv0]; + v192 = hir.bitcast v190 : u32; + v596 = arith.constant 4 : u32; + v194 = arith.mod v192, v596 : u32; + hir.assertz v194 #[code = 250]; + v195 = hir.int_to_ptr v192 : ptr; + hir.store v195, v191; + v196 = hir.load_local : i32 #[local = lv3]; + builtin.ret v196; }; - private builtin.function @miden:cross-ctx-account-word/foo@1.0.0#process-triple(v186: felt, v187: felt, v188: felt) -> i32 { - ^block19(v186: felt, v187: felt, v188: felt): - v191 = builtin.global_symbol @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/GOT.data.internal.__memory_base : ptr - v192 = hir.bitcast v191 : ptr; - v193 = hir.load v192 : i32; + private builtin.function @miden:cross-ctx-account-word/foo@1.0.0#process-pair(v197: felt, v198: felt) -> i32 { + ^block17(v197: felt, v198: felt): + hir.store_local v197 #[local = lv0]; + hir.store_local v198 #[local = lv1]; + v200 = builtin.global_symbol @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/GOT.data.internal.__memory_base : ptr + v201 = hir.bitcast v200 : ptr; + v202 = hir.load v201 : i32; + hir.store_local v202 #[local = lv2]; hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/wit_bindgen::rt::run_ctors_once() - v194 = arith.constant 5 : i32; - v195 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v194) : felt - v196 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v186, v195) : felt - v503 = arith.constant 5 : i32; - v198 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v503) : felt - v199 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v187, v198) : felt - v200 = arith.constant 1048584 : i32; - v201 = arith.add v193, v200 : i32 #[overflow = wrapping]; - v502 = arith.constant 5 : i32; - v203 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v502) : felt - v204 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v188, v203) : felt - v206 = arith.constant 8 : u32; - v205 = hir.bitcast v201 : u32; - v207 = arith.add v205, v206 : u32 #[overflow = checked]; - v208 = arith.constant 4 : u32; - v209 = arith.mod v207, v208 : u32; - hir.assertz v209 #[code = 250]; - v210 = hir.int_to_ptr v207 : ptr; - hir.store v210, v204; - v501 = arith.constant 4 : u32; - v211 = hir.bitcast v201 : u32; - v213 = arith.add v211, v501 : u32 #[overflow = checked]; - v500 = arith.constant 4 : u32; - v215 = arith.mod v213, v500 : u32; - hir.assertz v215 #[code = 250]; - v216 = hir.int_to_ptr v213 : ptr; - hir.store v216, v199; - v217 = hir.bitcast v201 : u32; - v499 = arith.constant 4 : u32; - v219 = arith.mod v217, v499 : u32; - hir.assertz v219 #[code = 250]; - v220 = hir.int_to_ptr v217 : ptr; - hir.store v220, v196; - builtin.ret v201; + v203 = hir.load_local : felt #[local = lv0]; + v603 = arith.constant 4 : felt; + v206 = arith.add v203, v603 : felt #[overflow = unchecked]; + hir.store_local v206 #[local = lv0]; + v207 = hir.load_local : i32 #[local = lv2]; + v605 = arith.constant 1048584 : i32; + v209 = arith.add v207, v605 : i32 #[overflow = wrapping]; + hir.store_local v209 #[local = lv2]; + v210 = hir.load_local : felt #[local = lv1]; + v604 = arith.constant 4 : u32; + v214 = hir.bitcast v209 : u32; + v216 = arith.add v214, v604 : u32 #[overflow = checked]; + v611 = arith.constant 4 : u32; + v218 = arith.mod v216, v611 : u32; + hir.assertz v218 #[code = 250]; + v610 = arith.constant 4 : felt; + v213 = arith.add v210, v610 : felt #[overflow = unchecked]; + v219 = hir.int_to_ptr v216 : ptr; + hir.store v219, v213; + v220 = hir.load_local : i32 #[local = lv2]; + v221 = hir.load_local : felt #[local = lv0]; + v222 = hir.bitcast v220 : u32; + v609 = arith.constant 4 : u32; + v224 = arith.mod v222, v609 : u32; + hir.assertz v224 #[code = 250]; + v225 = hir.int_to_ptr v222 : ptr; + hir.store v225, v221; + v226 = hir.load_local : i32 #[local = lv2]; + builtin.ret v226; }; - private builtin.function @miden:cross-ctx-account-word/foo@1.0.0#process-word(v221: felt, v222: felt, v223: felt, v224: felt) -> i32 { - ^block21(v221: felt, v222: felt, v223: felt, v224: felt): - v227 = builtin.global_symbol @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/GOT.data.internal.__memory_base : ptr - v228 = hir.bitcast v227 : ptr; - v229 = hir.load v228 : i32; + private builtin.function @miden:cross-ctx-account-word/foo@1.0.0#process-triple(v227: felt, v228: felt, v229: felt) -> i32 { + ^block19(v227: felt, v228: felt, v229: felt): + hir.store_local v227 #[local = lv0]; + hir.store_local v228 #[local = lv1]; + hir.store_local v229 #[local = lv2]; + v231 = builtin.global_symbol @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/GOT.data.internal.__memory_base : ptr + v232 = hir.bitcast v231 : ptr; + v233 = hir.load v232 : i32; + hir.store_local v233 #[local = lv3]; hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/wit_bindgen::rt::run_ctors_once() - v230 = arith.constant 1 : i32; - v231 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v230) : felt - v232 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v221, v231) : felt - v233 = arith.constant 2 : i32; - v234 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v233) : felt - v235 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v222, v234) : felt - v236 = arith.constant 3 : i32; - v237 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v236) : felt - v238 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v223, v237) : felt - v239 = arith.constant 1048584 : i32; - v240 = arith.add v229, v239 : i32 #[overflow = wrapping]; - v241 = arith.constant 4 : i32; - v242 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v241) : felt - v243 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v224, v242) : felt - v245 = arith.constant 12 : u32; - v244 = hir.bitcast v240 : u32; - v246 = arith.add v244, v245 : u32 #[overflow = checked]; - v247 = arith.constant 4 : u32; - v248 = arith.mod v246, v247 : u32; - hir.assertz v248 #[code = 250]; - v249 = hir.int_to_ptr v246 : ptr; - hir.store v249, v243; - v251 = arith.constant 8 : u32; - v250 = hir.bitcast v240 : u32; - v252 = arith.add v250, v251 : u32 #[overflow = checked]; - v507 = arith.constant 4 : u32; - v254 = arith.mod v252, v507 : u32; - hir.assertz v254 #[code = 250]; - v255 = hir.int_to_ptr v252 : ptr; - hir.store v255, v238; - v506 = arith.constant 4 : u32; - v256 = hir.bitcast v240 : u32; - v258 = arith.add v256, v506 : u32 #[overflow = checked]; - v505 = arith.constant 4 : u32; - v260 = arith.mod v258, v505 : u32; - hir.assertz v260 #[code = 250]; - v261 = hir.int_to_ptr v258 : ptr; - hir.store v261, v235; - v262 = hir.bitcast v240 : u32; - v504 = arith.constant 4 : u32; - v264 = arith.mod v262, v504 : u32; - hir.assertz v264 #[code = 250]; - v265 = hir.int_to_ptr v262 : ptr; - hir.store v265, v232; - builtin.ret v240; + v234 = hir.load_local : felt #[local = lv0]; + v615 = arith.constant 5 : felt; + v237 = arith.add v234, v615 : felt #[overflow = unchecked]; + hir.store_local v237 #[local = lv0]; + v238 = hir.load_local : felt #[local = lv1]; + v628 = arith.constant 5 : felt; + v241 = arith.add v238, v628 : felt #[overflow = unchecked]; + hir.store_local v241 #[local = lv1]; + v242 = hir.load_local : i32 #[local = lv3]; + v618 = arith.constant 1048584 : i32; + v244 = arith.add v242, v618 : i32 #[overflow = wrapping]; + hir.store_local v244 #[local = lv3]; + v245 = hir.load_local : felt #[local = lv2]; + v617 = arith.constant 8 : u32; + v249 = hir.bitcast v244 : u32; + v251 = arith.add v249, v617 : u32 #[overflow = checked]; + v616 = arith.constant 4 : u32; + v253 = arith.mod v251, v616 : u32; + hir.assertz v253 #[code = 250]; + v627 = arith.constant 5 : felt; + v248 = arith.add v245, v627 : felt #[overflow = unchecked]; + v254 = hir.int_to_ptr v251 : ptr; + hir.store v254, v248; + v255 = hir.load_local : i32 #[local = lv3]; + v256 = hir.load_local : felt #[local = lv1]; + v626 = arith.constant 4 : u32; + v257 = hir.bitcast v255 : u32; + v259 = arith.add v257, v626 : u32 #[overflow = checked]; + v625 = arith.constant 4 : u32; + v261 = arith.mod v259, v625 : u32; + hir.assertz v261 #[code = 250]; + v262 = hir.int_to_ptr v259 : ptr; + hir.store v262, v256; + v263 = hir.load_local : i32 #[local = lv3]; + v264 = hir.load_local : felt #[local = lv0]; + v265 = hir.bitcast v263 : u32; + v624 = arith.constant 4 : u32; + v267 = arith.mod v265, v624 : u32; + hir.assertz v267 #[code = 250]; + v268 = hir.int_to_ptr v265 : ptr; + hir.store v268, v264; + v269 = hir.load_local : i32 #[local = lv3]; + builtin.ret v269; + }; + + private builtin.function @miden:cross-ctx-account-word/foo@1.0.0#process-word(v270: felt, v271: felt, v272: felt, v273: felt) -> i32 { + ^block21(v270: felt, v271: felt, v272: felt, v273: felt): + hir.store_local v270 #[local = lv0]; + hir.store_local v271 #[local = lv1]; + hir.store_local v272 #[local = lv2]; + hir.store_local v273 #[local = lv3]; + v275 = builtin.global_symbol @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/GOT.data.internal.__memory_base : ptr + v276 = hir.bitcast v275 : ptr; + v277 = hir.load v276 : i32; + hir.store_local v277 #[local = lv4]; + hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/wit_bindgen::rt::run_ctors_once() + v278 = hir.load_local : felt #[local = lv0]; + v636 = arith.constant 1 : felt; + v281 = arith.add v278, v636 : felt #[overflow = unchecked]; + hir.store_local v281 #[local = lv0]; + v282 = hir.load_local : felt #[local = lv1]; + v635 = arith.constant 2 : felt; + v285 = arith.add v282, v635 : felt #[overflow = unchecked]; + hir.store_local v285 #[local = lv1]; + v286 = hir.load_local : felt #[local = lv2]; + v634 = arith.constant 3 : felt; + v289 = arith.add v286, v634 : felt #[overflow = unchecked]; + hir.store_local v289 #[local = lv2]; + v290 = hir.load_local : i32 #[local = lv4]; + v640 = arith.constant 1048584 : i32; + v292 = arith.add v290, v640 : i32 #[overflow = wrapping]; + hir.store_local v292 #[local = lv4]; + v293 = hir.load_local : felt #[local = lv3]; + v639 = arith.constant 12 : u32; + v297 = hir.bitcast v292 : u32; + v299 = arith.add v297, v639 : u32 #[overflow = checked]; + v638 = arith.constant 4 : u32; + v301 = arith.mod v299, v638 : u32; + hir.assertz v301 #[code = 250]; + v633 = arith.constant 4 : felt; + v296 = arith.add v293, v633 : felt #[overflow = unchecked]; + v302 = hir.int_to_ptr v299 : ptr; + hir.store v302, v296; + v303 = hir.load_local : i32 #[local = lv4]; + v304 = hir.load_local : felt #[local = lv2]; + v637 = arith.constant 8 : u32; + v305 = hir.bitcast v303 : u32; + v307 = arith.add v305, v637 : u32 #[overflow = checked]; + v648 = arith.constant 4 : u32; + v309 = arith.mod v307, v648 : u32; + hir.assertz v309 #[code = 250]; + v310 = hir.int_to_ptr v307 : ptr; + hir.store v310, v304; + v311 = hir.load_local : i32 #[local = lv4]; + v312 = hir.load_local : felt #[local = lv1]; + v647 = arith.constant 4 : u32; + v313 = hir.bitcast v311 : u32; + v315 = arith.add v313, v647 : u32 #[overflow = checked]; + v646 = arith.constant 4 : u32; + v317 = arith.mod v315, v646 : u32; + hir.assertz v317 #[code = 250]; + v318 = hir.int_to_ptr v315 : ptr; + hir.store v318, v312; + v319 = hir.load_local : i32 #[local = lv4]; + v320 = hir.load_local : felt #[local = lv0]; + v321 = hir.bitcast v319 : u32; + v645 = arith.constant 4 : u32; + v323 = arith.mod v321, v645 : u32; + hir.assertz v323 #[code = 250]; + v324 = hir.int_to_ptr v321 : ptr; + hir.store v324, v320; + v325 = hir.load_local : i32 #[local = lv4]; + builtin.ret v325; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block23: - v267 = builtin.global_symbol @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/GOT.data.internal.__memory_base : ptr - v268 = hir.bitcast v267 : ptr; - v269 = hir.load v268 : i32; - v270 = arith.constant 1048608 : i32; - v271 = arith.add v269, v270 : i32 #[overflow = wrapping]; - v272 = hir.bitcast v271 : u32; - v273 = hir.int_to_ptr v272 : ptr; - v274 = hir.load v273 : u8; - v266 = arith.constant 0 : i32; - v275 = arith.zext v274 : u32; - v276 = hir.bitcast v275 : i32; - v278 = arith.neq v276, v266 : i1; - scf.if v278{ + v326 = builtin.global_symbol @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/GOT.data.internal.__memory_base : ptr + v327 = hir.bitcast v326 : ptr; + v328 = hir.load v327 : i32; + v653 = arith.constant 1048608 : i32; + v330 = arith.add v328, v653 : i32 #[overflow = wrapping]; + v331 = hir.bitcast v330 : u32; + v332 = hir.int_to_ptr v331 : ptr; + v333 = hir.load v332 : u8; + v652 = arith.constant 0 : i32; + v334 = arith.zext v333 : u32; + v335 = hir.bitcast v334 : i32; + v337 = arith.neq v335, v652 : i1; + scf.if v337{ ^block25: scf.yield ; } else { ^block26: - v279 = builtin.global_symbol @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/GOT.data.internal.__memory_base : ptr - v280 = hir.bitcast v279 : ptr; - v281 = hir.load v280 : i32; + v338 = builtin.global_symbol @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/GOT.data.internal.__memory_base : ptr + v339 = hir.bitcast v338 : ptr; + v340 = hir.load v339 : i32; + hir.store_local v340 #[local = lv0]; hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/__wasm_call_ctors() - v509 = arith.constant 1 : u8; - v511 = arith.constant 1048608 : i32; - v283 = arith.add v281, v511 : i32 #[overflow = wrapping]; - v287 = hir.bitcast v283 : u32; - v288 = hir.int_to_ptr v287 : ptr; - hir.store v288, v509; + v341 = hir.load_local : i32 #[local = lv0]; + v651 = arith.constant 1 : u8; + v656 = arith.constant 1048608 : i32; + v343 = arith.add v341, v656 : i32 #[overflow = wrapping]; + v347 = hir.bitcast v343 : u32; + v348 = hir.int_to_ptr v347 : ptr; + hir.store v348, v651; scf.yield ; }; builtin.ret ; }; - private builtin.function @intrinsics::felt::add(v289: felt, v290: felt) -> felt { - ^block27(v289: felt, v290: felt): - v291 = arith.add v289, v290 : felt #[overflow = unchecked]; - builtin.ret v291; - }; - - private builtin.function @intrinsics::felt::from_u32(v293: i32) -> felt { - ^block29(v293: i32): - v294 = hir.bitcast v293 : felt; - builtin.ret v294; - }; - builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; @@ -382,179 +468,179 @@ builtin.component miden:cross-ctx-account-word/foo@1.0.0 { builtin.segment @1048576 = 0x0000000100000001; }; - public builtin.function @process-word(v296: felt, v297: felt, v298: felt, v299: felt) -> felt, felt, felt, felt { - ^block31(v296: felt, v297: felt, v298: felt, v299: felt): - v300 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-word(v296, v297, v298, v299) : i32 - v301 = arith.constant 0 : i32; - v302 = arith.add v300, v301 : i32 #[overflow = unchecked]; - v515 = arith.constant 0 : i32; - v516 = arith.constant 0 : i32; - v304 = arith.add v302, v516 : i32 #[overflow = unchecked]; - v306 = arith.add v304, v515 : i32 #[overflow = unchecked]; - v307 = hir.int_to_ptr v306 : ptr; - v308 = hir.load v307 : felt; - v514 = arith.constant 0 : i32; - v309 = arith.constant 4 : i32; - v310 = arith.add v302, v309 : i32 #[overflow = unchecked]; - v312 = arith.add v310, v514 : i32 #[overflow = unchecked]; - v313 = hir.int_to_ptr v312 : ptr; - v314 = hir.load v313 : felt; - v513 = arith.constant 0 : i32; - v315 = arith.constant 8 : i32; - v316 = arith.add v302, v315 : i32 #[overflow = unchecked]; - v318 = arith.add v316, v513 : i32 #[overflow = unchecked]; - v319 = hir.int_to_ptr v318 : ptr; - v320 = hir.load v319 : felt; - v512 = arith.constant 0 : i32; - v321 = arith.constant 12 : i32; - v322 = arith.add v302, v321 : i32 #[overflow = unchecked]; - v324 = arith.add v322, v512 : i32 #[overflow = unchecked]; - v325 = hir.int_to_ptr v324 : ptr; - v326 = hir.load v325 : felt; - builtin.ret v308, v314, v320, v326; - }; - - public builtin.function @process-another-word(v331: felt, v332: felt, v333: felt, v334: felt) -> felt, felt, felt, felt { - ^block33(v331: felt, v332: felt, v333: felt, v334: felt): - v335 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-another-word(v331, v332, v333, v334) : i32 - v336 = arith.constant 0 : i32; - v337 = arith.add v335, v336 : i32 #[overflow = unchecked]; - v520 = arith.constant 0 : i32; - v521 = arith.constant 0 : i32; - v339 = arith.add v337, v521 : i32 #[overflow = unchecked]; - v341 = arith.add v339, v520 : i32 #[overflow = unchecked]; - v342 = hir.int_to_ptr v341 : ptr; - v343 = hir.load v342 : felt; - v519 = arith.constant 0 : i32; - v344 = arith.constant 4 : i32; - v345 = arith.add v337, v344 : i32 #[overflow = unchecked]; - v347 = arith.add v345, v519 : i32 #[overflow = unchecked]; - v348 = hir.int_to_ptr v347 : ptr; - v349 = hir.load v348 : felt; - v518 = arith.constant 0 : i32; - v350 = arith.constant 8 : i32; - v351 = arith.add v337, v350 : i32 #[overflow = unchecked]; - v353 = arith.add v351, v518 : i32 #[overflow = unchecked]; - v354 = hir.int_to_ptr v353 : ptr; - v355 = hir.load v354 : felt; - v517 = arith.constant 0 : i32; - v356 = arith.constant 12 : i32; - v357 = arith.add v337, v356 : i32 #[overflow = unchecked]; - v359 = arith.add v357, v517 : i32 #[overflow = unchecked]; + public builtin.function @process-word(v349: felt, v350: felt, v351: felt, v352: felt) -> felt, felt, felt, felt { + ^block27(v349: felt, v350: felt, v351: felt, v352: felt): + v353 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-word(v349, v350, v351, v352) : i32 + v660 = arith.constant 0 : i32; + v355 = arith.add v353, v660 : i32 #[overflow = unchecked]; + v669 = arith.constant 0 : i32; + v670 = arith.constant 0 : i32; + v357 = arith.add v355, v670 : i32 #[overflow = unchecked]; + v359 = arith.add v357, v669 : i32 #[overflow = unchecked]; v360 = hir.int_to_ptr v359 : ptr; v361 = hir.load v360 : felt; - builtin.ret v343, v349, v355, v361; + v668 = arith.constant 0 : i32; + v659 = arith.constant 4 : i32; + v363 = arith.add v355, v659 : i32 #[overflow = unchecked]; + v365 = arith.add v363, v668 : i32 #[overflow = unchecked]; + v366 = hir.int_to_ptr v365 : ptr; + v367 = hir.load v366 : felt; + v667 = arith.constant 0 : i32; + v658 = arith.constant 8 : i32; + v369 = arith.add v355, v658 : i32 #[overflow = unchecked]; + v371 = arith.add v369, v667 : i32 #[overflow = unchecked]; + v372 = hir.int_to_ptr v371 : ptr; + v373 = hir.load v372 : felt; + v666 = arith.constant 0 : i32; + v657 = arith.constant 12 : i32; + v375 = arith.add v355, v657 : i32 #[overflow = unchecked]; + v377 = arith.add v375, v666 : i32 #[overflow = unchecked]; + v378 = hir.int_to_ptr v377 : ptr; + v379 = hir.load v378 : felt; + builtin.ret v361, v367, v373, v379; }; - public builtin.function @process-felt(v366: felt) -> felt { - ^block35(v366: felt): - v367 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-felt(v366) : felt - builtin.ret v367; + public builtin.function @process-another-word(v384: felt, v385: felt, v386: felt, v387: felt) -> felt, felt, felt, felt { + ^block29(v384: felt, v385: felt, v386: felt, v387: felt): + v388 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-another-word(v384, v385, v386, v387) : i32 + v674 = arith.constant 0 : i32; + v390 = arith.add v388, v674 : i32 #[overflow = unchecked]; + v683 = arith.constant 0 : i32; + v684 = arith.constant 0 : i32; + v392 = arith.add v390, v684 : i32 #[overflow = unchecked]; + v394 = arith.add v392, v683 : i32 #[overflow = unchecked]; + v395 = hir.int_to_ptr v394 : ptr; + v396 = hir.load v395 : felt; + v682 = arith.constant 0 : i32; + v673 = arith.constant 4 : i32; + v398 = arith.add v390, v673 : i32 #[overflow = unchecked]; + v400 = arith.add v398, v682 : i32 #[overflow = unchecked]; + v401 = hir.int_to_ptr v400 : ptr; + v402 = hir.load v401 : felt; + v681 = arith.constant 0 : i32; + v672 = arith.constant 8 : i32; + v404 = arith.add v390, v672 : i32 #[overflow = unchecked]; + v406 = arith.add v404, v681 : i32 #[overflow = unchecked]; + v407 = hir.int_to_ptr v406 : ptr; + v408 = hir.load v407 : felt; + v680 = arith.constant 0 : i32; + v671 = arith.constant 12 : i32; + v410 = arith.add v390, v671 : i32 #[overflow = unchecked]; + v412 = arith.add v410, v680 : i32 #[overflow = unchecked]; + v413 = hir.int_to_ptr v412 : ptr; + v414 = hir.load v413 : felt; + builtin.ret v396, v402, v408, v414; }; - public builtin.function @process-pair(v368: felt, v369: felt) -> felt, felt { - ^block37(v368: felt, v369: felt): - v370 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-pair(v368, v369) : i32 - v523 = arith.constant 0 : i32; - v371 = arith.constant 0 : i32; - v372 = arith.add v370, v371 : i32 #[overflow = unchecked]; - v374 = arith.add v372, v523 : i32 #[overflow = unchecked]; - v375 = hir.int_to_ptr v374 : ptr; - v376 = hir.load v375 : felt; - v522 = arith.constant 0 : i32; - v377 = arith.constant 4 : i32; - v378 = arith.add v370, v377 : i32 #[overflow = unchecked]; - v380 = arith.add v378, v522 : i32 #[overflow = unchecked]; - v381 = hir.int_to_ptr v380 : ptr; - v382 = hir.load v381 : felt; - builtin.ret v376, v382; + public builtin.function @process-felt(v419: felt) -> felt { + ^block31(v419: felt): + v420 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-felt(v419) : felt + builtin.ret v420; }; - public builtin.function @process-triple(v385: felt, v386: felt, v387: felt) -> felt, felt, felt { - ^block39(v385: felt, v386: felt, v387: felt): - v388 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-triple(v385, v386, v387) : i32 - v526 = arith.constant 0 : i32; - v389 = arith.constant 0 : i32; - v390 = arith.add v388, v389 : i32 #[overflow = unchecked]; - v392 = arith.add v390, v526 : i32 #[overflow = unchecked]; - v393 = hir.int_to_ptr v392 : ptr; - v394 = hir.load v393 : felt; - v525 = arith.constant 0 : i32; - v395 = arith.constant 4 : i32; - v396 = arith.add v388, v395 : i32 #[overflow = unchecked]; - v398 = arith.add v396, v525 : i32 #[overflow = unchecked]; - v399 = hir.int_to_ptr v398 : ptr; - v400 = hir.load v399 : felt; - v524 = arith.constant 0 : i32; - v401 = arith.constant 8 : i32; - v402 = arith.add v388, v401 : i32 #[overflow = unchecked]; - v404 = arith.add v402, v524 : i32 #[overflow = unchecked]; - v405 = hir.int_to_ptr v404 : ptr; - v406 = hir.load v405 : felt; - builtin.ret v394, v400, v406; + public builtin.function @process-pair(v421: felt, v422: felt) -> felt, felt { + ^block33(v421: felt, v422: felt): + v423 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-pair(v421, v422) : i32 + v690 = arith.constant 0 : i32; + v688 = arith.constant 0 : i32; + v425 = arith.add v423, v688 : i32 #[overflow = unchecked]; + v427 = arith.add v425, v690 : i32 #[overflow = unchecked]; + v428 = hir.int_to_ptr v427 : ptr; + v429 = hir.load v428 : felt; + v689 = arith.constant 0 : i32; + v685 = arith.constant 4 : i32; + v431 = arith.add v423, v685 : i32 #[overflow = unchecked]; + v433 = arith.add v431, v689 : i32 #[overflow = unchecked]; + v434 = hir.int_to_ptr v433 : ptr; + v435 = hir.load v434 : felt; + builtin.ret v429, v435; }; - public builtin.function @process-mixed(v410: i64, v411: felt, v412: i32, v413: felt, v414: i32, v415: i32, v416: i32) -> i64, felt, i32, felt, i32, i32, i32 { - ^block41(v410: i64, v411: felt, v412: i32, v413: felt, v414: i32, v415: i32, v416: i32): - v417 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-mixed(v410, v411, v412, v413, v414, v415, v416) : i32 - v418 = arith.constant 0 : i32; - v419 = arith.add v417, v418 : i32 #[overflow = unchecked]; - v420 = hir.int_to_ptr v419 : ptr; - v421 = hir.load v420 : u64; - v528 = arith.constant 0 : i32; - v422 = arith.constant 8 : i32; - v423 = arith.add v417, v422 : i32 #[overflow = unchecked]; - v425 = arith.add v423, v528 : i32 #[overflow = unchecked]; - v426 = hir.int_to_ptr v425 : ptr; - v427 = hir.load v426 : felt; - v428 = arith.constant 12 : i32; - v429 = arith.add v417, v428 : i32 #[overflow = unchecked]; - v430 = hir.int_to_ptr v429 : ptr; - v431 = hir.load v430 : u32; - v527 = arith.constant 0 : i32; - v432 = arith.constant 16 : i32; - v433 = arith.add v417, v432 : i32 #[overflow = unchecked]; - v435 = arith.add v433, v527 : i32 #[overflow = unchecked]; - v436 = hir.int_to_ptr v435 : ptr; - v437 = hir.load v436 : felt; - v438 = arith.constant 20 : i32; - v439 = arith.add v417, v438 : i32 #[overflow = unchecked]; - v440 = hir.int_to_ptr v439 : ptr; - v441 = hir.load v440 : u8; - v442 = arith.constant 21 : i32; - v443 = arith.add v417, v442 : i32 #[overflow = unchecked]; - v444 = hir.int_to_ptr v443 : ptr; - v445 = hir.load v444 : i1; - v446 = arith.constant 22 : i32; - v447 = arith.add v417, v446 : i32 #[overflow = unchecked]; - v448 = hir.int_to_ptr v447 : ptr; - v449 = hir.load v448 : u16; - builtin.ret v421, v427, v431, v437, v441, v445, v449; + public builtin.function @process-triple(v438: felt, v439: felt, v440: felt) -> felt, felt, felt { + ^block35(v438: felt, v439: felt, v440: felt): + v441 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-triple(v438, v439, v440) : i32 + v699 = arith.constant 0 : i32; + v696 = arith.constant 0 : i32; + v443 = arith.add v441, v696 : i32 #[overflow = unchecked]; + v445 = arith.add v443, v699 : i32 #[overflow = unchecked]; + v446 = hir.int_to_ptr v445 : ptr; + v447 = hir.load v446 : felt; + v698 = arith.constant 0 : i32; + v692 = arith.constant 4 : i32; + v449 = arith.add v441, v692 : i32 #[overflow = unchecked]; + v451 = arith.add v449, v698 : i32 #[overflow = unchecked]; + v452 = hir.int_to_ptr v451 : ptr; + v453 = hir.load v452 : felt; + v697 = arith.constant 0 : i32; + v691 = arith.constant 8 : i32; + v455 = arith.add v441, v691 : i32 #[overflow = unchecked]; + v457 = arith.add v455, v697 : i32 #[overflow = unchecked]; + v458 = hir.int_to_ptr v457 : ptr; + v459 = hir.load v458 : felt; + builtin.ret v447, v453, v459; }; - public builtin.function @process-nested(v457: felt, v458: felt, v459: felt) -> felt, felt, felt { - ^block43(v457: felt, v458: felt, v459: felt): - v460 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-nested(v457, v458, v459) : i32 - v461 = arith.constant 0 : i32; - v462 = arith.add v460, v461 : i32 #[overflow = unchecked]; - v531 = arith.constant 0 : i32; - v532 = arith.constant 0 : i32; - v464 = arith.add v462, v532 : i32 #[overflow = unchecked]; - v466 = arith.add v464, v531 : i32 #[overflow = unchecked]; - v467 = hir.int_to_ptr v466 : ptr; - v468 = hir.load v467 : felt; - v530 = arith.constant 0 : i32; - v469 = arith.constant 4 : i32; - v470 = arith.add v462, v469 : i32 #[overflow = unchecked]; - v472 = arith.add v470, v530 : i32 #[overflow = unchecked]; - v473 = hir.int_to_ptr v472 : ptr; - v474 = hir.load v473 : felt; - v529 = arith.constant 0 : i32; - v475 = arith.constant 8 : i32; - v476 = arith.add v460, v475 : i32 #[overflow = unchecked]; - v478 = arith.add v476, v529 : i32 #[overflow = unchecked]; + public builtin.function @process-mixed(v463: i64, v464: felt, v465: i32, v466: felt, v467: i32, v468: i32, v469: i32) -> i64, felt, i32, felt, i32, i32, i32 { + ^block37(v463: i64, v464: felt, v465: i32, v466: felt, v467: i32, v468: i32, v469: i32): + v470 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-mixed(v463, v464, v465, v466, v467, v468, v469) : i32 + v706 = arith.constant 0 : i32; + v472 = arith.add v470, v706 : i32 #[overflow = unchecked]; + v473 = hir.int_to_ptr v472 : ptr; + v474 = hir.load v473 : u64; + v710 = arith.constant 0 : i32; + v705 = arith.constant 8 : i32; + v476 = arith.add v470, v705 : i32 #[overflow = unchecked]; + v478 = arith.add v476, v710 : i32 #[overflow = unchecked]; v479 = hir.int_to_ptr v478 : ptr; v480 = hir.load v479 : felt; - builtin.ret v468, v474, v480; + v704 = arith.constant 12 : i32; + v482 = arith.add v470, v704 : i32 #[overflow = unchecked]; + v483 = hir.int_to_ptr v482 : ptr; + v484 = hir.load v483 : u32; + v709 = arith.constant 0 : i32; + v703 = arith.constant 16 : i32; + v486 = arith.add v470, v703 : i32 #[overflow = unchecked]; + v488 = arith.add v486, v709 : i32 #[overflow = unchecked]; + v489 = hir.int_to_ptr v488 : ptr; + v490 = hir.load v489 : felt; + v702 = arith.constant 20 : i32; + v492 = arith.add v470, v702 : i32 #[overflow = unchecked]; + v493 = hir.int_to_ptr v492 : ptr; + v494 = hir.load v493 : u8; + v701 = arith.constant 21 : i32; + v496 = arith.add v470, v701 : i32 #[overflow = unchecked]; + v497 = hir.int_to_ptr v496 : ptr; + v498 = hir.load v497 : i1; + v700 = arith.constant 22 : i32; + v500 = arith.add v470, v700 : i32 #[overflow = unchecked]; + v501 = hir.int_to_ptr v500 : ptr; + v502 = hir.load v501 : u16; + builtin.ret v474, v480, v484, v490, v494, v498, v502; + }; + + public builtin.function @process-nested(v510: felt, v511: felt, v512: felt) -> felt, felt, felt { + ^block39(v510: felt, v511: felt, v512: felt): + v513 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-nested(v510, v511, v512) : i32 + v713 = arith.constant 0 : i32; + v515 = arith.add v513, v713 : i32 #[overflow = unchecked]; + v720 = arith.constant 0 : i32; + v721 = arith.constant 0 : i32; + v517 = arith.add v515, v721 : i32 #[overflow = unchecked]; + v519 = arith.add v517, v720 : i32 #[overflow = unchecked]; + v520 = hir.int_to_ptr v519 : ptr; + v521 = hir.load v520 : felt; + v719 = arith.constant 0 : i32; + v712 = arith.constant 4 : i32; + v523 = arith.add v515, v712 : i32 #[overflow = unchecked]; + v525 = arith.add v523, v719 : i32 #[overflow = unchecked]; + v526 = hir.int_to_ptr v525 : ptr; + v527 = hir.load v526 : felt; + v718 = arith.constant 0 : i32; + v711 = arith.constant 8 : i32; + v529 = arith.add v513, v711 : i32 #[overflow = unchecked]; + v531 = arith.add v529, v718 : i32 #[overflow = unchecked]; + v532 = hir.int_to_ptr v531 : ptr; + v533 = hir.load v532 : felt; + builtin.ret v521, v527, v533; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account_word.masm b/tests/integration/expected/rust_sdk/cross_ctx_account_word.masm index da08823d4..6d629c30f 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account_word.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_account_word.masm @@ -1,11 +1,11 @@ -# mod miden:cross-ctx-account-word/foo@1.0.0 +# mod ::"miden:cross-ctx-account-word/foo@1.0.0" @callconv("canon-lift") pub proc process-word(felt, felt, felt, felt) -> (felt, felt, felt, felt) - exec.::miden:cross-ctx-account-word/foo@1.0.0::init + exec."miden:cross-ctx-account-word/foo@1.0.0"::init trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::miden:cross-ctx-account-word/foo@1.0.0#process-word + exec.::"miden:cross-ctx-account-word/foo@1.0.0"::cross_ctx_account_word::"miden:cross-ctx-account-word/foo@1.0.0#process-word" trace.252 nop push.0 @@ -60,7 +60,7 @@ pub proc process-word(felt, felt, felt, felt) -> (felt, felt, felt, felt) nop movdn.3 swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end @callconv("canon-lift") @@ -70,10 +70,10 @@ pub proc process-another-word( felt, felt ) -> (felt, felt, felt, felt) - exec.::miden:cross-ctx-account-word/foo@1.0.0::init + exec."miden:cross-ctx-account-word/foo@1.0.0"::init trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::miden:cross-ctx-account-word/foo@1.0.0#process-another-word + exec.::"miden:cross-ctx-account-word/foo@1.0.0"::cross_ctx_account_word::"miden:cross-ctx-account-word/foo@1.0.0#process-another-word" trace.252 nop push.0 @@ -128,26 +128,26 @@ pub proc process-another-word( nop movdn.3 swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end @callconv("canon-lift") pub proc process-felt(felt) -> felt - exec.::miden:cross-ctx-account-word/foo@1.0.0::init + exec."miden:cross-ctx-account-word/foo@1.0.0"::init trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::miden:cross-ctx-account-word/foo@1.0.0#process-felt + exec.::"miden:cross-ctx-account-word/foo@1.0.0"::cross_ctx_account_word::"miden:cross-ctx-account-word/foo@1.0.0#process-felt" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end @callconv("canon-lift") pub proc process-pair(felt, felt) -> (felt, felt) - exec.::miden:cross-ctx-account-word/foo@1.0.0::init + exec."miden:cross-ctx-account-word/foo@1.0.0"::init trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::miden:cross-ctx-account-word/foo@1.0.0#process-pair + exec.::"miden:cross-ctx-account-word/foo@1.0.0"::cross_ctx_account_word::"miden:cross-ctx-account-word/foo@1.0.0#process-pair" trace.252 nop push.0 @@ -175,15 +175,15 @@ pub proc process-pair(felt, felt) -> (felt, felt) trace.252 nop swap.1 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end @callconv("canon-lift") pub proc process-triple(felt, felt, felt) -> (felt, felt, felt) - exec.::miden:cross-ctx-account-word/foo@1.0.0::init + exec."miden:cross-ctx-account-word/foo@1.0.0"::init trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::miden:cross-ctx-account-word/foo@1.0.0#process-triple + exec.::"miden:cross-ctx-account-word/foo@1.0.0"::cross_ctx_account_word::"miden:cross-ctx-account-word/foo@1.0.0#process-triple" trace.252 nop push.0 @@ -223,7 +223,7 @@ pub proc process-triple(felt, felt, felt) -> (felt, felt, felt) trace.252 nop swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end @callconv("canon-lift") @@ -236,10 +236,10 @@ pub proc process-mixed( i32, i32 ) -> ([u32; 2], felt, i32, felt, i32, i32, i32) - exec.::miden:cross-ctx-account-word/foo@1.0.0::init + exec."miden:cross-ctx-account-word/foo@1.0.0"::init trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::miden:cross-ctx-account-word/foo@1.0.0#process-mixed + exec.::"miden:cross-ctx-account-word/foo@1.0.0"::cross_ctx_account_word::"miden:cross-ctx-account-word/foo@1.0.0#process-mixed" trace.252 nop push.0 @@ -344,15 +344,15 @@ pub proc process-mixed( movdn.7 movup.6 movup.6 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end @callconv("canon-lift") pub proc process-nested(felt, felt, felt) -> (felt, felt, felt) - exec.::miden:cross-ctx-account-word/foo@1.0.0::init + exec."miden:cross-ctx-account-word/foo@1.0.0"::init trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::miden:cross-ctx-account-word/foo@1.0.0#process-nested + exec.::"miden:cross-ctx-account-word/foo@1.0.0"::cross_ctx_account_word::"miden:cross-ctx-account-word/foo@1.0.0#process-nested" trace.252 nop push.0 @@ -395,7 +395,7 @@ pub proc process-nested(felt, felt, felt) -> (felt, felt, felt) trace.252 nop swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -408,7 +408,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -419,7 +419,7 @@ proc init mem_store.278537 end -# mod miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word +# mod ::"miden:cross-ctx-account-word/foo@1.0.0"::cross_ctx_account_word @callconv("C") proc __wasm_call_ctors( @@ -435,6 +435,7 @@ proc cross_ctx_account_word::bindings::__link_custom_section_describing_imports( nop end +@locals("5") @callconv("C") proc miden:cross-ctx-account-word/foo@1.0.0#process-another-word( felt, @@ -442,6 +443,38 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-another-word( felt, felt ) -> i32 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1114148 u32divmod.4 swap.1 @@ -450,64 +483,102 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-another-word( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:cross-ctx-account-word/foo@1.0.0"::cross_ctx_account_word::wit_bindgen::rt::run_ctors_once + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::wit_bindgen::rt::run_ctors_once + exec.::intrinsics::mem::load_felt trace.252 nop push.2 + add + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop - movup.2 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + exec.::intrinsics::mem::load_felt trace.252 nop push.3 + add + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop - movup.3 + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + exec.::intrinsics::mem::load_felt trace.252 nop push.4 + add + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop - movup.4 + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + exec.::intrinsics::mem::load_sw trace.252 nop push.1048584 - movup.4 u32wrapping_add - push.5 + dup.0 + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_sw trace.252 nop - movup.5 + locaddr.3 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + exec.::intrinsics::mem::load_felt trace.252 nop push.12 - dup.2 + movup.2 add u32assert push.4 @@ -516,6 +587,10 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-another-word( u32mod u32assert assertz + push.5 + movup.2 + add + swap.1 u32divmod.4 swap.1 trace.240 @@ -523,8 +598,24 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-another-word( exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.8 - dup.1 + movup.2 add u32assert push.4 @@ -533,8 +624,6 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-another-word( u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -542,8 +631,24 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-another-word( exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.4 - dup.1 + movup.2 add u32assert push.4 @@ -552,8 +657,6 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-another-word( u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -561,15 +664,29 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-another-word( exec.::intrinsics::mem::store_felt trace.252 nop - dup.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.1 push.4 dup.1 swap.1 u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -577,29 +694,45 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-another-word( exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("1") @callconv("C") proc miden:cross-ctx-account-word/foo@1.0.0#process-felt(felt) -> felt + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::wit_bindgen::rt::run_ctors_once + exec.::intrinsics::mem::store_felt trace.252 nop - push.3 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + exec.::"miden:cross-ctx-account-word/foo@1.0.0"::cross_ctx_account_word::wit_bindgen::rt::run_ctors_once trace.252 nop + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + exec.::intrinsics::mem::load_felt trace.252 nop + push.3 + add end +@locals("9") @callconv("C") proc miden:cross-ctx-account-word/foo@1.0.0#process-mixed( [u32; 2], @@ -610,6 +743,64 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-mixed( i32, i32 ) -> i32 + locaddr.0 + push.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.7 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114148 u32divmod.4 swap.1 @@ -618,40 +809,84 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-mixed( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:cross-ctx-account-word/foo@1.0.0"::cross_ctx_account_word::wit_bindgen::rt::run_ctors_once + trace.252 + nop + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::wit_bindgen::rt::run_ctors_once + exec.::intrinsics::mem::load_felt trace.252 nop push.6 + add + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop - movup.4 + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + exec.::intrinsics::mem::load_felt trace.252 nop push.7 + add + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop - movup.6 + locaddr.8 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + exec.::intrinsics::mem::load_sw trace.252 nop push.1048584 - movup.3 u32wrapping_add + dup.0 + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.7 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.22 - dup.1 + movup.2 add u32assert push.2 @@ -661,7 +896,7 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-mixed( u32assert assertz push.9 - movup.10 + movup.2 u32wrapping_add push.65535 u32and @@ -687,15 +922,31 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-mixed( u32or swap.1 mem_store + locaddr.8 push.0 - push.255 - movup.9 - u32and - eq - push.255 - u32and + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.255 + movup.2 + u32and + eq + push.255 + u32and push.21 - dup.2 + movup.2 add u32assert u32divmod.4 @@ -719,13 +970,28 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-mixed( u32or swap.1 mem_store + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.11 - movup.7 u32wrapping_add push.255 u32and push.20 - dup.2 + movup.2 add u32assert u32divmod.4 @@ -749,8 +1015,24 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-mixed( u32or swap.1 mem_store + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.16 - dup.1 + movup.2 add u32assert push.4 @@ -759,8 +1041,6 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-mixed( u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -768,8 +1048,24 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-mixed( exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.1 + movup.2 add u32assert push.4 @@ -779,7 +1075,7 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-mixed( u32assert assertz push.10 - movup.6 + movup.2 u32wrapping_add swap.1 u32divmod.4 @@ -789,8 +1085,24 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-mixed( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.8 - dup.1 + movup.2 add u32assert push.4 @@ -799,8 +1111,6 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-mixed( u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -808,7 +1118,24 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-mixed( exec.::intrinsics::mem::store_felt trace.252 nop - dup.0 + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + movup.2 push.8 dup.1 swap.1 @@ -817,11 +1144,11 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-mixed( assertz push.1000 push.0 - movup.5 - movup.5 + movup.4 + movup.4 trace.240 nop - exec.::std::math::u64::wrapping_add + exec.::miden::core::math::u64::wrapping_add trace.252 nop movup.2 @@ -834,14 +1161,47 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-mixed( exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("4") @callconv("C") proc miden:cross-ctx-account-word/foo@1.0.0#process-nested( felt, felt, felt ) -> i32 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1114148 u32divmod.4 swap.1 @@ -850,52 +1210,84 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-nested( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::wit_bindgen::rt::run_ctors_once + exec.::"miden:cross-ctx-account-word/foo@1.0.0"::cross_ctx_account_word::wit_bindgen::rt::run_ctors_once + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt trace.252 nop push.8 + add + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop - movup.2 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + exec.::intrinsics::mem::load_felt trace.252 nop push.8 + add + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop - movup.3 + locaddr.3 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + exec.::intrinsics::mem::load_sw trace.252 nop push.1048584 - movup.3 u32wrapping_add - push.8 + dup.0 + locaddr.3 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_sw trace.252 nop - movup.4 + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + exec.::intrinsics::mem::load_felt trace.252 nop push.8 - dup.2 + movup.2 add u32assert push.4 @@ -904,6 +1296,10 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-nested( u32mod u32assert assertz + push.8 + movup.2 + add + swap.1 u32divmod.4 swap.1 trace.240 @@ -911,8 +1307,24 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-nested( exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.4 - dup.1 + movup.2 add u32assert push.4 @@ -921,8 +1333,6 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-nested( u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -930,15 +1340,29 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-nested( exec.::intrinsics::mem::store_felt trace.252 nop - dup.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.1 push.4 dup.1 swap.1 u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -946,10 +1370,35 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-nested( exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("3") @callconv("C") proc miden:cross-ctx-account-word/foo@1.0.0#process-pair(felt, felt) -> i32 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1114148 u32divmod.4 swap.1 @@ -958,40 +1407,66 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-pair(felt, felt) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::wit_bindgen::rt::run_ctors_once + exec.::"miden:cross-ctx-account-word/foo@1.0.0"::cross_ctx_account_word::wit_bindgen::rt::run_ctors_once + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt trace.252 nop push.4 + add + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop - movup.2 + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + exec.::intrinsics::mem::load_sw trace.252 nop push.1048584 - movup.2 u32wrapping_add - push.4 + dup.0 + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_sw trace.252 nop - movup.3 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + exec.::intrinsics::mem::load_felt trace.252 nop push.4 - dup.2 + movup.2 add u32assert push.4 @@ -1000,6 +1475,10 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-pair(felt, felt) -> i32 u32mod u32assert assertz + push.4 + movup.2 + add + swap.1 u32divmod.4 swap.1 trace.240 @@ -1007,84 +1486,163 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-pair(felt, felt) -> i32 exec.::intrinsics::mem::store_felt trace.252 nop - dup.0 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.1 push.4 dup.1 swap.1 u32mod u32assert assertz - movup.2 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop +end + +@locals("4") +@callconv("C") +proc miden:cross-ctx-account-word/foo@1.0.0#process-triple( + felt, + felt, + felt +) -> i32 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.1114148 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw trace.252 nop -end - -@callconv("C") -proc miden:cross-ctx-account-word/foo@1.0.0#process-triple( - felt, - felt, - felt -) -> i32 - push.1114148 - u32divmod.4 - swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::"miden:cross-ctx-account-word/foo@1.0.0"::cross_ctx_account_word::wit_bindgen::rt::run_ctors_once trace.252 nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::wit_bindgen::rt::run_ctors_once + exec.::intrinsics::mem::load_felt trace.252 nop push.5 + add + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop - movup.2 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + exec.::intrinsics::mem::load_felt trace.252 nop push.5 + add + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop - movup.3 + locaddr.3 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + exec.::intrinsics::mem::load_sw trace.252 nop push.1048584 - movup.3 u32wrapping_add - push.5 + dup.0 + locaddr.3 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_sw trace.252 nop - movup.4 + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + exec.::intrinsics::mem::load_felt trace.252 nop push.8 - dup.2 + movup.2 add u32assert push.4 @@ -1093,6 +1651,10 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-triple( u32mod u32assert assertz + push.5 + movup.2 + add + swap.1 u32divmod.4 swap.1 trace.240 @@ -1100,8 +1662,24 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-triple( exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.4 - dup.1 + movup.2 add u32assert push.4 @@ -1110,8 +1688,6 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-triple( u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1119,15 +1695,29 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-triple( exec.::intrinsics::mem::store_felt trace.252 nop - dup.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.1 push.4 dup.1 swap.1 u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1135,8 +1725,17 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-triple( exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("5") @callconv("C") proc miden:cross-ctx-account-word/foo@1.0.0#process-word( felt, @@ -1144,6 +1743,38 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-word( felt, felt ) -> i32 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1114148 u32divmod.4 swap.1 @@ -1152,64 +1783,102 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-word( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:cross-ctx-account-word/foo@1.0.0"::cross_ctx_account_word::wit_bindgen::rt::run_ctors_once + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::wit_bindgen::rt::run_ctors_once + exec.::intrinsics::mem::load_felt trace.252 nop push.1 + add + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop - movup.2 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + exec.::intrinsics::mem::load_felt trace.252 nop push.2 + add + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop - movup.3 + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + exec.::intrinsics::mem::load_felt trace.252 nop push.3 + add + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop - movup.4 + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + exec.::intrinsics::mem::load_sw trace.252 nop push.1048584 - movup.4 u32wrapping_add - push.4 + dup.0 + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_sw trace.252 nop - movup.5 + locaddr.3 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + exec.::intrinsics::mem::load_felt trace.252 nop push.12 - dup.2 + movup.2 add u32assert push.4 @@ -1218,6 +1887,10 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-word( u32mod u32assert assertz + push.4 + movup.2 + add + swap.1 u32divmod.4 swap.1 trace.240 @@ -1225,8 +1898,24 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-word( exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.8 - dup.1 + movup.2 add u32assert push.4 @@ -1235,8 +1924,6 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-word( u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1244,8 +1931,24 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-word( exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.4 - dup.1 + movup.2 add u32assert push.4 @@ -1254,8 +1957,6 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-word( u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1263,15 +1964,29 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-word( exec.::intrinsics::mem::store_felt trace.252 nop - dup.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.1 push.4 dup.1 swap.1 u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1279,8 +1994,17 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-word( exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -1322,9 +2046,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:cross-ctx-account-word/foo@1.0.0"::cross_ctx_account_word::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -1355,13 +2095,3 @@ proc wit_bindgen::rt::run_ctors_once( end end -@callconv("C") -proc intrinsics::felt::add(felt, felt) -> felt - add -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.hir b/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.hir index 8ffffcb56..60fcd3ae9 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.hir +++ b/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.hir @@ -12,124 +12,131 @@ builtin.component miden:cross-ctx-account-word-arg/foo@1.0.0 { private builtin.function @miden:cross-ctx-account-word-arg/foo@1.0.0#process-word(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: felt, v6: felt, v7: felt, v8: felt, v9: felt, v10: felt, v11: felt, v12: felt, v13: felt, v14: felt, v15: felt) -> felt { ^block9(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: felt, v6: felt, v7: felt, v8: felt, v9: felt, v10: felt, v11: felt, v12: felt, v13: felt, v14: felt, v15: felt): + hir.store_local v0 #[local = lv0]; + hir.store_local v1 #[local = lv1]; + hir.store_local v2 #[local = lv2]; + hir.store_local v3 #[local = lv3]; + hir.store_local v4 #[local = lv4]; + hir.store_local v5 #[local = lv5]; + hir.store_local v6 #[local = lv6]; + hir.store_local v7 #[local = lv7]; + hir.store_local v8 #[local = lv8]; + hir.store_local v9 #[local = lv9]; + hir.store_local v10 #[local = lv10]; + hir.store_local v11 #[local = lv11]; + hir.store_local v12 #[local = lv12]; + hir.store_local v13 #[local = lv13]; + hir.store_local v14 #[local = lv14]; + hir.store_local v15 #[local = lv15]; hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/wit_bindgen::rt::run_ctors_once() - hir.store_local v15 #[local = lv0]; - v17 = arith.constant 1 : i32; - v18 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v17) : felt - v19 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v0, v18) : felt - v20 = arith.constant 2 : i32; - v21 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v20) : felt - v22 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v1, v21) : felt - v23 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v19, v22) : felt - v24 = arith.constant 4 : i32; - v25 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v24) : felt - v26 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v2, v25) : felt - v27 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v23, v26) : felt - v28 = arith.constant 8 : i32; - v29 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v28) : felt - v30 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v3, v29) : felt - v31 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v27, v30) : felt - v32 = arith.constant 16 : i32; - v33 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v32) : felt - v34 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v4, v33) : felt - v35 = arith.constant 32 : i32; - v36 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v35) : felt - v37 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v5, v36) : felt - v38 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v34, v37) : felt - v39 = arith.constant 64 : i32; - v40 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v39) : felt - v41 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v6, v40) : felt - v42 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v38, v41) : felt - v43 = arith.constant 128 : i32; - v44 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v43) : felt - v45 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v7, v44) : felt - v46 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v42, v45) : felt - v47 = arith.constant 256 : i32; - v48 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v47) : felt - v49 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v8, v48) : felt - v50 = arith.constant 512 : i32; - v51 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v50) : felt - v52 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v9, v51) : felt - v53 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v49, v52) : felt - v54 = arith.constant 1024 : i32; - v55 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v54) : felt - v56 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v10, v55) : felt - v57 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v53, v56) : felt - v58 = arith.constant 2048 : i32; - v59 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v58) : felt - v60 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v11, v59) : felt - v61 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v57, v60) : felt - v62 = arith.constant 4096 : i32; - v63 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v62) : felt - v64 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v12, v63) : felt - v65 = arith.constant 8192 : i32; - v66 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v65) : felt - v67 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v13, v66) : felt - v68 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v64, v67) : felt - v69 = arith.constant 16384 : i32; - v70 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v69) : felt - v71 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v14, v70) : felt - v72 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v68, v71) : felt - v73 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v31, v46) : felt - v74 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v73, v61) : felt - v75 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v74, v72) : felt - v129 = hir.load_local : felt #[local = lv0]; - v76 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v75, v129) : felt - builtin.ret v76; + v17 = hir.load_local : felt #[local = lv0]; + v21 = hir.load_local : felt #[local = lv1]; + v26 = hir.load_local : felt #[local = lv2]; + v31 = hir.load_local : felt #[local = lv3]; + v163 = arith.constant 8 : felt; + v34 = arith.mul v31, v163 : felt #[overflow = unchecked]; + v164 = arith.constant 4 : felt; + v29 = arith.mul v26, v164 : felt #[overflow = unchecked]; + v165 = arith.constant 2 : felt; + v24 = arith.mul v21, v165 : felt #[overflow = unchecked]; + v166 = arith.constant 1 : felt; + v20 = arith.mul v17, v166 : felt #[overflow = unchecked]; + v25 = arith.add v20, v24 : felt #[overflow = unchecked]; + v30 = arith.add v25, v29 : felt #[overflow = unchecked]; + v35 = arith.add v30, v34 : felt #[overflow = unchecked]; + hir.store_local v35 #[local = lv3]; + v36 = hir.load_local : felt #[local = lv4]; + v40 = hir.load_local : felt #[local = lv5]; + v45 = hir.load_local : felt #[local = lv6]; + v50 = hir.load_local : felt #[local = lv7]; + v159 = arith.constant 128 : felt; + v53 = arith.mul v50, v159 : felt #[overflow = unchecked]; + v160 = arith.constant 64 : felt; + v48 = arith.mul v45, v160 : felt #[overflow = unchecked]; + v161 = arith.constant 32 : felt; + v43 = arith.mul v40, v161 : felt #[overflow = unchecked]; + v162 = arith.constant 16 : felt; + v39 = arith.mul v36, v162 : felt #[overflow = unchecked]; + v44 = arith.add v39, v43 : felt #[overflow = unchecked]; + v49 = arith.add v44, v48 : felt #[overflow = unchecked]; + v54 = arith.add v49, v53 : felt #[overflow = unchecked]; + hir.store_local v54 #[local = lv7]; + v55 = hir.load_local : felt #[local = lv8]; + v59 = hir.load_local : felt #[local = lv9]; + v64 = hir.load_local : felt #[local = lv10]; + v69 = hir.load_local : felt #[local = lv11]; + v155 = arith.constant 2048 : felt; + v72 = arith.mul v69, v155 : felt #[overflow = unchecked]; + v156 = arith.constant 1024 : felt; + v67 = arith.mul v64, v156 : felt #[overflow = unchecked]; + v157 = arith.constant 512 : felt; + v62 = arith.mul v59, v157 : felt #[overflow = unchecked]; + v158 = arith.constant 256 : felt; + v58 = arith.mul v55, v158 : felt #[overflow = unchecked]; + v63 = arith.add v58, v62 : felt #[overflow = unchecked]; + v68 = arith.add v63, v67 : felt #[overflow = unchecked]; + v73 = arith.add v68, v72 : felt #[overflow = unchecked]; + hir.store_local v73 #[local = lv11]; + v74 = hir.load_local : felt #[local = lv12]; + v78 = hir.load_local : felt #[local = lv13]; + v83 = hir.load_local : felt #[local = lv14]; + v152 = arith.constant 16384 : felt; + v86 = arith.mul v83, v152 : felt #[overflow = unchecked]; + v153 = arith.constant 8192 : felt; + v81 = arith.mul v78, v153 : felt #[overflow = unchecked]; + v154 = arith.constant 4096 : felt; + v77 = arith.mul v74, v154 : felt #[overflow = unchecked]; + v82 = arith.add v77, v81 : felt #[overflow = unchecked]; + v87 = arith.add v82, v86 : felt #[overflow = unchecked]; + hir.store_local v87 #[local = lv14]; + v88 = hir.load_local : felt #[local = lv3]; + v89 = hir.load_local : felt #[local = lv7]; + v91 = hir.load_local : felt #[local = lv11]; + v93 = hir.load_local : felt #[local = lv14]; + v95 = hir.load_local : felt #[local = lv15]; + v90 = arith.add v88, v89 : felt #[overflow = unchecked]; + v92 = arith.add v90, v91 : felt #[overflow = unchecked]; + v94 = arith.add v92, v93 : felt #[overflow = unchecked]; + v96 = arith.add v94, v95 : felt #[overflow = unchecked]; + builtin.ret v96; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v78 = builtin.global_symbol @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/GOT.data.internal.__memory_base : ptr - v79 = hir.bitcast v78 : ptr; - v80 = hir.load v79 : i32; - v81 = arith.constant 1048584 : i32; - v82 = arith.add v80, v81 : i32 #[overflow = wrapping]; - v83 = hir.bitcast v82 : u32; - v84 = hir.int_to_ptr v83 : ptr; - v85 = hir.load v84 : u8; - v77 = arith.constant 0 : i32; - v86 = arith.zext v85 : u32; - v87 = hir.bitcast v86 : i32; - v89 = arith.neq v87, v77 : i1; - scf.if v89{ + v97 = builtin.global_symbol @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/GOT.data.internal.__memory_base : ptr + v98 = hir.bitcast v97 : ptr; + v99 = hir.load v98 : i32; + v171 = arith.constant 1048584 : i32; + v101 = arith.add v99, v171 : i32 #[overflow = wrapping]; + v102 = hir.bitcast v101 : u32; + v103 = hir.int_to_ptr v102 : ptr; + v104 = hir.load v103 : u8; + v170 = arith.constant 0 : i32; + v105 = arith.zext v104 : u32; + v106 = hir.bitcast v105 : i32; + v108 = arith.neq v106, v170 : i1; + scf.if v108{ ^block13: scf.yield ; } else { ^block14: - v90 = builtin.global_symbol @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/GOT.data.internal.__memory_base : ptr - v91 = hir.bitcast v90 : ptr; - v92 = hir.load v91 : i32; + v109 = builtin.global_symbol @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/GOT.data.internal.__memory_base : ptr + v110 = hir.bitcast v109 : ptr; + v111 = hir.load v110 : i32; + hir.store_local v111 #[local = lv0]; hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/__wasm_call_ctors() - v131 = arith.constant 1 : u8; - v133 = arith.constant 1048584 : i32; - v94 = arith.add v92, v133 : i32 #[overflow = wrapping]; - v98 = hir.bitcast v94 : u32; - v99 = hir.int_to_ptr v98 : ptr; - hir.store v99, v131; + v112 = hir.load_local : i32 #[local = lv0]; + v169 = arith.constant 1 : u8; + v174 = arith.constant 1048584 : i32; + v114 = arith.add v112, v174 : i32 #[overflow = wrapping]; + v118 = hir.bitcast v114 : u32; + v119 = hir.int_to_ptr v118 : ptr; + hir.store v119, v169; scf.yield ; }; builtin.ret ; }; - private builtin.function @intrinsics::felt::add(v100: felt, v101: felt) -> felt { - ^block15(v100: felt, v101: felt): - v102 = arith.add v100, v101 : felt #[overflow = unchecked]; - builtin.ret v102; - }; - - private builtin.function @intrinsics::felt::from_u32(v104: i32) -> felt { - ^block17(v104: i32): - v105 = hir.bitcast v104 : felt; - builtin.ret v105; - }; - - private builtin.function @intrinsics::felt::mul(v107: felt, v108: felt) -> felt { - ^block19(v107: felt, v108: felt): - v109 = arith.mul v107, v108 : felt #[overflow = unchecked]; - builtin.ret v109; - }; - builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; @@ -141,9 +148,9 @@ builtin.component miden:cross-ctx-account-word-arg/foo@1.0.0 { builtin.segment @1048576 = 0x0000000100000001; }; - public builtin.function @process-word(v111: felt, v112: felt, v113: felt, v114: felt, v115: felt, v116: felt, v117: felt, v118: felt, v119: felt, v120: felt, v121: felt, v122: felt, v123: felt, v124: felt, v125: felt, v126: felt) -> felt { - ^block21(v111: felt, v112: felt, v113: felt, v114: felt, v115: felt, v116: felt, v117: felt, v118: felt, v119: felt, v120: felt, v121: felt, v122: felt, v123: felt, v124: felt, v125: felt, v126: felt): - v127 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/miden:cross-ctx-account-word-arg/foo@1.0.0#process-word(v111, v112, v113, v114, v115, v116, v117, v118, v119, v120, v121, v122, v123, v124, v125, v126) : felt - builtin.ret v127; + public builtin.function @process-word(v120: felt, v121: felt, v122: felt, v123: felt, v124: felt, v125: felt, v126: felt, v127: felt, v128: felt, v129: felt, v130: felt, v131: felt, v132: felt, v133: felt, v134: felt, v135: felt) -> felt { + ^block15(v120: felt, v121: felt, v122: felt, v123: felt, v124: felt, v125: felt, v126: felt, v127: felt, v128: felt, v129: felt, v130: felt, v131: felt, v132: felt, v133: felt, v134: felt, v135: felt): + v136 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/miden:cross-ctx-account-word-arg/foo@1.0.0#process-word(v120, v121, v122, v123, v124, v125, v126, v127, v128, v129, v130, v131, v132, v133, v134, v135) : felt + builtin.ret v136; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.masm b/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.masm index bb4651b26..40a98500e 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.masm @@ -1,4 +1,4 @@ -# mod miden:cross-ctx-account-word-arg/foo@1.0.0 +# mod ::"miden:cross-ctx-account-word-arg/foo@1.0.0" @callconv("canon-lift") pub proc process-word( @@ -19,13 +19,13 @@ pub proc process-word( felt, felt ) -> felt - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::init + exec."miden:cross-ctx-account-word-arg/foo@1.0.0"::init trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::miden:cross-ctx-account-word-arg/foo@1.0.0#process-word + exec.::"miden:cross-ctx-account-word-arg/foo@1.0.0"::cross_ctx_account_word_arg::"miden:cross-ctx-account-word-arg/foo@1.0.0#process-word" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -38,7 +38,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -49,7 +49,7 @@ proc init mem_store.278537 end -# mod miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg +# mod ::"miden:cross-ctx-account-word-arg/foo@1.0.0"::cross_ctx_account_word_arg @callconv("C") proc __wasm_call_ctors( @@ -65,8 +65,9 @@ proc cross_ctx_account_word_arg::bindings::__link_custom_section_describing_impo nop end +@locals("16") @callconv("C") -proc miden:cross-ctx-account-word-arg/foo@1.0.0#process-word.1( +proc miden:cross-ctx-account-word-arg/foo@1.0.0#process-word( felt, felt, felt, @@ -84,12 +85,6 @@ proc miden:cross-ctx-account-word-arg/foo@1.0.0#process-word.1( felt, felt ) -> felt - trace.240 - nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::wit_bindgen::rt::run_ctors_once - trace.252 - nop - movup.15 locaddr.0 push.0 swap.1 @@ -98,272 +93,360 @@ proc miden:cross-ctx-account-word-arg/foo@1.0.0#process-word.1( exec.::intrinsics::mem::store_felt trace.252 nop - push.1 - trace.240 - nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 - trace.252 - nop + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul - trace.252 - nop - push.2 - trace.240 - nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop - movup.2 + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.3 + push.0 swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + exec.::intrinsics::mem::store_felt trace.252 nop - push.4 + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop - movup.2 + locaddr.5 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.6 + push.0 swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + exec.::intrinsics::mem::store_felt trace.252 nop - push.8 + locaddr.7 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop - movup.2 + locaddr.8 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.9 + push.0 swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + exec.::intrinsics::mem::store_felt trace.252 nop - push.16 + locaddr.10 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop - movup.2 + locaddr.11 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + exec.::intrinsics::mem::store_felt trace.252 nop - push.32 + locaddr.12 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop - movup.3 + locaddr.13 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.14 + push.0 swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + exec.::intrinsics::mem::store_felt trace.252 nop - push.64 + locaddr.15 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop - movup.3 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + exec.::"miden:cross-ctx-account-word-arg/foo@1.0.0"::cross_ctx_account_word_arg::wit_bindgen::rt::run_ctors_once trace.252 nop + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add - trace.252 - nop - push.128 - trace.240 - nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_felt trace.252 nop - movup.3 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + exec.::intrinsics::mem::load_felt trace.252 nop - push.256 + locaddr.3 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_felt trace.252 nop + push.8 + mul + push.4 + movup.2 + mul + push.2 movup.3 + mul + push.1 + movup.4 + mul + add + add + add + locaddr.3 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + exec.::intrinsics::mem::store_felt trace.252 nop - push.512 + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_felt trace.252 nop - movup.4 + locaddr.5 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.6 + push.0 swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + exec.::intrinsics::mem::load_felt trace.252 nop - push.1024 + locaddr.7 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_felt trace.252 nop + push.128 + mul + push.64 + movup.2 + mul + push.32 + movup.3 + mul + push.16 movup.4 - trace.240 - nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul - trace.252 - nop + mul + add + add + add + locaddr.7 + push.0 swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + exec.::intrinsics::mem::store_felt trace.252 nop - push.2048 + locaddr.8 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_felt trace.252 nop - movup.4 + locaddr.9 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.10 + push.0 swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + exec.::intrinsics::mem::load_felt trace.252 nop - push.4096 + locaddr.11 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_felt trace.252 nop + push.2048 + mul + push.1024 + movup.2 + mul + push.512 + movup.3 + mul + push.256 movup.4 + mul + add + add + add + locaddr.11 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + exec.::intrinsics::mem::store_felt trace.252 nop - push.8192 + locaddr.12 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_felt trace.252 nop - movup.5 + locaddr.13 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.14 + push.0 swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + exec.::intrinsics::mem::load_felt trace.252 nop push.16384 - trace.240 - nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 - trace.252 - nop - movup.5 - trace.240 - nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul - trace.252 - nop + mul + push.8192 + movup.2 + mul + push.4096 + movup.3 + mul + add + add + locaddr.14 + push.0 swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + exec.::intrinsics::mem::store_felt trace.252 nop - movup.2 - movup.3 + locaddr.3 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + exec.::intrinsics::mem::load_felt trace.252 nop - movup.2 + locaddr.7 + push.0 swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.11 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + exec.::intrinsics::mem::load_felt trace.252 nop - locaddr.0 + locaddr.14 push.0 swap.1 trace.240 @@ -371,14 +454,25 @@ proc miden:cross-ctx-account-word-arg/foo@1.0.0#process-word.1( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.15 + push.0 swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + exec.::intrinsics::mem::load_felt trace.252 nop + movup.4 + movup.4 + add + movup.3 + add + movup.2 + add + add end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -420,9 +514,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::__wasm_call_ctors + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:cross-ctx-account-word-arg/foo@1.0.0"::cross_ctx_account_word_arg::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -453,18 +563,3 @@ proc wit_bindgen::rt::run_ctors_once( end end -@callconv("C") -proc intrinsics::felt::add(felt, felt) -> felt - add -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc intrinsics::felt::mul(felt, felt) -> felt - mul -end - diff --git a/tests/integration/expected/rust_sdk/cross_ctx_note.hir b/tests/integration/expected/rust_sdk/cross_ctx_note.hir index b41016ea6..0bbf9eff8 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note.hir +++ b/tests/integration/expected/rust_sdk/cross_ctx_note.hir @@ -18,90 +18,80 @@ builtin.component miden:base/note-script@1.0.0 { private builtin.function @miden:base/note-script@1.0.0#run(v2: felt, v3: felt, v4: felt, v5: felt) { ^block12(v2: felt, v3: felt, v4: felt, v5: felt): - v8 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note/GOT.data.internal.__memory_base : ptr - v9 = hir.bitcast v8 : ptr; - v10 = hir.load v9 : i32; + v6 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note/GOT.data.internal.__memory_base : ptr + v7 = hir.bitcast v6 : ptr; + v8 = hir.load v7 : i32; + hir.store_local v8 #[local = lv4]; hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/wit_bindgen::rt::run_ctors_once() - v11 = arith.constant 1048588 : i32; - v12 = arith.add v10, v11 : i32 #[overflow = wrapping]; - v13 = hir.bitcast v12 : u32; - v14 = arith.constant 4 : u32; - v15 = arith.mod v13, v14 : u32; - hir.assertz v15 #[code = 250]; - v16 = hir.int_to_ptr v13 : ptr; - v17 = hir.load v16 : i32; - v18 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/intrinsics::felt::from_u32(v17) : felt - v19 = arith.constant 11 : i32; - v20 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/intrinsics::felt::from_u32(v19) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/intrinsics::felt::assert_eq(v18, v20) - v21 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/cross_ctx_note::bindings::miden::cross_ctx_account::foo::process_felt::wit_import1(v18) : felt - v22 = arith.constant 53 : i32; - v23 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/intrinsics::felt::from_u32(v22) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/intrinsics::felt::assert_eq(v21, v23) - v24 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/intrinsics::felt::as_u64(v21) : i64 - v27 = hir.bitcast v12 : u32; - v66 = arith.constant 4 : u32; - v29 = arith.mod v27, v66 : u32; - hir.assertz v29 #[code = 250]; - v25 = hir.bitcast v24 : u64; - v26 = arith.trunc v25 : u32; - v30 = hir.int_to_ptr v27 : ptr; - hir.store v30, v26; + v9 = hir.load_local : i32 #[local = lv4]; + v65 = arith.constant 1048588 : i32; + v11 = arith.add v9, v65 : i32 #[overflow = wrapping]; + hir.store_local v11 #[local = lv4]; + v12 = hir.bitcast v11 : u32; + v64 = arith.constant 4 : u32; + v14 = arith.mod v12, v64 : u32; + hir.assertz v14 #[code = 250]; + v15 = hir.int_to_ptr v12 : ptr; + v16 = hir.load v15 : i32; + v17 = hir.bitcast v16 : felt; + hir.store_local v17 #[local = lv5]; + v63 = arith.constant 11 : felt; + hir.assert_eq v17, v63; + v20 = hir.load_local : felt #[local = lv5]; + v21 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/cross_ctx_note::bindings::miden::cross_ctx_account::foo::process_felt::wit_import1(v20) : felt + hir.store_local v21 #[local = lv5]; + v62 = arith.constant 53 : felt; + hir.assert_eq v21, v62; + v24 = hir.load_local : i32 #[local = lv4]; + v25 = hir.load_local : felt #[local = lv5]; + v29 = hir.bitcast v24 : u32; + v67 = arith.constant 4 : u32; + v31 = arith.mod v29, v67 : u32; + hir.assertz v31 #[code = 250]; + v26 = hir.cast v25 : i64; + v27 = hir.bitcast v26 : u64; + v28 = arith.trunc v27 : u32; + v32 = hir.int_to_ptr v29 : ptr; + hir.store v32, v28; builtin.ret ; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block14: - v32 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note/GOT.data.internal.__memory_base : ptr - v33 = hir.bitcast v32 : ptr; - v34 = hir.load v33 : i32; - v35 = arith.constant 1048592 : i32; - v36 = arith.add v34, v35 : i32 #[overflow = wrapping]; - v37 = hir.bitcast v36 : u32; - v38 = hir.int_to_ptr v37 : ptr; - v39 = hir.load v38 : u8; - v31 = arith.constant 0 : i32; - v40 = arith.zext v39 : u32; - v41 = hir.bitcast v40 : i32; - v43 = arith.neq v41, v31 : i1; - scf.if v43{ + v33 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note/GOT.data.internal.__memory_base : ptr + v34 = hir.bitcast v33 : ptr; + v35 = hir.load v34 : i32; + v72 = arith.constant 1048592 : i32; + v37 = arith.add v35, v72 : i32 #[overflow = wrapping]; + v38 = hir.bitcast v37 : u32; + v39 = hir.int_to_ptr v38 : ptr; + v40 = hir.load v39 : u8; + v71 = arith.constant 0 : i32; + v41 = arith.zext v40 : u32; + v42 = hir.bitcast v41 : i32; + v44 = arith.neq v42, v71 : i1; + scf.if v44{ ^block16: scf.yield ; } else { ^block17: - v44 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note/GOT.data.internal.__memory_base : ptr - v45 = hir.bitcast v44 : ptr; - v46 = hir.load v45 : i32; + v45 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note/GOT.data.internal.__memory_base : ptr + v46 = hir.bitcast v45 : ptr; + v47 = hir.load v46 : i32; + hir.store_local v47 #[local = lv0]; hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/__wasm_call_ctors() - v68 = arith.constant 1 : u8; - v70 = arith.constant 1048592 : i32; - v48 = arith.add v46, v70 : i32 #[overflow = wrapping]; - v52 = hir.bitcast v48 : u32; - v53 = hir.int_to_ptr v52 : ptr; - hir.store v53, v68; + v48 = hir.load_local : i32 #[local = lv0]; + v70 = arith.constant 1 : u8; + v75 = arith.constant 1048592 : i32; + v50 = arith.add v48, v75 : i32 #[overflow = wrapping]; + v54 = hir.bitcast v50 : u32; + v55 = hir.int_to_ptr v54 : ptr; + hir.store v55, v70; scf.yield ; }; builtin.ret ; }; - private builtin.function @intrinsics::felt::as_u64(v54: felt) -> i64 { - ^block18(v54: felt): - v55 = hir.cast v54 : i64; - builtin.ret v55; - }; - - private builtin.function @intrinsics::felt::assert_eq(v57: felt, v58: felt) { - ^block20(v57: felt, v58: felt): - hir.assert_eq v57, v58; - builtin.ret ; - }; - - private builtin.function @intrinsics::felt::from_u32(v59: i32) -> felt { - ^block22(v59: i32): - v60 = hir.bitcast v59 : felt; - builtin.ret v60; - }; - builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; @@ -113,9 +103,9 @@ builtin.component miden:base/note-script@1.0.0 { builtin.segment @1048576 = 0x0000000b000000010000000100000001; }; - public builtin.function @run(v62: felt, v63: felt, v64: felt, v65: felt) { - ^block24(v62: felt, v63: felt, v64: felt, v65: felt): - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/miden:base/note-script@1.0.0#run(v62, v63, v64, v65) + public builtin.function @run(v56: felt, v57: felt, v58: felt, v59: felt) { + ^block18(v56: felt, v57: felt, v58: felt, v59: felt): + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/miden:base/note-script@1.0.0#run(v56, v57, v58, v59) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/cross_ctx_note.masm b/tests/integration/expected/rust_sdk/cross_ctx_note.masm index abeb22f22..b6eefa83d 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_note.masm @@ -1,14 +1,14 @@ -# mod miden:base/note-script@1.0.0 +# mod ::"miden:base/note-script@1.0.0" @callconv("canon-lift") pub proc run(felt, felt, felt, felt) - exec.::miden:base/note-script@1.0.0::init + exec."miden:base/note-script@1.0.0"::init trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note::miden:base/note-script@1.0.0#run + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note::"miden:base/note-script@1.0.0#run" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -21,7 +21,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -32,7 +32,7 @@ proc init mem_store.278537 end -# mod miden:base/note-script@1.0.0::cross_ctx_note +# mod ::"miden:base/note-script@1.0.0"::cross_ctx_note @callconv("C") proc cross_ctx_note::bindings::miden::cross_ctx_account::foo::process_felt::wit_import1( @@ -40,7 +40,7 @@ proc cross_ctx_note::bindings::miden::cross_ctx_account::foo::process_felt::wit_ ) -> felt trace.240 nop - call.::miden:cross-ctx-account/foo@1.0.0::process-felt + call.::"miden:cross-ctx-account/foo@1.0.0"::"process-felt" trace.252 nop end @@ -59,6 +59,7 @@ proc cross_ctx_note::bindings::__link_custom_section_describing_imports( nop end +@locals("6") @callconv("C") proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop @@ -73,14 +74,38 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note::wit_bindgen::rt::run_ctors_once + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note::wit_bindgen::rt::run_ctors_once + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1048588 u32wrapping_add dup.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -94,53 +119,66 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.5 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop push.11 + assert_eq + locaddr.5 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_felt trace.252 nop - dup.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note::intrinsics::felt::assert_eq + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note::cross_ctx_note::bindings::miden::cross_ctx_account::foo::process_felt::wit_import1 trace.252 nop + dup.0 + locaddr.5 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note::cross_ctx_note::bindings::miden::cross_ctx_account::foo::process_felt::wit_import1 + exec.::intrinsics::mem::store_felt trace.252 nop push.53 + assert_eq + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note::intrinsics::felt::from_u32 - trace.252 - nop - dup.1 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.5 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note::intrinsics::felt::as_u64 + exec.::intrinsics::mem::load_felt trace.252 nop - movup.2 + swap.1 push.4 dup.1 swap.1 u32mod u32assert assertz - movdn.2 + swap.1 + u32split drop swap.1 u32divmod.4 @@ -152,6 +190,7 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -193,9 +232,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -226,18 +281,3 @@ proc wit_bindgen::rt::run_ctors_once( end end -@callconv("C") -proc intrinsics::felt::as_u64(felt) -> [u32; 2] - u32split -end - -@callconv("C") -proc intrinsics::felt::assert_eq(felt, felt) - assert_eq -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - diff --git a/tests/integration/expected/rust_sdk/cross_ctx_note_word.hir b/tests/integration/expected/rust_sdk/cross_ctx_note_word.hir index ab8b42c4d..f8f786788 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note_word.hir +++ b/tests/integration/expected/rust_sdk/cross_ctx_note_word.hir @@ -3,30 +3,30 @@ builtin.component miden:base/note-script@1.0.0 { private builtin.function @cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_word::wit_import7(v0: felt, v1: felt, v2: felt, v3: felt, v4: i32) { ^block3(v0: felt, v1: felt, v2: felt, v3: felt, v4: i32): v5, v6, v7, v8 = hir.call v0, v1, v2, v3 : felt, felt, felt, felt #[callee = miden:cross-ctx-account-word/foo@1.0.0/process-word] #[signature = (cc canon-lower) (param felt) (param felt) (param felt) (param felt) (result felt felt felt felt)]; - v9 = arith.constant 0 : i32; - v10 = arith.add v4, v9 : i32 #[overflow = unchecked]; - v519 = arith.constant 0 : i32; - v520 = arith.constant 0 : i32; - v12 = arith.add v10, v520 : i32 #[overflow = unchecked]; - v14 = arith.add v12, v519 : i32 #[overflow = unchecked]; + v564 = arith.constant 0 : i32; + v10 = arith.add v4, v564 : i32 #[overflow = unchecked]; + v573 = arith.constant 0 : i32; + v574 = arith.constant 0 : i32; + v12 = arith.add v10, v574 : i32 #[overflow = unchecked]; + v14 = arith.add v12, v573 : i32 #[overflow = unchecked]; v15 = hir.int_to_ptr v14 : ptr; hir.store v15, v5; - v518 = arith.constant 0 : i32; - v16 = arith.constant 4 : i32; - v17 = arith.add v10, v16 : i32 #[overflow = unchecked]; - v19 = arith.add v17, v518 : i32 #[overflow = unchecked]; + v572 = arith.constant 0 : i32; + v563 = arith.constant 4 : i32; + v17 = arith.add v10, v563 : i32 #[overflow = unchecked]; + v19 = arith.add v17, v572 : i32 #[overflow = unchecked]; v20 = hir.int_to_ptr v19 : ptr; hir.store v20, v6; - v517 = arith.constant 0 : i32; - v21 = arith.constant 8 : i32; - v22 = arith.add v10, v21 : i32 #[overflow = unchecked]; - v24 = arith.add v22, v517 : i32 #[overflow = unchecked]; + v571 = arith.constant 0 : i32; + v562 = arith.constant 8 : i32; + v22 = arith.add v10, v562 : i32 #[overflow = unchecked]; + v24 = arith.add v22, v571 : i32 #[overflow = unchecked]; v25 = hir.int_to_ptr v24 : ptr; hir.store v25, v7; - v516 = arith.constant 0 : i32; - v26 = arith.constant 12 : i32; - v27 = arith.add v10, v26 : i32 #[overflow = unchecked]; - v29 = arith.add v27, v516 : i32 #[overflow = unchecked]; + v570 = arith.constant 0 : i32; + v561 = arith.constant 12 : i32; + v27 = arith.add v10, v561 : i32 #[overflow = unchecked]; + v29 = arith.add v27, v570 : i32 #[overflow = unchecked]; v30 = hir.int_to_ptr v29 : ptr; hir.store v30, v8; builtin.ret ; @@ -35,30 +35,30 @@ builtin.component miden:base/note-script@1.0.0 { private builtin.function @cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_another_word::wit_import7(v31: felt, v32: felt, v33: felt, v34: felt, v35: i32) { ^block6(v31: felt, v32: felt, v33: felt, v34: felt, v35: i32): v36, v37, v38, v39 = hir.call v31, v32, v33, v34 : felt, felt, felt, felt #[callee = miden:cross-ctx-account-word/foo@1.0.0/process-another-word] #[signature = (cc canon-lower) (param felt) (param felt) (param felt) (param felt) (result felt felt felt felt)]; - v40 = arith.constant 0 : i32; - v41 = arith.add v35, v40 : i32 #[overflow = unchecked]; - v524 = arith.constant 0 : i32; - v525 = arith.constant 0 : i32; - v43 = arith.add v41, v525 : i32 #[overflow = unchecked]; - v45 = arith.add v43, v524 : i32 #[overflow = unchecked]; + v578 = arith.constant 0 : i32; + v41 = arith.add v35, v578 : i32 #[overflow = unchecked]; + v587 = arith.constant 0 : i32; + v588 = arith.constant 0 : i32; + v43 = arith.add v41, v588 : i32 #[overflow = unchecked]; + v45 = arith.add v43, v587 : i32 #[overflow = unchecked]; v46 = hir.int_to_ptr v45 : ptr; hir.store v46, v36; - v523 = arith.constant 0 : i32; - v47 = arith.constant 4 : i32; - v48 = arith.add v41, v47 : i32 #[overflow = unchecked]; - v50 = arith.add v48, v523 : i32 #[overflow = unchecked]; + v586 = arith.constant 0 : i32; + v577 = arith.constant 4 : i32; + v48 = arith.add v41, v577 : i32 #[overflow = unchecked]; + v50 = arith.add v48, v586 : i32 #[overflow = unchecked]; v51 = hir.int_to_ptr v50 : ptr; hir.store v51, v37; - v522 = arith.constant 0 : i32; - v52 = arith.constant 8 : i32; - v53 = arith.add v41, v52 : i32 #[overflow = unchecked]; - v55 = arith.add v53, v522 : i32 #[overflow = unchecked]; + v585 = arith.constant 0 : i32; + v576 = arith.constant 8 : i32; + v53 = arith.add v41, v576 : i32 #[overflow = unchecked]; + v55 = arith.add v53, v585 : i32 #[overflow = unchecked]; v56 = hir.int_to_ptr v55 : ptr; hir.store v56, v38; - v521 = arith.constant 0 : i32; - v57 = arith.constant 12 : i32; - v58 = arith.add v41, v57 : i32 #[overflow = unchecked]; - v60 = arith.add v58, v521 : i32 #[overflow = unchecked]; + v584 = arith.constant 0 : i32; + v575 = arith.constant 12 : i32; + v58 = arith.add v41, v575 : i32 #[overflow = unchecked]; + v60 = arith.add v58, v584 : i32 #[overflow = unchecked]; v61 = hir.int_to_ptr v60 : ptr; hir.store v61, v39; builtin.ret ; @@ -73,16 +73,16 @@ builtin.component miden:base/note-script@1.0.0 { private builtin.function @cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_pair::wit_import4(v64: felt, v65: felt, v66: i32) { ^block10(v64: felt, v65: felt, v66: i32): v67, v68 = hir.call v64, v65 : felt, felt #[callee = miden:cross-ctx-account-word/foo@1.0.0/process-pair] #[signature = (cc canon-lower) (param felt) (param felt) (result felt felt)]; - v527 = arith.constant 0 : i32; - v69 = arith.constant 0 : i32; - v70 = arith.add v66, v69 : i32 #[overflow = unchecked]; - v72 = arith.add v70, v527 : i32 #[overflow = unchecked]; + v594 = arith.constant 0 : i32; + v592 = arith.constant 0 : i32; + v70 = arith.add v66, v592 : i32 #[overflow = unchecked]; + v72 = arith.add v70, v594 : i32 #[overflow = unchecked]; v73 = hir.int_to_ptr v72 : ptr; hir.store v73, v67; - v526 = arith.constant 0 : i32; - v74 = arith.constant 4 : i32; - v75 = arith.add v66, v74 : i32 #[overflow = unchecked]; - v77 = arith.add v75, v526 : i32 #[overflow = unchecked]; + v593 = arith.constant 0 : i32; + v589 = arith.constant 4 : i32; + v75 = arith.add v66, v589 : i32 #[overflow = unchecked]; + v77 = arith.add v75, v593 : i32 #[overflow = unchecked]; v78 = hir.int_to_ptr v77 : ptr; hir.store v78, v68; builtin.ret ; @@ -91,22 +91,22 @@ builtin.component miden:base/note-script@1.0.0 { private builtin.function @cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_triple::wit_import5(v79: felt, v80: felt, v81: felt, v82: i32) { ^block12(v79: felt, v80: felt, v81: felt, v82: i32): v83, v84, v85 = hir.call v79, v80, v81 : felt, felt, felt #[callee = miden:cross-ctx-account-word/foo@1.0.0/process-triple] #[signature = (cc canon-lower) (param felt) (param felt) (param felt) (result felt felt felt)]; - v530 = arith.constant 0 : i32; - v86 = arith.constant 0 : i32; - v87 = arith.add v82, v86 : i32 #[overflow = unchecked]; - v89 = arith.add v87, v530 : i32 #[overflow = unchecked]; + v603 = arith.constant 0 : i32; + v600 = arith.constant 0 : i32; + v87 = arith.add v82, v600 : i32 #[overflow = unchecked]; + v89 = arith.add v87, v603 : i32 #[overflow = unchecked]; v90 = hir.int_to_ptr v89 : ptr; hir.store v90, v83; - v529 = arith.constant 0 : i32; - v91 = arith.constant 4 : i32; - v92 = arith.add v82, v91 : i32 #[overflow = unchecked]; - v94 = arith.add v92, v529 : i32 #[overflow = unchecked]; + v602 = arith.constant 0 : i32; + v596 = arith.constant 4 : i32; + v92 = arith.add v82, v596 : i32 #[overflow = unchecked]; + v94 = arith.add v92, v602 : i32 #[overflow = unchecked]; v95 = hir.int_to_ptr v94 : ptr; hir.store v95, v84; - v528 = arith.constant 0 : i32; - v96 = arith.constant 8 : i32; - v97 = arith.add v82, v96 : i32 #[overflow = unchecked]; - v99 = arith.add v97, v528 : i32 #[overflow = unchecked]; + v601 = arith.constant 0 : i32; + v595 = arith.constant 8 : i32; + v97 = arith.add v82, v595 : i32 #[overflow = unchecked]; + v99 = arith.add v97, v601 : i32 #[overflow = unchecked]; v100 = hir.int_to_ptr v99 : ptr; hir.store v100, v85; builtin.ret ; @@ -116,40 +116,40 @@ builtin.component miden:base/note-script@1.0.0 { ^block14(v101: i64, v102: felt, v103: i32, v104: felt, v105: i32, v106: i32, v107: i32, v108: i32): v109, v110, v111, v112, v113, v114, v115 = hir.call v101, v102, v103, v104, v105, v106, v107 : i64, felt, i32, felt, i32, i32, i32 #[callee = miden:cross-ctx-account-word/foo@1.0.0/process-mixed] #[signature = (cc canon-lower) (param i64) (param felt) (param i32) (param felt) (param (zext) i32) (param (zext) i32) (param (zext) i32) (result i64 felt i32 felt i32 i32 i32)]; v119 = hir.bitcast v109 : u64; - v116 = arith.constant 0 : i32; - v117 = arith.add v108, v116 : i32 #[overflow = unchecked]; + v610 = arith.constant 0 : i32; + v117 = arith.add v108, v610 : i32 #[overflow = unchecked]; v118 = hir.int_to_ptr v117 : ptr; hir.store v118, v119; - v532 = arith.constant 0 : i32; - v120 = arith.constant 8 : i32; - v121 = arith.add v108, v120 : i32 #[overflow = unchecked]; - v123 = arith.add v121, v532 : i32 #[overflow = unchecked]; + v614 = arith.constant 0 : i32; + v609 = arith.constant 8 : i32; + v121 = arith.add v108, v609 : i32 #[overflow = unchecked]; + v123 = arith.add v121, v614 : i32 #[overflow = unchecked]; v124 = hir.int_to_ptr v123 : ptr; hir.store v124, v110; v128 = hir.bitcast v111 : u32; - v125 = arith.constant 12 : i32; - v126 = arith.add v108, v125 : i32 #[overflow = unchecked]; + v608 = arith.constant 12 : i32; + v126 = arith.add v108, v608 : i32 #[overflow = unchecked]; v127 = hir.int_to_ptr v126 : ptr; hir.store v127, v128; - v531 = arith.constant 0 : i32; - v129 = arith.constant 16 : i32; - v130 = arith.add v108, v129 : i32 #[overflow = unchecked]; - v132 = arith.add v130, v531 : i32 #[overflow = unchecked]; + v613 = arith.constant 0 : i32; + v607 = arith.constant 16 : i32; + v130 = arith.add v108, v607 : i32 #[overflow = unchecked]; + v132 = arith.add v130, v613 : i32 #[overflow = unchecked]; v133 = hir.int_to_ptr v132 : ptr; hir.store v133, v112; v137 = hir.bitcast v113 : u8; - v134 = arith.constant 20 : i32; - v135 = arith.add v108, v134 : i32 #[overflow = unchecked]; + v606 = arith.constant 20 : i32; + v135 = arith.add v108, v606 : i32 #[overflow = unchecked]; v136 = hir.int_to_ptr v135 : ptr; hir.store v136, v137; v141 = hir.bitcast v114 : i1; - v138 = arith.constant 21 : i32; - v139 = arith.add v108, v138 : i32 #[overflow = unchecked]; + v605 = arith.constant 21 : i32; + v139 = arith.add v108, v605 : i32 #[overflow = unchecked]; v140 = hir.int_to_ptr v139 : ptr; hir.store v140, v141; v145 = hir.bitcast v115 : u16; - v142 = arith.constant 22 : i32; - v143 = arith.add v108, v142 : i32 #[overflow = unchecked]; + v604 = arith.constant 22 : i32; + v143 = arith.add v108, v604 : i32 #[overflow = unchecked]; v144 = hir.int_to_ptr v143 : ptr; hir.store v144, v145; builtin.ret ; @@ -158,24 +158,24 @@ builtin.component miden:base/note-script@1.0.0 { private builtin.function @cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_nested::wit_import6(v146: felt, v147: felt, v148: felt, v149: i32) { ^block16(v146: felt, v147: felt, v148: felt, v149: i32): v150, v151, v152 = hir.call v146, v147, v148 : felt, felt, felt #[callee = miden:cross-ctx-account-word/foo@1.0.0/process-nested] #[signature = (cc canon-lower) (param felt) (param felt) (param felt) (result felt felt felt)]; - v153 = arith.constant 0 : i32; - v154 = arith.add v149, v153 : i32 #[overflow = unchecked]; - v535 = arith.constant 0 : i32; - v536 = arith.constant 0 : i32; - v156 = arith.add v154, v536 : i32 #[overflow = unchecked]; - v158 = arith.add v156, v535 : i32 #[overflow = unchecked]; + v617 = arith.constant 0 : i32; + v154 = arith.add v149, v617 : i32 #[overflow = unchecked]; + v624 = arith.constant 0 : i32; + v625 = arith.constant 0 : i32; + v156 = arith.add v154, v625 : i32 #[overflow = unchecked]; + v158 = arith.add v156, v624 : i32 #[overflow = unchecked]; v159 = hir.int_to_ptr v158 : ptr; hir.store v159, v150; - v534 = arith.constant 0 : i32; - v160 = arith.constant 4 : i32; - v161 = arith.add v154, v160 : i32 #[overflow = unchecked]; - v163 = arith.add v161, v534 : i32 #[overflow = unchecked]; + v623 = arith.constant 0 : i32; + v616 = arith.constant 4 : i32; + v161 = arith.add v154, v616 : i32 #[overflow = unchecked]; + v163 = arith.add v161, v623 : i32 #[overflow = unchecked]; v164 = hir.int_to_ptr v163 : ptr; hir.store v164, v151; - v533 = arith.constant 0 : i32; - v165 = arith.constant 8 : i32; - v166 = arith.add v149, v165 : i32 #[overflow = unchecked]; - v168 = arith.add v166, v533 : i32 #[overflow = unchecked]; + v622 = arith.constant 0 : i32; + v615 = arith.constant 8 : i32; + v166 = arith.add v149, v615 : i32 #[overflow = unchecked]; + v168 = arith.add v166, v622 : i32 #[overflow = unchecked]; v169 = hir.int_to_ptr v168 : ptr; hir.store v169, v152; builtin.ret ; @@ -193,354 +193,391 @@ builtin.component miden:base/note-script@1.0.0 { private builtin.function @miden:base/note-script@1.0.0#run(v170: felt, v171: felt, v172: felt, v173: felt) { ^block24(v170: felt, v171: felt, v172: felt, v173: felt): - v177 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word/__stack_pointer : ptr - v178 = hir.bitcast v177 : ptr; - v179 = hir.load v178 : i32; - v180 = arith.constant 32 : i32; - v181 = arith.sub v179, v180 : i32 #[overflow = wrapping]; - v182 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word/__stack_pointer : ptr - v183 = hir.bitcast v182 : ptr; - hir.store v183, v181; + v174 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word/__stack_pointer : ptr + v175 = hir.bitcast v174 : ptr; + v176 = hir.load v175 : i32; + v711 = arith.constant 32 : i32; + v178 = arith.sub v176, v711 : i32 #[overflow = wrapping]; + hir.store_local v178 #[local = lv4]; + v179 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word/__stack_pointer : ptr + v180 = hir.bitcast v179 : ptr; + hir.store v180, v178; hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/wit_bindgen::rt::run_ctors_once() - v184 = arith.constant 2 : i32; - v185 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v184) : felt - v186 = arith.constant 3 : i32; - v187 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v186) : felt - v188 = arith.constant 4 : i32; - v189 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v188) : felt - v190 = arith.constant 5 : i32; - v191 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v190) : felt - v192 = arith.constant 8 : i32; - v193 = arith.add v181, v192 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_word::wit_import7(v185, v187, v189, v191, v193) - v195 = arith.constant 20 : u32; - v194 = hir.bitcast v181 : u32; - v196 = arith.add v194, v195 : u32 #[overflow = checked]; - v197 = arith.constant 4 : u32; - v198 = arith.mod v196, v197 : u32; - hir.assertz v198 #[code = 250]; - v199 = hir.int_to_ptr v196 : ptr; - v200 = hir.load v199 : felt; - v202 = arith.constant 16 : u32; - v201 = hir.bitcast v181 : u32; - v203 = arith.add v201, v202 : u32 #[overflow = checked]; - v590 = arith.constant 4 : u32; - v205 = arith.mod v203, v590 : u32; + v688 = arith.constant 2 : felt; + hir.store_local v688 #[local = lv5]; + v687 = arith.constant 3 : felt; + hir.store_local v687 #[local = lv6]; + v686 = arith.constant 4 : felt; + hir.store_local v686 #[local = lv7]; + v685 = arith.constant 5 : felt; + hir.store_local v685 #[local = lv8]; + v189 = hir.load_local : i32 #[local = lv4]; + v709 = arith.constant 8 : i32; + v191 = arith.add v189, v709 : i32 #[overflow = wrapping]; + v819 = arith.constant 5 : felt; + v820 = arith.constant 4 : felt; + v821 = arith.constant 3 : felt; + v822 = arith.constant 2 : felt; + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_word::wit_import7(v822, v821, v820, v819, v191) + v192 = hir.load_local : i32 #[local = lv4]; + v708 = arith.constant 20 : u32; + v193 = hir.bitcast v192 : u32; + v195 = arith.add v193, v708 : u32 #[overflow = checked]; + v707 = arith.constant 4 : u32; + v197 = arith.mod v195, v707 : u32; + hir.assertz v197 #[code = 250]; + v198 = hir.int_to_ptr v195 : ptr; + v199 = hir.load v198 : felt; + v200 = hir.load_local : i32 #[local = lv4]; + v706 = arith.constant 16 : u32; + v201 = hir.bitcast v200 : u32; + v203 = arith.add v201, v706 : u32 #[overflow = checked]; + v818 = arith.constant 4 : u32; + v205 = arith.mod v203, v818 : u32; hir.assertz v205 #[code = 250]; v206 = hir.int_to_ptr v203 : ptr; v207 = hir.load v206 : felt; - v209 = arith.constant 12 : u32; - v208 = hir.bitcast v181 : u32; - v210 = arith.add v208, v209 : u32 #[overflow = checked]; - v589 = arith.constant 4 : u32; - v212 = arith.mod v210, v589 : u32; - hir.assertz v212 #[code = 250]; - v213 = hir.int_to_ptr v210 : ptr; - v214 = hir.load v213 : felt; - v216 = arith.constant 8 : u32; - v215 = hir.bitcast v181 : u32; - v217 = arith.add v215, v216 : u32 #[overflow = checked]; - v588 = arith.constant 4 : u32; - v219 = arith.mod v217, v588 : u32; - hir.assertz v219 #[code = 250]; - v220 = hir.int_to_ptr v217 : ptr; - v221 = hir.load v220 : felt; - v587 = arith.constant 3 : i32; - v223 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v587) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v221, v223) - v586 = arith.constant 5 : i32; - v225 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v586) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v214, v225) - v226 = arith.constant 7 : i32; - v227 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v226) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v207, v227) - v228 = arith.constant 9 : i32; - v229 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v228) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v200, v229) - v585 = arith.constant 8 : i32; - v231 = arith.add v181, v585 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_another_word::wit_import7(v185, v187, v189, v191, v231) - v584 = arith.constant 20 : u32; - v232 = hir.bitcast v181 : u32; - v234 = arith.add v232, v584 : u32 #[overflow = checked]; - v583 = arith.constant 4 : u32; - v236 = arith.mod v234, v583 : u32; - hir.assertz v236 #[code = 250]; - v237 = hir.int_to_ptr v234 : ptr; - v238 = hir.load v237 : felt; - v582 = arith.constant 16 : u32; - v239 = hir.bitcast v181 : u32; - v241 = arith.add v239, v582 : u32 #[overflow = checked]; - v581 = arith.constant 4 : u32; - v243 = arith.mod v241, v581 : u32; - hir.assertz v243 #[code = 250]; - v244 = hir.int_to_ptr v241 : ptr; - v245 = hir.load v244 : felt; - v580 = arith.constant 12 : u32; - v246 = hir.bitcast v181 : u32; - v248 = arith.add v246, v580 : u32 #[overflow = checked]; - v579 = arith.constant 4 : u32; - v250 = arith.mod v248, v579 : u32; - hir.assertz v250 #[code = 250]; - v251 = hir.int_to_ptr v248 : ptr; - v252 = hir.load v251 : felt; - v578 = arith.constant 8 : u32; - v253 = hir.bitcast v181 : u32; - v255 = arith.add v253, v578 : u32 #[overflow = checked]; - v577 = arith.constant 4 : u32; - v257 = arith.mod v255, v577 : u32; - hir.assertz v257 #[code = 250]; - v258 = hir.int_to_ptr v255 : ptr; - v259 = hir.load v258 : felt; - v576 = arith.constant 4 : i32; - v261 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v576) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v259, v261) - v262 = arith.constant 6 : i32; - v263 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v262) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v252, v263) - v575 = arith.constant 8 : i32; - v265 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v575) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v245, v265) - v266 = arith.constant 10 : i32; - v267 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v266) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v238, v267) - v574 = arith.constant 9 : i32; - v269 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v574) : felt - v270 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_felt::wit_import1(v269) : felt - v271 = arith.constant 12 : i32; - v272 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v271) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v270, v272) - v573 = arith.constant 10 : i32; - v274 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v573) : felt - v275 = arith.constant 20 : i32; - v276 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v275) : felt - v572 = arith.constant 8 : u32; - v278 = hir.bitcast v181 : u32; - v280 = arith.add v278, v572 : u32 #[overflow = checked]; - v571 = arith.constant 8 : u32; - v282 = arith.mod v280, v571 : u32; - hir.assertz v282 #[code = 250]; - v277 = arith.constant 0 : i64; - v283 = hir.int_to_ptr v280 : ptr; - hir.store v283, v277; - v570 = arith.constant 8 : i32; - v285 = arith.add v181, v570 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_pair::wit_import4(v274, v276, v285) - v569 = arith.constant 12 : u32; - v286 = hir.bitcast v181 : u32; - v288 = arith.add v286, v569 : u32 #[overflow = checked]; - v568 = arith.constant 4 : u32; - v290 = arith.mod v288, v568 : u32; - hir.assertz v290 #[code = 250]; - v291 = hir.int_to_ptr v288 : ptr; - v292 = hir.load v291 : felt; - v567 = arith.constant 8 : u32; - v293 = hir.bitcast v181 : u32; - v295 = arith.add v293, v567 : u32 #[overflow = checked]; - v566 = arith.constant 4 : u32; - v297 = arith.mod v295, v566 : u32; - hir.assertz v297 #[code = 250]; - v298 = hir.int_to_ptr v295 : ptr; - v299 = hir.load v298 : felt; - v300 = arith.constant 14 : i32; - v301 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v300) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v299, v301) - v302 = arith.constant 24 : i32; - v303 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v302) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v292, v303) - v304 = arith.constant 100 : i32; - v305 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v304) : felt - v306 = arith.constant 200 : i32; - v307 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v306) : felt - v308 = arith.constant 300 : i32; - v309 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v308) : felt - v565 = arith.constant 8 : i32; - v311 = arith.add v181, v565 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_triple::wit_import5(v305, v307, v309, v311) - v564 = arith.constant 16 : u32; - v312 = hir.bitcast v181 : u32; - v314 = arith.add v312, v564 : u32 #[overflow = checked]; - v563 = arith.constant 4 : u32; - v316 = arith.mod v314, v563 : u32; - hir.assertz v316 #[code = 250]; - v317 = hir.int_to_ptr v314 : ptr; - v318 = hir.load v317 : felt; - v562 = arith.constant 12 : u32; - v319 = hir.bitcast v181 : u32; - v321 = arith.add v319, v562 : u32 #[overflow = checked]; - v561 = arith.constant 4 : u32; - v323 = arith.mod v321, v561 : u32; - hir.assertz v323 #[code = 250]; - v324 = hir.int_to_ptr v321 : ptr; - v325 = hir.load v324 : felt; - v560 = arith.constant 8 : u32; - v326 = hir.bitcast v181 : u32; - v328 = arith.add v326, v560 : u32 #[overflow = checked]; - v559 = arith.constant 4 : u32; - v330 = arith.mod v328, v559 : u32; - hir.assertz v330 #[code = 250]; - v331 = hir.int_to_ptr v328 : ptr; - v332 = hir.load v331 : felt; - v333 = arith.constant 105 : i32; - v334 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v333) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v332, v334) - v335 = arith.constant 205 : i32; - v336 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v335) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v325, v336) - v337 = arith.constant 305 : i32; - v338 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v337) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v318, v338) - v340 = arith.constant -4294967302 : i64; - v341 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u64_unchecked(v340) : felt - v343 = arith.constant 50 : i32; - v344 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v343) : felt - v557 = arith.constant 8 : i32; - v349 = arith.add v181, v557 : i32 #[overflow = wrapping]; - v558 = arith.constant 3 : i32; - v174 = arith.constant 0 : i32; - v345 = arith.constant 111 : i32; - v342 = arith.constant -11 : i32; - v339 = arith.constant -1001 : i64; - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_mixed::wit_import4(v339, v341, v342, v344, v345, v174, v558, v349) - v556 = arith.constant 8 : u32; - v350 = hir.bitcast v181 : u32; - v352 = arith.add v350, v556 : u32 #[overflow = checked]; - v555 = arith.constant 8 : u32; - v354 = arith.mod v352, v555 : u32; - hir.assertz v354 #[code = 250]; - v355 = hir.int_to_ptr v352 : ptr; - v356 = hir.load v355 : i64; - v554 = arith.constant 0 : i32; - v357 = arith.constant -1 : i64; - v358 = arith.eq v356, v357 : i1; - v359 = arith.zext v358 : u32; - v360 = hir.bitcast v359 : i32; - v362 = arith.neq v360, v554 : i1; - cf.cond_br v362 ^block26, ^block27; + v208 = hir.load_local : i32 #[local = lv4]; + v705 = arith.constant 12 : u32; + v209 = hir.bitcast v208 : u32; + v211 = arith.add v209, v705 : u32 #[overflow = checked]; + v817 = arith.constant 4 : u32; + v213 = arith.mod v211, v817 : u32; + hir.assertz v213 #[code = 250]; + v214 = hir.int_to_ptr v211 : ptr; + v215 = hir.load v214 : felt; + v216 = hir.load_local : i32 #[local = lv4]; + v704 = arith.constant 8 : u32; + v217 = hir.bitcast v216 : u32; + v219 = arith.add v217, v704 : u32 #[overflow = checked]; + v816 = arith.constant 4 : u32; + v221 = arith.mod v219, v816 : u32; + hir.assertz v221 #[code = 250]; + v222 = hir.int_to_ptr v219 : ptr; + v223 = hir.load v222 : felt; + v815 = arith.constant 3 : felt; + hir.assert_eq v223, v815; + v814 = arith.constant 5 : felt; + hir.assert_eq v215, v814; + v684 = arith.constant 7 : felt; + hir.assert_eq v207, v684; + v683 = arith.constant 9 : felt; + hir.assert_eq v199, v683; + v235 = hir.load_local : felt #[local = lv5]; + v236 = hir.load_local : felt #[local = lv6]; + v237 = hir.load_local : felt #[local = lv7]; + v238 = hir.load_local : felt #[local = lv8]; + v239 = hir.load_local : i32 #[local = lv4]; + v813 = arith.constant 8 : i32; + v241 = arith.add v239, v813 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_another_word::wit_import7(v235, v236, v237, v238, v241) + v242 = hir.load_local : i32 #[local = lv4]; + v812 = arith.constant 20 : u32; + v243 = hir.bitcast v242 : u32; + v245 = arith.add v243, v812 : u32 #[overflow = checked]; + v811 = arith.constant 4 : u32; + v247 = arith.mod v245, v811 : u32; + hir.assertz v247 #[code = 250]; + v248 = hir.int_to_ptr v245 : ptr; + v249 = hir.load v248 : felt; + hir.store_local v249 #[local = lv5]; + v250 = hir.load_local : i32 #[local = lv4]; + v810 = arith.constant 16 : u32; + v251 = hir.bitcast v250 : u32; + v253 = arith.add v251, v810 : u32 #[overflow = checked]; + v809 = arith.constant 4 : u32; + v255 = arith.mod v253, v809 : u32; + hir.assertz v255 #[code = 250]; + v256 = hir.int_to_ptr v253 : ptr; + v257 = hir.load v256 : felt; + hir.store_local v257 #[local = lv6]; + v258 = hir.load_local : i32 #[local = lv4]; + v808 = arith.constant 12 : u32; + v259 = hir.bitcast v258 : u32; + v261 = arith.add v259, v808 : u32 #[overflow = checked]; + v807 = arith.constant 4 : u32; + v263 = arith.mod v261, v807 : u32; + hir.assertz v263 #[code = 250]; + v264 = hir.int_to_ptr v261 : ptr; + v265 = hir.load v264 : felt; + hir.store_local v265 #[local = lv7]; + v266 = hir.load_local : i32 #[local = lv4]; + v806 = arith.constant 8 : u32; + v267 = hir.bitcast v266 : u32; + v269 = arith.add v267, v806 : u32 #[overflow = checked]; + v805 = arith.constant 4 : u32; + v271 = arith.mod v269, v805 : u32; + hir.assertz v271 #[code = 250]; + v272 = hir.int_to_ptr v269 : ptr; + v273 = hir.load v272 : felt; + v804 = arith.constant 4 : felt; + hir.assert_eq v273, v804; + v276 = hir.load_local : felt #[local = lv7]; + v682 = arith.constant 6 : felt; + hir.assert_eq v276, v682; + v279 = hir.load_local : felt #[local = lv6]; + v681 = arith.constant 8 : felt; + hir.assert_eq v279, v681; + v282 = hir.load_local : felt #[local = lv5]; + v680 = arith.constant 10 : felt; + hir.assert_eq v282, v680; + v803 = arith.constant 9 : felt; + v287 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_felt::wit_import1(v803) : felt + v679 = arith.constant 12 : felt; + hir.assert_eq v287, v679; + v802 = arith.constant 10 : felt; + hir.store_local v802 #[local = lv5]; + v678 = arith.constant 20 : felt; + hir.store_local v678 #[local = lv6]; + v294 = hir.load_local : i32 #[local = lv4]; + v801 = arith.constant 8 : u32; + v296 = hir.bitcast v294 : u32; + v298 = arith.add v296, v801 : u32 #[overflow = checked]; + v800 = arith.constant 8 : u32; + v300 = arith.mod v298, v800 : u32; + hir.assertz v300 #[code = 250]; + v703 = arith.constant 0 : i64; + v301 = hir.int_to_ptr v298 : ptr; + hir.store v301, v703; + v302 = hir.load_local : felt #[local = lv5]; + v303 = hir.load_local : felt #[local = lv6]; + v304 = hir.load_local : i32 #[local = lv4]; + v799 = arith.constant 8 : i32; + v306 = arith.add v304, v799 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_pair::wit_import4(v302, v303, v306) + v307 = hir.load_local : i32 #[local = lv4]; + v798 = arith.constant 12 : u32; + v308 = hir.bitcast v307 : u32; + v310 = arith.add v308, v798 : u32 #[overflow = checked]; + v797 = arith.constant 4 : u32; + v312 = arith.mod v310, v797 : u32; + hir.assertz v312 #[code = 250]; + v313 = hir.int_to_ptr v310 : ptr; + v314 = hir.load v313 : felt; + hir.store_local v314 #[local = lv5]; + v315 = hir.load_local : i32 #[local = lv4]; + v796 = arith.constant 8 : u32; + v316 = hir.bitcast v315 : u32; + v318 = arith.add v316, v796 : u32 #[overflow = checked]; + v795 = arith.constant 4 : u32; + v320 = arith.mod v318, v795 : u32; + hir.assertz v320 #[code = 250]; + v321 = hir.int_to_ptr v318 : ptr; + v322 = hir.load v321 : felt; + v677 = arith.constant 14 : felt; + hir.assert_eq v322, v677; + v325 = hir.load_local : felt #[local = lv5]; + v676 = arith.constant 24 : felt; + hir.assert_eq v325, v676; + v334 = hir.load_local : i32 #[local = lv4]; + v794 = arith.constant 8 : i32; + v336 = arith.add v334, v794 : i32 #[overflow = wrapping]; + v673 = arith.constant 300 : felt; + v674 = arith.constant 200 : felt; + v675 = arith.constant 100 : felt; + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_triple::wit_import5(v675, v674, v673, v336) + v337 = hir.load_local : i32 #[local = lv4]; + v793 = arith.constant 16 : u32; + v338 = hir.bitcast v337 : u32; + v340 = arith.add v338, v793 : u32 #[overflow = checked]; + v792 = arith.constant 4 : u32; + v342 = arith.mod v340, v792 : u32; + hir.assertz v342 #[code = 250]; + v343 = hir.int_to_ptr v340 : ptr; + v344 = hir.load v343 : felt; + hir.store_local v344 #[local = lv5]; + v345 = hir.load_local : i32 #[local = lv4]; + v791 = arith.constant 12 : u32; + v346 = hir.bitcast v345 : u32; + v348 = arith.add v346, v791 : u32 #[overflow = checked]; + v790 = arith.constant 4 : u32; + v350 = arith.mod v348, v790 : u32; + hir.assertz v350 #[code = 250]; + v351 = hir.int_to_ptr v348 : ptr; + v352 = hir.load v351 : felt; + hir.store_local v352 #[local = lv6]; + v353 = hir.load_local : i32 #[local = lv4]; + v789 = arith.constant 8 : u32; + v354 = hir.bitcast v353 : u32; + v356 = arith.add v354, v789 : u32 #[overflow = checked]; + v788 = arith.constant 4 : u32; + v358 = arith.mod v356, v788 : u32; + hir.assertz v358 #[code = 250]; + v359 = hir.int_to_ptr v356 : ptr; + v360 = hir.load v359 : felt; + v672 = arith.constant 105 : felt; + hir.assert_eq v360, v672; + v363 = hir.load_local : felt #[local = lv6]; + v671 = arith.constant 205 : felt; + hir.assert_eq v363, v671; + v366 = hir.load_local : felt #[local = lv5]; + v670 = arith.constant 305 : felt; + hir.assert_eq v366, v670; + v378 = hir.load_local : i32 #[local = lv4]; + v787 = arith.constant 8 : i32; + v380 = arith.add v378, v787 : i32 #[overflow = wrapping]; + v710 = arith.constant 3 : i32; + v698 = arith.constant 0 : i32; + v699 = arith.constant 111 : i32; + v669 = arith.constant 50 : felt; + v700 = arith.constant -11 : i32; + v701 = arith.constant -4294967302 : i64; + v371 = arith.trunc v701 : felt; + v702 = arith.constant -1001 : i64; + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_mixed::wit_import4(v702, v371, v700, v669, v699, v698, v710, v380) + v381 = hir.load_local : i32 #[local = lv4]; + v786 = arith.constant 8 : u32; + v382 = hir.bitcast v381 : u32; + v384 = arith.add v382, v786 : u32 #[overflow = checked]; + v785 = arith.constant 8 : u32; + v386 = arith.mod v384, v785 : u32; + hir.assertz v386 #[code = 250]; + v387 = hir.int_to_ptr v384 : ptr; + v388 = hir.load v387 : i64; + v784 = arith.constant 0 : i32; + v697 = arith.constant -1 : i64; + v390 = arith.eq v388, v697 : i1; + v391 = arith.zext v390 : u32; + v392 = hir.bitcast v391 : i32; + v394 = arith.neq v392, v784 : i1; + cf.cond_br v394 ^block26, ^block27; ^block26: - v364 = arith.constant 30 : u32; - v363 = hir.bitcast v181 : u32; - v365 = arith.add v363, v364 : u32 #[overflow = checked]; - v366 = arith.constant 2 : u32; - v367 = arith.mod v365, v366 : u32; - hir.assertz v367 #[code = 250]; - v368 = hir.int_to_ptr v365 : ptr; - v369 = hir.load v368 : u16; - v373 = arith.constant 29 : u32; - v372 = hir.bitcast v181 : u32; - v374 = arith.add v372, v373 : u32 #[overflow = checked]; - v375 = hir.int_to_ptr v374 : ptr; - v376 = hir.load v375 : u8; - v380 = arith.constant 28 : u32; - v379 = hir.bitcast v181 : u32; - v381 = arith.add v379, v380 : u32 #[overflow = checked]; - v382 = hir.int_to_ptr v381 : ptr; - v383 = hir.load v382 : u8; - v387 = arith.constant 24 : u32; - v386 = hir.bitcast v181 : u32; - v388 = arith.add v386, v387 : u32 #[overflow = checked]; - v553 = arith.constant 4 : u32; - v390 = arith.mod v388, v553 : u32; - hir.assertz v390 #[code = 250]; - v391 = hir.int_to_ptr v388 : ptr; - v392 = hir.load v391 : felt; - v552 = arith.constant 20 : u32; - v393 = hir.bitcast v181 : u32; - v395 = arith.add v393, v552 : u32 #[overflow = checked]; - v551 = arith.constant 4 : u32; - v397 = arith.mod v395, v551 : u32; - hir.assertz v397 #[code = 250]; - v398 = hir.int_to_ptr v395 : ptr; - v399 = hir.load v398 : i32; - v550 = arith.constant 16 : u32; - v400 = hir.bitcast v181 : u32; - v402 = arith.add v400, v550 : u32 #[overflow = checked]; - v549 = arith.constant 4 : u32; - v404 = arith.mod v402, v549 : u32; - hir.assertz v404 #[code = 250]; - v405 = hir.int_to_ptr v402 : ptr; - v406 = hir.load v405 : felt; - v407 = arith.constant -4294967296 : i64; - v408 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u64_unchecked(v407) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v406, v408) - v409 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/>::from(v399) : felt - v410 = arith.constant -1 : i32; - v411 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v410) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v409, v411) - v412 = arith.constant 57 : i32; - v413 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v412) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v392, v413) - v384 = arith.zext v383 : u32; - v385 = hir.bitcast v384 : i32; - v414 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/>::from(v385) : felt - v415 = arith.constant 122 : i32; - v416 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v415) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v414, v416) - v548 = arith.constant 0 : i32; - v417 = arith.constant 255 : i32; - v377 = arith.zext v376 : u32; - v378 = hir.bitcast v377 : i32; - v418 = arith.band v378, v417 : i32; - v420 = arith.neq v418, v548 : i1; - v421 = arith.zext v420 : u32; - v422 = hir.bitcast v421 : i32; - v423 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v422) : felt - v424 = arith.constant 1 : i32; - v425 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v424) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v423, v425) - v370 = arith.zext v369 : u32; - v371 = hir.bitcast v370 : i32; - v426 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/>::from(v371) : felt - v547 = arith.constant 12 : i32; - v428 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v547) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v426, v428) - v429 = arith.constant 30 : i32; - v430 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v429) : felt - v431 = arith.constant 40 : i32; - v432 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v431) : felt - v546 = arith.constant 50 : i32; - v434 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v546) : felt - v545 = arith.constant 8 : i32; - v436 = arith.add v181, v545 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_nested::wit_import6(v430, v432, v434, v436) - v544 = arith.constant 16 : u32; - v437 = hir.bitcast v181 : u32; - v439 = arith.add v437, v544 : u32 #[overflow = checked]; - v543 = arith.constant 4 : u32; - v441 = arith.mod v439, v543 : u32; - hir.assertz v441 #[code = 250]; - v442 = hir.int_to_ptr v439 : ptr; - v443 = hir.load v442 : felt; - v542 = arith.constant 12 : u32; - v444 = hir.bitcast v181 : u32; - v446 = arith.add v444, v542 : u32 #[overflow = checked]; - v541 = arith.constant 4 : u32; - v448 = arith.mod v446, v541 : u32; - hir.assertz v448 #[code = 250]; - v449 = hir.int_to_ptr v446 : ptr; - v450 = hir.load v449 : felt; - v540 = arith.constant 8 : u32; - v451 = hir.bitcast v181 : u32; - v453 = arith.add v451, v540 : u32 #[overflow = checked]; - v539 = arith.constant 4 : u32; - v455 = arith.mod v453, v539 : u32; - hir.assertz v455 #[code = 250]; - v456 = hir.int_to_ptr v453 : ptr; - v457 = hir.load v456 : felt; - v458 = arith.constant 38 : i32; - v459 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v458) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v457, v459) - v460 = arith.constant 48 : i32; - v461 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v460) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v450, v461) - v462 = arith.constant 58 : i32; - v463 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v462) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v443, v463) - v538 = arith.constant 32 : i32; - v465 = arith.add v181, v538 : i32 #[overflow = wrapping]; - v466 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word/__stack_pointer : ptr - v467 = hir.bitcast v466 : ptr; - hir.store v467, v465; + v395 = hir.load_local : i32 #[local = lv4]; + v696 = arith.constant 30 : u32; + v396 = hir.bitcast v395 : u32; + v398 = arith.add v396, v696 : u32 #[overflow = checked]; + v695 = arith.constant 2 : u32; + v400 = arith.mod v398, v695 : u32; + hir.assertz v400 #[code = 250]; + v401 = hir.int_to_ptr v398 : ptr; + v402 = hir.load v401 : u16; + v403 = arith.zext v402 : u32; + v404 = hir.bitcast v403 : i32; + hir.store_local v404 #[local = lv12]; + v405 = hir.load_local : i32 #[local = lv4]; + v694 = arith.constant 29 : u32; + v406 = hir.bitcast v405 : u32; + v408 = arith.add v406, v694 : u32 #[overflow = checked]; + v409 = hir.int_to_ptr v408 : ptr; + v410 = hir.load v409 : u8; + v411 = arith.zext v410 : u32; + v412 = hir.bitcast v411 : i32; + hir.store_local v412 #[local = lv13]; + v413 = hir.load_local : i32 #[local = lv4]; + v693 = arith.constant 28 : u32; + v414 = hir.bitcast v413 : u32; + v416 = arith.add v414, v693 : u32 #[overflow = checked]; + v417 = hir.int_to_ptr v416 : ptr; + v418 = hir.load v417 : u8; + v419 = arith.zext v418 : u32; + v420 = hir.bitcast v419 : i32; + hir.store_local v420 #[local = lv14]; + v421 = hir.load_local : i32 #[local = lv4]; + v692 = arith.constant 24 : u32; + v422 = hir.bitcast v421 : u32; + v424 = arith.add v422, v692 : u32 #[overflow = checked]; + v783 = arith.constant 4 : u32; + v426 = arith.mod v424, v783 : u32; + hir.assertz v426 #[code = 250]; + v427 = hir.int_to_ptr v424 : ptr; + v428 = hir.load v427 : felt; + hir.store_local v428 #[local = lv5]; + v429 = hir.load_local : i32 #[local = lv4]; + v782 = arith.constant 20 : u32; + v430 = hir.bitcast v429 : u32; + v432 = arith.add v430, v782 : u32 #[overflow = checked]; + v781 = arith.constant 4 : u32; + v434 = arith.mod v432, v781 : u32; + hir.assertz v434 #[code = 250]; + v435 = hir.int_to_ptr v432 : ptr; + v436 = hir.load v435 : i32; + v437 = hir.load_local : i32 #[local = lv4]; + v780 = arith.constant 16 : u32; + v438 = hir.bitcast v437 : u32; + v440 = arith.add v438, v780 : u32 #[overflow = checked]; + v779 = arith.constant 4 : u32; + v442 = arith.mod v440, v779 : u32; + hir.assertz v442 #[code = 250]; + v443 = hir.int_to_ptr v440 : ptr; + v444 = hir.load v443 : felt; + v691 = arith.constant -4294967296 : i64; + v446 = arith.trunc v691 : felt; + hir.assert_eq v444, v446; + v448 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/>::from(v436) : felt + v690 = arith.constant -1 : i32; + v450 = hir.bitcast v690 : felt; + hir.assert_eq v448, v450; + v451 = hir.load_local : felt #[local = lv5]; + v668 = arith.constant 57 : felt; + hir.assert_eq v451, v668; + v454 = hir.load_local : i32 #[local = lv14]; + v455 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/>::from(v454) : felt + v667 = arith.constant 122 : felt; + hir.assert_eq v455, v667; + v458 = hir.load_local : i32 #[local = lv13]; + v666 = arith.constant 1 : felt; + v778 = arith.constant 0 : i32; + v689 = arith.constant 255 : i32; + v460 = arith.band v458, v689 : i32; + v462 = arith.neq v460, v778 : i1; + v463 = arith.zext v462 : u32; + v464 = hir.bitcast v463 : i32; + v465 = hir.bitcast v464 : felt; + hir.assert_eq v465, v666; + v468 = hir.load_local : i32 #[local = lv12]; + v469 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/>::from(v468) : felt + v777 = arith.constant 12 : felt; + hir.assert_eq v469, v777; + v478 = hir.load_local : i32 #[local = lv4]; + v775 = arith.constant 8 : i32; + v480 = arith.add v478, v775 : i32 #[overflow = wrapping]; + v776 = arith.constant 50 : felt; + v664 = arith.constant 40 : felt; + v665 = arith.constant 30 : felt; + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_nested::wit_import6(v665, v664, v776, v480) + v481 = hir.load_local : i32 #[local = lv4]; + v774 = arith.constant 16 : u32; + v482 = hir.bitcast v481 : u32; + v484 = arith.add v482, v774 : u32 #[overflow = checked]; + v773 = arith.constant 4 : u32; + v486 = arith.mod v484, v773 : u32; + hir.assertz v486 #[code = 250]; + v487 = hir.int_to_ptr v484 : ptr; + v488 = hir.load v487 : felt; + hir.store_local v488 #[local = lv5]; + v489 = hir.load_local : i32 #[local = lv4]; + v772 = arith.constant 12 : u32; + v490 = hir.bitcast v489 : u32; + v492 = arith.add v490, v772 : u32 #[overflow = checked]; + v771 = arith.constant 4 : u32; + v494 = arith.mod v492, v771 : u32; + hir.assertz v494 #[code = 250]; + v495 = hir.int_to_ptr v492 : ptr; + v496 = hir.load v495 : felt; + hir.store_local v496 #[local = lv6]; + v497 = hir.load_local : i32 #[local = lv4]; + v770 = arith.constant 8 : u32; + v498 = hir.bitcast v497 : u32; + v500 = arith.add v498, v770 : u32 #[overflow = checked]; + v769 = arith.constant 4 : u32; + v502 = arith.mod v500, v769 : u32; + hir.assertz v502 #[code = 250]; + v503 = hir.int_to_ptr v500 : ptr; + v504 = hir.load v503 : felt; + v663 = arith.constant 38 : felt; + hir.assert_eq v504, v663; + v507 = hir.load_local : felt #[local = lv6]; + v662 = arith.constant 48 : felt; + hir.assert_eq v507, v662; + v510 = hir.load_local : felt #[local = lv5]; + v661 = arith.constant 58 : felt; + hir.assert_eq v510, v661; + v513 = hir.load_local : i32 #[local = lv4]; + v768 = arith.constant 32 : i32; + v515 = arith.add v513, v768 : i32 #[overflow = wrapping]; + v516 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word/__stack_pointer : ptr + v517 = hir.bitcast v516 : ptr; + hir.store v517, v515; builtin.ret ; ^block27: ub.unreachable ; @@ -548,76 +585,60 @@ builtin.component miden:base/note-script@1.0.0 { private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block28: - v469 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word/GOT.data.internal.__memory_base : ptr - v470 = hir.bitcast v469 : ptr; - v471 = hir.load v470 : i32; - v472 = arith.constant 1048588 : i32; - v473 = arith.add v471, v472 : i32 #[overflow = wrapping]; - v474 = hir.bitcast v473 : u32; - v475 = hir.int_to_ptr v474 : ptr; - v476 = hir.load v475 : u8; - v468 = arith.constant 0 : i32; - v477 = arith.zext v476 : u32; - v478 = hir.bitcast v477 : i32; - v480 = arith.neq v478, v468 : i1; - scf.if v480{ + v518 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word/GOT.data.internal.__memory_base : ptr + v519 = hir.bitcast v518 : ptr; + v520 = hir.load v519 : i32; + v827 = arith.constant 1048588 : i32; + v522 = arith.add v520, v827 : i32 #[overflow = wrapping]; + v523 = hir.bitcast v522 : u32; + v524 = hir.int_to_ptr v523 : ptr; + v525 = hir.load v524 : u8; + v826 = arith.constant 0 : i32; + v526 = arith.zext v525 : u32; + v527 = hir.bitcast v526 : i32; + v529 = arith.neq v527, v826 : i1; + scf.if v529{ ^block30: scf.yield ; } else { ^block31: - v481 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word/GOT.data.internal.__memory_base : ptr - v482 = hir.bitcast v481 : ptr; - v483 = hir.load v482 : i32; + v530 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word/GOT.data.internal.__memory_base : ptr + v531 = hir.bitcast v530 : ptr; + v532 = hir.load v531 : i32; + hir.store_local v532 #[local = lv0]; hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/__wasm_call_ctors() - v592 = arith.constant 1 : u8; - v594 = arith.constant 1048588 : i32; - v485 = arith.add v483, v594 : i32 #[overflow = wrapping]; - v489 = hir.bitcast v485 : u32; - v490 = hir.int_to_ptr v489 : ptr; - hir.store v490, v592; + v533 = hir.load_local : i32 #[local = lv0]; + v825 = arith.constant 1 : u8; + v830 = arith.constant 1048588 : i32; + v535 = arith.add v533, v830 : i32 #[overflow = wrapping]; + v539 = hir.bitcast v535 : u32; + v540 = hir.int_to_ptr v539 : ptr; + hir.store v540, v825; scf.yield ; }; builtin.ret ; }; - private builtin.function @>::from(v491: i32) -> felt { - ^block32(v491: i32): - v493 = hir.bitcast v491 : felt; - builtin.ret v493; + private builtin.function @>::from(v541: i32) -> felt { + ^block32(v541: i32): + v544 = hir.bitcast v541 : felt; + builtin.ret v544; }; - private builtin.function @>::from(v494: i32) -> felt { - ^block34(v494: i32): - v496 = arith.constant 65535 : i32; - v497 = arith.band v494, v496 : i32; - v498 = hir.bitcast v497 : felt; - builtin.ret v498; + private builtin.function @>::from(v545: i32) -> felt { + ^block34(v545: i32): + v831 = arith.constant 65535 : i32; + v549 = arith.band v545, v831 : i32; + v550 = hir.bitcast v549 : felt; + builtin.ret v550; }; - private builtin.function @>::from(v499: i32) -> felt { - ^block36(v499: i32): - v501 = arith.constant 255 : i32; - v502 = arith.band v499, v501 : i32; - v503 = hir.bitcast v502 : felt; - builtin.ret v503; - }; - - private builtin.function @intrinsics::felt::assert_eq(v504: felt, v505: felt) { - ^block38(v504: felt, v505: felt): - hir.assert_eq v504, v505; - builtin.ret ; - }; - - private builtin.function @intrinsics::felt::from_u32(v506: i32) -> felt { - ^block40(v506: i32): - v507 = hir.bitcast v506 : felt; - builtin.ret v507; - }; - - private builtin.function @intrinsics::felt::from_u64_unchecked(v509: i64) -> felt { - ^block42(v509: i64): - v510 = hir.cast v509 : felt; - builtin.ret v510; + private builtin.function @>::from(v551: i32) -> felt { + ^block36(v551: i32): + v832 = arith.constant 255 : i32; + v555 = arith.band v551, v832 : i32; + v556 = hir.bitcast v555 : felt; + builtin.ret v556; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -631,9 +652,9 @@ builtin.component miden:base/note-script@1.0.0 { builtin.segment @1048576 = 0x000000010000000100000001; }; - public builtin.function @run(v512: felt, v513: felt, v514: felt, v515: felt) { - ^block44(v512: felt, v513: felt, v514: felt, v515: felt): - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/miden:base/note-script@1.0.0#run(v512, v513, v514, v515) + public builtin.function @run(v557: felt, v558: felt, v559: felt, v560: felt) { + ^block38(v557: felt, v558: felt, v559: felt, v560: felt): + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/miden:base/note-script@1.0.0#run(v557, v558, v559, v560) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/cross_ctx_note_word.masm b/tests/integration/expected/rust_sdk/cross_ctx_note_word.masm index 9ae4fb781..34419c260 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note_word.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_note_word.masm @@ -1,14 +1,14 @@ -# mod miden:base/note-script@1.0.0 +# mod ::"miden:base/note-script@1.0.0" @callconv("canon-lift") pub proc run(felt, felt, felt, felt) - exec.::miden:base/note-script@1.0.0::init + exec."miden:base/note-script@1.0.0"::init trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::miden:base/note-script@1.0.0#run + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::"miden:base/note-script@1.0.0#run" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -21,7 +21,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -32,7 +32,7 @@ proc init mem_store.278537 end -# mod miden:base/note-script@1.0.0::cross_ctx_note_word +# mod ::"miden:base/note-script@1.0.0"::cross_ctx_note_word @callconv("C") proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_word::wit_import7( @@ -44,7 +44,7 @@ proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_ ) trace.240 nop - call.::miden:cross-ctx-account-word/foo@1.0.0::process-word + call.::"miden:cross-ctx-account-word/foo@1.0.0"::"process-word" trace.252 nop push.0 @@ -116,7 +116,7 @@ proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_ ) trace.240 nop - call.::miden:cross-ctx-account-word/foo@1.0.0::process-another-word + call.::"miden:cross-ctx-account-word/foo@1.0.0"::"process-another-word" trace.252 nop push.0 @@ -184,7 +184,7 @@ proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_ ) -> felt trace.240 nop - call.::miden:cross-ctx-account-word/foo@1.0.0::process-felt + call.::"miden:cross-ctx-account-word/foo@1.0.0"::"process-felt" trace.252 nop end @@ -197,7 +197,7 @@ proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_ ) trace.240 nop - call.::miden:cross-ctx-account-word/foo@1.0.0::process-pair + call.::"miden:cross-ctx-account-word/foo@1.0.0"::"process-pair" trace.252 nop push.0 @@ -235,7 +235,7 @@ proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_ ) trace.240 nop - call.::miden:cross-ctx-account-word/foo@1.0.0::process-triple + call.::"miden:cross-ctx-account-word/foo@1.0.0"::"process-triple" trace.252 nop push.0 @@ -289,7 +289,7 @@ proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_ ) trace.240 nop - call.::miden:cross-ctx-account-word/foo@1.0.0::process-mixed + call.::"miden:cross-ctx-account-word/foo@1.0.0"::"process-mixed" trace.252 nop push.0 @@ -421,7 +421,7 @@ proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_ ) trace.240 nop - call.::miden:cross-ctx-account-word/foo@1.0.0::process-nested + call.::"miden:cross-ctx-account-word/foo@1.0.0"::"process-nested" trace.252 nop push.0 @@ -481,6 +481,7 @@ proc cross_ctx_note_word::bindings::__link_custom_section_describing_imports( nop end +@locals("16") @callconv("C") proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop @@ -497,9 +498,16 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) nop push.32 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.4 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -509,51 +517,74 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) nop trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::wit_bindgen::rt::run_ctors_once + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::wit_bindgen::rt::run_ctors_once trace.252 nop push.2 + locaddr.5 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop push.3 + locaddr.6 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop push.4 + locaddr.7 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop push.5 + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.5 u32wrapping_add - dup.4 - dup.4 - dup.4 - dup.4 - swap.1 - swap.2 + push.5 + push.4 + push.3 + push.2 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_word::wit_import7 + trace.252 + nop + locaddr.4 + push.0 swap.1 - swap.3 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_word::wit_import7 + exec.::intrinsics::mem::load_sw trace.252 nop push.20 - dup.5 + swap.1 add u32assert push.4 @@ -569,8 +600,16 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - dup.6 + swap.1 add u32assert push.4 @@ -586,8 +625,16 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.7 + swap.1 add u32assert push.4 @@ -603,8 +650,16 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.8 + swap.1 add u32assert push.4 @@ -621,55 +676,54 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) trace.252 nop push.3 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 - trace.252 - nop - swap.1 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq - trace.252 - nop + assert_eq push.5 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 - trace.252 - nop + assert_eq + push.7 + assert_eq + push.9 + assert_eq + locaddr.5 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_felt trace.252 nop - push.7 + locaddr.6 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.7 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_felt trace.252 nop - push.9 + locaddr.8 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.4 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.5 u32wrapping_add swap.1 swap.3 @@ -677,11 +731,19 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) swap.4 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_another_word::wit_import7 + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_another_word::wit_import7 + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.20 - dup.1 + swap.1 add u32assert push.4 @@ -697,8 +759,24 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - dup.2 + swap.1 add u32assert push.4 @@ -714,8 +792,24 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.3 + swap.1 add u32assert push.4 @@ -731,8 +825,24 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.7 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.4 + swap.1 add u32assert push.4 @@ -749,90 +859,73 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) trace.252 nop push.4 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 - trace.252 - nop + assert_eq + locaddr.7 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_felt trace.252 nop push.6 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 - trace.252 - nop + assert_eq + locaddr.6 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_felt trace.252 nop push.8 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 - trace.252 - nop + assert_eq + locaddr.5 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_felt trace.252 nop push.10 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 - trace.252 - nop - swap.1 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq - trace.252 - nop + assert_eq push.9 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 - trace.252 - nop - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_felt::wit_import1 + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_felt::wit_import1 trace.252 nop push.12 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 - trace.252 - nop + assert_eq + push.10 + locaddr.5 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + exec.::intrinsics::mem::store_felt trace.252 nop - push.10 + push.20 + locaddr.6 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop - push.20 + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.3 + swap.1 add u32assert push.8 @@ -853,17 +946,48 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.3 u32wrapping_add swap.2 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_pair::wit_import4 + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_pair::wit_import4 + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.12 - dup.1 + swap.1 add u32assert push.4 @@ -879,8 +1003,24 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.2 + swap.1 add u32assert push.4 @@ -897,59 +1037,45 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) trace.252 nop push.14 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 - trace.252 - nop + assert_eq + locaddr.5 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_felt trace.252 nop push.24 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 - trace.252 - nop + assert_eq + locaddr.4 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq - trace.252 - nop - push.100 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 - trace.252 - nop - push.200 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop + push.8 + u32wrapping_add push.300 + push.200 + push.100 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_triple::wit_import5 trace.252 nop - push.8 - dup.4 - u32wrapping_add - movdn.3 - swap.2 + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_triple::wit_import5 + exec.::intrinsics::mem::load_sw trace.252 nop push.16 - dup.1 + swap.1 add u32assert push.4 @@ -965,25 +1091,24 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop - push.12 - dup.2 - add - u32assert - push.4 - dup.1 + locaddr.5 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::load_sw trace.252 nop - push.8 - dup.3 + push.12 + swap.1 add u32assert push.4 @@ -999,79 +1124,97 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop - push.105 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 - trace.252 - nop + locaddr.6 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq - trace.252 - nop - push.205 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.4 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_sw trace.252 nop - push.305 + push.8 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_felt trace.252 nop + push.105 + assert_eq + locaddr.6 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_felt trace.252 nop - push.4294967290 - push.4294967294 + push.205 + assert_eq + locaddr.5 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u64_unchecked + exec.::intrinsics::mem::load_felt trace.252 nop - push.50 + push.305 + assert_eq + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.3 u32wrapping_add push.3 push.0 push.111 + push.50 push.4294967285 + push.4294967290 + push.4294967294 + mul.4294967296 + add push.4294966295 push.4294967295 - movup.2 - swap.3 - swap.5 - swap.7 - swap.4 - swap.6 - swap.8 - movdn.2 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_mixed::wit_import4 + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_mixed::wit_import4 + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.1 + swap.1 add u32assert push.8 @@ -1095,13 +1238,21 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) movup.4 trace.240 nop - exec.::std::math::u64::eq + exec.::miden::core::math::u64::eq trace.252 nop neq if.true + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.30 - dup.1 + swap.1 add u32assert push.2 @@ -1123,8 +1274,24 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop push.65535 u32and + locaddr.12 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.29 - dup.2 + swap.1 add u32assert u32divmod.4 @@ -1140,8 +1307,24 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop push.255 u32and + locaddr.13 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.28 - dup.3 + swap.1 add u32assert u32divmod.4 @@ -1157,8 +1340,24 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop push.255 u32and + locaddr.14 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.24 - dup.4 + swap.1 add u32assert push.4 @@ -1174,8 +1373,24 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.20 - dup.5 + swap.1 add u32assert push.4 @@ -1191,8 +1406,16 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - dup.6 + swap.1 add u32assert push.4 @@ -1210,132 +1433,99 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) nop push.0 push.4294967295 + mul.4294967296 + add + assert_eq trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u64_unchecked - trace.252 - nop - swap.1 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq - trace.252 - nop - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::>::from + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::>::from trace.252 nop push.4294967295 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 - trace.252 - nop + assert_eq + locaddr.5 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_felt trace.252 nop push.57 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 - trace.252 - nop + assert_eq + locaddr.14 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_sw trace.252 nop trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::>::from + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::>::from trace.252 nop push.122 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 - trace.252 - nop + assert_eq + locaddr.13 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_sw trace.252 nop + push.1 push.0 push.255 - movup.2 + movup.3 u32and neq - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 - trace.252 - nop - push.1 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 - trace.252 - nop + assert_eq + locaddr.12 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_sw trace.252 nop trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::>::from + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::>::from trace.252 nop push.12 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 - trace.252 - nop + assert_eq + locaddr.4 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq - trace.252 - nop - push.30 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 - trace.252 - nop - push.40 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop + push.8 + u32wrapping_add push.50 + push.40 + push.30 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_nested::wit_import6 trace.252 nop - push.8 - dup.4 - u32wrapping_add - movdn.3 - swap.2 + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_nested::wit_import6 + exec.::intrinsics::mem::load_sw trace.252 nop push.16 - dup.1 + swap.1 add u32assert push.4 @@ -1351,8 +1541,24 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.2 + swap.1 add u32assert push.4 @@ -1368,8 +1574,24 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.3 + swap.1 add u32assert push.4 @@ -1386,39 +1608,33 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) trace.252 nop push.38 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 - trace.252 - nop + assert_eq + locaddr.6 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_felt trace.252 nop push.48 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 - trace.252 - nop + assert_eq + locaddr.5 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_felt trace.252 nop push.58 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 - trace.252 - nop + assert_eq + locaddr.4 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + exec.::intrinsics::mem::load_sw trace.252 nop push.32 @@ -1432,12 +1648,12 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) trace.252 nop else - drop push.0 assert end end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -1479,9 +1695,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -1512,52 +1744,29 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("1") @callconv("C") -proc >::from( +proc >::from( i32 ) -> felt nop end +@locals("1") @callconv("C") -proc >::from( +proc >::from( i32 ) -> felt push.65535 u32and end +@locals("1") @callconv("C") -proc >::from( +proc >::from( i32 ) -> felt push.255 u32and end -@callconv("C") -proc intrinsics::felt::assert_eq(felt, felt) - assert_eq -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc intrinsics::felt::from_u64_unchecked([u32; 2]) -> felt - dup.1 - dup.1 - push.1 - push.4294967295 - trace.240 - nop - exec.::std::math::u64::lt - trace.252 - nop - assert - mul.4294967296 - add -end - diff --git a/tests/integration/expected/rust_sdk/cross_ctx_note_word.wat b/tests/integration/expected/rust_sdk/cross_ctx_note_word.wat index 1cce65d7c..7e9542dcb 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note_word.wat +++ b/tests/integration/expected/rust_sdk/cross_ctx_note_word.wat @@ -49,8 +49,8 @@ (type (;4;) (func (param i64 f32 i32 f32 i32 i32 i32 i32))) (type (;5;) (func)) (type (;6;) (func (param f32 f32 f32 f32))) - (type (;7;) (func (param i32) (result f32))) - (type (;8;) (func (param f32 f32))) + (type (;7;) (func (param f32 f32))) + (type (;8;) (func (param i32) (result f32))) (type (;9;) (func (param i64) (result f32))) (import "miden:cross-ctx-account-word/foo@1.0.0" "process-word" (func $cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_word::wit_import7 (;0;) (type 0))) (import "miden:cross-ctx-account-word/foo@1.0.0" "process-another-word" (func $cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_another_word::wit_import7 (;1;) (type 0))) @@ -256,7 +256,7 @@ call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq local.get 15 - call $>::from + call $>::from i32.const -1 call $intrinsics::felt::from_u32 call $intrinsics::felt::assert_eq @@ -265,7 +265,7 @@ call $intrinsics::felt::from_u32 call $intrinsics::felt::assert_eq local.get 14 - call $>::from + call $>::from i32.const 122 call $intrinsics::felt::from_u32 call $intrinsics::felt::assert_eq @@ -279,7 +279,7 @@ call $intrinsics::felt::from_u32 call $intrinsics::felt::assert_eq local.get 12 - call $>::from + call $>::from i32.const 12 call $intrinsics::felt::from_u32 call $intrinsics::felt::assert_eq @@ -335,31 +335,31 @@ i32.store8 end ) - (func $>::from (;11;) (type 7) (param i32) (result f32) + (func $intrinsics::felt::assert_eq (;11;) (type 7) (param f32 f32) + unreachable + ) + (func $intrinsics::felt::from_u32 (;12;) (type 8) (param i32) (result f32) + unreachable + ) + (func $intrinsics::felt::from_u64_unchecked (;13;) (type 9) (param i64) (result f32) + unreachable + ) + (func $>::from (;14;) (type 8) (param i32) (result f32) local.get 0 f32.reinterpret_i32 ) - (func $>::from (;12;) (type 7) (param i32) (result f32) + (func $>::from (;15;) (type 8) (param i32) (result f32) local.get 0 i32.const 65535 i32.and f32.reinterpret_i32 ) - (func $>::from (;13;) (type 7) (param i32) (result f32) + (func $>::from (;16;) (type 8) (param i32) (result f32) local.get 0 i32.const 255 i32.and f32.reinterpret_i32 ) - (func $intrinsics::felt::assert_eq (;14;) (type 8) (param f32 f32) - unreachable - ) - (func $intrinsics::felt::from_u32 (;15;) (type 7) (param i32) (result f32) - unreachable - ) - (func $intrinsics::felt::from_u64_unchecked (;16;) (type 9) (param i64) (result f32) - unreachable - ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00") ) (core module $wit-component-shim-module (;1;) diff --git a/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.hir b/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.hir index 5b1c53eea..5a5ece3e2 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.hir +++ b/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.hir @@ -19,91 +19,63 @@ builtin.component miden:base/note-script@1.0.0 { private builtin.function @miden:base/note-script@1.0.0#run(v17: felt, v18: felt, v19: felt, v20: felt) { ^block12(v17: felt, v18: felt, v19: felt, v20: felt): hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/wit_bindgen::rt::run_ctors_once() - v21 = arith.constant 1 : i32; - v22 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v21) : felt - v23 = arith.constant 2 : i32; - v24 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v23) : felt - v25 = arith.constant 3 : i32; - v26 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v25) : felt - v27 = arith.constant 4 : i32; - v28 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v27) : felt - v29 = arith.constant 5 : i32; - v30 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v29) : felt - v31 = arith.constant 6 : i32; - v32 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v31) : felt - v33 = arith.constant 7 : i32; - v34 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v33) : felt - v35 = arith.constant 8 : i32; - v36 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v35) : felt - v37 = arith.constant 9 : i32; - v38 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v37) : felt - v39 = arith.constant 10 : i32; - v40 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v39) : felt - v41 = arith.constant 11 : i32; - v42 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v41) : felt - v43 = arith.constant 12 : i32; - v44 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v43) : felt - v45 = arith.constant 13 : i32; - v46 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v45) : felt - v47 = arith.constant 14 : i32; - v48 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v47) : felt - v49 = arith.constant 15 : i32; - v50 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v49) : felt - v88 = arith.constant 7 : i32; - v52 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v88) : felt - v53 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/cross_ctx_note_word_arg::bindings::miden::cross_ctx_account_word_arg::foo::process_word::wit_import22(v22, v24, v26, v28, v30, v32, v34, v36, v38, v40, v42, v44, v46, v48, v50, v52) : felt - v54 = arith.constant 458760 : i32; - v55 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v54) : felt - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::assert_eq(v53, v55) + v109 = arith.constant 7 : felt; + v101 = arith.constant 15 : felt; + v102 = arith.constant 14 : felt; + v103 = arith.constant 13 : felt; + v104 = arith.constant 12 : felt; + v105 = arith.constant 11 : felt; + v106 = arith.constant 10 : felt; + v107 = arith.constant 9 : felt; + v108 = arith.constant 8 : felt; + v110 = arith.constant 6 : felt; + v111 = arith.constant 5 : felt; + v112 = arith.constant 4 : felt; + v113 = arith.constant 3 : felt; + v114 = arith.constant 2 : felt; + v115 = arith.constant 1 : felt; + v53 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/cross_ctx_note_word_arg::bindings::miden::cross_ctx_account_word_arg::foo::process_word::wit_import22(v115, v114, v113, v112, v111, v110, v109, v108, v107, v106, v105, v104, v103, v102, v101, v109) : felt + v100 = arith.constant 458760 : felt; + hir.assert_eq v53, v100; builtin.ret ; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block14: - v57 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/GOT.data.internal.__memory_base : ptr - v58 = hir.bitcast v57 : ptr; - v59 = hir.load v58 : i32; - v60 = arith.constant 1048588 : i32; - v61 = arith.add v59, v60 : i32 #[overflow = wrapping]; - v62 = hir.bitcast v61 : u32; - v63 = hir.int_to_ptr v62 : ptr; - v64 = hir.load v63 : u8; - v56 = arith.constant 0 : i32; - v65 = arith.zext v64 : u32; - v66 = hir.bitcast v65 : i32; - v68 = arith.neq v66, v56 : i1; - scf.if v68{ + v56 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/GOT.data.internal.__memory_base : ptr + v57 = hir.bitcast v56 : ptr; + v58 = hir.load v57 : i32; + v120 = arith.constant 1048588 : i32; + v60 = arith.add v58, v120 : i32 #[overflow = wrapping]; + v61 = hir.bitcast v60 : u32; + v62 = hir.int_to_ptr v61 : ptr; + v63 = hir.load v62 : u8; + v119 = arith.constant 0 : i32; + v64 = arith.zext v63 : u32; + v65 = hir.bitcast v64 : i32; + v67 = arith.neq v65, v119 : i1; + scf.if v67{ ^block16: scf.yield ; } else { ^block17: - v69 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/GOT.data.internal.__memory_base : ptr - v70 = hir.bitcast v69 : ptr; - v71 = hir.load v70 : i32; + v68 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/GOT.data.internal.__memory_base : ptr + v69 = hir.bitcast v68 : ptr; + v70 = hir.load v69 : i32; + hir.store_local v70 #[local = lv0]; hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/__wasm_call_ctors() - v90 = arith.constant 1 : u8; - v92 = arith.constant 1048588 : i32; - v73 = arith.add v71, v92 : i32 #[overflow = wrapping]; + v71 = hir.load_local : i32 #[local = lv0]; + v118 = arith.constant 1 : u8; + v123 = arith.constant 1048588 : i32; + v73 = arith.add v71, v123 : i32 #[overflow = wrapping]; v77 = hir.bitcast v73 : u32; v78 = hir.int_to_ptr v77 : ptr; - hir.store v78, v90; + hir.store v78, v118; scf.yield ; }; builtin.ret ; }; - private builtin.function @intrinsics::felt::assert_eq(v79: felt, v80: felt) { - ^block18(v79: felt, v80: felt): - hir.assert_eq v79, v80; - builtin.ret ; - }; - - private builtin.function @intrinsics::felt::from_u32(v81: i32) -> felt { - ^block20(v81: i32): - v82 = hir.bitcast v81 : felt; - builtin.ret v82; - }; - builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; @@ -115,9 +87,9 @@ builtin.component miden:base/note-script@1.0.0 { builtin.segment @1048576 = 0x000000010000000100000001; }; - public builtin.function @run(v84: felt, v85: felt, v86: felt, v87: felt) { - ^block22(v84: felt, v85: felt, v86: felt, v87: felt): - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/miden:base/note-script@1.0.0#run(v84, v85, v86, v87) + public builtin.function @run(v79: felt, v80: felt, v81: felt, v82: felt) { + ^block18(v79: felt, v80: felt, v81: felt, v82: felt): + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/miden:base/note-script@1.0.0#run(v79, v80, v81, v82) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.masm b/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.masm index 984ad994e..cd8deee5e 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.masm @@ -1,14 +1,14 @@ -# mod miden:base/note-script@1.0.0 +# mod ::"miden:base/note-script@1.0.0" @callconv("canon-lift") pub proc run(felt, felt, felt, felt) - exec.::miden:base/note-script@1.0.0::init + exec."miden:base/note-script@1.0.0"::init trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::miden:base/note-script@1.0.0#run + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word_arg::"miden:base/note-script@1.0.0#run" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -21,7 +21,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -32,7 +32,7 @@ proc init mem_store.278537 end -# mod miden:base/note-script@1.0.0::cross_ctx_note_word_arg +# mod ::"miden:base/note-script@1.0.0"::cross_ctx_note_word_arg @callconv("C") proc cross_ctx_note_word_arg::bindings::miden::cross_ctx_account_word_arg::foo::process_word::wit_import22( @@ -55,7 +55,7 @@ proc cross_ctx_note_word_arg::bindings::miden::cross_ctx_account_word_arg::foo:: ) -> felt trace.240 nop - call.::miden:cross-ctx-account-word-arg/foo@1.0.0::process-word + call.::"miden:cross-ctx-account-word-arg/foo@1.0.0"::"process-word" trace.252 nop end @@ -74,6 +74,7 @@ proc cross_ctx_note_word_arg::bindings::__link_custom_section_describing_imports nop end +@locals("4") @callconv("C") proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop @@ -82,146 +83,42 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::wit_bindgen::rt::run_ctors_once - trace.252 - nop - push.1 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 - trace.252 - nop - push.2 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 - trace.252 - nop - push.3 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 - trace.252 - nop - push.4 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 - trace.252 - nop - push.5 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 - trace.252 - nop - push.6 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word_arg::wit_bindgen::rt::run_ctors_once trace.252 nop push.7 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 - trace.252 - nop - push.8 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 - trace.252 - nop - push.9 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 - trace.252 - nop - push.10 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 - trace.252 - nop - push.11 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 - trace.252 - nop - push.12 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 - trace.252 - nop - push.13 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 - trace.252 - nop - push.14 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 - trace.252 - nop push.15 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 - trace.252 - nop - push.7 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 - trace.252 - nop - movup.7 - swap.8 - movdn.7 - movup.6 - swap.9 - movdn.6 - movup.5 - swap.10 - movdn.5 - movup.4 - swap.11 - movdn.4 - movup.3 - swap.12 - movdn.3 - movup.2 - swap.13 - movdn.2 - swap.1 - swap.14 - swap.1 + push.14 + push.13 + push.12 + push.11 + push.10 + push.9 + push.8 + push.6 + push.5 + push.4 + push.3 + push.2 + push.1 + dup.14 swap.15 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::cross_ctx_note_word_arg::bindings::miden::cross_ctx_account_word_arg::foo::process_word::wit_import22 - trace.252 - nop - push.458760 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 - trace.252 - nop + swap.6 + swap.5 + swap.4 + swap.3 + swap.2 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::assert_eq + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word_arg::cross_ctx_note_word_arg::bindings::miden::cross_ctx_account_word_arg::foo::process_word::wit_import22 trace.252 nop + push.458760 + assert_eq end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -263,9 +160,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word_arg::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -296,13 +209,3 @@ proc wit_bindgen::rt::run_ctors_once( end end -@callconv("C") -proc intrinsics::felt::assert_eq(felt, felt) - assert_eq -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - diff --git a/tests/integration/expected/rust_sdk/pure_rust_add.hir b/tests/integration/expected/rust_sdk/pure_rust_add.hir index 348c04892..73107b593 100644 --- a/tests/integration/expected/rust_sdk/pure_rust_add.hir +++ b/tests/integration/expected/rust_sdk/pure_rust_add.hir @@ -2,62 +2,76 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @pure_rust_add { private builtin.function @__rustc::__rust_alloc(v0: i32, v1: i32) -> i32 { ^block4(v0: i32, v1: i32): - v3 = arith.constant 1048580 : i32; - v4 = hir.exec @root_ns:root@1.0.0/pure_rust_add/::alloc(v3, v1, v0) : i32 - builtin.ret v4; + v218 = arith.constant 1048580 : i32; + v6 = hir.exec @root_ns:root@1.0.0/pure_rust_add/::alloc(v218, v1, v0) : i32 + builtin.ret v6; }; - private builtin.function @__rustc::__rust_realloc(v5: i32, v6: i32, v7: i32, v8: i32) -> i32 { - ^block6(v5: i32, v6: i32, v7: i32, v8: i32): - v10 = arith.constant 1048580 : i32; - v11 = hir.exec @root_ns:root@1.0.0/pure_rust_add/::alloc(v10, v7, v8) : i32 - v178 = arith.constant 0 : i32; - v12 = arith.constant 0 : i32; - v13 = arith.eq v11, v12 : i1; - v14 = arith.zext v13 : u32; - v15 = hir.bitcast v14 : i32; - v17 = arith.neq v15, v178 : i1; - scf.if v17{ - ^block8: + private builtin.function @__rustc::__rust_realloc(v7: i32, v8: i32, v9: i32, v10: i32) -> i32 { + ^block6(v7: i32, v8: i32, v9: i32, v10: i32): + hir.store_local v7 #[local = lv0]; + hir.store_local v8 #[local = lv1]; + hir.store_local v9 #[local = lv2]; + hir.store_local v10 #[local = lv3]; + v13 = hir.load_local : i32 #[local = lv2]; + v14 = hir.load_local : i32 #[local = lv3]; + v220 = arith.constant 1048580 : i32; + v15 = hir.exec @root_ns:root@1.0.0/pure_rust_add/::alloc(v220, v13, v14) : i32 + hir.store_local v15 #[local = lv2]; + v230 = arith.constant 0 : i32; + v224 = arith.constant 0 : i32; + v17 = arith.eq v15, v224 : i1; + v18 = arith.zext v17 : u32; + v19 = hir.bitcast v18 : i32; + v21 = arith.neq v19, v230 : i1; + scf.if v21{ + ^block45: scf.yield ; } else { ^block9: - v177 = arith.constant 0 : i32; - v19 = hir.bitcast v6 : u32; - v18 = hir.bitcast v8 : u32; - v20 = arith.lt v18, v19 : i1; - v21 = arith.zext v20 : u32; - v22 = hir.bitcast v21 : i32; - v24 = arith.neq v22, v177 : i1; - v25 = cf.select v24, v8, v6 : i32; - v175 = arith.constant 0 : i32; - v176 = arith.constant 0 : i32; - v27 = arith.eq v25, v176 : i1; - v28 = arith.zext v27 : u32; - v29 = hir.bitcast v28 : i32; - v31 = arith.neq v29, v175 : i1; - scf.if v31{ + v22 = hir.load_local : i32 #[local = lv3]; + v23 = hir.load_local : i32 #[local = lv1]; + v229 = arith.constant 0 : i32; + v27 = hir.bitcast v23 : u32; + v26 = hir.bitcast v22 : u32; + v28 = arith.lt v26, v27 : i1; + v29 = arith.zext v28 : u32; + v30 = hir.bitcast v29 : i32; + v32 = arith.neq v30, v229 : i1; + v33 = cf.select v32, v22, v23 : i32; + hir.store_local v33 #[local = lv3]; + v227 = arith.constant 0 : i32; + v228 = arith.constant 0 : i32; + v35 = arith.eq v33, v228 : i1; + v36 = arith.zext v35 : u32; + v37 = hir.bitcast v36 : i32; + v39 = arith.neq v37, v227 : i1; + scf.if v39{ ^block44: scf.yield ; } else { ^block10: - v32 = hir.bitcast v25 : u32; - v33 = hir.bitcast v11 : u32; - v34 = hir.int_to_ptr v33 : ptr; - v35 = hir.bitcast v5 : u32; - v36 = hir.int_to_ptr v35 : ptr; - hir.mem_cpy v36, v34, v32; + v40 = hir.load_local : i32 #[local = lv2]; + v41 = hir.load_local : i32 #[local = lv0]; + v42 = hir.load_local : i32 #[local = lv3]; + v43 = hir.bitcast v42 : u32; + v44 = hir.bitcast v40 : u32; + v45 = hir.int_to_ptr v44 : ptr; + v46 = hir.bitcast v41 : u32; + v47 = hir.int_to_ptr v46 : ptr; + hir.mem_cpy v47, v45, v43; scf.yield ; }; scf.yield ; }; - builtin.ret v11; + v48 = hir.load_local : i32 #[local = lv2]; + builtin.ret v48; }; - public builtin.function @entrypoint(v38: i32, v39: i32) -> i32 { - ^block11(v38: i32, v39: i32): - v41 = arith.add v39, v38 : i32 #[overflow = wrapping]; - builtin.ret v41; + public builtin.function @entrypoint(v49: i32, v50: i32) -> i32 { + ^block11(v49: i32, v50: i32): + v54 = arith.add v50, v49 : i32 #[overflow = wrapping]; + builtin.ret v54; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { @@ -65,221 +79,261 @@ builtin.component root_ns:root@1.0.0 { builtin.ret ; }; - private builtin.function @::alloc(v42: i32, v43: i32, v44: i32) -> i32 { - ^block15(v42: i32, v43: i32, v44: i32): - v47 = arith.constant 16 : i32; - v46 = arith.constant 0 : i32; - v180 = arith.constant 16 : u32; - v49 = hir.bitcast v43 : u32; - v51 = arith.gt v49, v180 : i1; - v52 = arith.zext v51 : u32; - v53 = hir.bitcast v52 : i32; - v55 = arith.neq v53, v46 : i1; - v56 = cf.select v55, v43, v47 : i32; - v220 = arith.constant 0 : i32; - v57 = arith.constant -1 : i32; - v58 = arith.add v56, v57 : i32 #[overflow = wrapping]; - v59 = arith.band v56, v58 : i32; - v61 = arith.neq v59, v220 : i1; - v189, v190 = scf.if v61 : i32, u32 { - ^block49: - v181 = arith.constant 0 : u32; - v185 = ub.poison i32 : i32; - scf.yield v185, v181; + private builtin.function @::alloc(v55: i32, v56: i32, v57: i32) -> i32 { + ^block15(v55: i32, v56: i32, v57: i32): + hir.store_local v55 #[local = lv0]; + hir.store_local v56 #[local = lv1]; + hir.store_local v57 #[local = lv2]; + v59 = hir.load_local : i32 #[local = lv1]; + v238 = arith.constant 16 : i32; + v237 = arith.constant 0 : i32; + v233 = arith.constant 16 : u32; + v63 = hir.bitcast v59 : u32; + v65 = arith.gt v63, v233 : i1; + v66 = arith.zext v65 : u32; + v67 = hir.bitcast v66 : i32; + v69 = arith.neq v67, v237 : i1; + v70 = cf.select v69, v59, v238 : i32; + hir.store_local v70 #[local = lv3]; + v71 = hir.load_local : i32 #[local = lv3]; + v281 = arith.constant 0 : i32; + v236 = arith.constant -1 : i32; + v73 = arith.add v71, v236 : i32 #[overflow = wrapping]; + v74 = arith.band v70, v73 : i32; + v76 = arith.neq v74, v281 : i1; + v259, v260 = scf.if v76 : i32, u32 { + ^block51: + v251 = arith.constant 0 : u32; + v255 = ub.poison i32 : i32; + scf.yield v255, v251; } else { ^block18: - v63 = hir.exec @root_ns:root@1.0.0/pure_rust_add/::max(v43, v56) : i32 - v219 = arith.constant 0 : i32; - v62 = arith.constant -2147483648 : i32; - v64 = arith.sub v62, v63 : i32 #[overflow = wrapping]; - v66 = hir.bitcast v64 : u32; - v65 = hir.bitcast v44 : u32; - v67 = arith.gt v65, v66 : i1; - v68 = arith.zext v67 : u32; - v69 = hir.bitcast v68 : i32; - v71 = arith.neq v69, v219 : i1; - v204 = scf.if v71 : i32 { - ^block48: - v218 = ub.poison i32 : i32; - scf.yield v218; + v77 = hir.load_local : i32 #[local = lv2]; + v79 = hir.load_local : i32 #[local = lv1]; + v80 = hir.load_local : i32 #[local = lv3]; + v81 = hir.exec @root_ns:root@1.0.0/pure_rust_add/::max(v79, v80) : i32 + hir.store_local v81 #[local = lv1]; + v280 = arith.constant 0 : i32; + v235 = arith.constant -2147483648 : i32; + v82 = arith.sub v235, v81 : i32 #[overflow = wrapping]; + v84 = hir.bitcast v82 : u32; + v83 = hir.bitcast v77 : u32; + v85 = arith.gt v83, v84 : i1; + v86 = arith.zext v85 : u32; + v87 = hir.bitcast v86 : i32; + v89 = arith.neq v87, v280 : i1; + v265 = scf.if v89 : i32 { + ^block50: + v279 = ub.poison i32 : i32; + scf.yield v279; } else { ^block19: - v216 = arith.constant 0 : i32; - v77 = arith.sub v216, v63 : i32 #[overflow = wrapping]; - v217 = arith.constant -1 : i32; - v73 = arith.add v44, v63 : i32 #[overflow = wrapping]; - v75 = arith.add v73, v217 : i32 #[overflow = wrapping]; - v78 = arith.band v75, v77 : i32; - v79 = hir.bitcast v42 : u32; - v80 = arith.constant 4 : u32; - v81 = arith.mod v79, v80 : u32; - hir.assertz v81 #[code = 250]; - v82 = hir.int_to_ptr v79 : ptr; - v83 = hir.load v82 : i32; - v215 = arith.constant 0 : i32; - v85 = arith.neq v83, v215 : i1; - scf.if v85{ - ^block47: + v278 = arith.constant 0 : i32; + hir.store_local v278 #[local = lv3]; + v91 = hir.load_local : i32 #[local = lv2]; + v92 = hir.load_local : i32 #[local = lv1]; + v276 = arith.constant 0 : i32; + v98 = arith.sub v276, v92 : i32 #[overflow = wrapping]; + v277 = arith.constant -1 : i32; + v93 = arith.add v91, v92 : i32 #[overflow = wrapping]; + v95 = arith.add v93, v277 : i32 #[overflow = wrapping]; + v99 = arith.band v95, v98 : i32; + hir.store_local v99 #[local = lv2]; + v100 = hir.load_local : i32 #[local = lv0]; + v101 = hir.bitcast v100 : u32; + v234 = arith.constant 4 : u32; + v103 = arith.mod v101, v234 : u32; + hir.assertz v103 #[code = 250]; + v104 = hir.int_to_ptr v101 : ptr; + v105 = hir.load v104 : i32; + v275 = arith.constant 0 : i32; + v107 = arith.neq v105, v275 : i1; + scf.if v107{ + ^block49: scf.yield ; } else { ^block21: - v86 = hir.exec @root_ns:root@1.0.0/pure_rust_add/intrinsics::mem::heap_base() : i32 - v87 = hir.mem_size : u32; - v93 = hir.bitcast v42 : u32; - v214 = arith.constant 4 : u32; - v95 = arith.mod v93, v214 : u32; - hir.assertz v95 #[code = 250]; - v213 = arith.constant 16 : u32; - v88 = hir.bitcast v87 : i32; - v91 = arith.shl v88, v213 : i32; - v92 = arith.add v86, v91 : i32 #[overflow = wrapping]; - v96 = hir.int_to_ptr v93 : ptr; - hir.store v96, v92; + v108 = hir.load_local : i32 #[local = lv0]; + v109 = hir.exec @root_ns:root@1.0.0/pure_rust_add/intrinsics::mem::heap_base() : i32 + v110 = hir.mem_size : u32; + v116 = hir.bitcast v108 : u32; + v274 = arith.constant 4 : u32; + v118 = arith.mod v116, v274 : u32; + hir.assertz v118 #[code = 250]; + v273 = arith.constant 16 : u32; + v111 = hir.bitcast v110 : i32; + v114 = arith.shl v111, v273 : i32; + v115 = arith.add v109, v114 : i32 #[overflow = wrapping]; + v119 = hir.int_to_ptr v116 : ptr; + hir.store v119, v115; scf.yield ; }; - v99 = hir.bitcast v42 : u32; - v212 = arith.constant 4 : u32; - v101 = arith.mod v99, v212 : u32; - hir.assertz v101 #[code = 250]; - v102 = hir.int_to_ptr v99 : ptr; - v103 = hir.load v102 : i32; - v210 = arith.constant 0 : i32; - v211 = arith.constant -1 : i32; - v105 = arith.bxor v103, v211 : i32; - v107 = hir.bitcast v105 : u32; - v106 = hir.bitcast v78 : u32; - v108 = arith.gt v106, v107 : i1; - v109 = arith.zext v108 : u32; - v110 = hir.bitcast v109 : i32; - v112 = arith.neq v110, v210 : i1; - v203 = scf.if v112 : i32 { - ^block22: - v209 = arith.constant 0 : i32; - scf.yield v209; + v120 = hir.load_local : i32 #[local = lv2]; + v121 = hir.load_local : i32 #[local = lv0]; + v122 = hir.bitcast v121 : u32; + v272 = arith.constant 4 : u32; + v124 = arith.mod v122, v272 : u32; + hir.assertz v124 #[code = 250]; + v125 = hir.int_to_ptr v122 : ptr; + v126 = hir.load v125 : i32; + hir.store_local v126 #[local = lv4]; + v270 = arith.constant 0 : i32; + v271 = arith.constant -1 : i32; + v128 = arith.bxor v126, v271 : i32; + v130 = hir.bitcast v128 : u32; + v129 = hir.bitcast v120 : u32; + v131 = arith.gt v129, v130 : i1; + v132 = arith.zext v131 : u32; + v133 = hir.bitcast v132 : i32; + v135 = arith.neq v133, v270 : i1; + scf.if v135{ + ^block48: + scf.yield ; } else { ^block23: - v114 = hir.bitcast v42 : u32; - v208 = arith.constant 4 : u32; - v116 = arith.mod v114, v208 : u32; - hir.assertz v116 #[code = 250]; - v113 = arith.add v103, v78 : i32 #[overflow = wrapping]; - v117 = hir.int_to_ptr v114 : ptr; - hir.store v117, v113; - v119 = arith.add v103, v63 : i32 #[overflow = wrapping]; - scf.yield v119; + v136 = hir.load_local : i32 #[local = lv0]; + v137 = hir.load_local : i32 #[local = lv4]; + v138 = hir.load_local : i32 #[local = lv2]; + v140 = hir.bitcast v136 : u32; + v269 = arith.constant 4 : u32; + v142 = arith.mod v140, v269 : u32; + hir.assertz v142 #[code = 250]; + v139 = arith.add v137, v138 : i32 #[overflow = wrapping]; + v143 = hir.int_to_ptr v140 : ptr; + hir.store v143, v139; + v144 = hir.load_local : i32 #[local = lv4]; + v145 = hir.load_local : i32 #[local = lv1]; + v146 = arith.add v144, v145 : i32 #[overflow = wrapping]; + hir.store_local v146 #[local = lv3]; + scf.yield ; }; - scf.yield v203; + v147 = hir.load_local : i32 #[local = lv3]; + scf.yield v147; }; - v186 = arith.constant 1 : u32; - v207 = arith.constant 0 : u32; - v205 = cf.select v71, v207, v186 : u32; - scf.yield v204, v205; + v256 = arith.constant 1 : u32; + v268 = arith.constant 0 : u32; + v266 = cf.select v89, v268, v256 : u32; + scf.yield v265, v266; }; - v206 = arith.constant 0 : u32; - v202 = arith.eq v190, v206 : i1; - cf.cond_br v202 ^block17, ^block51(v189); + v267 = arith.constant 0 : u32; + v264 = arith.eq v260, v267 : i1; + cf.cond_br v264 ^block17, ^block53(v259); ^block17: ub.unreachable ; - ^block51(v182: i32): - builtin.ret v182; + ^block53(v252: i32): + builtin.ret v252; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { ^block24: - v122 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v122; + v148 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v148; }; - private builtin.function @::max(v124: i32, v125: i32) -> i32 { - ^block28(v124: i32, v125: i32): - v132 = arith.constant 0 : i32; - v128 = hir.bitcast v125 : u32; - v127 = hir.bitcast v124 : u32; - v129 = arith.gt v127, v128 : i1; - v130 = arith.zext v129 : u32; - v131 = hir.bitcast v130 : i32; - v133 = arith.neq v131, v132 : i1; - v134 = cf.select v133, v124, v125 : i32; - builtin.ret v134; + private builtin.function @::max(v150: i32, v151: i32) -> i32 { + ^block28(v150: i32, v151: i32): + v282 = arith.constant 0 : i32; + v158 = hir.bitcast v151 : u32; + v157 = hir.bitcast v150 : u32; + v159 = arith.gt v157, v158 : i1; + v160 = arith.zext v159 : u32; + v161 = hir.bitcast v160 : i32; + v163 = arith.neq v161, v282 : i1; + v164 = cf.select v163, v150, v151 : i32; + builtin.ret v164; }; - public builtin.function @cabi_realloc(v135: i32, v136: i32, v137: i32, v138: i32) -> i32 { - ^block30(v135: i32, v136: i32, v137: i32, v138: i32): - v140 = hir.exec @root_ns:root@1.0.0/pure_rust_add/cabi_realloc_wit_bindgen_0_46_0(v135, v136, v137, v138) : i32 - builtin.ret v140; + public builtin.function @cabi_realloc(v165: i32, v166: i32, v167: i32, v168: i32) -> i32 { + ^block30(v165: i32, v166: i32, v167: i32, v168: i32): + v174 = hir.exec @root_ns:root@1.0.0/pure_rust_add/cabi_realloc_wit_bindgen_0_46_0(v165, v166, v167, v168) : i32 + builtin.ret v174; }; - private builtin.function @alloc::alloc::alloc(v141: i32, v142: i32) -> i32 { - ^block32(v141: i32, v142: i32): + private builtin.function @alloc::alloc::alloc(v175: i32, v176: i32) -> i32 { + ^block32(v175: i32, v176: i32): + hir.store_local v175 #[local = lv0]; + hir.store_local v176 #[local = lv1]; hir.exec @root_ns:root@1.0.0/pure_rust_add/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v144 = hir.exec @root_ns:root@1.0.0/pure_rust_add/__rustc::__rust_alloc(v142, v141) : i32 - builtin.ret v144; + v178 = hir.load_local : i32 #[local = lv1]; + v179 = hir.load_local : i32 #[local = lv0]; + v180 = hir.exec @root_ns:root@1.0.0/pure_rust_add/__rustc::__rust_alloc(v178, v179) : i32 + builtin.ret v180; }; - private builtin.function @wit_bindgen::rt::cabi_realloc(v145: i32, v146: i32, v147: i32, v148: i32) -> i32 { - ^block34(v145: i32, v146: i32, v147: i32, v148: i32): - v150 = arith.constant 0 : i32; - v151 = arith.neq v146, v150 : i1; - v231, v232, v233 = scf.if v151 : i32, i32, u32 { + private builtin.function @wit_bindgen::rt::cabi_realloc(v181: i32, v182: i32, v183: i32, v184: i32) -> i32 { + ^block34(v181: i32, v182: i32, v183: i32, v184: i32): + hir.store_local v181 #[local = lv0]; + hir.store_local v182 #[local = lv1]; + hir.store_local v183 #[local = lv2]; + hir.store_local v184 #[local = lv3]; + v186 = hir.load_local : i32 #[local = lv1]; + v283 = arith.constant 0 : i32; + v188 = arith.neq v186, v283 : i1; + v292 = scf.if v188 : u32 { ^block38: - v159 = hir.exec @root_ns:root@1.0.0/pure_rust_add/__rustc::__rust_realloc(v145, v146, v147, v148) : i32 - v222 = arith.constant 0 : u32; - v226 = ub.poison i32 : i32; - scf.yield v159, v226, v222; + v199 = hir.load_local : i32 #[local = lv0]; + v200 = hir.load_local : i32 #[local = lv1]; + v201 = hir.load_local : i32 #[local = lv2]; + v202 = hir.load_local : i32 #[local = lv3]; + v203 = hir.exec @root_ns:root@1.0.0/pure_rust_add/__rustc::__rust_realloc(v199, v200, v201, v202) : i32 + hir.store_local v203 #[local = lv2]; + v288 = arith.constant 0 : u32; + scf.yield v288; } else { ^block39: - v261 = arith.constant 0 : i32; - v262 = arith.constant 0 : i32; - v153 = arith.eq v148, v262 : i1; - v154 = arith.zext v153 : u32; - v155 = hir.bitcast v154 : i32; - v157 = arith.neq v155, v261 : i1; - v249 = scf.if v157 : i32 { - ^block55: - v260 = ub.poison i32 : i32; - scf.yield v260; + v189 = hir.load_local : i32 #[local = lv3]; + v308 = arith.constant 0 : i32; + v309 = arith.constant 0 : i32; + v191 = arith.eq v189, v309 : i1; + v192 = arith.zext v191 : u32; + v193 = hir.bitcast v192 : i32; + v195 = arith.neq v193, v308 : i1; + scf.if v195{ + ^block56: + scf.yield ; } else { ^block40: - v158 = hir.exec @root_ns:root@1.0.0/pure_rust_add/alloc::alloc::alloc(v147, v148) : i32 - scf.yield v158; + v196 = hir.load_local : i32 #[local = lv2]; + v197 = hir.load_local : i32 #[local = lv3]; + v198 = hir.exec @root_ns:root@1.0.0/pure_rust_add/alloc::alloc::alloc(v196, v197) : i32 + hir.store_local v198 #[local = lv2]; + scf.yield ; }; - v258 = arith.constant 0 : u32; - v227 = arith.constant 1 : u32; - v251 = cf.select v157, v227, v258 : u32; - v259 = ub.poison i32 : i32; - v250 = cf.select v157, v147, v259 : i32; - scf.yield v249, v250, v251; + v307 = arith.constant 0 : u32; + v290 = arith.constant 1 : u32; + v301 = cf.select v195, v290, v307 : u32; + scf.yield v301; }; - v238, v239 = scf.index_switch v233 : i32, u32 + v295 = scf.index_switch v292 : u32 case 0 { ^block37: - v256 = arith.constant 0 : i32; - v162 = arith.neq v231, v256 : i1; - v253 = arith.constant 1 : u32; - v254 = arith.constant 0 : u32; - v248 = cf.select v162, v254, v253 : u32; - v255 = ub.poison i32 : i32; - v247 = cf.select v162, v231, v255 : i32; - scf.yield v247, v248; + v204 = hir.load_local : i32 #[local = lv2]; + v303 = arith.constant 1 : u32; + v304 = arith.constant 0 : u32; + v305 = arith.constant 0 : i32; + v206 = arith.neq v204, v305 : i1; + v300 = cf.select v206, v304, v303 : u32; + scf.yield v300; } default { - ^block62: - v257 = arith.constant 0 : u32; - scf.yield v232, v257; + ^block63: + v306 = arith.constant 0 : u32; + scf.yield v306; }; - v252 = arith.constant 0 : u32; - v246 = arith.eq v239, v252 : i1; - cf.cond_br v246 ^block57, ^block58; - ^block57: - builtin.ret v238; - ^block58: + v302 = arith.constant 0 : u32; + v299 = arith.eq v295, v302 : i1; + cf.cond_br v299 ^block36, ^block59; + ^block36: + v207 = hir.load_local : i32 #[local = lv2]; + builtin.ret v207; + ^block59: ub.unreachable ; }; - public builtin.function @cabi_realloc_wit_bindgen_0_46_0(v164: i32, v165: i32, v166: i32, v167: i32) -> i32 { - ^block42(v164: i32, v165: i32, v166: i32, v167: i32): - v169 = hir.exec @root_ns:root@1.0.0/pure_rust_add/wit_bindgen::rt::cabi_realloc(v164, v165, v166, v167) : i32 - builtin.ret v169; + public builtin.function @cabi_realloc_wit_bindgen_0_46_0(v208: i32, v209: i32, v210: i32, v211: i32) -> i32 { + ^block42(v208: i32, v209: i32, v210: i32, v211: i32): + v217 = hir.exec @root_ns:root@1.0.0/pure_rust_add/wit_bindgen::rt::cabi_realloc(v208, v209, v210, v211) : i32 + builtin.ret v217; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.hir index ad44ae53e..17fada947 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.hir @@ -12,301 +12,166 @@ builtin.component miden:rust-sdk-account-asset-build-fungible-asset-binding/rust private builtin.function @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1#binding() -> i32 { ^block9: - v2 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__stack_pointer : ptr - v3 = hir.bitcast v2 : ptr; - v4 = hir.load v3 : i32; - v5 = arith.constant 16 : i32; - v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; - v7 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__stack_pointer : ptr - v8 = hir.bitcast v7 : ptr; - hir.store v8, v6; + v1 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v172 = arith.constant 16 : i32; + v5 = arith.sub v3, v172 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/wit_bindgen::rt::run_ctors_once() - v9 = arith.constant 1 : i32; - v10 = hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/intrinsics::felt::from_u32(v9) : felt - v1 = arith.constant 0 : i32; - v12 = hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/intrinsics::felt::from_u32(v1) : felt - v13 = arith.constant 10 : i32; - v14 = hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/intrinsics::felt::from_u32(v13) : felt - hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/miden_base_sys::bindings::asset::build_fungible_asset(v6, v10, v12, v14) + v8 = hir.load_local : i32 #[local = lv0]; + v166 = arith.constant 10 : felt; + v167 = arith.constant 0 : felt; + v168 = arith.constant 1 : felt; + hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/miden_base_sys::bindings::asset::build_fungible_asset(v8, v168, v167, v166) v15 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/GOT.data.internal.__memory_base : ptr v16 = hir.bitcast v15 : ptr; v17 = hir.load v16 : i32; - v18 = arith.constant 1048584 : i32; - v19 = arith.add v17, v18 : i32 #[overflow = wrapping]; - v21 = arith.constant 8 : u32; - v20 = hir.bitcast v6 : u32; - v22 = arith.add v20, v21 : u32 #[overflow = checked]; - v259 = arith.constant 8 : u32; - v24 = arith.mod v22, v259 : u32; - hir.assertz v24 #[code = 250]; - v25 = hir.int_to_ptr v22 : ptr; - v26 = hir.load v25 : i64; - v258 = arith.constant 8 : u32; - v27 = hir.bitcast v19 : u32; - v29 = arith.add v27, v258 : u32 #[overflow = checked]; - v30 = arith.constant 4 : u32; - v31 = arith.mod v29, v30 : u32; - hir.assertz v31 #[code = 250]; - v32 = hir.int_to_ptr v29 : ptr; - hir.store v32, v26; - v33 = hir.bitcast v6 : u32; - v257 = arith.constant 8 : u32; - v35 = arith.mod v33, v257 : u32; - hir.assertz v35 #[code = 250]; - v36 = hir.int_to_ptr v33 : ptr; - v37 = hir.load v36 : i64; - v38 = hir.bitcast v19 : u32; - v256 = arith.constant 4 : u32; - v40 = arith.mod v38, v256 : u32; - hir.assertz v40 #[code = 250]; - v41 = hir.int_to_ptr v38 : ptr; - hir.store v41, v37; - v255 = arith.constant 16 : i32; - v43 = arith.add v6, v255 : i32 #[overflow = wrapping]; - v44 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__stack_pointer : ptr - v45 = hir.bitcast v44 : ptr; - hir.store v45, v43; - builtin.ret v19; + v171 = arith.constant 1048584 : i32; + v19 = arith.add v17, v171 : i32 #[overflow = wrapping]; + hir.store_local v19 #[local = lv1]; + v20 = hir.load_local : i32 #[local = lv0]; + v170 = arith.constant 8 : u32; + v21 = hir.bitcast v20 : u32; + v23 = arith.add v21, v170 : u32 #[overflow = checked]; + v182 = arith.constant 8 : u32; + v25 = arith.mod v23, v182 : u32; + hir.assertz v25 #[code = 250]; + v26 = hir.int_to_ptr v23 : ptr; + v27 = hir.load v26 : i64; + v181 = arith.constant 8 : u32; + v28 = hir.bitcast v19 : u32; + v30 = arith.add v28, v181 : u32 #[overflow = checked]; + v169 = arith.constant 4 : u32; + v32 = arith.mod v30, v169 : u32; + hir.assertz v32 #[code = 250]; + v33 = hir.int_to_ptr v30 : ptr; + hir.store v33, v27; + v34 = hir.load_local : i32 #[local = lv1]; + v35 = hir.load_local : i32 #[local = lv0]; + v36 = hir.bitcast v35 : u32; + v180 = arith.constant 8 : u32; + v38 = arith.mod v36, v180 : u32; + hir.assertz v38 #[code = 250]; + v39 = hir.int_to_ptr v36 : ptr; + v40 = hir.load v39 : i64; + v41 = hir.bitcast v34 : u32; + v179 = arith.constant 4 : u32; + v43 = arith.mod v41, v179 : u32; + hir.assertz v43 #[code = 250]; + v44 = hir.int_to_ptr v41 : ptr; + hir.store v44, v40; + v45 = hir.load_local : i32 #[local = lv0]; + v178 = arith.constant 16 : i32; + v47 = arith.add v45, v178 : i32 #[overflow = wrapping]; + v48 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__stack_pointer : ptr + v49 = hir.bitcast v48 : ptr; + hir.store v49, v47; + v50 = hir.load_local : i32 #[local = lv1]; + builtin.ret v50; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v47 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/GOT.data.internal.__memory_base : ptr - v48 = hir.bitcast v47 : ptr; - v49 = hir.load v48 : i32; - v50 = arith.constant 1048600 : i32; - v51 = arith.add v49, v50 : i32 #[overflow = wrapping]; - v52 = hir.bitcast v51 : u32; - v53 = hir.int_to_ptr v52 : ptr; - v54 = hir.load v53 : u8; - v46 = arith.constant 0 : i32; - v55 = arith.zext v54 : u32; - v56 = hir.bitcast v55 : i32; - v58 = arith.neq v56, v46 : i1; - scf.if v58{ + v51 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v52 = hir.bitcast v51 : ptr; + v53 = hir.load v52 : i32; + v187 = arith.constant 1048600 : i32; + v55 = arith.add v53, v187 : i32 #[overflow = wrapping]; + v56 = hir.bitcast v55 : u32; + v57 = hir.int_to_ptr v56 : ptr; + v58 = hir.load v57 : u8; + v186 = arith.constant 0 : i32; + v59 = arith.zext v58 : u32; + v60 = hir.bitcast v59 : i32; + v62 = arith.neq v60, v186 : i1; + scf.if v62{ ^block13: scf.yield ; } else { ^block14: - v59 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/GOT.data.internal.__memory_base : ptr - v60 = hir.bitcast v59 : ptr; - v61 = hir.load v60 : i32; + v63 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v64 = hir.bitcast v63 : ptr; + v65 = hir.load v64 : i32; + hir.store_local v65 #[local = lv0]; hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__wasm_call_ctors() - v261 = arith.constant 1 : u8; - v263 = arith.constant 1048600 : i32; - v63 = arith.add v61, v263 : i32 #[overflow = wrapping]; - v67 = hir.bitcast v63 : u32; - v68 = hir.int_to_ptr v67 : ptr; - hir.store v68, v261; + v66 = hir.load_local : i32 #[local = lv0]; + v185 = arith.constant 1 : u8; + v190 = arith.constant 1048600 : i32; + v68 = arith.add v66, v190 : i32 #[overflow = wrapping]; + v72 = hir.bitcast v68 : u32; + v73 = hir.int_to_ptr v72 : ptr; + hir.store v73, v185; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::asset::build_fungible_asset(v69: i32, v70: felt, v71: felt, v72: felt) { - ^block15(v69: i32, v70: felt, v71: felt, v72: felt): - v74 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__stack_pointer : ptr - v75 = hir.bitcast v74 : ptr; - v76 = hir.load v75 : i32; - v77 = arith.constant 32 : i32; - v78 = arith.sub v76, v77 : i32 #[overflow = wrapping]; - v79 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__stack_pointer : ptr - v80 = hir.bitcast v79 : ptr; - hir.store v80, v78; - hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/miden::asset::build_fungible_asset(v70, v71, v72, v78) - v82 = arith.constant 8 : u32; - v81 = hir.bitcast v78 : u32; - v83 = arith.add v81, v82 : u32 #[overflow = checked]; - v268 = arith.constant 8 : u32; - v85 = arith.mod v83, v268 : u32; - hir.assertz v85 #[code = 250]; - v86 = hir.int_to_ptr v83 : ptr; - v87 = hir.load v86 : i64; - v89 = arith.constant 24 : u32; - v88 = hir.bitcast v78 : u32; - v90 = arith.add v88, v89 : u32 #[overflow = checked]; - v267 = arith.constant 8 : u32; - v92 = arith.mod v90, v267 : u32; - hir.assertz v92 #[code = 250]; - v93 = hir.int_to_ptr v90 : ptr; - hir.store v93, v87; - v94 = hir.bitcast v78 : u32; - v266 = arith.constant 8 : u32; - v96 = arith.mod v94, v266 : u32; - hir.assertz v96 #[code = 250]; - v97 = hir.int_to_ptr v94 : ptr; - v98 = hir.load v97 : i64; - v100 = arith.constant 16 : u32; - v99 = hir.bitcast v78 : u32; - v101 = arith.add v99, v100 : u32 #[overflow = checked]; - v265 = arith.constant 8 : u32; - v103 = arith.mod v101, v265 : u32; + private builtin.function @miden_base_sys::bindings::asset::build_fungible_asset(v74: i32, v75: felt, v76: felt, v77: felt) { + ^block15(v74: i32, v75: felt, v76: felt, v77: felt): + hir.store_local v74 #[local = lv0]; + v78 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__stack_pointer : ptr + v79 = hir.bitcast v78 : ptr; + v80 = hir.load v79 : i32; + v198 = arith.constant 16 : i32; + v82 = arith.sub v80, v198 : i32 #[overflow = wrapping]; + hir.store_local v82 #[local = lv4]; + v83 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__stack_pointer : ptr + v84 = hir.bitcast v83 : ptr; + hir.store v84, v82; + v88 = hir.load_local : i32 #[local = lv4]; + hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/miden::protocol::asset::build_fungible_asset(v75, v76, v77, v88) + v89 = hir.load_local : i32 #[local = lv0]; + v90 = hir.load_local : i32 #[local = lv4]; + v91 = hir.bitcast v90 : u32; + v197 = arith.constant 8 : u32; + v93 = arith.mod v91, v197 : u32; + hir.assertz v93 #[code = 250]; + v94 = hir.int_to_ptr v91 : ptr; + v95 = hir.load v94 : i64; + v194, v195 = arith.split v95 : felt, felt; + v210 = arith.constant 8 : u32; + v99 = hir.bitcast v89 : u32; + v101 = arith.add v99, v210 : u32 #[overflow = checked]; + v209 = arith.constant 8 : u32; + v103 = arith.mod v101, v209 : u32; hir.assertz v103 #[code = 250]; + v196 = arith.join v195, v194 : i64; v104 = hir.int_to_ptr v101 : ptr; - hir.store v104, v98; - v105 = arith.constant 16 : i32; - v106 = arith.add v78, v105 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/::reverse(v69, v106) - v264 = arith.constant 32 : i32; - v108 = arith.add v78, v264 : i32 #[overflow = wrapping]; - v109 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__stack_pointer : ptr - v110 = hir.bitcast v109 : ptr; - hir.store v110, v108; + hir.store v104, v196; + v105 = hir.load_local : i32 #[local = lv0]; + v106 = hir.load_local : i32 #[local = lv4]; + v208 = arith.constant 8 : u32; + v107 = hir.bitcast v106 : u32; + v109 = arith.add v107, v208 : u32 #[overflow = checked]; + v207 = arith.constant 8 : u32; + v111 = arith.mod v109, v207 : u32; + hir.assertz v111 #[code = 250]; + v112 = hir.int_to_ptr v109 : ptr; + v113 = hir.load v112 : i64; + v191, v192 = arith.split v113 : felt, felt; + v117 = hir.bitcast v105 : u32; + v206 = arith.constant 8 : u32; + v119 = arith.mod v117, v206 : u32; + hir.assertz v119 #[code = 250]; + v193 = arith.join v192, v191 : i64; + v120 = hir.int_to_ptr v117 : ptr; + hir.store v120, v193; + v121 = hir.load_local : i32 #[local = lv4]; + v205 = arith.constant 16 : i32; + v123 = arith.add v121, v205 : i32 #[overflow = wrapping]; + v124 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__stack_pointer : ptr + v125 = hir.bitcast v124 : ptr; + hir.store v125, v123; builtin.ret ; }; - private builtin.function @::reverse(v111: i32, v112: i32) { - ^block17(v111: i32, v112: i32): - v115 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__stack_pointer : ptr - v116 = hir.bitcast v115 : ptr; - v117 = hir.load v116 : i32; - v118 = arith.constant 16 : i32; - v119 = arith.sub v117, v118 : i32 #[overflow = wrapping]; - v121 = arith.constant 8 : u32; - v120 = hir.bitcast v112 : u32; - v122 = arith.add v120, v121 : u32 #[overflow = checked]; - v355 = arith.constant 8 : u32; - v124 = arith.mod v122, v355 : u32; - hir.assertz v124 #[code = 250]; - v125 = hir.int_to_ptr v122 : ptr; - v126 = hir.load v125 : i64; - v354 = arith.constant 8 : u32; - v127 = hir.bitcast v119 : u32; - v129 = arith.add v127, v354 : u32 #[overflow = checked]; - v130 = arith.constant 4 : u32; - v131 = arith.mod v129, v130 : u32; - hir.assertz v131 #[code = 250]; - v132 = hir.int_to_ptr v129 : ptr; - hir.store v132, v126; - v133 = hir.bitcast v112 : u32; - v353 = arith.constant 8 : u32; - v135 = arith.mod v133, v353 : u32; - hir.assertz v135 #[code = 250]; - v136 = hir.int_to_ptr v133 : ptr; - v137 = hir.load v136 : i64; - v138 = hir.bitcast v119 : u32; - v352 = arith.constant 4 : u32; - v140 = arith.mod v138, v352 : u32; - hir.assertz v140 #[code = 250]; - v141 = hir.int_to_ptr v138 : ptr; - hir.store v141, v137; - v142 = arith.constant 12 : i32; - v143 = arith.add v119, v142 : i32 #[overflow = wrapping]; - v113 = arith.constant 0 : i32; - v323, v324, v325, v326, v327, v328 = scf.while v113, v119, v143, v111 : i32, i32, i32, i32, i32, i32 { - ^block39(v329: i32, v330: i32, v331: i32, v332: i32): - v351 = arith.constant 0 : i32; - v146 = arith.constant 8 : i32; - v147 = arith.eq v329, v146 : i1; - v148 = arith.zext v147 : u32; - v149 = hir.bitcast v148 : i32; - v151 = arith.neq v149, v351 : i1; - v317, v318 = scf.if v151 : i32, i32 { - ^block38: - v277 = ub.poison i32 : i32; - scf.yield v277, v277; - } else { - ^block22: - v153 = arith.add v330, v329 : i32 #[overflow = wrapping]; - v154 = hir.bitcast v153 : u32; - v350 = arith.constant 4 : u32; - v156 = arith.mod v154, v350 : u32; - hir.assertz v156 #[code = 250]; - v157 = hir.int_to_ptr v154 : ptr; - v158 = hir.load v157 : felt; - v160 = hir.bitcast v331 : u32; - v349 = arith.constant 4 : u32; - v162 = arith.mod v160, v349 : u32; - hir.assertz v162 #[code = 250]; - v163 = hir.int_to_ptr v160 : ptr; - v164 = hir.load v163 : i32; - v165 = hir.bitcast v153 : u32; - v348 = arith.constant 4 : u32; - v167 = arith.mod v165, v348 : u32; - hir.assertz v167 #[code = 250]; - v168 = hir.int_to_ptr v165 : ptr; - hir.store v168, v164; - v169 = hir.bitcast v331 : u32; - v347 = arith.constant 4 : u32; - v171 = arith.mod v169, v347 : u32; - hir.assertz v171 #[code = 250]; - v172 = hir.int_to_ptr v169 : ptr; - hir.store v172, v158; - v175 = arith.constant -4 : i32; - v176 = arith.add v331, v175 : i32 #[overflow = wrapping]; - v173 = arith.constant 4 : i32; - v174 = arith.add v329, v173 : i32 #[overflow = wrapping]; - scf.yield v174, v176; - }; - v345 = ub.poison i32 : i32; - v320 = cf.select v151, v345, v332 : i32; - v346 = ub.poison i32 : i32; - v319 = cf.select v151, v346, v330 : i32; - v276 = arith.constant 1 : u32; - v269 = arith.constant 0 : u32; - v322 = cf.select v151, v269, v276 : u32; - v310 = arith.trunc v322 : i1; - scf.condition v310, v317, v319, v318, v320, v330, v332; - } do { - ^block40(v333: i32, v334: i32, v335: i32, v336: i32, v337: i32, v338: i32): - scf.yield v333, v334, v335, v336; - }; - v344 = arith.constant 8 : u32; - v178 = hir.bitcast v327 : u32; - v180 = arith.add v178, v344 : u32 #[overflow = checked]; - v343 = arith.constant 4 : u32; - v182 = arith.mod v180, v343 : u32; - hir.assertz v182 #[code = 250]; - v183 = hir.int_to_ptr v180 : ptr; - v184 = hir.load v183 : i64; - v342 = arith.constant 8 : u32; - v185 = hir.bitcast v328 : u32; - v187 = arith.add v185, v342 : u32 #[overflow = checked]; - v341 = arith.constant 8 : u32; - v189 = arith.mod v187, v341 : u32; - hir.assertz v189 #[code = 250]; - v190 = hir.int_to_ptr v187 : ptr; - hir.store v190, v184; - v191 = hir.bitcast v327 : u32; - v340 = arith.constant 4 : u32; - v193 = arith.mod v191, v340 : u32; - hir.assertz v193 #[code = 250]; - v194 = hir.int_to_ptr v191 : ptr; - v195 = hir.load v194 : i64; - v196 = hir.bitcast v328 : u32; - v339 = arith.constant 8 : u32; - v198 = arith.mod v196, v339 : u32; - hir.assertz v198 #[code = 250]; - v199 = hir.int_to_ptr v196 : ptr; - hir.store v199, v195; - builtin.ret ; - }; - - private builtin.function @intrinsics::felt::from_u32(v200: i32) -> felt { - ^block23(v200: i32): - v201 = hir.bitcast v200 : felt; - builtin.ret v201; - }; - - private builtin.function @miden::asset::build_fungible_asset(v203: felt, v204: felt, v205: felt, v206: i32) { - ^block25(v203: felt, v204: felt, v205: felt, v206: i32): - v207, v208, v209, v210 = hir.exec @miden/asset/build_fungible_asset(v203, v204, v205) : felt, felt, felt, felt - v211 = hir.bitcast v206 : u32; - v212 = hir.int_to_ptr v211 : ptr; - hir.store v212, v207; - v213 = arith.constant 4 : u32; - v214 = arith.add v211, v213 : u32 #[overflow = checked]; - v215 = hir.int_to_ptr v214 : ptr; - hir.store v215, v208; - v216 = arith.constant 8 : u32; - v217 = arith.add v211, v216 : u32 #[overflow = checked]; - v218 = hir.int_to_ptr v217 : ptr; - hir.store v218, v209; - v219 = arith.constant 12 : u32; - v220 = arith.add v211, v219 : u32 #[overflow = checked]; - v221 = hir.int_to_ptr v220 : ptr; - hir.store v221, v210; - builtin.ret ; + private builtin.function @miden::protocol::asset::build_fungible_asset(v126: felt, v127: felt, v128: felt, v129: i32) { + ^block17(v126: felt, v127: felt, v128: felt, v129: i32): + ub.unreachable ; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -321,36 +186,36 @@ builtin.component miden:rust-sdk-account-asset-build-fungible-asset-binding/rust }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block29: - v222 = hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1#binding() : i32 - v361 = arith.constant 0 : i32; + ^block19: + v130 = hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1#binding() : i32 + v226 = arith.constant 0 : i32; + v220 = arith.constant 0 : i32; + v132 = arith.add v130, v220 : i32 #[overflow = unchecked]; + v134 = arith.add v132, v226 : i32 #[overflow = unchecked]; + v224 = arith.constant 0 : i32; + v225 = arith.constant 0 : i32; + v136 = arith.add v134, v225 : i32 #[overflow = unchecked]; + v138 = arith.add v136, v224 : i32 #[overflow = unchecked]; + v139 = hir.int_to_ptr v138 : ptr; + v140 = hir.load v139 : felt; v223 = arith.constant 0 : i32; - v224 = arith.add v222, v223 : i32 #[overflow = unchecked]; - v226 = arith.add v224, v361 : i32 #[overflow = unchecked]; - v359 = arith.constant 0 : i32; - v360 = arith.constant 0 : i32; - v228 = arith.add v226, v360 : i32 #[overflow = unchecked]; - v230 = arith.add v228, v359 : i32 #[overflow = unchecked]; - v231 = hir.int_to_ptr v230 : ptr; - v232 = hir.load v231 : felt; - v358 = arith.constant 0 : i32; - v233 = arith.constant 4 : i32; - v234 = arith.add v226, v233 : i32 #[overflow = unchecked]; - v236 = arith.add v234, v358 : i32 #[overflow = unchecked]; - v237 = hir.int_to_ptr v236 : ptr; - v238 = hir.load v237 : felt; - v357 = arith.constant 0 : i32; - v239 = arith.constant 8 : i32; - v240 = arith.add v226, v239 : i32 #[overflow = unchecked]; - v242 = arith.add v240, v357 : i32 #[overflow = unchecked]; - v243 = hir.int_to_ptr v242 : ptr; - v244 = hir.load v243 : felt; - v356 = arith.constant 0 : i32; - v245 = arith.constant 12 : i32; - v246 = arith.add v226, v245 : i32 #[overflow = unchecked]; - v248 = arith.add v246, v356 : i32 #[overflow = unchecked]; - v249 = hir.int_to_ptr v248 : ptr; - v250 = hir.load v249 : felt; - builtin.ret v232, v238, v244, v250; + v213 = arith.constant 4 : i32; + v142 = arith.add v134, v213 : i32 #[overflow = unchecked]; + v144 = arith.add v142, v223 : i32 #[overflow = unchecked]; + v145 = hir.int_to_ptr v144 : ptr; + v146 = hir.load v145 : felt; + v222 = arith.constant 0 : i32; + v212 = arith.constant 8 : i32; + v148 = arith.add v134, v212 : i32 #[overflow = unchecked]; + v150 = arith.add v148, v222 : i32 #[overflow = unchecked]; + v151 = hir.int_to_ptr v150 : ptr; + v152 = hir.load v151 : felt; + v221 = arith.constant 0 : i32; + v211 = arith.constant 12 : i32; + v154 = arith.add v134, v211 : i32 #[overflow = unchecked]; + v156 = arith.add v154, v221 : i32 #[overflow = unchecked]; + v157 = hir.int_to_ptr v156 : ptr; + v158 = hir.load v157 : felt; + builtin.ret v140, v146, v152, v158; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.masm index 876b3ccb7..c9dc56af8 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.masm @@ -1,13 +1,13 @@ -# mod miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1 +# mod ::"miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> (felt, felt, felt, felt) - exec.::miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1::init + exec."miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_fungible_asset_binding::miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1#binding + exec.::"miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1"::rust_sdk_account_asset_build_fungible_asset_binding::"miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1#binding" trace.252 nop push.0 @@ -65,7 +65,7 @@ pub proc binding( nop movdn.3 swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -78,7 +78,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -89,7 +89,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_fungible_asset_binding +# mod ::"miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1"::rust_sdk_account_asset_build_fungible_asset_binding @callconv("C") proc __wasm_call_ctors( @@ -105,6 +105,7 @@ proc rust_sdk_account_asset_build_fungible_asset_binding::bindings::__link_custo nop end +@locals("2") @callconv("C") proc miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1#binding( @@ -119,60 +120,74 @@ proc miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account- nop push.16 u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 + dup.0 + locaddr.0 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::store_sw trace.252 nop + push.1114144 + u32divmod.4 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_fungible_asset_binding::wit_bindgen::rt::run_ctors_once + exec.::intrinsics::mem::store_sw trace.252 nop - push.1 trace.240 nop - exec.::miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_fungible_asset_binding::intrinsics::felt::from_u32 + exec.::"miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1"::rust_sdk_account_asset_build_fungible_asset_binding::wit_bindgen::rt::run_ctors_once trace.252 nop + locaddr.0 push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_fungible_asset_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop push.10 + push.0 + push.1 + movup.3 trace.240 nop - exec.::miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_fungible_asset_binding::intrinsics::felt::from_u32 + exec.::"miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1"::rust_sdk_account_asset_build_fungible_asset_binding::miden_base_sys::bindings::asset::build_fungible_asset trace.252 nop - dup.3 + push.1114148 + u32divmod.4 swap.1 - swap.3 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + dup.0 + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_fungible_asset_binding::miden_base_sys::bindings::asset::build_fungible_asset + exec.::intrinsics::mem::store_sw trace.252 nop - push.1114148 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 - u32wrapping_add push.8 - dup.2 + swap.1 add u32assert push.8 @@ -190,7 +205,7 @@ proc miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account- nop swap.1 push.8 - dup.3 + movup.3 add u32assert push.4 @@ -208,7 +223,22 @@ proc miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account- exec.::intrinsics::mem::store_dw trace.252 nop - dup.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 dup.1 swap.1 @@ -223,7 +253,7 @@ proc miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account- trace.252 nop swap.1 - dup.2 + movup.2 push.4 dup.1 swap.1 @@ -239,8 +269,15 @@ proc miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account- exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - movup.2 u32wrapping_add push.1114144 u32divmod.4 @@ -250,8 +287,17 @@ proc miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account- exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -293,9 +339,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1"::rust_sdk_account_asset_build_fungible_asset_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_fungible_asset_binding::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -326,6 +388,7 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("5") @callconv("C") proc miden_base_sys::bindings::asset::build_fungible_asset( i32, @@ -333,150 +396,71 @@ proc miden_base_sys::bindings::asset::build_fungible_asset( felt, felt ) - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::store_sw trace.252 nop - push.32 - u32wrapping_sub push.1114144 - dup.1 - swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop + push.16 + u32wrapping_sub dup.0 - movup.2 - swap.5 - movdn.2 - swap.1 - swap.4 - swap.1 - swap.3 - trace.240 - nop - exec.::miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_fungible_asset_binding::miden::asset::build_fungible_asset - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.4 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_sw trace.252 nop - swap.1 - push.24 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.1114144 u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop - dup.0 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.4 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop - swap.1 - push.16 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.16 - dup.1 - u32wrapping_add - movup.2 - trace.240 - nop - exec.::miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_fungible_asset_binding::::reverse + exec.::"miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1"::rust_sdk_account_asset_build_fungible_asset_binding::"miden::protocol::asset::build_fungible_asset" trace.252 nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop -end - -@callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 + locaddr.4 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert push.8 dup.1 swap.1 @@ -492,15 +476,17 @@ proc ::reverse( nop swap.1 push.8 - dup.3 + movup.3 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -510,182 +496,24 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.12 - dup.1 - u32wrapping_add + locaddr.4 push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop - swap.1 push.8 - dup.4 + swap.1 add u32assert push.8 @@ -696,21 +524,6 @@ proc ::reverse( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 trace.240 nop exec.::intrinsics::mem::load_dw @@ -724,6 +537,8 @@ proc ::reverse( u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -733,66 +548,34 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc miden::asset::build_fungible_asset(felt, felt, felt, i32) - trace.240 - nop - exec.::miden::asset::build_fungible_asset - trace.252 - nop - movup.4 - dup.0 - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 + locaddr.4 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_sw trace.252 nop - push.12 - add - u32assert + push.16 + u32wrapping_add + push.1114144 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::store_sw trace.252 nop end +@locals("4") +@callconv("C") +proc miden::protocol::asset::build_fungible_asset(felt, felt, felt, i32) + drop + drop + drop + drop + push.0 + assert +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.wat index 86a1834f9..52becdace 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.wat @@ -15,9 +15,8 @@ (type (;0;) (func)) (type (;1;) (func (result i32))) (type (;2;) (func (param i32 f32 f32 f32))) - (type (;3;) (func (param i32 i32))) - (type (;4;) (func (param i32) (result f32))) - (type (;5;) (func (param f32 f32 f32 i32))) + (type (;3;) (func (param i32) (result f32))) + (type (;4;) (func (param f32 f32 f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -81,7 +80,7 @@ (func $miden_base_sys::bindings::asset::build_fungible_asset (;4;) (type 2) (param i32 f32 f32 f32) (local i32) global.get $__stack_pointer - i32.const 32 + i32.const 16 i32.sub local.tee 4 global.set $__stack_pointer @@ -89,91 +88,32 @@ local.get 2 local.get 3 local.get 4 - call $miden::asset::build_fungible_asset - local.get 4 - local.get 4 - i64.load offset=8 - i64.store offset=24 - local.get 4 + call $miden::protocol::asset::build_fungible_asset + local.get 0 local.get 4 i64.load - i64.store offset=16 + i64.const 32 + i64.rotl + i64.store offset=8 local.get 0 local.get 4 - i32.const 16 - i32.add - call $::reverse + i64.load offset=8 + i64.const 32 + i64.rotl + i64.store local.get 4 - i32.const 32 - i32.add - global.set $__stack_pointer - ) - (func $::reverse (;5;) (type 3) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store + global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) unreachable ) - (func $miden::asset::build_fungible_asset (;7;) (type 5) (param f32 f32 f32 i32) + (func $miden::protocol::asset::build_fungible_asset (;6;) (type 4) (param f32 f32 f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "grust_sdk_account_asset_build_fungible_asset_binding\01\0b0.0.1\03\01\01\00\00") + (@custom "rodata,miden_account" (after data) "grust_sdk_account_asset_build_fungible_asset_binding\01\0b0.0.1\03\01\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "asset" (type $asset (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.hir index 74e038fd9..99adbc0d7 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.hir @@ -12,410 +12,285 @@ builtin.component miden:rust-sdk-account-asset-build-non-fungible-asset-binding/ private builtin.function @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1#binding() -> i32 { ^block9: - v3 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr - v4 = hir.bitcast v3 : ptr; - v5 = hir.load v4 : i32; - v6 = arith.constant 32 : i32; - v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; - v8 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr - v9 = hir.bitcast v8 : ptr; - hir.store v9, v7; + v1 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v262 = arith.constant 32 : i32; + v5 = arith.sub v3, v262 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/wit_bindgen::rt::run_ctors_once() - v11 = arith.constant 1 : i32; - v12 = hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/intrinsics::felt::from_u32(v11) : felt - v1 = arith.constant 0 : i32; - v14 = hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/intrinsics::felt::from_u32(v1) : felt - v443 = arith.constant 0 : i32; - v16 = hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/intrinsics::felt::from_u32(v443) : felt - v442 = arith.constant 0 : i32; - v403, v404, v405, v406, v407, v408, v409, v410 = scf.while v442, v7, v16, v12, v14 : i32, i32, felt, felt, felt, i32, felt, felt { - ^block42(v411: i32, v412: i32, v413: felt, v414: felt, v415: felt): - v441 = arith.constant 0 : i32; - v59 = arith.constant 16 : i32; - v19 = arith.eq v411, v59 : i1; - v20 = arith.zext v19 : u32; - v21 = hir.bitcast v20 : i32; - v23 = arith.neq v21, v441 : i1; - v396 = scf.if v23 : i32 { - ^block41: - v343 = ub.poison i32 : i32; - scf.yield v343; + v261 = arith.constant 0 : i32; + hir.store_local v261 #[local = lv1]; + v253 = arith.constant 1 : felt; + hir.store_local v253 #[local = lv2]; + v252 = arith.constant 0 : felt; + hir.store_local v252 #[local = lv3]; + v304 = arith.constant 0 : felt; + hir.store_local v304 #[local = lv4]; + scf.while { + ^block12: + v15 = hir.load_local : i32 #[local = lv1]; + v303 = arith.constant 0 : i32; + v266 = arith.constant 16 : i32; + v17 = arith.eq v15, v266 : i1; + v18 = arith.zext v17 : u32; + v19 = hir.bitcast v18 : i32; + v21 = arith.neq v19, v303 : i1; + scf.if v21{ + ^block31: + scf.yield ; } else { ^block14: - v440 = arith.constant 16 : i32; - v26 = arith.add v412, v440 : i32 #[overflow = wrapping]; - v27 = arith.add v26, v411 : i32 #[overflow = wrapping]; - v29 = hir.bitcast v27 : u32; - v38 = arith.constant 4 : u32; - v31 = arith.mod v29, v38 : u32; - hir.assertz v31 #[code = 250]; - v32 = hir.int_to_ptr v29 : ptr; - hir.store v32, v413; - v33 = arith.constant 4 : i32; - v34 = arith.add v411, v33 : i32 #[overflow = wrapping]; - scf.yield v34; + v22 = hir.load_local : i32 #[local = lv0]; + v25 = hir.load_local : i32 #[local = lv1]; + v27 = hir.load_local : felt #[local = lv4]; + v302 = arith.constant 16 : i32; + v24 = arith.add v22, v302 : i32 #[overflow = wrapping]; + v26 = arith.add v24, v25 : i32 #[overflow = wrapping]; + v28 = hir.bitcast v26 : u32; + v263 = arith.constant 4 : u32; + v30 = arith.mod v28, v263 : u32; + hir.assertz v30 #[code = 250]; + v31 = hir.int_to_ptr v28 : ptr; + hir.store v31, v27; + v32 = hir.load_local : i32 #[local = lv1]; + v254 = arith.constant 4 : i32; + v34 = arith.add v32, v254 : i32 #[overflow = wrapping]; + hir.store_local v34 #[local = lv1]; + scf.yield ; }; - v437 = ub.poison felt : felt; - v400 = cf.select v23, v437, v415 : felt; - v438 = ub.poison felt : felt; - v399 = cf.select v23, v438, v414 : felt; - v344 = ub.poison felt : felt; - v398 = cf.select v23, v344, v413 : felt; - v439 = ub.poison i32 : i32; - v397 = cf.select v23, v439, v412 : i32; - v342 = arith.constant 1 : u32; - v334 = arith.constant 0 : u32; - v402 = cf.select v23, v334, v342 : u32; - v388 = arith.trunc v402 : i1; - scf.condition v388, v396, v397, v398, v399, v400, v412, v414, v415; + v283 = arith.constant 1 : u32; + v280 = arith.constant 0 : u32; + v288 = cf.select v21, v280, v283 : u32; + v284 = arith.trunc v288 : i1; + scf.condition v284; } do { - ^block43(v416: i32, v417: i32, v418: felt, v419: felt, v420: felt, v421: i32, v422: felt, v423: felt): - scf.yield v416, v417, v418, v419, v420; + ^block30: + scf.yield ; }; - v36 = arith.constant 24 : u32; - v35 = hir.bitcast v408 : u32; - v37 = arith.add v35, v36 : u32 #[overflow = checked]; - v436 = arith.constant 4 : u32; - v39 = arith.mod v37, v436 : u32; - hir.assertz v39 #[code = 250]; - v40 = hir.int_to_ptr v37 : ptr; - v41 = hir.load v40 : i64; - v43 = arith.constant 8 : u32; - v42 = hir.bitcast v408 : u32; - v44 = arith.add v42, v43 : u32 #[overflow = checked]; - v435 = arith.constant 8 : u32; - v46 = arith.mod v44, v435 : u32; - hir.assertz v46 #[code = 250]; - v47 = hir.int_to_ptr v44 : ptr; - hir.store v47, v41; - v49 = arith.constant 16 : u32; - v48 = hir.bitcast v408 : u32; - v50 = arith.add v48, v49 : u32 #[overflow = checked]; - v434 = arith.constant 4 : u32; - v52 = arith.mod v50, v434 : u32; - hir.assertz v52 #[code = 250]; - v53 = hir.int_to_ptr v50 : ptr; - v54 = hir.load v53 : i64; - v55 = hir.bitcast v408 : u32; - v433 = arith.constant 8 : u32; - v57 = arith.mod v55, v433 : u32; - hir.assertz v57 #[code = 250]; - v58 = hir.int_to_ptr v55 : ptr; - hir.store v58, v54; - v432 = arith.constant 16 : i32; - v60 = arith.add v408, v432 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/miden_base_sys::bindings::asset::build_non_fungible_asset(v60, v409, v410, v408) - v63 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr - v64 = hir.bitcast v63 : ptr; - v65 = hir.load v64 : i32; - v66 = arith.constant 1048584 : i32; - v67 = arith.add v65, v66 : i32 #[overflow = wrapping]; - v431 = arith.constant 24 : u32; - v68 = hir.bitcast v408 : u32; - v70 = arith.add v68, v431 : u32 #[overflow = checked]; - v430 = arith.constant 8 : u32; - v72 = arith.mod v70, v430 : u32; - hir.assertz v72 #[code = 250]; - v73 = hir.int_to_ptr v70 : ptr; - v74 = hir.load v73 : i64; - v429 = arith.constant 8 : u32; - v75 = hir.bitcast v67 : u32; - v77 = arith.add v75, v429 : u32 #[overflow = checked]; - v428 = arith.constant 4 : u32; - v79 = arith.mod v77, v428 : u32; + v35 = hir.load_local : i32 #[local = lv0]; + v260 = arith.constant 24 : u32; + v37 = hir.bitcast v35 : u32; + v39 = arith.add v37, v260 : u32 #[overflow = checked]; + v301 = arith.constant 4 : u32; + v41 = arith.mod v39, v301 : u32; + hir.assertz v41 #[code = 250]; + v42 = hir.int_to_ptr v39 : ptr; + v43 = hir.load v42 : i64; + v258 = arith.constant 8 : u32; + v44 = hir.bitcast v35 : u32; + v46 = arith.add v44, v258 : u32 #[overflow = checked]; + v300 = arith.constant 8 : u32; + v48 = arith.mod v46, v300 : u32; + hir.assertz v48 #[code = 250]; + v49 = hir.int_to_ptr v46 : ptr; + hir.store v49, v43; + v50 = hir.load_local : i32 #[local = lv0]; + v257 = arith.constant 16 : u32; + v52 = hir.bitcast v50 : u32; + v54 = arith.add v52, v257 : u32 #[overflow = checked]; + v299 = arith.constant 4 : u32; + v56 = arith.mod v54, v299 : u32; + hir.assertz v56 #[code = 250]; + v57 = hir.int_to_ptr v54 : ptr; + v58 = hir.load v57 : i64; + v59 = hir.bitcast v50 : u32; + v298 = arith.constant 8 : u32; + v61 = arith.mod v59, v298 : u32; + hir.assertz v61 #[code = 250]; + v62 = hir.int_to_ptr v59 : ptr; + hir.store v62, v58; + v63 = hir.load_local : i32 #[local = lv0]; + v66 = hir.load_local : felt #[local = lv2]; + v67 = hir.load_local : felt #[local = lv3]; + v297 = arith.constant 16 : i32; + v65 = arith.add v63, v297 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/miden_base_sys::bindings::asset::build_non_fungible_asset(v65, v66, v67, v63) + v69 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v70 = hir.bitcast v69 : ptr; + v71 = hir.load v70 : i32; + v255 = arith.constant 1048584 : i32; + v73 = arith.add v71, v255 : i32 #[overflow = wrapping]; + hir.store_local v73 #[local = lv1]; + v74 = hir.load_local : i32 #[local = lv0]; + v296 = arith.constant 24 : u32; + v75 = hir.bitcast v74 : u32; + v77 = arith.add v75, v296 : u32 #[overflow = checked]; + v295 = arith.constant 8 : u32; + v79 = arith.mod v77, v295 : u32; hir.assertz v79 #[code = 250]; v80 = hir.int_to_ptr v77 : ptr; - hir.store v80, v74; - v427 = arith.constant 16 : u32; - v81 = hir.bitcast v408 : u32; - v83 = arith.add v81, v427 : u32 #[overflow = checked]; - v426 = arith.constant 8 : u32; - v85 = arith.mod v83, v426 : u32; - hir.assertz v85 #[code = 250]; - v86 = hir.int_to_ptr v83 : ptr; - v87 = hir.load v86 : i64; - v88 = hir.bitcast v67 : u32; - v425 = arith.constant 4 : u32; - v90 = arith.mod v88, v425 : u32; - hir.assertz v90 #[code = 250]; - v91 = hir.int_to_ptr v88 : ptr; - hir.store v91, v87; - v424 = arith.constant 32 : i32; - v93 = arith.add v408, v424 : i32 #[overflow = wrapping]; - v94 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr - v95 = hir.bitcast v94 : ptr; - hir.store v95, v93; - builtin.ret v67; + v81 = hir.load v80 : i64; + v294 = arith.constant 8 : u32; + v82 = hir.bitcast v73 : u32; + v84 = arith.add v82, v294 : u32 #[overflow = checked]; + v293 = arith.constant 4 : u32; + v86 = arith.mod v84, v293 : u32; + hir.assertz v86 #[code = 250]; + v87 = hir.int_to_ptr v84 : ptr; + hir.store v87, v81; + v88 = hir.load_local : i32 #[local = lv1]; + v89 = hir.load_local : i32 #[local = lv0]; + v292 = arith.constant 16 : u32; + v90 = hir.bitcast v89 : u32; + v92 = arith.add v90, v292 : u32 #[overflow = checked]; + v291 = arith.constant 8 : u32; + v94 = arith.mod v92, v291 : u32; + hir.assertz v94 #[code = 250]; + v95 = hir.int_to_ptr v92 : ptr; + v96 = hir.load v95 : i64; + v97 = hir.bitcast v88 : u32; + v290 = arith.constant 4 : u32; + v99 = arith.mod v97, v290 : u32; + hir.assertz v99 #[code = 250]; + v100 = hir.int_to_ptr v97 : ptr; + hir.store v100, v96; + v101 = hir.load_local : i32 #[local = lv0]; + v289 = arith.constant 32 : i32; + v103 = arith.add v101, v289 : i32 #[overflow = wrapping]; + v104 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr + v105 = hir.bitcast v104 : ptr; + hir.store v105, v103; + v106 = hir.load_local : i32 #[local = lv1]; + builtin.ret v106; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block15: - v97 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr - v98 = hir.bitcast v97 : ptr; - v99 = hir.load v98 : i32; - v100 = arith.constant 1048600 : i32; - v101 = arith.add v99, v100 : i32 #[overflow = wrapping]; - v102 = hir.bitcast v101 : u32; - v103 = hir.int_to_ptr v102 : ptr; - v104 = hir.load v103 : u8; - v96 = arith.constant 0 : i32; - v105 = arith.zext v104 : u32; - v106 = hir.bitcast v105 : i32; - v108 = arith.neq v106, v96 : i1; - scf.if v108{ + v107 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v108 = hir.bitcast v107 : ptr; + v109 = hir.load v108 : i32; + v309 = arith.constant 1048600 : i32; + v111 = arith.add v109, v309 : i32 #[overflow = wrapping]; + v112 = hir.bitcast v111 : u32; + v113 = hir.int_to_ptr v112 : ptr; + v114 = hir.load v113 : u8; + v308 = arith.constant 0 : i32; + v115 = arith.zext v114 : u32; + v116 = hir.bitcast v115 : i32; + v118 = arith.neq v116, v308 : i1; + scf.if v118{ ^block17: scf.yield ; } else { ^block18: - v109 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr - v110 = hir.bitcast v109 : ptr; - v111 = hir.load v110 : i32; + v119 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v120 = hir.bitcast v119 : ptr; + v121 = hir.load v120 : i32; + hir.store_local v121 #[local = lv0]; hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__wasm_call_ctors() - v445 = arith.constant 1 : u8; - v447 = arith.constant 1048600 : i32; - v113 = arith.add v111, v447 : i32 #[overflow = wrapping]; - v117 = hir.bitcast v113 : u32; - v118 = hir.int_to_ptr v117 : ptr; - hir.store v118, v445; + v122 = hir.load_local : i32 #[local = lv0]; + v307 = arith.constant 1 : u8; + v312 = arith.constant 1048600 : i32; + v124 = arith.add v122, v312 : i32 #[overflow = wrapping]; + v128 = hir.bitcast v124 : u32; + v129 = hir.int_to_ptr v128 : ptr; + hir.store v129, v307; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::asset::build_non_fungible_asset(v119: i32, v120: felt, v121: felt, v122: i32) { - ^block19(v119: i32, v120: felt, v121: felt, v122: i32): - v124 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr - v125 = hir.bitcast v124 : ptr; - v126 = hir.load v125 : i32; - v127 = arith.constant 32 : i32; - v128 = arith.sub v126, v127 : i32 #[overflow = wrapping]; - v129 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr - v130 = hir.bitcast v129 : ptr; - hir.store v130, v128; - v132 = arith.constant 12 : u32; - v131 = hir.bitcast v122 : u32; - v133 = arith.add v131, v132 : u32 #[overflow = checked]; - v134 = arith.constant 4 : u32; - v135 = arith.mod v133, v134 : u32; - hir.assertz v135 #[code = 250]; - v136 = hir.int_to_ptr v133 : ptr; - v137 = hir.load v136 : felt; - v139 = arith.constant 8 : u32; - v138 = hir.bitcast v122 : u32; - v140 = arith.add v138, v139 : u32 #[overflow = checked]; - v457 = arith.constant 4 : u32; - v142 = arith.mod v140, v457 : u32; - hir.assertz v142 #[code = 250]; - v143 = hir.int_to_ptr v140 : ptr; - v144 = hir.load v143 : felt; - v456 = arith.constant 4 : u32; - v145 = hir.bitcast v122 : u32; - v147 = arith.add v145, v456 : u32 #[overflow = checked]; - v455 = arith.constant 4 : u32; - v149 = arith.mod v147, v455 : u32; - hir.assertz v149 #[code = 250]; - v150 = hir.int_to_ptr v147 : ptr; - v151 = hir.load v150 : felt; - v152 = hir.bitcast v122 : u32; - v454 = arith.constant 4 : u32; - v154 = arith.mod v152, v454 : u32; - hir.assertz v154 #[code = 250]; - v155 = hir.int_to_ptr v152 : ptr; - v156 = hir.load v155 : felt; - hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/miden::asset::build_non_fungible_asset(v120, v137, v144, v151, v156, v128) - v453 = arith.constant 8 : u32; - v157 = hir.bitcast v128 : u32; - v159 = arith.add v157, v453 : u32 #[overflow = checked]; - v452 = arith.constant 8 : u32; - v161 = arith.mod v159, v452 : u32; - hir.assertz v161 #[code = 250]; - v162 = hir.int_to_ptr v159 : ptr; - v163 = hir.load v162 : i64; - v165 = arith.constant 24 : u32; - v164 = hir.bitcast v128 : u32; - v166 = arith.add v164, v165 : u32 #[overflow = checked]; - v451 = arith.constant 8 : u32; - v168 = arith.mod v166, v451 : u32; - hir.assertz v168 #[code = 250]; - v169 = hir.int_to_ptr v166 : ptr; - hir.store v169, v163; - v170 = hir.bitcast v128 : u32; - v450 = arith.constant 8 : u32; - v172 = arith.mod v170, v450 : u32; - hir.assertz v172 #[code = 250]; - v173 = hir.int_to_ptr v170 : ptr; - v174 = hir.load v173 : i64; - v176 = arith.constant 16 : u32; - v175 = hir.bitcast v128 : u32; - v177 = arith.add v175, v176 : u32 #[overflow = checked]; - v449 = arith.constant 8 : u32; - v179 = arith.mod v177, v449 : u32; - hir.assertz v179 #[code = 250]; - v180 = hir.int_to_ptr v177 : ptr; - hir.store v180, v174; - v181 = arith.constant 16 : i32; - v182 = arith.add v128, v181 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/::reverse(v119, v182) - v448 = arith.constant 32 : i32; - v184 = arith.add v128, v448 : i32 #[overflow = wrapping]; - v185 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr - v186 = hir.bitcast v185 : ptr; - hir.store v186, v184; + private builtin.function @miden_base_sys::bindings::asset::build_non_fungible_asset(v130: i32, v131: felt, v132: felt, v133: i32) { + ^block19(v130: i32, v131: felt, v132: felt, v133: i32): + hir.store_local v130 #[local = lv0]; + hir.store_local v133 #[local = lv3]; + v134 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr + v135 = hir.bitcast v134 : ptr; + v136 = hir.load v135 : i32; + v322 = arith.constant 16 : i32; + v138 = arith.sub v136, v322 : i32 #[overflow = wrapping]; + hir.store_local v138 #[local = lv4]; + v139 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr + v140 = hir.bitcast v139 : ptr; + hir.store v140, v138; + v142 = hir.load_local : i32 #[local = lv3]; + v321 = arith.constant 12 : u32; + v143 = hir.bitcast v142 : u32; + v145 = arith.add v143, v321 : u32 #[overflow = checked]; + v320 = arith.constant 4 : u32; + v147 = arith.mod v145, v320 : u32; + hir.assertz v147 #[code = 250]; + v148 = hir.int_to_ptr v145 : ptr; + v149 = hir.load v148 : felt; + v150 = hir.load_local : i32 #[local = lv3]; + v319 = arith.constant 8 : u32; + v151 = hir.bitcast v150 : u32; + v153 = arith.add v151, v319 : u32 #[overflow = checked]; + v344 = arith.constant 4 : u32; + v155 = arith.mod v153, v344 : u32; + hir.assertz v155 #[code = 250]; + v156 = hir.int_to_ptr v153 : ptr; + v157 = hir.load v156 : felt; + v158 = hir.load_local : i32 #[local = lv3]; + v343 = arith.constant 4 : u32; + v159 = hir.bitcast v158 : u32; + v161 = arith.add v159, v343 : u32 #[overflow = checked]; + v342 = arith.constant 4 : u32; + v163 = arith.mod v161, v342 : u32; + hir.assertz v163 #[code = 250]; + v164 = hir.int_to_ptr v161 : ptr; + v165 = hir.load v164 : felt; + v166 = hir.load_local : i32 #[local = lv3]; + v167 = hir.bitcast v166 : u32; + v341 = arith.constant 4 : u32; + v169 = arith.mod v167, v341 : u32; + hir.assertz v169 #[code = 250]; + v170 = hir.int_to_ptr v167 : ptr; + v171 = hir.load v170 : felt; + v172 = hir.load_local : i32 #[local = lv4]; + hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/miden::protocol::asset::build_non_fungible_asset(v131, v149, v157, v165, v171, v172) + v173 = hir.load_local : i32 #[local = lv0]; + v174 = hir.load_local : i32 #[local = lv4]; + v175 = hir.bitcast v174 : u32; + v340 = arith.constant 8 : u32; + v177 = arith.mod v175, v340 : u32; + hir.assertz v177 #[code = 250]; + v178 = hir.int_to_ptr v175 : ptr; + v179 = hir.load v178 : i64; + v316, v317 = arith.split v179 : felt, felt; + v339 = arith.constant 8 : u32; + v183 = hir.bitcast v173 : u32; + v185 = arith.add v183, v339 : u32 #[overflow = checked]; + v338 = arith.constant 8 : u32; + v187 = arith.mod v185, v338 : u32; + hir.assertz v187 #[code = 250]; + v318 = arith.join v317, v316 : i64; + v188 = hir.int_to_ptr v185 : ptr; + hir.store v188, v318; + v189 = hir.load_local : i32 #[local = lv0]; + v190 = hir.load_local : i32 #[local = lv4]; + v337 = arith.constant 8 : u32; + v191 = hir.bitcast v190 : u32; + v193 = arith.add v191, v337 : u32 #[overflow = checked]; + v336 = arith.constant 8 : u32; + v195 = arith.mod v193, v336 : u32; + hir.assertz v195 #[code = 250]; + v196 = hir.int_to_ptr v193 : ptr; + v197 = hir.load v196 : i64; + v313, v314 = arith.split v197 : felt, felt; + v201 = hir.bitcast v189 : u32; + v335 = arith.constant 8 : u32; + v203 = arith.mod v201, v335 : u32; + hir.assertz v203 #[code = 250]; + v315 = arith.join v314, v313 : i64; + v204 = hir.int_to_ptr v201 : ptr; + hir.store v204, v315; + v205 = hir.load_local : i32 #[local = lv4]; + v334 = arith.constant 16 : i32; + v207 = arith.add v205, v334 : i32 #[overflow = wrapping]; + v208 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr + v209 = hir.bitcast v208 : ptr; + hir.store v209, v207; builtin.ret ; }; - private builtin.function @::reverse(v187: i32, v188: i32) { - ^block21(v187: i32, v188: i32): - v191 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr - v192 = hir.bitcast v191 : ptr; - v193 = hir.load v192 : i32; - v194 = arith.constant 16 : i32; - v195 = arith.sub v193, v194 : i32 #[overflow = wrapping]; - v197 = arith.constant 8 : u32; - v196 = hir.bitcast v188 : u32; - v198 = arith.add v196, v197 : u32 #[overflow = checked]; - v544 = arith.constant 8 : u32; - v200 = arith.mod v198, v544 : u32; - hir.assertz v200 #[code = 250]; - v201 = hir.int_to_ptr v198 : ptr; - v202 = hir.load v201 : i64; - v543 = arith.constant 8 : u32; - v203 = hir.bitcast v195 : u32; - v205 = arith.add v203, v543 : u32 #[overflow = checked]; - v206 = arith.constant 4 : u32; - v207 = arith.mod v205, v206 : u32; - hir.assertz v207 #[code = 250]; - v208 = hir.int_to_ptr v205 : ptr; - hir.store v208, v202; - v209 = hir.bitcast v188 : u32; - v542 = arith.constant 8 : u32; - v211 = arith.mod v209, v542 : u32; - hir.assertz v211 #[code = 250]; - v212 = hir.int_to_ptr v209 : ptr; - v213 = hir.load v212 : i64; - v214 = hir.bitcast v195 : u32; - v541 = arith.constant 4 : u32; - v216 = arith.mod v214, v541 : u32; - hir.assertz v216 #[code = 250]; - v217 = hir.int_to_ptr v214 : ptr; - hir.store v217, v213; - v218 = arith.constant 12 : i32; - v219 = arith.add v195, v218 : i32 #[overflow = wrapping]; - v189 = arith.constant 0 : i32; - v512, v513, v514, v515, v516, v517 = scf.while v189, v195, v219, v187 : i32, i32, i32, i32, i32, i32 { - ^block52(v518: i32, v519: i32, v520: i32, v521: i32): - v540 = arith.constant 0 : i32; - v222 = arith.constant 8 : i32; - v223 = arith.eq v518, v222 : i1; - v224 = arith.zext v223 : u32; - v225 = hir.bitcast v224 : i32; - v227 = arith.neq v225, v540 : i1; - v506, v507 = scf.if v227 : i32, i32 { - ^block51: - v466 = ub.poison i32 : i32; - scf.yield v466, v466; - } else { - ^block26: - v229 = arith.add v519, v518 : i32 #[overflow = wrapping]; - v230 = hir.bitcast v229 : u32; - v539 = arith.constant 4 : u32; - v232 = arith.mod v230, v539 : u32; - hir.assertz v232 #[code = 250]; - v233 = hir.int_to_ptr v230 : ptr; - v234 = hir.load v233 : felt; - v236 = hir.bitcast v520 : u32; - v538 = arith.constant 4 : u32; - v238 = arith.mod v236, v538 : u32; - hir.assertz v238 #[code = 250]; - v239 = hir.int_to_ptr v236 : ptr; - v240 = hir.load v239 : i32; - v241 = hir.bitcast v229 : u32; - v537 = arith.constant 4 : u32; - v243 = arith.mod v241, v537 : u32; - hir.assertz v243 #[code = 250]; - v244 = hir.int_to_ptr v241 : ptr; - hir.store v244, v240; - v245 = hir.bitcast v520 : u32; - v536 = arith.constant 4 : u32; - v247 = arith.mod v245, v536 : u32; - hir.assertz v247 #[code = 250]; - v248 = hir.int_to_ptr v245 : ptr; - hir.store v248, v234; - v251 = arith.constant -4 : i32; - v252 = arith.add v520, v251 : i32 #[overflow = wrapping]; - v249 = arith.constant 4 : i32; - v250 = arith.add v518, v249 : i32 #[overflow = wrapping]; - scf.yield v250, v252; - }; - v534 = ub.poison i32 : i32; - v509 = cf.select v227, v534, v521 : i32; - v535 = ub.poison i32 : i32; - v508 = cf.select v227, v535, v519 : i32; - v465 = arith.constant 1 : u32; - v458 = arith.constant 0 : u32; - v511 = cf.select v227, v458, v465 : u32; - v499 = arith.trunc v511 : i1; - scf.condition v499, v506, v508, v507, v509, v519, v521; - } do { - ^block53(v522: i32, v523: i32, v524: i32, v525: i32, v526: i32, v527: i32): - scf.yield v522, v523, v524, v525; - }; - v533 = arith.constant 8 : u32; - v254 = hir.bitcast v516 : u32; - v256 = arith.add v254, v533 : u32 #[overflow = checked]; - v532 = arith.constant 4 : u32; - v258 = arith.mod v256, v532 : u32; - hir.assertz v258 #[code = 250]; - v259 = hir.int_to_ptr v256 : ptr; - v260 = hir.load v259 : i64; - v531 = arith.constant 8 : u32; - v261 = hir.bitcast v517 : u32; - v263 = arith.add v261, v531 : u32 #[overflow = checked]; - v530 = arith.constant 8 : u32; - v265 = arith.mod v263, v530 : u32; - hir.assertz v265 #[code = 250]; - v266 = hir.int_to_ptr v263 : ptr; - hir.store v266, v260; - v267 = hir.bitcast v516 : u32; - v529 = arith.constant 4 : u32; - v269 = arith.mod v267, v529 : u32; - hir.assertz v269 #[code = 250]; - v270 = hir.int_to_ptr v267 : ptr; - v271 = hir.load v270 : i64; - v272 = hir.bitcast v517 : u32; - v528 = arith.constant 8 : u32; - v274 = arith.mod v272, v528 : u32; - hir.assertz v274 #[code = 250]; - v275 = hir.int_to_ptr v272 : ptr; - hir.store v275, v271; - builtin.ret ; - }; - - private builtin.function @intrinsics::felt::from_u32(v276: i32) -> felt { - ^block27(v276: i32): - v277 = hir.bitcast v276 : felt; - builtin.ret v277; - }; - - private builtin.function @miden::asset::build_non_fungible_asset(v279: felt, v280: felt, v281: felt, v282: felt, v283: felt, v284: i32) { - ^block29(v279: felt, v280: felt, v281: felt, v282: felt, v283: felt, v284: i32): - v285, v286, v287, v288 = hir.exec @miden/asset/build_non_fungible_asset(v279, v280, v281, v282, v283) : felt, felt, felt, felt - v289 = hir.bitcast v284 : u32; - v290 = hir.int_to_ptr v289 : ptr; - hir.store v290, v285; - v291 = arith.constant 4 : u32; - v292 = arith.add v289, v291 : u32 #[overflow = checked]; - v293 = hir.int_to_ptr v292 : ptr; - hir.store v293, v286; - v294 = arith.constant 8 : u32; - v295 = arith.add v289, v294 : u32 #[overflow = checked]; - v296 = hir.int_to_ptr v295 : ptr; - hir.store v296, v287; - v297 = arith.constant 12 : u32; - v298 = arith.add v289, v297 : u32 #[overflow = checked]; - v299 = hir.int_to_ptr v298 : ptr; - hir.store v299, v288; - builtin.ret ; + private builtin.function @miden::protocol::asset::build_non_fungible_asset(v210: felt, v211: felt, v212: felt, v213: felt, v214: felt, v215: i32) { + ^block21(v210: felt, v211: felt, v212: felt, v213: felt, v214: felt, v215: i32): + ub.unreachable ; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -430,36 +305,36 @@ builtin.component miden:rust-sdk-account-asset-build-non-fungible-asset-binding/ }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block33: - v300 = hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1#binding() : i32 - v550 = arith.constant 0 : i32; - v301 = arith.constant 0 : i32; - v302 = arith.add v300, v301 : i32 #[overflow = unchecked]; - v304 = arith.add v302, v550 : i32 #[overflow = unchecked]; - v548 = arith.constant 0 : i32; - v549 = arith.constant 0 : i32; - v306 = arith.add v304, v549 : i32 #[overflow = unchecked]; - v308 = arith.add v306, v548 : i32 #[overflow = unchecked]; - v309 = hir.int_to_ptr v308 : ptr; - v310 = hir.load v309 : felt; - v547 = arith.constant 0 : i32; - v311 = arith.constant 4 : i32; - v312 = arith.add v304, v311 : i32 #[overflow = unchecked]; - v314 = arith.add v312, v547 : i32 #[overflow = unchecked]; - v315 = hir.int_to_ptr v314 : ptr; - v316 = hir.load v315 : felt; - v546 = arith.constant 0 : i32; - v317 = arith.constant 8 : i32; - v318 = arith.add v304, v317 : i32 #[overflow = unchecked]; - v320 = arith.add v318, v546 : i32 #[overflow = unchecked]; - v321 = hir.int_to_ptr v320 : ptr; - v322 = hir.load v321 : felt; - v545 = arith.constant 0 : i32; - v323 = arith.constant 12 : i32; - v324 = arith.add v304, v323 : i32 #[overflow = unchecked]; - v326 = arith.add v324, v545 : i32 #[overflow = unchecked]; - v327 = hir.int_to_ptr v326 : ptr; - v328 = hir.load v327 : felt; - builtin.ret v310, v316, v322, v328; + ^block23: + v216 = hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1#binding() : i32 + v360 = arith.constant 0 : i32; + v354 = arith.constant 0 : i32; + v218 = arith.add v216, v354 : i32 #[overflow = unchecked]; + v220 = arith.add v218, v360 : i32 #[overflow = unchecked]; + v358 = arith.constant 0 : i32; + v359 = arith.constant 0 : i32; + v222 = arith.add v220, v359 : i32 #[overflow = unchecked]; + v224 = arith.add v222, v358 : i32 #[overflow = unchecked]; + v225 = hir.int_to_ptr v224 : ptr; + v226 = hir.load v225 : felt; + v357 = arith.constant 0 : i32; + v347 = arith.constant 4 : i32; + v228 = arith.add v220, v347 : i32 #[overflow = unchecked]; + v230 = arith.add v228, v357 : i32 #[overflow = unchecked]; + v231 = hir.int_to_ptr v230 : ptr; + v232 = hir.load v231 : felt; + v356 = arith.constant 0 : i32; + v346 = arith.constant 8 : i32; + v234 = arith.add v220, v346 : i32 #[overflow = unchecked]; + v236 = arith.add v234, v356 : i32 #[overflow = unchecked]; + v237 = hir.int_to_ptr v236 : ptr; + v238 = hir.load v237 : felt; + v355 = arith.constant 0 : i32; + v345 = arith.constant 12 : i32; + v240 = arith.add v220, v345 : i32 #[overflow = unchecked]; + v242 = arith.add v240, v355 : i32 #[overflow = unchecked]; + v243 = hir.int_to_ptr v242 : ptr; + v244 = hir.load v243 : felt; + builtin.ret v226, v232, v238, v244; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.masm index 86e1f11b9..da0f9b98a 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.masm @@ -1,13 +1,13 @@ -# mod miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1 +# mod ::"miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> (felt, felt, felt, felt) - exec.::miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1::init + exec."miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_non_fungible_asset_binding::miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1#binding + exec.::"miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1"::rust_sdk_account_asset_build_non_fungible_asset_binding::"miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1#binding" trace.252 nop push.0 @@ -65,7 +65,7 @@ pub proc binding( nop movdn.3 swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -78,7 +78,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -89,7 +89,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_non_fungible_asset_binding +# mod ::"miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1"::rust_sdk_account_asset_build_non_fungible_asset_binding @callconv("C") proc __wasm_call_ctors( @@ -105,6 +105,7 @@ proc rust_sdk_account_asset_build_non_fungible_asset_binding::bindings::__link_c nop end +@locals("5") @callconv("C") proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1#binding( @@ -119,9 +120,16 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco nop push.32 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -131,49 +139,92 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco nop trace.240 nop - exec.::miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_non_fungible_asset_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1"::rust_sdk_account_asset_build_non_fungible_asset_binding::wit_bindgen::rt::run_ctors_once trace.252 nop - push.1 + push.0 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_non_fungible_asset_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_sw trace.252 nop + push.1 + locaddr.2 push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_non_fungible_asset_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop push.0 + locaddr.3 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_non_fungible_asset_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop push.0 + locaddr.4 + push.0 swap.1 - swap.2 - swap.4 - swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1 while.true + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.16 - dup.2 + movup.2 eq neq dup.0 if.true - swap.1 - drop - push.3735929054 + nop else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.16 - dup.3 + movup.3 u32wrapping_add - dup.2 + movup.2 u32wrapping_add push.4 dup.1 @@ -181,8 +232,6 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco u32mod u32assert assertz - dup.4 - swap.1 u32divmod.4 swap.1 trace.240 @@ -190,64 +239,45 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - movup.2 u32wrapping_add + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.3735929054 - dup.2 - dup.7 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.3 - dup.7 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - movup.2 - swap.7 - movdn.2 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop push.1 push.0 - movup.6 + movup.2 cdrop push.1 u32and - swap.1 - swap.2 - swap.3 - swap.5 - swap.6 - swap.4 - swap.1 if.true - movup.5 - drop - movup.5 - drop - movup.5 - drop push.1 else push.0 end end - drop - drop - drop - drop - drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.24 dup.1 add @@ -267,7 +297,7 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco nop swap.1 push.8 - dup.3 + movup.3 add u32assert push.8 @@ -285,6 +315,14 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 dup.1 add @@ -303,7 +341,7 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco trace.252 nop swap.1 - dup.2 + movup.2 push.8 dup.1 swap.1 @@ -319,18 +357,38 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.16 - dup.1 + dup.3 u32wrapping_add - dup.1 movup.2 - swap.4 - movdn.2 - swap.3 swap.1 trace.240 nop - exec.::miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_non_fungible_asset_binding::miden_base_sys::bindings::asset::build_non_fungible_asset + exec.::"miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1"::rust_sdk_account_asset_build_non_fungible_asset_binding::miden_base_sys::bindings::asset::build_non_fungible_asset trace.252 nop push.1114148 @@ -343,8 +401,25 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco nop push.1048584 u32wrapping_add + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.24 - dup.2 + swap.1 add u32assert push.8 @@ -362,7 +437,7 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco nop swap.1 push.8 - dup.3 + movup.3 add u32assert push.4 @@ -380,8 +455,24 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - dup.2 + swap.1 add u32assert push.8 @@ -398,7 +489,7 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco trace.252 nop swap.1 - dup.2 + movup.2 push.4 dup.1 swap.1 @@ -414,8 +505,15 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.32 - movup.2 u32wrapping_add push.1114144 u32divmod.4 @@ -425,8 +523,17 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -468,9 +575,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1"::rust_sdk_account_asset_build_non_fungible_asset_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_non_fungible_asset_binding::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -501,6 +624,7 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("5") @callconv("C") proc miden_base_sys::bindings::asset::build_non_fungible_asset( i32, @@ -510,6 +634,23 @@ proc miden_base_sys::bindings::asset::build_non_fungible_asset( ) movup.2 drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + swap.1 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -518,11 +659,18 @@ proc miden_base_sys::bindings::asset::build_non_fungible_asset( exec.::intrinsics::mem::load_sw trace.252 nop - push.32 + push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.4 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -530,8 +678,16 @@ proc miden_base_sys::bindings::asset::build_non_fungible_asset( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.4 + swap.1 add u32assert push.4 @@ -547,8 +703,16 @@ proc miden_base_sys::bindings::asset::build_non_fungible_asset( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.5 + swap.1 add u32assert push.4 @@ -564,56 +728,19 @@ proc miden_base_sys::bindings::asset::build_non_fungible_asset( exec.::intrinsics::mem::load_felt trace.252 nop - push.4 - dup.6 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.3 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::load_sw trace.252 nop - movup.6 push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.4 - movup.2 - swap.3 - movdn.2 swap.1 - swap.4 - swap.1 - swap.5 - swap.7 - trace.240 - nop - exec.::miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_non_fungible_asset_binding::miden::asset::build_non_fungible_asset - trace.252 - nop - push.8 - dup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -623,31 +750,18 @@ proc miden_base_sys::bindings::asset::build_non_fungible_asset( swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.3 + push.0 swap.1 - push.24 - dup.4 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - dup.1 - push.8 + push.4 dup.1 swap.1 u32mod @@ -657,69 +771,45 @@ proc miden_base_sys::bindings::asset::build_non_fungible_asset( swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.4 + push.0 swap.1 - push.16 - dup.4 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - dup.2 - u32wrapping_add + movup.2 + swap.3 + movdn.2 swap.1 + swap.4 + swap.1 + swap.5 trace.240 nop - exec.::miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_non_fungible_asset_binding::::reverse + exec.::"miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1"::rust_sdk_account_asset_build_non_fungible_asset_binding::"miden::protocol::asset::build_non_fungible_asset" trace.252 nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop -end - -@callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 + locaddr.4 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert push.8 dup.1 swap.1 @@ -735,15 +825,17 @@ proc ::reverse( nop swap.1 push.8 - dup.3 + movup.3 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -753,182 +845,24 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.12 - dup.1 - u32wrapping_add + locaddr.4 push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop - swap.1 push.8 - dup.4 + swap.1 add u32assert push.8 @@ -939,21 +873,6 @@ proc ::reverse( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 trace.240 nop exec.::intrinsics::mem::load_dw @@ -967,6 +886,8 @@ proc ::reverse( u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -976,66 +897,43 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc miden::asset::build_non_fungible_asset(felt, felt, felt, felt, felt, i32) - trace.240 - nop - exec.::miden::asset::build_non_fungible_asset - trace.252 - nop - movup.4 - dup.0 - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 + locaddr.4 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_sw trace.252 nop - push.12 - add - u32assert + push.16 + u32wrapping_add + push.1114144 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::store_sw trace.252 nop end +@locals("6") +@callconv("C") +proc miden::protocol::asset::build_non_fungible_asset( + felt, + felt, + felt, + felt, + felt, + i32 +) + drop + drop + drop + drop + drop + drop + push.0 + assert +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.wat index 6c4120636..d0a504600 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.wat @@ -15,9 +15,8 @@ (type (;0;) (func)) (type (;1;) (func (result i32))) (type (;2;) (func (param i32 f32 f32 i32))) - (type (;3;) (func (param i32 i32))) - (type (;4;) (func (param i32) (result f32))) - (type (;5;) (func (param f32 f32 f32 f32 f32 i32))) + (type (;3;) (func (param i32) (result f32))) + (type (;4;) (func (param f32 f32 f32 f32 f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -119,7 +118,7 @@ (func $miden_base_sys::bindings::asset::build_non_fungible_asset (;4;) (type 2) (param i32 f32 f32 i32) (local i32) global.get $__stack_pointer - i32.const 32 + i32.const 16 i32.sub local.tee 4 global.set $__stack_pointer @@ -133,91 +132,32 @@ local.get 3 f32.load local.get 4 - call $miden::asset::build_non_fungible_asset - local.get 4 - local.get 4 - i64.load offset=8 - i64.store offset=24 - local.get 4 + call $miden::protocol::asset::build_non_fungible_asset + local.get 0 local.get 4 i64.load - i64.store offset=16 + i64.const 32 + i64.rotl + i64.store offset=8 local.get 0 local.get 4 - i32.const 16 - i32.add - call $::reverse + i64.load offset=8 + i64.const 32 + i64.rotl + i64.store local.get 4 - i32.const 32 - i32.add - global.set $__stack_pointer - ) - (func $::reverse (;5;) (type 3) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store + global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) unreachable ) - (func $miden::asset::build_non_fungible_asset (;7;) (type 5) (param f32 f32 f32 f32 f32 i32) + (func $miden::protocol::asset::build_non_fungible_asset (;6;) (type 4) (param f32 f32 f32 f32 f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "orust_sdk_account_asset_build_non_fungible_asset_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "orust_sdk_account_asset_build_non_fungible_asset_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "asset" (type $asset (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.hir index 653b6fc5b..fd00393e2 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.hir @@ -12,273 +12,157 @@ builtin.component miden:rust-sdk-account-compute-commitment-binding/rust-sdk-acc private builtin.function @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1#binding() -> i32 { ^block9: - v2 = builtin.global_symbol @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/__stack_pointer : ptr - v3 = hir.bitcast v2 : ptr; - v4 = hir.load v3 : i32; - v5 = arith.constant 48 : i32; - v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; - v7 = builtin.global_symbol @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/__stack_pointer : ptr - v8 = hir.bitcast v7 : ptr; - hir.store v8, v6; + v1 = builtin.global_symbol @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v150 = arith.constant 16 : i32; + v5 = arith.sub v3, v150 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; + v8 = builtin.global_symbol @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/GOT.data.internal.__memory_base : ptr + v9 = hir.bitcast v8 : ptr; + v10 = hir.load v9 : i32; + hir.store_local v10 #[local = lv1]; hir.exec @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/wit_bindgen::rt::run_ctors_once() - v9 = arith.constant 16 : i32; - v10 = arith.add v6, v9 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/miden::active_account::compute_commitment(v10) - v12 = arith.constant 24 : u32; - v11 = hir.bitcast v6 : u32; - v13 = arith.add v11, v12 : u32 #[overflow = checked]; - v14 = arith.constant 8 : u32; - v15 = arith.mod v13, v14 : u32; - hir.assertz v15 #[code = 250]; - v16 = hir.int_to_ptr v13 : ptr; - v17 = hir.load v16 : i64; - v19 = arith.constant 40 : u32; - v18 = hir.bitcast v6 : u32; - v20 = arith.add v18, v19 : u32 #[overflow = checked]; - v237 = arith.constant 8 : u32; - v22 = arith.mod v20, v237 : u32; - hir.assertz v22 #[code = 250]; - v23 = hir.int_to_ptr v20 : ptr; - hir.store v23, v17; - v25 = arith.constant 16 : u32; - v24 = hir.bitcast v6 : u32; - v26 = arith.add v24, v25 : u32 #[overflow = checked]; - v236 = arith.constant 8 : u32; - v28 = arith.mod v26, v236 : u32; - hir.assertz v28 #[code = 250]; - v29 = hir.int_to_ptr v26 : ptr; - v30 = hir.load v29 : i64; - v32 = arith.constant 32 : u32; - v31 = hir.bitcast v6 : u32; - v33 = arith.add v31, v32 : u32 #[overflow = checked]; - v235 = arith.constant 8 : u32; - v35 = arith.mod v33, v235 : u32; - hir.assertz v35 #[code = 250]; - v36 = hir.int_to_ptr v33 : ptr; - hir.store v36, v30; - v37 = builtin.global_symbol @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/GOT.data.internal.__memory_base : ptr - v38 = hir.bitcast v37 : ptr; - v39 = hir.load v38 : i32; - v40 = arith.constant 32 : i32; - v41 = arith.add v6, v40 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/::reverse(v6, v41) - v42 = arith.constant 1048584 : i32; - v43 = arith.add v39, v42 : i32 #[overflow = wrapping]; - v234 = arith.constant 8 : u32; - v44 = hir.bitcast v6 : u32; - v46 = arith.add v44, v234 : u32 #[overflow = checked]; - v233 = arith.constant 8 : u32; - v48 = arith.mod v46, v233 : u32; + v11 = hir.load_local : i32 #[local = lv0]; + hir.exec @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/miden::protocol::active_account::compute_commitment(v11) + v12 = hir.load_local : i32 #[local = lv1]; + v149 = arith.constant 1048584 : i32; + v14 = arith.add v12, v149 : i32 #[overflow = wrapping]; + hir.store_local v14 #[local = lv1]; + v15 = hir.load_local : i32 #[local = lv0]; + v16 = hir.bitcast v15 : u32; + v148 = arith.constant 4 : u32; + v18 = arith.mod v16, v148 : u32; + hir.assertz v18 #[code = 250]; + v19 = hir.int_to_ptr v16 : ptr; + v20 = hir.load v19 : felt; + v147 = arith.constant 12 : u32; + v21 = hir.bitcast v14 : u32; + v23 = arith.add v21, v147 : u32 #[overflow = checked]; + v174 = arith.constant 4 : u32; + v25 = arith.mod v23, v174 : u32; + hir.assertz v25 #[code = 250]; + v26 = hir.int_to_ptr v23 : ptr; + hir.store v26, v20; + v27 = hir.load_local : i32 #[local = lv1]; + v28 = hir.load_local : i32 #[local = lv0]; + v173 = arith.constant 4 : u32; + v29 = hir.bitcast v28 : u32; + v31 = arith.add v29, v173 : u32 #[overflow = checked]; + v172 = arith.constant 4 : u32; + v33 = arith.mod v31, v172 : u32; + hir.assertz v33 #[code = 250]; + v34 = hir.int_to_ptr v31 : ptr; + v35 = hir.load v34 : felt; + v146 = arith.constant 8 : u32; + v36 = hir.bitcast v27 : u32; + v38 = arith.add v36, v146 : u32 #[overflow = checked]; + v171 = arith.constant 4 : u32; + v40 = arith.mod v38, v171 : u32; + hir.assertz v40 #[code = 250]; + v41 = hir.int_to_ptr v38 : ptr; + hir.store v41, v35; + v42 = hir.load_local : i32 #[local = lv1]; + v43 = hir.load_local : i32 #[local = lv0]; + v170 = arith.constant 8 : u32; + v44 = hir.bitcast v43 : u32; + v46 = arith.add v44, v170 : u32 #[overflow = checked]; + v169 = arith.constant 4 : u32; + v48 = arith.mod v46, v169 : u32; hir.assertz v48 #[code = 250]; - v49 = hir.int_to_ptr v46 : ptr; - v50 = hir.load v49 : i64; - v232 = arith.constant 8 : u32; - v51 = hir.bitcast v43 : u32; - v53 = arith.add v51, v232 : u32 #[overflow = checked]; - v54 = arith.constant 4 : u32; - v55 = arith.mod v53, v54 : u32; + v49 = hir.int_to_ptr v46 : ptr; + v50 = hir.load v49 : felt; + v168 = arith.constant 4 : u32; + v51 = hir.bitcast v42 : u32; + v53 = arith.add v51, v168 : u32 #[overflow = checked]; + v167 = arith.constant 4 : u32; + v55 = arith.mod v53, v167 : u32; hir.assertz v55 #[code = 250]; - v56 = hir.int_to_ptr v53 : ptr; + v56 = hir.int_to_ptr v53 : ptr; hir.store v56, v50; - v57 = hir.bitcast v6 : u32; - v231 = arith.constant 8 : u32; - v59 = arith.mod v57, v231 : u32; - hir.assertz v59 #[code = 250]; - v60 = hir.int_to_ptr v57 : ptr; - v61 = hir.load v60 : i64; - v62 = hir.bitcast v43 : u32; - v230 = arith.constant 4 : u32; - v64 = arith.mod v62, v230 : u32; - hir.assertz v64 #[code = 250]; - v65 = hir.int_to_ptr v62 : ptr; - hir.store v65, v61; - v229 = arith.constant 48 : i32; - v67 = arith.add v6, v229 : i32 #[overflow = wrapping]; - v68 = builtin.global_symbol @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/__stack_pointer : ptr - v69 = hir.bitcast v68 : ptr; - hir.store v69, v67; - builtin.ret v43; + v57 = hir.load_local : i32 #[local = lv1]; + v58 = hir.load_local : i32 #[local = lv0]; + v166 = arith.constant 12 : u32; + v59 = hir.bitcast v58 : u32; + v61 = arith.add v59, v166 : u32 #[overflow = checked]; + v165 = arith.constant 4 : u32; + v63 = arith.mod v61, v165 : u32; + hir.assertz v63 #[code = 250]; + v64 = hir.int_to_ptr v61 : ptr; + v65 = hir.load v64 : felt; + v66 = hir.bitcast v57 : u32; + v164 = arith.constant 4 : u32; + v68 = arith.mod v66, v164 : u32; + hir.assertz v68 #[code = 250]; + v69 = hir.int_to_ptr v66 : ptr; + hir.store v69, v65; + v70 = hir.load_local : i32 #[local = lv0]; + v163 = arith.constant 16 : i32; + v72 = arith.add v70, v163 : i32 #[overflow = wrapping]; + v73 = builtin.global_symbol @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/__stack_pointer : ptr + v74 = hir.bitcast v73 : ptr; + hir.store v74, v72; + v75 = hir.load_local : i32 #[local = lv1]; + builtin.ret v75; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v71 = builtin.global_symbol @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/GOT.data.internal.__memory_base : ptr - v72 = hir.bitcast v71 : ptr; - v73 = hir.load v72 : i32; - v74 = arith.constant 1048600 : i32; - v75 = arith.add v73, v74 : i32 #[overflow = wrapping]; - v76 = hir.bitcast v75 : u32; - v77 = hir.int_to_ptr v76 : ptr; - v78 = hir.load v77 : u8; - v70 = arith.constant 0 : i32; - v79 = arith.zext v78 : u32; - v80 = hir.bitcast v79 : i32; - v82 = arith.neq v80, v70 : i1; - scf.if v82{ + v76 = builtin.global_symbol @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/GOT.data.internal.__memory_base : ptr + v77 = hir.bitcast v76 : ptr; + v78 = hir.load v77 : i32; + v179 = arith.constant 1048600 : i32; + v80 = arith.add v78, v179 : i32 #[overflow = wrapping]; + v81 = hir.bitcast v80 : u32; + v82 = hir.int_to_ptr v81 : ptr; + v83 = hir.load v82 : u8; + v178 = arith.constant 0 : i32; + v84 = arith.zext v83 : u32; + v85 = hir.bitcast v84 : i32; + v87 = arith.neq v85, v178 : i1; + scf.if v87{ ^block13: scf.yield ; } else { ^block14: - v83 = builtin.global_symbol @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/GOT.data.internal.__memory_base : ptr - v84 = hir.bitcast v83 : ptr; - v85 = hir.load v84 : i32; + v88 = builtin.global_symbol @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/GOT.data.internal.__memory_base : ptr + v89 = hir.bitcast v88 : ptr; + v90 = hir.load v89 : i32; + hir.store_local v90 #[local = lv0]; hir.exec @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/__wasm_call_ctors() - v239 = arith.constant 1 : u8; - v241 = arith.constant 1048600 : i32; - v87 = arith.add v85, v241 : i32 #[overflow = wrapping]; - v91 = hir.bitcast v87 : u32; - v92 = hir.int_to_ptr v91 : ptr; - hir.store v92, v239; + v91 = hir.load_local : i32 #[local = lv0]; + v177 = arith.constant 1 : u8; + v182 = arith.constant 1048600 : i32; + v93 = arith.add v91, v182 : i32 #[overflow = wrapping]; + v97 = hir.bitcast v93 : u32; + v98 = hir.int_to_ptr v97 : ptr; + hir.store v98, v177; scf.yield ; }; builtin.ret ; }; - private builtin.function @::reverse(v93: i32, v94: i32) { - ^block15(v93: i32, v94: i32): - v97 = builtin.global_symbol @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/__stack_pointer : ptr - v98 = hir.bitcast v97 : ptr; - v99 = hir.load v98 : i32; - v100 = arith.constant 16 : i32; - v101 = arith.sub v99, v100 : i32 #[overflow = wrapping]; - v103 = arith.constant 8 : u32; - v102 = hir.bitcast v94 : u32; - v104 = arith.add v102, v103 : u32 #[overflow = checked]; - v328 = arith.constant 8 : u32; - v106 = arith.mod v104, v328 : u32; - hir.assertz v106 #[code = 250]; - v107 = hir.int_to_ptr v104 : ptr; - v108 = hir.load v107 : i64; - v327 = arith.constant 8 : u32; - v109 = hir.bitcast v101 : u32; - v111 = arith.add v109, v327 : u32 #[overflow = checked]; - v112 = arith.constant 4 : u32; - v113 = arith.mod v111, v112 : u32; - hir.assertz v113 #[code = 250]; - v114 = hir.int_to_ptr v111 : ptr; - hir.store v114, v108; - v115 = hir.bitcast v94 : u32; - v326 = arith.constant 8 : u32; - v117 = arith.mod v115, v326 : u32; - hir.assertz v117 #[code = 250]; - v118 = hir.int_to_ptr v115 : ptr; - v119 = hir.load v118 : i64; - v120 = hir.bitcast v101 : u32; - v325 = arith.constant 4 : u32; - v122 = arith.mod v120, v325 : u32; - hir.assertz v122 #[code = 250]; - v123 = hir.int_to_ptr v120 : ptr; - hir.store v123, v119; - v124 = arith.constant 12 : i32; - v125 = arith.add v101, v124 : i32 #[overflow = wrapping]; - v95 = arith.constant 0 : i32; - v296, v297, v298, v299, v300, v301 = scf.while v95, v101, v125, v93 : i32, i32, i32, i32, i32, i32 { - ^block35(v302: i32, v303: i32, v304: i32, v305: i32): - v324 = arith.constant 0 : i32; - v128 = arith.constant 8 : i32; - v129 = arith.eq v302, v128 : i1; - v130 = arith.zext v129 : u32; - v131 = hir.bitcast v130 : i32; - v133 = arith.neq v131, v324 : i1; - v290, v291 = scf.if v133 : i32, i32 { - ^block34: - v250 = ub.poison i32 : i32; - scf.yield v250, v250; - } else { - ^block20: - v135 = arith.add v303, v302 : i32 #[overflow = wrapping]; - v136 = hir.bitcast v135 : u32; - v323 = arith.constant 4 : u32; - v138 = arith.mod v136, v323 : u32; - hir.assertz v138 #[code = 250]; - v139 = hir.int_to_ptr v136 : ptr; - v140 = hir.load v139 : felt; - v142 = hir.bitcast v304 : u32; - v322 = arith.constant 4 : u32; - v144 = arith.mod v142, v322 : u32; - hir.assertz v144 #[code = 250]; - v145 = hir.int_to_ptr v142 : ptr; - v146 = hir.load v145 : i32; - v147 = hir.bitcast v135 : u32; - v321 = arith.constant 4 : u32; - v149 = arith.mod v147, v321 : u32; - hir.assertz v149 #[code = 250]; - v150 = hir.int_to_ptr v147 : ptr; - hir.store v150, v146; - v151 = hir.bitcast v304 : u32; - v320 = arith.constant 4 : u32; - v153 = arith.mod v151, v320 : u32; - hir.assertz v153 #[code = 250]; - v154 = hir.int_to_ptr v151 : ptr; - hir.store v154, v140; - v157 = arith.constant -4 : i32; - v158 = arith.add v304, v157 : i32 #[overflow = wrapping]; - v155 = arith.constant 4 : i32; - v156 = arith.add v302, v155 : i32 #[overflow = wrapping]; - scf.yield v156, v158; - }; - v318 = ub.poison i32 : i32; - v293 = cf.select v133, v318, v305 : i32; - v319 = ub.poison i32 : i32; - v292 = cf.select v133, v319, v303 : i32; - v249 = arith.constant 1 : u32; - v242 = arith.constant 0 : u32; - v295 = cf.select v133, v242, v249 : u32; - v283 = arith.trunc v295 : i1; - scf.condition v283, v290, v292, v291, v293, v303, v305; - } do { - ^block36(v306: i32, v307: i32, v308: i32, v309: i32, v310: i32, v311: i32): - scf.yield v306, v307, v308, v309; - }; - v317 = arith.constant 8 : u32; - v160 = hir.bitcast v300 : u32; - v162 = arith.add v160, v317 : u32 #[overflow = checked]; - v316 = arith.constant 4 : u32; - v164 = arith.mod v162, v316 : u32; - hir.assertz v164 #[code = 250]; - v165 = hir.int_to_ptr v162 : ptr; - v166 = hir.load v165 : i64; - v315 = arith.constant 8 : u32; - v167 = hir.bitcast v301 : u32; - v169 = arith.add v167, v315 : u32 #[overflow = checked]; - v314 = arith.constant 8 : u32; - v171 = arith.mod v169, v314 : u32; - hir.assertz v171 #[code = 250]; - v172 = hir.int_to_ptr v169 : ptr; - hir.store v172, v166; - v173 = hir.bitcast v300 : u32; - v313 = arith.constant 4 : u32; - v175 = arith.mod v173, v313 : u32; - hir.assertz v175 #[code = 250]; - v176 = hir.int_to_ptr v173 : ptr; - v177 = hir.load v176 : i64; - v178 = hir.bitcast v301 : u32; - v312 = arith.constant 8 : u32; - v180 = arith.mod v178, v312 : u32; - hir.assertz v180 #[code = 250]; - v181 = hir.int_to_ptr v178 : ptr; - hir.store v181, v177; - builtin.ret ; - }; - - private builtin.function @miden::active_account::compute_commitment(v182: i32) { - ^block21(v182: i32): - v183, v184, v185, v186 = hir.exec @miden/active_account/compute_commitment() : felt, felt, felt, felt - v187 = hir.bitcast v182 : u32; - v188 = hir.int_to_ptr v187 : ptr; - hir.store v188, v183; - v189 = arith.constant 4 : u32; - v190 = arith.add v187, v189 : u32 #[overflow = checked]; - v191 = hir.int_to_ptr v190 : ptr; - hir.store v191, v184; - v192 = arith.constant 8 : u32; - v193 = arith.add v187, v192 : u32 #[overflow = checked]; - v194 = hir.int_to_ptr v193 : ptr; - hir.store v194, v185; - v195 = arith.constant 12 : u32; - v196 = arith.add v187, v195 : u32 #[overflow = checked]; - v197 = hir.int_to_ptr v196 : ptr; - hir.store v197, v186; + private builtin.function @miden::protocol::active_account::compute_commitment(v99: i32) { + ^block15(v99: i32): + v100, v101, v102, v103 = hir.exec @miden/protocol/active_account/compute_commitment() : felt, felt, felt, felt + v104 = hir.bitcast v99 : u32; + v105 = hir.int_to_ptr v104 : ptr; + hir.store v105, v100; + v185 = arith.constant 4 : u32; + v107 = arith.add v104, v185 : u32 #[overflow = checked]; + v108 = hir.int_to_ptr v107 : ptr; + hir.store v108, v101; + v184 = arith.constant 8 : u32; + v110 = arith.add v104, v184 : u32 #[overflow = checked]; + v111 = hir.int_to_ptr v110 : ptr; + hir.store v111, v102; + v183 = arith.constant 12 : u32; + v113 = arith.add v104, v183 : u32 #[overflow = checked]; + v114 = hir.int_to_ptr v113 : ptr; + hir.store v114, v103; builtin.ret ; }; @@ -294,34 +178,34 @@ builtin.component miden:rust-sdk-account-compute-commitment-binding/rust-sdk-acc }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block25: - v198 = hir.exec @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1#binding() : i32 + ^block20: + v115 = hir.exec @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1#binding() : i32 + v189 = arith.constant 0 : i32; + v117 = arith.add v115, v189 : i32 #[overflow = unchecked]; + v198 = arith.constant 0 : i32; v199 = arith.constant 0 : i32; - v200 = arith.add v198, v199 : i32 #[overflow = unchecked]; - v332 = arith.constant 0 : i32; - v333 = arith.constant 0 : i32; - v202 = arith.add v200, v333 : i32 #[overflow = unchecked]; - v204 = arith.add v202, v332 : i32 #[overflow = unchecked]; - v205 = hir.int_to_ptr v204 : ptr; - v206 = hir.load v205 : felt; - v331 = arith.constant 0 : i32; - v207 = arith.constant 4 : i32; - v208 = arith.add v200, v207 : i32 #[overflow = unchecked]; - v210 = arith.add v208, v331 : i32 #[overflow = unchecked]; - v211 = hir.int_to_ptr v210 : ptr; - v212 = hir.load v211 : felt; - v330 = arith.constant 0 : i32; - v213 = arith.constant 8 : i32; - v214 = arith.add v200, v213 : i32 #[overflow = unchecked]; - v216 = arith.add v214, v330 : i32 #[overflow = unchecked]; - v217 = hir.int_to_ptr v216 : ptr; - v218 = hir.load v217 : felt; - v329 = arith.constant 0 : i32; - v219 = arith.constant 12 : i32; - v220 = arith.add v200, v219 : i32 #[overflow = unchecked]; - v222 = arith.add v220, v329 : i32 #[overflow = unchecked]; - v223 = hir.int_to_ptr v222 : ptr; - v224 = hir.load v223 : felt; - builtin.ret v206, v212, v218, v224; + v119 = arith.add v117, v199 : i32 #[overflow = unchecked]; + v121 = arith.add v119, v198 : i32 #[overflow = unchecked]; + v122 = hir.int_to_ptr v121 : ptr; + v123 = hir.load v122 : felt; + v197 = arith.constant 0 : i32; + v188 = arith.constant 4 : i32; + v125 = arith.add v117, v188 : i32 #[overflow = unchecked]; + v127 = arith.add v125, v197 : i32 #[overflow = unchecked]; + v128 = hir.int_to_ptr v127 : ptr; + v129 = hir.load v128 : felt; + v196 = arith.constant 0 : i32; + v187 = arith.constant 8 : i32; + v131 = arith.add v117, v187 : i32 #[overflow = unchecked]; + v133 = arith.add v131, v196 : i32 #[overflow = unchecked]; + v134 = hir.int_to_ptr v133 : ptr; + v135 = hir.load v134 : felt; + v195 = arith.constant 0 : i32; + v186 = arith.constant 12 : i32; + v137 = arith.add v117, v186 : i32 #[overflow = unchecked]; + v139 = arith.add v137, v195 : i32 #[overflow = unchecked]; + v140 = hir.int_to_ptr v139 : ptr; + v141 = hir.load v140 : felt; + builtin.ret v123, v129, v135, v141; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.masm index 36b57b5cd..9c861612b 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.masm @@ -1,13 +1,13 @@ -# mod miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1 +# mod ::"miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> (felt, felt, felt, felt) - exec.::miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1::init + exec."miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1::rust_sdk_account_compute_commitment_binding::miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1#binding + exec.::"miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1"::rust_sdk_account_compute_commitment_binding::"miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1#binding" trace.252 nop push.0 @@ -62,7 +62,7 @@ pub proc binding( nop movdn.3 swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -75,7 +75,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -86,7 +86,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1::rust_sdk_account_compute_commitment_binding +# mod ::"miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1"::rust_sdk_account_compute_commitment_binding @callconv("C") proc __wasm_call_ctors( @@ -102,6 +102,7 @@ proc rust_sdk_account_compute_commitment_binding::bindings::__link_custom_sectio nop end +@locals("2") @callconv("C") proc miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1#binding( @@ -114,36 +115,87 @@ proc miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute- exec.::intrinsics::mem::load_sw trace.252 nop - push.48 + push.16 u32wrapping_sub + dup.0 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 - dup.1 + u32divmod.4 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114148 u32divmod.4 swap.1 trace.240 nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop exec.::intrinsics::mem::store_sw trace.252 nop trace.240 nop - exec.::miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1::rust_sdk_account_compute_commitment_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1"::rust_sdk_account_compute_commitment_binding::wit_bindgen::rt::run_ctors_once trace.252 nop - push.16 - dup.1 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1"::rust_sdk_account_compute_commitment_binding::"miden::protocol::active_account::compute_commitment" + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 u32wrapping_add + dup.0 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1::rust_sdk_account_compute_commitment_binding::miden::active_account::compute_commitment + exec.::intrinsics::mem::store_sw trace.252 nop - push.24 - dup.1 - add - u32assert - push.8 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 dup.1 swap.1 u32mod @@ -153,15 +205,14 @@ proc miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute- swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.40 - dup.3 + push.12 + movup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -169,18 +220,32 @@ proc miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute- assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.16 - dup.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -190,15 +255,14 @@ proc miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute- swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.32 - dup.3 + push.8 + movup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -206,37 +270,32 @@ proc miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute- assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.1114148 - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.32 - dup.2 - u32wrapping_add - dup.2 + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1::rust_sdk_account_compute_commitment_binding::::reverse + exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 - u32wrapping_add push.8 - dup.2 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -246,12 +305,11 @@ proc miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute- swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.8 - dup.3 + push.4 + movup.2 add u32assert push.4 @@ -262,15 +320,32 @@ proc miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute- assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - dup.1 - push.8 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + swap.1 + add + u32assert + push.4 dup.1 swap.1 u32mod @@ -280,11 +355,10 @@ proc miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute- swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop swap.1 - dup.2 push.4 dup.1 swap.1 @@ -293,15 +367,20 @@ proc miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute- assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.48 - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 u32wrapping_add push.1114144 u32divmod.4 @@ -311,8 +390,17 @@ proc miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute- exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -354,9 +442,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop trace.240 nop - exec.::miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1::rust_sdk_account_compute_commitment_binding::__wasm_call_ctors + exec.::"miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1"::rust_sdk_account_compute_commitment_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -388,287 +492,10 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.4 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop -end - -@callconv("C") -proc miden::active_account::compute_commitment(i32) +proc miden::protocol::active_account::compute_commitment(i32) trace.240 nop - exec.::miden::active_account::compute_commitment + exec.::miden::protocol::active_account::compute_commitment trace.252 nop movup.4 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.wat index e9ec6410d..074437e4c 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.wat @@ -12,8 +12,7 @@ (core module $main (;0;) (type (;0;) (func)) (type (;1;) (func (result i32))) - (type (;2;) (func (param i32 i32))) - (type (;3;) (func (param i32))) + (type (;2;) (func (param i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -26,43 +25,36 @@ (func $miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1#binding (;2;) (type 1) (result i32) (local i32 i32) global.get $__stack_pointer - i32.const 48 + i32.const 16 i32.sub local.tee 0 global.set $__stack_pointer - call $wit_bindgen::rt::run_ctors_once - local.get 0 - i32.const 16 - i32.add - call $miden::active_account::compute_commitment - local.get 0 - local.get 0 - i64.load offset=24 - i64.store offset=40 - local.get 0 - local.get 0 - i64.load offset=16 - i64.store offset=32 global.get $GOT.data.internal.__memory_base local.set 1 + call $wit_bindgen::rt::run_ctors_once local.get 0 - local.get 0 - i32.const 32 - i32.add - call $::reverse + call $miden::protocol::active_account::compute_commitment local.get 1 i32.const 1048584 i32.add local.tee 1 local.get 0 - i64.load offset=8 - i64.store offset=8 align=4 + f32.load + f32.store offset=12 local.get 1 local.get 0 - i64.load - i64.store align=4 + f32.load offset=4 + f32.store offset=8 + local.get 1 + local.get 0 + f32.load offset=8 + f32.store offset=4 + local.get 1 local.get 0 - i32.const 48 + f32.load offset=12 + f32.store + local.get 0 + i32.const 16 i32.add global.set $__stack_pointer local.get 1 @@ -85,69 +77,11 @@ i32.store8 end ) - (func $::reverse (;4;) (type 2) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store - ) - (func $miden::active_account::compute_commitment (;5;) (type 3) (param i32) + (func $miden::protocol::active_account::compute_commitment (;4;) (type 2) (param i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "Wrust_sdk_account_compute_commitment_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "Wrust_sdk_account_compute_commitment_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.hir index 8f00994a1..63859f5a0 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.hir @@ -12,273 +12,157 @@ builtin.component miden:rust-sdk-account-compute-delta-commitment-binding/rust-s private builtin.function @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1#binding() -> i32 { ^block9: - v2 = builtin.global_symbol @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/__stack_pointer : ptr - v3 = hir.bitcast v2 : ptr; - v4 = hir.load v3 : i32; - v5 = arith.constant 48 : i32; - v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; - v7 = builtin.global_symbol @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/__stack_pointer : ptr - v8 = hir.bitcast v7 : ptr; - hir.store v8, v6; + v1 = builtin.global_symbol @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v150 = arith.constant 16 : i32; + v5 = arith.sub v3, v150 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; + v8 = builtin.global_symbol @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/GOT.data.internal.__memory_base : ptr + v9 = hir.bitcast v8 : ptr; + v10 = hir.load v9 : i32; + hir.store_local v10 #[local = lv1]; hir.exec @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/wit_bindgen::rt::run_ctors_once() - v9 = arith.constant 16 : i32; - v10 = arith.add v6, v9 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/miden::native_account::compute_delta_commitment(v10) - v12 = arith.constant 24 : u32; - v11 = hir.bitcast v6 : u32; - v13 = arith.add v11, v12 : u32 #[overflow = checked]; - v14 = arith.constant 8 : u32; - v15 = arith.mod v13, v14 : u32; - hir.assertz v15 #[code = 250]; - v16 = hir.int_to_ptr v13 : ptr; - v17 = hir.load v16 : i64; - v19 = arith.constant 40 : u32; - v18 = hir.bitcast v6 : u32; - v20 = arith.add v18, v19 : u32 #[overflow = checked]; - v237 = arith.constant 8 : u32; - v22 = arith.mod v20, v237 : u32; - hir.assertz v22 #[code = 250]; - v23 = hir.int_to_ptr v20 : ptr; - hir.store v23, v17; - v25 = arith.constant 16 : u32; - v24 = hir.bitcast v6 : u32; - v26 = arith.add v24, v25 : u32 #[overflow = checked]; - v236 = arith.constant 8 : u32; - v28 = arith.mod v26, v236 : u32; - hir.assertz v28 #[code = 250]; - v29 = hir.int_to_ptr v26 : ptr; - v30 = hir.load v29 : i64; - v32 = arith.constant 32 : u32; - v31 = hir.bitcast v6 : u32; - v33 = arith.add v31, v32 : u32 #[overflow = checked]; - v235 = arith.constant 8 : u32; - v35 = arith.mod v33, v235 : u32; - hir.assertz v35 #[code = 250]; - v36 = hir.int_to_ptr v33 : ptr; - hir.store v36, v30; - v37 = builtin.global_symbol @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/GOT.data.internal.__memory_base : ptr - v38 = hir.bitcast v37 : ptr; - v39 = hir.load v38 : i32; - v40 = arith.constant 32 : i32; - v41 = arith.add v6, v40 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/::reverse(v6, v41) - v42 = arith.constant 1048584 : i32; - v43 = arith.add v39, v42 : i32 #[overflow = wrapping]; - v234 = arith.constant 8 : u32; - v44 = hir.bitcast v6 : u32; - v46 = arith.add v44, v234 : u32 #[overflow = checked]; - v233 = arith.constant 8 : u32; - v48 = arith.mod v46, v233 : u32; + v11 = hir.load_local : i32 #[local = lv0]; + hir.exec @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/miden::protocol::native_account::compute_delta_commitment(v11) + v12 = hir.load_local : i32 #[local = lv1]; + v149 = arith.constant 1048584 : i32; + v14 = arith.add v12, v149 : i32 #[overflow = wrapping]; + hir.store_local v14 #[local = lv1]; + v15 = hir.load_local : i32 #[local = lv0]; + v16 = hir.bitcast v15 : u32; + v148 = arith.constant 4 : u32; + v18 = arith.mod v16, v148 : u32; + hir.assertz v18 #[code = 250]; + v19 = hir.int_to_ptr v16 : ptr; + v20 = hir.load v19 : felt; + v147 = arith.constant 12 : u32; + v21 = hir.bitcast v14 : u32; + v23 = arith.add v21, v147 : u32 #[overflow = checked]; + v174 = arith.constant 4 : u32; + v25 = arith.mod v23, v174 : u32; + hir.assertz v25 #[code = 250]; + v26 = hir.int_to_ptr v23 : ptr; + hir.store v26, v20; + v27 = hir.load_local : i32 #[local = lv1]; + v28 = hir.load_local : i32 #[local = lv0]; + v173 = arith.constant 4 : u32; + v29 = hir.bitcast v28 : u32; + v31 = arith.add v29, v173 : u32 #[overflow = checked]; + v172 = arith.constant 4 : u32; + v33 = arith.mod v31, v172 : u32; + hir.assertz v33 #[code = 250]; + v34 = hir.int_to_ptr v31 : ptr; + v35 = hir.load v34 : felt; + v146 = arith.constant 8 : u32; + v36 = hir.bitcast v27 : u32; + v38 = arith.add v36, v146 : u32 #[overflow = checked]; + v171 = arith.constant 4 : u32; + v40 = arith.mod v38, v171 : u32; + hir.assertz v40 #[code = 250]; + v41 = hir.int_to_ptr v38 : ptr; + hir.store v41, v35; + v42 = hir.load_local : i32 #[local = lv1]; + v43 = hir.load_local : i32 #[local = lv0]; + v170 = arith.constant 8 : u32; + v44 = hir.bitcast v43 : u32; + v46 = arith.add v44, v170 : u32 #[overflow = checked]; + v169 = arith.constant 4 : u32; + v48 = arith.mod v46, v169 : u32; hir.assertz v48 #[code = 250]; - v49 = hir.int_to_ptr v46 : ptr; - v50 = hir.load v49 : i64; - v232 = arith.constant 8 : u32; - v51 = hir.bitcast v43 : u32; - v53 = arith.add v51, v232 : u32 #[overflow = checked]; - v54 = arith.constant 4 : u32; - v55 = arith.mod v53, v54 : u32; + v49 = hir.int_to_ptr v46 : ptr; + v50 = hir.load v49 : felt; + v168 = arith.constant 4 : u32; + v51 = hir.bitcast v42 : u32; + v53 = arith.add v51, v168 : u32 #[overflow = checked]; + v167 = arith.constant 4 : u32; + v55 = arith.mod v53, v167 : u32; hir.assertz v55 #[code = 250]; - v56 = hir.int_to_ptr v53 : ptr; + v56 = hir.int_to_ptr v53 : ptr; hir.store v56, v50; - v57 = hir.bitcast v6 : u32; - v231 = arith.constant 8 : u32; - v59 = arith.mod v57, v231 : u32; - hir.assertz v59 #[code = 250]; - v60 = hir.int_to_ptr v57 : ptr; - v61 = hir.load v60 : i64; - v62 = hir.bitcast v43 : u32; - v230 = arith.constant 4 : u32; - v64 = arith.mod v62, v230 : u32; - hir.assertz v64 #[code = 250]; - v65 = hir.int_to_ptr v62 : ptr; - hir.store v65, v61; - v229 = arith.constant 48 : i32; - v67 = arith.add v6, v229 : i32 #[overflow = wrapping]; - v68 = builtin.global_symbol @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/__stack_pointer : ptr - v69 = hir.bitcast v68 : ptr; - hir.store v69, v67; - builtin.ret v43; + v57 = hir.load_local : i32 #[local = lv1]; + v58 = hir.load_local : i32 #[local = lv0]; + v166 = arith.constant 12 : u32; + v59 = hir.bitcast v58 : u32; + v61 = arith.add v59, v166 : u32 #[overflow = checked]; + v165 = arith.constant 4 : u32; + v63 = arith.mod v61, v165 : u32; + hir.assertz v63 #[code = 250]; + v64 = hir.int_to_ptr v61 : ptr; + v65 = hir.load v64 : felt; + v66 = hir.bitcast v57 : u32; + v164 = arith.constant 4 : u32; + v68 = arith.mod v66, v164 : u32; + hir.assertz v68 #[code = 250]; + v69 = hir.int_to_ptr v66 : ptr; + hir.store v69, v65; + v70 = hir.load_local : i32 #[local = lv0]; + v163 = arith.constant 16 : i32; + v72 = arith.add v70, v163 : i32 #[overflow = wrapping]; + v73 = builtin.global_symbol @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/__stack_pointer : ptr + v74 = hir.bitcast v73 : ptr; + hir.store v74, v72; + v75 = hir.load_local : i32 #[local = lv1]; + builtin.ret v75; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v71 = builtin.global_symbol @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/GOT.data.internal.__memory_base : ptr - v72 = hir.bitcast v71 : ptr; - v73 = hir.load v72 : i32; - v74 = arith.constant 1048600 : i32; - v75 = arith.add v73, v74 : i32 #[overflow = wrapping]; - v76 = hir.bitcast v75 : u32; - v77 = hir.int_to_ptr v76 : ptr; - v78 = hir.load v77 : u8; - v70 = arith.constant 0 : i32; - v79 = arith.zext v78 : u32; - v80 = hir.bitcast v79 : i32; - v82 = arith.neq v80, v70 : i1; - scf.if v82{ + v76 = builtin.global_symbol @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/GOT.data.internal.__memory_base : ptr + v77 = hir.bitcast v76 : ptr; + v78 = hir.load v77 : i32; + v179 = arith.constant 1048600 : i32; + v80 = arith.add v78, v179 : i32 #[overflow = wrapping]; + v81 = hir.bitcast v80 : u32; + v82 = hir.int_to_ptr v81 : ptr; + v83 = hir.load v82 : u8; + v178 = arith.constant 0 : i32; + v84 = arith.zext v83 : u32; + v85 = hir.bitcast v84 : i32; + v87 = arith.neq v85, v178 : i1; + scf.if v87{ ^block13: scf.yield ; } else { ^block14: - v83 = builtin.global_symbol @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/GOT.data.internal.__memory_base : ptr - v84 = hir.bitcast v83 : ptr; - v85 = hir.load v84 : i32; + v88 = builtin.global_symbol @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/GOT.data.internal.__memory_base : ptr + v89 = hir.bitcast v88 : ptr; + v90 = hir.load v89 : i32; + hir.store_local v90 #[local = lv0]; hir.exec @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/__wasm_call_ctors() - v239 = arith.constant 1 : u8; - v241 = arith.constant 1048600 : i32; - v87 = arith.add v85, v241 : i32 #[overflow = wrapping]; - v91 = hir.bitcast v87 : u32; - v92 = hir.int_to_ptr v91 : ptr; - hir.store v92, v239; + v91 = hir.load_local : i32 #[local = lv0]; + v177 = arith.constant 1 : u8; + v182 = arith.constant 1048600 : i32; + v93 = arith.add v91, v182 : i32 #[overflow = wrapping]; + v97 = hir.bitcast v93 : u32; + v98 = hir.int_to_ptr v97 : ptr; + hir.store v98, v177; scf.yield ; }; builtin.ret ; }; - private builtin.function @::reverse(v93: i32, v94: i32) { - ^block15(v93: i32, v94: i32): - v97 = builtin.global_symbol @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/__stack_pointer : ptr - v98 = hir.bitcast v97 : ptr; - v99 = hir.load v98 : i32; - v100 = arith.constant 16 : i32; - v101 = arith.sub v99, v100 : i32 #[overflow = wrapping]; - v103 = arith.constant 8 : u32; - v102 = hir.bitcast v94 : u32; - v104 = arith.add v102, v103 : u32 #[overflow = checked]; - v328 = arith.constant 8 : u32; - v106 = arith.mod v104, v328 : u32; - hir.assertz v106 #[code = 250]; - v107 = hir.int_to_ptr v104 : ptr; - v108 = hir.load v107 : i64; - v327 = arith.constant 8 : u32; - v109 = hir.bitcast v101 : u32; - v111 = arith.add v109, v327 : u32 #[overflow = checked]; - v112 = arith.constant 4 : u32; - v113 = arith.mod v111, v112 : u32; - hir.assertz v113 #[code = 250]; - v114 = hir.int_to_ptr v111 : ptr; - hir.store v114, v108; - v115 = hir.bitcast v94 : u32; - v326 = arith.constant 8 : u32; - v117 = arith.mod v115, v326 : u32; - hir.assertz v117 #[code = 250]; - v118 = hir.int_to_ptr v115 : ptr; - v119 = hir.load v118 : i64; - v120 = hir.bitcast v101 : u32; - v325 = arith.constant 4 : u32; - v122 = arith.mod v120, v325 : u32; - hir.assertz v122 #[code = 250]; - v123 = hir.int_to_ptr v120 : ptr; - hir.store v123, v119; - v124 = arith.constant 12 : i32; - v125 = arith.add v101, v124 : i32 #[overflow = wrapping]; - v95 = arith.constant 0 : i32; - v296, v297, v298, v299, v300, v301 = scf.while v95, v101, v125, v93 : i32, i32, i32, i32, i32, i32 { - ^block35(v302: i32, v303: i32, v304: i32, v305: i32): - v324 = arith.constant 0 : i32; - v128 = arith.constant 8 : i32; - v129 = arith.eq v302, v128 : i1; - v130 = arith.zext v129 : u32; - v131 = hir.bitcast v130 : i32; - v133 = arith.neq v131, v324 : i1; - v290, v291 = scf.if v133 : i32, i32 { - ^block34: - v250 = ub.poison i32 : i32; - scf.yield v250, v250; - } else { - ^block20: - v135 = arith.add v303, v302 : i32 #[overflow = wrapping]; - v136 = hir.bitcast v135 : u32; - v323 = arith.constant 4 : u32; - v138 = arith.mod v136, v323 : u32; - hir.assertz v138 #[code = 250]; - v139 = hir.int_to_ptr v136 : ptr; - v140 = hir.load v139 : felt; - v142 = hir.bitcast v304 : u32; - v322 = arith.constant 4 : u32; - v144 = arith.mod v142, v322 : u32; - hir.assertz v144 #[code = 250]; - v145 = hir.int_to_ptr v142 : ptr; - v146 = hir.load v145 : i32; - v147 = hir.bitcast v135 : u32; - v321 = arith.constant 4 : u32; - v149 = arith.mod v147, v321 : u32; - hir.assertz v149 #[code = 250]; - v150 = hir.int_to_ptr v147 : ptr; - hir.store v150, v146; - v151 = hir.bitcast v304 : u32; - v320 = arith.constant 4 : u32; - v153 = arith.mod v151, v320 : u32; - hir.assertz v153 #[code = 250]; - v154 = hir.int_to_ptr v151 : ptr; - hir.store v154, v140; - v157 = arith.constant -4 : i32; - v158 = arith.add v304, v157 : i32 #[overflow = wrapping]; - v155 = arith.constant 4 : i32; - v156 = arith.add v302, v155 : i32 #[overflow = wrapping]; - scf.yield v156, v158; - }; - v318 = ub.poison i32 : i32; - v293 = cf.select v133, v318, v305 : i32; - v319 = ub.poison i32 : i32; - v292 = cf.select v133, v319, v303 : i32; - v249 = arith.constant 1 : u32; - v242 = arith.constant 0 : u32; - v295 = cf.select v133, v242, v249 : u32; - v283 = arith.trunc v295 : i1; - scf.condition v283, v290, v292, v291, v293, v303, v305; - } do { - ^block36(v306: i32, v307: i32, v308: i32, v309: i32, v310: i32, v311: i32): - scf.yield v306, v307, v308, v309; - }; - v317 = arith.constant 8 : u32; - v160 = hir.bitcast v300 : u32; - v162 = arith.add v160, v317 : u32 #[overflow = checked]; - v316 = arith.constant 4 : u32; - v164 = arith.mod v162, v316 : u32; - hir.assertz v164 #[code = 250]; - v165 = hir.int_to_ptr v162 : ptr; - v166 = hir.load v165 : i64; - v315 = arith.constant 8 : u32; - v167 = hir.bitcast v301 : u32; - v169 = arith.add v167, v315 : u32 #[overflow = checked]; - v314 = arith.constant 8 : u32; - v171 = arith.mod v169, v314 : u32; - hir.assertz v171 #[code = 250]; - v172 = hir.int_to_ptr v169 : ptr; - hir.store v172, v166; - v173 = hir.bitcast v300 : u32; - v313 = arith.constant 4 : u32; - v175 = arith.mod v173, v313 : u32; - hir.assertz v175 #[code = 250]; - v176 = hir.int_to_ptr v173 : ptr; - v177 = hir.load v176 : i64; - v178 = hir.bitcast v301 : u32; - v312 = arith.constant 8 : u32; - v180 = arith.mod v178, v312 : u32; - hir.assertz v180 #[code = 250]; - v181 = hir.int_to_ptr v178 : ptr; - hir.store v181, v177; - builtin.ret ; - }; - - private builtin.function @miden::native_account::compute_delta_commitment(v182: i32) { - ^block21(v182: i32): - v183, v184, v185, v186 = hir.exec @miden/native_account/compute_delta_commitment() : felt, felt, felt, felt - v187 = hir.bitcast v182 : u32; - v188 = hir.int_to_ptr v187 : ptr; - hir.store v188, v183; - v189 = arith.constant 4 : u32; - v190 = arith.add v187, v189 : u32 #[overflow = checked]; - v191 = hir.int_to_ptr v190 : ptr; - hir.store v191, v184; - v192 = arith.constant 8 : u32; - v193 = arith.add v187, v192 : u32 #[overflow = checked]; - v194 = hir.int_to_ptr v193 : ptr; - hir.store v194, v185; - v195 = arith.constant 12 : u32; - v196 = arith.add v187, v195 : u32 #[overflow = checked]; - v197 = hir.int_to_ptr v196 : ptr; - hir.store v197, v186; + private builtin.function @miden::protocol::native_account::compute_delta_commitment(v99: i32) { + ^block15(v99: i32): + v100, v101, v102, v103 = hir.exec @miden/protocol/native_account/compute_delta_commitment() : felt, felt, felt, felt + v104 = hir.bitcast v99 : u32; + v105 = hir.int_to_ptr v104 : ptr; + hir.store v105, v100; + v185 = arith.constant 4 : u32; + v107 = arith.add v104, v185 : u32 #[overflow = checked]; + v108 = hir.int_to_ptr v107 : ptr; + hir.store v108, v101; + v184 = arith.constant 8 : u32; + v110 = arith.add v104, v184 : u32 #[overflow = checked]; + v111 = hir.int_to_ptr v110 : ptr; + hir.store v111, v102; + v183 = arith.constant 12 : u32; + v113 = arith.add v104, v183 : u32 #[overflow = checked]; + v114 = hir.int_to_ptr v113 : ptr; + hir.store v114, v103; builtin.ret ; }; @@ -294,34 +178,34 @@ builtin.component miden:rust-sdk-account-compute-delta-commitment-binding/rust-s }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block25: - v198 = hir.exec @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1#binding() : i32 + ^block20: + v115 = hir.exec @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1#binding() : i32 + v189 = arith.constant 0 : i32; + v117 = arith.add v115, v189 : i32 #[overflow = unchecked]; + v198 = arith.constant 0 : i32; v199 = arith.constant 0 : i32; - v200 = arith.add v198, v199 : i32 #[overflow = unchecked]; - v332 = arith.constant 0 : i32; - v333 = arith.constant 0 : i32; - v202 = arith.add v200, v333 : i32 #[overflow = unchecked]; - v204 = arith.add v202, v332 : i32 #[overflow = unchecked]; - v205 = hir.int_to_ptr v204 : ptr; - v206 = hir.load v205 : felt; - v331 = arith.constant 0 : i32; - v207 = arith.constant 4 : i32; - v208 = arith.add v200, v207 : i32 #[overflow = unchecked]; - v210 = arith.add v208, v331 : i32 #[overflow = unchecked]; - v211 = hir.int_to_ptr v210 : ptr; - v212 = hir.load v211 : felt; - v330 = arith.constant 0 : i32; - v213 = arith.constant 8 : i32; - v214 = arith.add v200, v213 : i32 #[overflow = unchecked]; - v216 = arith.add v214, v330 : i32 #[overflow = unchecked]; - v217 = hir.int_to_ptr v216 : ptr; - v218 = hir.load v217 : felt; - v329 = arith.constant 0 : i32; - v219 = arith.constant 12 : i32; - v220 = arith.add v200, v219 : i32 #[overflow = unchecked]; - v222 = arith.add v220, v329 : i32 #[overflow = unchecked]; - v223 = hir.int_to_ptr v222 : ptr; - v224 = hir.load v223 : felt; - builtin.ret v206, v212, v218, v224; + v119 = arith.add v117, v199 : i32 #[overflow = unchecked]; + v121 = arith.add v119, v198 : i32 #[overflow = unchecked]; + v122 = hir.int_to_ptr v121 : ptr; + v123 = hir.load v122 : felt; + v197 = arith.constant 0 : i32; + v188 = arith.constant 4 : i32; + v125 = arith.add v117, v188 : i32 #[overflow = unchecked]; + v127 = arith.add v125, v197 : i32 #[overflow = unchecked]; + v128 = hir.int_to_ptr v127 : ptr; + v129 = hir.load v128 : felt; + v196 = arith.constant 0 : i32; + v187 = arith.constant 8 : i32; + v131 = arith.add v117, v187 : i32 #[overflow = unchecked]; + v133 = arith.add v131, v196 : i32 #[overflow = unchecked]; + v134 = hir.int_to_ptr v133 : ptr; + v135 = hir.load v134 : felt; + v195 = arith.constant 0 : i32; + v186 = arith.constant 12 : i32; + v137 = arith.add v117, v186 : i32 #[overflow = unchecked]; + v139 = arith.add v137, v195 : i32 #[overflow = unchecked]; + v140 = hir.int_to_ptr v139 : ptr; + v141 = hir.load v140 : felt; + builtin.ret v123, v129, v135, v141; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.masm index f717cfe2a..4e004ff41 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.masm @@ -1,13 +1,13 @@ -# mod miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1 +# mod ::"miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> (felt, felt, felt, felt) - exec.::miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1::init + exec."miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1::rust_sdk_account_compute_delta_commitment_binding::miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1#binding + exec.::"miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1"::rust_sdk_account_compute_delta_commitment_binding::"miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1#binding" trace.252 nop push.0 @@ -62,7 +62,7 @@ pub proc binding( nop movdn.3 swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -75,7 +75,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -86,7 +86,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1::rust_sdk_account_compute_delta_commitment_binding +# mod ::"miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1"::rust_sdk_account_compute_delta_commitment_binding @callconv("C") proc __wasm_call_ctors( @@ -102,6 +102,7 @@ proc rust_sdk_account_compute_delta_commitment_binding::bindings::__link_custom_ nop end +@locals("2") @callconv("C") proc miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1#binding( @@ -114,36 +115,87 @@ proc miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-co exec.::intrinsics::mem::load_sw trace.252 nop - push.48 + push.16 u32wrapping_sub + dup.0 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 - dup.1 + u32divmod.4 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114148 u32divmod.4 swap.1 trace.240 nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop exec.::intrinsics::mem::store_sw trace.252 nop trace.240 nop - exec.::miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1::rust_sdk_account_compute_delta_commitment_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1"::rust_sdk_account_compute_delta_commitment_binding::wit_bindgen::rt::run_ctors_once trace.252 nop - push.16 - dup.1 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1"::rust_sdk_account_compute_delta_commitment_binding::"miden::protocol::native_account::compute_delta_commitment" + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 u32wrapping_add + dup.0 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1::rust_sdk_account_compute_delta_commitment_binding::miden::native_account::compute_delta_commitment + exec.::intrinsics::mem::store_sw trace.252 nop - push.24 - dup.1 - add - u32assert - push.8 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 dup.1 swap.1 u32mod @@ -153,15 +205,14 @@ proc miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-co swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.40 - dup.3 + push.12 + movup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -169,18 +220,32 @@ proc miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-co assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.16 - dup.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -190,15 +255,14 @@ proc miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-co swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.32 - dup.3 + push.8 + movup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -206,37 +270,32 @@ proc miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-co assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.1114148 - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.32 - dup.2 - u32wrapping_add - dup.2 + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1::rust_sdk_account_compute_delta_commitment_binding::::reverse + exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 - u32wrapping_add push.8 - dup.2 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -246,12 +305,11 @@ proc miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-co swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.8 - dup.3 + push.4 + movup.2 add u32assert push.4 @@ -262,15 +320,32 @@ proc miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-co assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - dup.1 - push.8 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + swap.1 + add + u32assert + push.4 dup.1 swap.1 u32mod @@ -280,11 +355,10 @@ proc miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-co swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop swap.1 - dup.2 push.4 dup.1 swap.1 @@ -293,15 +367,20 @@ proc miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-co assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.48 - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 u32wrapping_add push.1114144 u32divmod.4 @@ -311,8 +390,17 @@ proc miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-co exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -354,9 +442,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop trace.240 nop - exec.::miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1::rust_sdk_account_compute_delta_commitment_binding::__wasm_call_ctors + exec.::"miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1"::rust_sdk_account_compute_delta_commitment_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -388,287 +492,10 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.4 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop -end - -@callconv("C") -proc miden::native_account::compute_delta_commitment(i32) +proc miden::protocol::native_account::compute_delta_commitment(i32) trace.240 nop - exec.::miden::native_account::compute_delta_commitment + exec.::miden::protocol::native_account::compute_delta_commitment trace.252 nop movup.4 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.wat index 310292586..e4da3b821 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.wat @@ -12,8 +12,7 @@ (core module $main (;0;) (type (;0;) (func)) (type (;1;) (func (result i32))) - (type (;2;) (func (param i32 i32))) - (type (;3;) (func (param i32))) + (type (;2;) (func (param i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -26,43 +25,36 @@ (func $miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1#binding (;2;) (type 1) (result i32) (local i32 i32) global.get $__stack_pointer - i32.const 48 + i32.const 16 i32.sub local.tee 0 global.set $__stack_pointer - call $wit_bindgen::rt::run_ctors_once - local.get 0 - i32.const 16 - i32.add - call $miden::native_account::compute_delta_commitment - local.get 0 - local.get 0 - i64.load offset=24 - i64.store offset=40 - local.get 0 - local.get 0 - i64.load offset=16 - i64.store offset=32 global.get $GOT.data.internal.__memory_base local.set 1 + call $wit_bindgen::rt::run_ctors_once local.get 0 - local.get 0 - i32.const 32 - i32.add - call $::reverse + call $miden::protocol::native_account::compute_delta_commitment local.get 1 i32.const 1048584 i32.add local.tee 1 local.get 0 - i64.load offset=8 - i64.store offset=8 align=4 + f32.load + f32.store offset=12 local.get 1 local.get 0 - i64.load - i64.store align=4 + f32.load offset=4 + f32.store offset=8 + local.get 1 + local.get 0 + f32.load offset=8 + f32.store offset=4 + local.get 1 local.get 0 - i32.const 48 + f32.load offset=12 + f32.store + local.get 0 + i32.const 16 i32.add global.set $__stack_pointer local.get 1 @@ -85,69 +77,11 @@ i32.store8 end ) - (func $::reverse (;4;) (type 2) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store - ) - (func $miden::native_account::compute_delta_commitment (;5;) (type 3) (param i32) + (func $miden::protocol::native_account::compute_delta_commitment (;4;) (type 2) (param i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "crust_sdk_account_compute_delta_commitment_binding\01\0b0.0.1\03\01\01\00\00\00\00") + (@custom "rodata,miden_account" (after data) "crust_sdk_account_compute_delta_commitment_binding\01\0b0.0.1\03\01\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.hir index c80f86cd9..6ed26633b 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.hir @@ -12,273 +12,157 @@ builtin.component miden:rust-sdk-account-compute-storage-commitment-binding/rust private builtin.function @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1#binding() -> i32 { ^block9: - v2 = builtin.global_symbol @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/__stack_pointer : ptr - v3 = hir.bitcast v2 : ptr; - v4 = hir.load v3 : i32; - v5 = arith.constant 48 : i32; - v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; - v7 = builtin.global_symbol @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/__stack_pointer : ptr - v8 = hir.bitcast v7 : ptr; - hir.store v8, v6; + v1 = builtin.global_symbol @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v150 = arith.constant 16 : i32; + v5 = arith.sub v3, v150 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; + v8 = builtin.global_symbol @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/GOT.data.internal.__memory_base : ptr + v9 = hir.bitcast v8 : ptr; + v10 = hir.load v9 : i32; + hir.store_local v10 #[local = lv1]; hir.exec @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/wit_bindgen::rt::run_ctors_once() - v9 = arith.constant 16 : i32; - v10 = arith.add v6, v9 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/miden::active_account::compute_storage_commitment(v10) - v12 = arith.constant 24 : u32; - v11 = hir.bitcast v6 : u32; - v13 = arith.add v11, v12 : u32 #[overflow = checked]; - v14 = arith.constant 8 : u32; - v15 = arith.mod v13, v14 : u32; - hir.assertz v15 #[code = 250]; - v16 = hir.int_to_ptr v13 : ptr; - v17 = hir.load v16 : i64; - v19 = arith.constant 40 : u32; - v18 = hir.bitcast v6 : u32; - v20 = arith.add v18, v19 : u32 #[overflow = checked]; - v237 = arith.constant 8 : u32; - v22 = arith.mod v20, v237 : u32; - hir.assertz v22 #[code = 250]; - v23 = hir.int_to_ptr v20 : ptr; - hir.store v23, v17; - v25 = arith.constant 16 : u32; - v24 = hir.bitcast v6 : u32; - v26 = arith.add v24, v25 : u32 #[overflow = checked]; - v236 = arith.constant 8 : u32; - v28 = arith.mod v26, v236 : u32; - hir.assertz v28 #[code = 250]; - v29 = hir.int_to_ptr v26 : ptr; - v30 = hir.load v29 : i64; - v32 = arith.constant 32 : u32; - v31 = hir.bitcast v6 : u32; - v33 = arith.add v31, v32 : u32 #[overflow = checked]; - v235 = arith.constant 8 : u32; - v35 = arith.mod v33, v235 : u32; - hir.assertz v35 #[code = 250]; - v36 = hir.int_to_ptr v33 : ptr; - hir.store v36, v30; - v37 = builtin.global_symbol @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/GOT.data.internal.__memory_base : ptr - v38 = hir.bitcast v37 : ptr; - v39 = hir.load v38 : i32; - v40 = arith.constant 32 : i32; - v41 = arith.add v6, v40 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/::reverse(v6, v41) - v42 = arith.constant 1048584 : i32; - v43 = arith.add v39, v42 : i32 #[overflow = wrapping]; - v234 = arith.constant 8 : u32; - v44 = hir.bitcast v6 : u32; - v46 = arith.add v44, v234 : u32 #[overflow = checked]; - v233 = arith.constant 8 : u32; - v48 = arith.mod v46, v233 : u32; + v11 = hir.load_local : i32 #[local = lv0]; + hir.exec @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/miden::protocol::active_account::compute_storage_commitment(v11) + v12 = hir.load_local : i32 #[local = lv1]; + v149 = arith.constant 1048584 : i32; + v14 = arith.add v12, v149 : i32 #[overflow = wrapping]; + hir.store_local v14 #[local = lv1]; + v15 = hir.load_local : i32 #[local = lv0]; + v16 = hir.bitcast v15 : u32; + v148 = arith.constant 4 : u32; + v18 = arith.mod v16, v148 : u32; + hir.assertz v18 #[code = 250]; + v19 = hir.int_to_ptr v16 : ptr; + v20 = hir.load v19 : felt; + v147 = arith.constant 12 : u32; + v21 = hir.bitcast v14 : u32; + v23 = arith.add v21, v147 : u32 #[overflow = checked]; + v174 = arith.constant 4 : u32; + v25 = arith.mod v23, v174 : u32; + hir.assertz v25 #[code = 250]; + v26 = hir.int_to_ptr v23 : ptr; + hir.store v26, v20; + v27 = hir.load_local : i32 #[local = lv1]; + v28 = hir.load_local : i32 #[local = lv0]; + v173 = arith.constant 4 : u32; + v29 = hir.bitcast v28 : u32; + v31 = arith.add v29, v173 : u32 #[overflow = checked]; + v172 = arith.constant 4 : u32; + v33 = arith.mod v31, v172 : u32; + hir.assertz v33 #[code = 250]; + v34 = hir.int_to_ptr v31 : ptr; + v35 = hir.load v34 : felt; + v146 = arith.constant 8 : u32; + v36 = hir.bitcast v27 : u32; + v38 = arith.add v36, v146 : u32 #[overflow = checked]; + v171 = arith.constant 4 : u32; + v40 = arith.mod v38, v171 : u32; + hir.assertz v40 #[code = 250]; + v41 = hir.int_to_ptr v38 : ptr; + hir.store v41, v35; + v42 = hir.load_local : i32 #[local = lv1]; + v43 = hir.load_local : i32 #[local = lv0]; + v170 = arith.constant 8 : u32; + v44 = hir.bitcast v43 : u32; + v46 = arith.add v44, v170 : u32 #[overflow = checked]; + v169 = arith.constant 4 : u32; + v48 = arith.mod v46, v169 : u32; hir.assertz v48 #[code = 250]; - v49 = hir.int_to_ptr v46 : ptr; - v50 = hir.load v49 : i64; - v232 = arith.constant 8 : u32; - v51 = hir.bitcast v43 : u32; - v53 = arith.add v51, v232 : u32 #[overflow = checked]; - v54 = arith.constant 4 : u32; - v55 = arith.mod v53, v54 : u32; + v49 = hir.int_to_ptr v46 : ptr; + v50 = hir.load v49 : felt; + v168 = arith.constant 4 : u32; + v51 = hir.bitcast v42 : u32; + v53 = arith.add v51, v168 : u32 #[overflow = checked]; + v167 = arith.constant 4 : u32; + v55 = arith.mod v53, v167 : u32; hir.assertz v55 #[code = 250]; - v56 = hir.int_to_ptr v53 : ptr; + v56 = hir.int_to_ptr v53 : ptr; hir.store v56, v50; - v57 = hir.bitcast v6 : u32; - v231 = arith.constant 8 : u32; - v59 = arith.mod v57, v231 : u32; - hir.assertz v59 #[code = 250]; - v60 = hir.int_to_ptr v57 : ptr; - v61 = hir.load v60 : i64; - v62 = hir.bitcast v43 : u32; - v230 = arith.constant 4 : u32; - v64 = arith.mod v62, v230 : u32; - hir.assertz v64 #[code = 250]; - v65 = hir.int_to_ptr v62 : ptr; - hir.store v65, v61; - v229 = arith.constant 48 : i32; - v67 = arith.add v6, v229 : i32 #[overflow = wrapping]; - v68 = builtin.global_symbol @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/__stack_pointer : ptr - v69 = hir.bitcast v68 : ptr; - hir.store v69, v67; - builtin.ret v43; + v57 = hir.load_local : i32 #[local = lv1]; + v58 = hir.load_local : i32 #[local = lv0]; + v166 = arith.constant 12 : u32; + v59 = hir.bitcast v58 : u32; + v61 = arith.add v59, v166 : u32 #[overflow = checked]; + v165 = arith.constant 4 : u32; + v63 = arith.mod v61, v165 : u32; + hir.assertz v63 #[code = 250]; + v64 = hir.int_to_ptr v61 : ptr; + v65 = hir.load v64 : felt; + v66 = hir.bitcast v57 : u32; + v164 = arith.constant 4 : u32; + v68 = arith.mod v66, v164 : u32; + hir.assertz v68 #[code = 250]; + v69 = hir.int_to_ptr v66 : ptr; + hir.store v69, v65; + v70 = hir.load_local : i32 #[local = lv0]; + v163 = arith.constant 16 : i32; + v72 = arith.add v70, v163 : i32 #[overflow = wrapping]; + v73 = builtin.global_symbol @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/__stack_pointer : ptr + v74 = hir.bitcast v73 : ptr; + hir.store v74, v72; + v75 = hir.load_local : i32 #[local = lv1]; + builtin.ret v75; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v71 = builtin.global_symbol @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/GOT.data.internal.__memory_base : ptr - v72 = hir.bitcast v71 : ptr; - v73 = hir.load v72 : i32; - v74 = arith.constant 1048600 : i32; - v75 = arith.add v73, v74 : i32 #[overflow = wrapping]; - v76 = hir.bitcast v75 : u32; - v77 = hir.int_to_ptr v76 : ptr; - v78 = hir.load v77 : u8; - v70 = arith.constant 0 : i32; - v79 = arith.zext v78 : u32; - v80 = hir.bitcast v79 : i32; - v82 = arith.neq v80, v70 : i1; - scf.if v82{ + v76 = builtin.global_symbol @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/GOT.data.internal.__memory_base : ptr + v77 = hir.bitcast v76 : ptr; + v78 = hir.load v77 : i32; + v179 = arith.constant 1048600 : i32; + v80 = arith.add v78, v179 : i32 #[overflow = wrapping]; + v81 = hir.bitcast v80 : u32; + v82 = hir.int_to_ptr v81 : ptr; + v83 = hir.load v82 : u8; + v178 = arith.constant 0 : i32; + v84 = arith.zext v83 : u32; + v85 = hir.bitcast v84 : i32; + v87 = arith.neq v85, v178 : i1; + scf.if v87{ ^block13: scf.yield ; } else { ^block14: - v83 = builtin.global_symbol @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/GOT.data.internal.__memory_base : ptr - v84 = hir.bitcast v83 : ptr; - v85 = hir.load v84 : i32; + v88 = builtin.global_symbol @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/GOT.data.internal.__memory_base : ptr + v89 = hir.bitcast v88 : ptr; + v90 = hir.load v89 : i32; + hir.store_local v90 #[local = lv0]; hir.exec @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/__wasm_call_ctors() - v239 = arith.constant 1 : u8; - v241 = arith.constant 1048600 : i32; - v87 = arith.add v85, v241 : i32 #[overflow = wrapping]; - v91 = hir.bitcast v87 : u32; - v92 = hir.int_to_ptr v91 : ptr; - hir.store v92, v239; + v91 = hir.load_local : i32 #[local = lv0]; + v177 = arith.constant 1 : u8; + v182 = arith.constant 1048600 : i32; + v93 = arith.add v91, v182 : i32 #[overflow = wrapping]; + v97 = hir.bitcast v93 : u32; + v98 = hir.int_to_ptr v97 : ptr; + hir.store v98, v177; scf.yield ; }; builtin.ret ; }; - private builtin.function @::reverse(v93: i32, v94: i32) { - ^block15(v93: i32, v94: i32): - v97 = builtin.global_symbol @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/__stack_pointer : ptr - v98 = hir.bitcast v97 : ptr; - v99 = hir.load v98 : i32; - v100 = arith.constant 16 : i32; - v101 = arith.sub v99, v100 : i32 #[overflow = wrapping]; - v103 = arith.constant 8 : u32; - v102 = hir.bitcast v94 : u32; - v104 = arith.add v102, v103 : u32 #[overflow = checked]; - v328 = arith.constant 8 : u32; - v106 = arith.mod v104, v328 : u32; - hir.assertz v106 #[code = 250]; - v107 = hir.int_to_ptr v104 : ptr; - v108 = hir.load v107 : i64; - v327 = arith.constant 8 : u32; - v109 = hir.bitcast v101 : u32; - v111 = arith.add v109, v327 : u32 #[overflow = checked]; - v112 = arith.constant 4 : u32; - v113 = arith.mod v111, v112 : u32; - hir.assertz v113 #[code = 250]; - v114 = hir.int_to_ptr v111 : ptr; - hir.store v114, v108; - v115 = hir.bitcast v94 : u32; - v326 = arith.constant 8 : u32; - v117 = arith.mod v115, v326 : u32; - hir.assertz v117 #[code = 250]; - v118 = hir.int_to_ptr v115 : ptr; - v119 = hir.load v118 : i64; - v120 = hir.bitcast v101 : u32; - v325 = arith.constant 4 : u32; - v122 = arith.mod v120, v325 : u32; - hir.assertz v122 #[code = 250]; - v123 = hir.int_to_ptr v120 : ptr; - hir.store v123, v119; - v124 = arith.constant 12 : i32; - v125 = arith.add v101, v124 : i32 #[overflow = wrapping]; - v95 = arith.constant 0 : i32; - v296, v297, v298, v299, v300, v301 = scf.while v95, v101, v125, v93 : i32, i32, i32, i32, i32, i32 { - ^block35(v302: i32, v303: i32, v304: i32, v305: i32): - v324 = arith.constant 0 : i32; - v128 = arith.constant 8 : i32; - v129 = arith.eq v302, v128 : i1; - v130 = arith.zext v129 : u32; - v131 = hir.bitcast v130 : i32; - v133 = arith.neq v131, v324 : i1; - v290, v291 = scf.if v133 : i32, i32 { - ^block34: - v250 = ub.poison i32 : i32; - scf.yield v250, v250; - } else { - ^block20: - v135 = arith.add v303, v302 : i32 #[overflow = wrapping]; - v136 = hir.bitcast v135 : u32; - v323 = arith.constant 4 : u32; - v138 = arith.mod v136, v323 : u32; - hir.assertz v138 #[code = 250]; - v139 = hir.int_to_ptr v136 : ptr; - v140 = hir.load v139 : felt; - v142 = hir.bitcast v304 : u32; - v322 = arith.constant 4 : u32; - v144 = arith.mod v142, v322 : u32; - hir.assertz v144 #[code = 250]; - v145 = hir.int_to_ptr v142 : ptr; - v146 = hir.load v145 : i32; - v147 = hir.bitcast v135 : u32; - v321 = arith.constant 4 : u32; - v149 = arith.mod v147, v321 : u32; - hir.assertz v149 #[code = 250]; - v150 = hir.int_to_ptr v147 : ptr; - hir.store v150, v146; - v151 = hir.bitcast v304 : u32; - v320 = arith.constant 4 : u32; - v153 = arith.mod v151, v320 : u32; - hir.assertz v153 #[code = 250]; - v154 = hir.int_to_ptr v151 : ptr; - hir.store v154, v140; - v157 = arith.constant -4 : i32; - v158 = arith.add v304, v157 : i32 #[overflow = wrapping]; - v155 = arith.constant 4 : i32; - v156 = arith.add v302, v155 : i32 #[overflow = wrapping]; - scf.yield v156, v158; - }; - v318 = ub.poison i32 : i32; - v293 = cf.select v133, v318, v305 : i32; - v319 = ub.poison i32 : i32; - v292 = cf.select v133, v319, v303 : i32; - v249 = arith.constant 1 : u32; - v242 = arith.constant 0 : u32; - v295 = cf.select v133, v242, v249 : u32; - v283 = arith.trunc v295 : i1; - scf.condition v283, v290, v292, v291, v293, v303, v305; - } do { - ^block36(v306: i32, v307: i32, v308: i32, v309: i32, v310: i32, v311: i32): - scf.yield v306, v307, v308, v309; - }; - v317 = arith.constant 8 : u32; - v160 = hir.bitcast v300 : u32; - v162 = arith.add v160, v317 : u32 #[overflow = checked]; - v316 = arith.constant 4 : u32; - v164 = arith.mod v162, v316 : u32; - hir.assertz v164 #[code = 250]; - v165 = hir.int_to_ptr v162 : ptr; - v166 = hir.load v165 : i64; - v315 = arith.constant 8 : u32; - v167 = hir.bitcast v301 : u32; - v169 = arith.add v167, v315 : u32 #[overflow = checked]; - v314 = arith.constant 8 : u32; - v171 = arith.mod v169, v314 : u32; - hir.assertz v171 #[code = 250]; - v172 = hir.int_to_ptr v169 : ptr; - hir.store v172, v166; - v173 = hir.bitcast v300 : u32; - v313 = arith.constant 4 : u32; - v175 = arith.mod v173, v313 : u32; - hir.assertz v175 #[code = 250]; - v176 = hir.int_to_ptr v173 : ptr; - v177 = hir.load v176 : i64; - v178 = hir.bitcast v301 : u32; - v312 = arith.constant 8 : u32; - v180 = arith.mod v178, v312 : u32; - hir.assertz v180 #[code = 250]; - v181 = hir.int_to_ptr v178 : ptr; - hir.store v181, v177; - builtin.ret ; - }; - - private builtin.function @miden::active_account::compute_storage_commitment(v182: i32) { - ^block21(v182: i32): - v183, v184, v185, v186 = hir.exec @miden/active_account/compute_storage_commitment() : felt, felt, felt, felt - v187 = hir.bitcast v182 : u32; - v188 = hir.int_to_ptr v187 : ptr; - hir.store v188, v183; - v189 = arith.constant 4 : u32; - v190 = arith.add v187, v189 : u32 #[overflow = checked]; - v191 = hir.int_to_ptr v190 : ptr; - hir.store v191, v184; - v192 = arith.constant 8 : u32; - v193 = arith.add v187, v192 : u32 #[overflow = checked]; - v194 = hir.int_to_ptr v193 : ptr; - hir.store v194, v185; - v195 = arith.constant 12 : u32; - v196 = arith.add v187, v195 : u32 #[overflow = checked]; - v197 = hir.int_to_ptr v196 : ptr; - hir.store v197, v186; + private builtin.function @miden::protocol::active_account::compute_storage_commitment(v99: i32) { + ^block15(v99: i32): + v100, v101, v102, v103 = hir.exec @miden/protocol/active_account/compute_storage_commitment() : felt, felt, felt, felt + v104 = hir.bitcast v99 : u32; + v105 = hir.int_to_ptr v104 : ptr; + hir.store v105, v100; + v185 = arith.constant 4 : u32; + v107 = arith.add v104, v185 : u32 #[overflow = checked]; + v108 = hir.int_to_ptr v107 : ptr; + hir.store v108, v101; + v184 = arith.constant 8 : u32; + v110 = arith.add v104, v184 : u32 #[overflow = checked]; + v111 = hir.int_to_ptr v110 : ptr; + hir.store v111, v102; + v183 = arith.constant 12 : u32; + v113 = arith.add v104, v183 : u32 #[overflow = checked]; + v114 = hir.int_to_ptr v113 : ptr; + hir.store v114, v103; builtin.ret ; }; @@ -294,34 +178,34 @@ builtin.component miden:rust-sdk-account-compute-storage-commitment-binding/rust }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block25: - v198 = hir.exec @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1#binding() : i32 + ^block20: + v115 = hir.exec @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1#binding() : i32 + v189 = arith.constant 0 : i32; + v117 = arith.add v115, v189 : i32 #[overflow = unchecked]; + v198 = arith.constant 0 : i32; v199 = arith.constant 0 : i32; - v200 = arith.add v198, v199 : i32 #[overflow = unchecked]; - v332 = arith.constant 0 : i32; - v333 = arith.constant 0 : i32; - v202 = arith.add v200, v333 : i32 #[overflow = unchecked]; - v204 = arith.add v202, v332 : i32 #[overflow = unchecked]; - v205 = hir.int_to_ptr v204 : ptr; - v206 = hir.load v205 : felt; - v331 = arith.constant 0 : i32; - v207 = arith.constant 4 : i32; - v208 = arith.add v200, v207 : i32 #[overflow = unchecked]; - v210 = arith.add v208, v331 : i32 #[overflow = unchecked]; - v211 = hir.int_to_ptr v210 : ptr; - v212 = hir.load v211 : felt; - v330 = arith.constant 0 : i32; - v213 = arith.constant 8 : i32; - v214 = arith.add v200, v213 : i32 #[overflow = unchecked]; - v216 = arith.add v214, v330 : i32 #[overflow = unchecked]; - v217 = hir.int_to_ptr v216 : ptr; - v218 = hir.load v217 : felt; - v329 = arith.constant 0 : i32; - v219 = arith.constant 12 : i32; - v220 = arith.add v200, v219 : i32 #[overflow = unchecked]; - v222 = arith.add v220, v329 : i32 #[overflow = unchecked]; - v223 = hir.int_to_ptr v222 : ptr; - v224 = hir.load v223 : felt; - builtin.ret v206, v212, v218, v224; + v119 = arith.add v117, v199 : i32 #[overflow = unchecked]; + v121 = arith.add v119, v198 : i32 #[overflow = unchecked]; + v122 = hir.int_to_ptr v121 : ptr; + v123 = hir.load v122 : felt; + v197 = arith.constant 0 : i32; + v188 = arith.constant 4 : i32; + v125 = arith.add v117, v188 : i32 #[overflow = unchecked]; + v127 = arith.add v125, v197 : i32 #[overflow = unchecked]; + v128 = hir.int_to_ptr v127 : ptr; + v129 = hir.load v128 : felt; + v196 = arith.constant 0 : i32; + v187 = arith.constant 8 : i32; + v131 = arith.add v117, v187 : i32 #[overflow = unchecked]; + v133 = arith.add v131, v196 : i32 #[overflow = unchecked]; + v134 = hir.int_to_ptr v133 : ptr; + v135 = hir.load v134 : felt; + v195 = arith.constant 0 : i32; + v186 = arith.constant 12 : i32; + v137 = arith.add v117, v186 : i32 #[overflow = unchecked]; + v139 = arith.add v137, v195 : i32 #[overflow = unchecked]; + v140 = hir.int_to_ptr v139 : ptr; + v141 = hir.load v140 : felt; + builtin.ret v123, v129, v135, v141; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.masm index 1b8d1157b..ece2841d9 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.masm @@ -1,13 +1,13 @@ -# mod miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1 +# mod ::"miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> (felt, felt, felt, felt) - exec.::miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1::init + exec."miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1::rust_sdk_account_compute_storage_commitment_binding::miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1#binding + exec.::"miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1"::rust_sdk_account_compute_storage_commitment_binding::"miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1#binding" trace.252 nop push.0 @@ -62,7 +62,7 @@ pub proc binding( nop movdn.3 swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -75,7 +75,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -86,7 +86,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1::rust_sdk_account_compute_storage_commitment_binding +# mod ::"miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1"::rust_sdk_account_compute_storage_commitment_binding @callconv("C") proc __wasm_call_ctors( @@ -102,6 +102,7 @@ proc rust_sdk_account_compute_storage_commitment_binding::bindings::__link_custo nop end +@locals("2") @callconv("C") proc miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1#binding( @@ -114,36 +115,87 @@ proc miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account- exec.::intrinsics::mem::load_sw trace.252 nop - push.48 + push.16 u32wrapping_sub + dup.0 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 - dup.1 + u32divmod.4 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114148 u32divmod.4 swap.1 trace.240 nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop exec.::intrinsics::mem::store_sw trace.252 nop trace.240 nop - exec.::miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1::rust_sdk_account_compute_storage_commitment_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1"::rust_sdk_account_compute_storage_commitment_binding::wit_bindgen::rt::run_ctors_once trace.252 nop - push.16 - dup.1 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1"::rust_sdk_account_compute_storage_commitment_binding::"miden::protocol::active_account::compute_storage_commitment" + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 u32wrapping_add + dup.0 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1::rust_sdk_account_compute_storage_commitment_binding::miden::active_account::compute_storage_commitment + exec.::intrinsics::mem::store_sw trace.252 nop - push.24 - dup.1 - add - u32assert - push.8 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 dup.1 swap.1 u32mod @@ -153,15 +205,14 @@ proc miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account- swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.40 - dup.3 + push.12 + movup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -169,18 +220,32 @@ proc miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account- assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.16 - dup.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -190,15 +255,14 @@ proc miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account- swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.32 - dup.3 + push.8 + movup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -206,37 +270,32 @@ proc miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account- assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.1114148 - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.32 - dup.2 - u32wrapping_add - dup.2 + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1::rust_sdk_account_compute_storage_commitment_binding::::reverse + exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 - u32wrapping_add push.8 - dup.2 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -246,12 +305,11 @@ proc miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account- swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.8 - dup.3 + push.4 + movup.2 add u32assert push.4 @@ -262,15 +320,32 @@ proc miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account- assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - dup.1 - push.8 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + swap.1 + add + u32assert + push.4 dup.1 swap.1 u32mod @@ -280,11 +355,10 @@ proc miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account- swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop swap.1 - dup.2 push.4 dup.1 swap.1 @@ -293,15 +367,20 @@ proc miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account- assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.48 - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 u32wrapping_add push.1114144 u32divmod.4 @@ -311,8 +390,17 @@ proc miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account- exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -354,9 +442,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop trace.240 nop - exec.::miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1::rust_sdk_account_compute_storage_commitment_binding::__wasm_call_ctors + exec.::"miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1"::rust_sdk_account_compute_storage_commitment_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -388,287 +492,10 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.4 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop -end - -@callconv("C") -proc miden::active_account::compute_storage_commitment(i32) +proc miden::protocol::active_account::compute_storage_commitment(i32) trace.240 nop - exec.::miden::active_account::compute_storage_commitment + exec.::miden::protocol::active_account::compute_storage_commitment trace.252 nop movup.4 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.wat index 0bdf9452b..209fd7029 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.wat @@ -12,8 +12,7 @@ (core module $main (;0;) (type (;0;) (func)) (type (;1;) (func (result i32))) - (type (;2;) (func (param i32 i32))) - (type (;3;) (func (param i32))) + (type (;2;) (func (param i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -26,43 +25,36 @@ (func $miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1#binding (;2;) (type 1) (result i32) (local i32 i32) global.get $__stack_pointer - i32.const 48 + i32.const 16 i32.sub local.tee 0 global.set $__stack_pointer - call $wit_bindgen::rt::run_ctors_once - local.get 0 - i32.const 16 - i32.add - call $miden::active_account::compute_storage_commitment - local.get 0 - local.get 0 - i64.load offset=24 - i64.store offset=40 - local.get 0 - local.get 0 - i64.load offset=16 - i64.store offset=32 global.get $GOT.data.internal.__memory_base local.set 1 + call $wit_bindgen::rt::run_ctors_once local.get 0 - local.get 0 - i32.const 32 - i32.add - call $::reverse + call $miden::protocol::active_account::compute_storage_commitment local.get 1 i32.const 1048584 i32.add local.tee 1 local.get 0 - i64.load offset=8 - i64.store offset=8 align=4 + f32.load + f32.store offset=12 local.get 1 local.get 0 - i64.load - i64.store align=4 + f32.load offset=4 + f32.store offset=8 + local.get 1 + local.get 0 + f32.load offset=8 + f32.store offset=4 + local.get 1 local.get 0 - i32.const 48 + f32.load offset=12 + f32.store + local.get 0 + i32.const 16 i32.add global.set $__stack_pointer local.get 1 @@ -85,69 +77,11 @@ i32.store8 end ) - (func $::reverse (;4;) (type 2) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store - ) - (func $miden::active_account::compute_storage_commitment (;5;) (type 3) (param i32) + (func $miden::protocol::active_account::compute_storage_commitment (;4;) (type 2) (param i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "grust_sdk_account_compute_storage_commitment_binding\01\0b0.0.1\03\01\01\00\00") + (@custom "rodata,miden_account" (after data) "grust_sdk_account_compute_storage_commitment_binding\01\0b0.0.1\03\01\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.hir index 83f4110d5..eddc9c0c2 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.hir @@ -12,408 +12,292 @@ builtin.component miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-fa private builtin.function @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1#binding() -> i32 { ^block9: - v3 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__stack_pointer : ptr - v4 = hir.bitcast v3 : ptr; - v5 = hir.load v4 : i32; - v6 = arith.constant 32 : i32; - v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; - v8 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__stack_pointer : ptr - v9 = hir.bitcast v8 : ptr; - hir.store v9, v7; + v1 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v254 = arith.constant 32 : i32; + v5 = arith.sub v3, v254 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/wit_bindgen::rt::run_ctors_once() - v1 = arith.constant 0 : i32; - v12 = hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/intrinsics::felt::from_u32(v1) : felt - v389 = arith.constant 0 : i32; - v368, v369, v370, v371 = scf.while v389, v7, v12 : i32, i32, felt, i32 { - ^block44(v372: i32, v373: i32, v374: felt): - v388 = arith.constant 0 : i32; - v34 = arith.constant 16 : i32; - v15 = arith.eq v372, v34 : i1; - v16 = arith.zext v15 : u32; - v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v388 : i1; - v363 = scf.if v19 : i32 { - ^block43: - v334 = ub.poison i32 : i32; - scf.yield v334; + v253 = arith.constant 0 : i32; + hir.store_local v253 #[local = lv1]; + v245 = arith.constant 0 : felt; + hir.store_local v245 #[local = lv2]; + scf.while { + ^block12: + v11 = hir.load_local : i32 #[local = lv1]; + v282 = arith.constant 0 : i32; + v258 = arith.constant 16 : i32; + v13 = arith.eq v11, v258 : i1; + v14 = arith.zext v13 : u32; + v15 = hir.bitcast v14 : i32; + v17 = arith.neq v15, v282 : i1; + scf.if v17{ + ^block33: + scf.yield ; } else { ^block14: - v387 = arith.constant 16 : i32; - v22 = arith.add v373, v387 : i32 #[overflow = wrapping]; - v23 = arith.add v22, v372 : i32 #[overflow = wrapping]; - v25 = hir.bitcast v23 : u32; - v50 = arith.constant 4 : u32; - v27 = arith.mod v25, v50 : u32; - hir.assertz v27 #[code = 250]; - v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v374; - v29 = arith.constant 4 : i32; - v30 = arith.add v372, v29 : i32 #[overflow = wrapping]; - scf.yield v30; + v18 = hir.load_local : i32 #[local = lv0]; + v21 = hir.load_local : i32 #[local = lv1]; + v23 = hir.load_local : felt #[local = lv2]; + v281 = arith.constant 16 : i32; + v20 = arith.add v18, v281 : i32 #[overflow = wrapping]; + v22 = arith.add v20, v21 : i32 #[overflow = wrapping]; + v24 = hir.bitcast v22 : u32; + v255 = arith.constant 4 : u32; + v26 = arith.mod v24, v255 : u32; + hir.assertz v26 #[code = 250]; + v27 = hir.int_to_ptr v24 : ptr; + hir.store v27, v23; + v28 = hir.load_local : i32 #[local = lv1]; + v246 = arith.constant 4 : i32; + v30 = arith.add v28, v246 : i32 #[overflow = wrapping]; + hir.store_local v30 #[local = lv1]; + scf.yield ; }; - v335 = ub.poison felt : felt; - v365 = cf.select v19, v335, v374 : felt; - v386 = ub.poison i32 : i32; - v364 = cf.select v19, v386, v373 : i32; - v333 = arith.constant 1 : u32; - v327 = arith.constant 0 : u32; - v367 = cf.select v19, v327, v333 : u32; - v357 = arith.trunc v367 : i1; - scf.condition v357, v363, v364, v365, v373; + v268 = arith.constant 1 : u32; + v265 = arith.constant 0 : u32; + v273 = cf.select v17, v265, v268 : u32; + v269 = arith.trunc v273 : i1; + scf.condition v269; } do { - ^block45(v375: i32, v376: i32, v377: felt, v378: i32): - scf.yield v375, v376, v377; + ^block32: + scf.yield ; }; v31 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/GOT.data.internal.__memory_base : ptr v32 = hir.bitcast v31 : ptr; v33 = hir.load v32 : i32; - v385 = arith.constant 16 : i32; - v35 = arith.add v371, v385 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/>::from(v371, v35) - v384 = arith.constant 16 : i32; - v37 = arith.add v371, v384 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/miden_base_sys::bindings::faucet::burn(v37, v371) - v38 = arith.constant 1048584 : i32; - v39 = arith.add v33, v38 : i32 #[overflow = wrapping]; - v41 = arith.constant 24 : u32; - v40 = hir.bitcast v371 : u32; - v42 = arith.add v40, v41 : u32 #[overflow = checked]; - v43 = arith.constant 8 : u32; - v44 = arith.mod v42, v43 : u32; - hir.assertz v44 #[code = 250]; - v45 = hir.int_to_ptr v42 : ptr; - v46 = hir.load v45 : i64; - v383 = arith.constant 8 : u32; - v47 = hir.bitcast v39 : u32; - v49 = arith.add v47, v383 : u32 #[overflow = checked]; - v382 = arith.constant 4 : u32; - v51 = arith.mod v49, v382 : u32; - hir.assertz v51 #[code = 250]; - v52 = hir.int_to_ptr v49 : ptr; - hir.store v52, v46; - v54 = arith.constant 16 : u32; - v53 = hir.bitcast v371 : u32; - v55 = arith.add v53, v54 : u32 #[overflow = checked]; - v381 = arith.constant 8 : u32; - v57 = arith.mod v55, v381 : u32; + hir.store_local v33 #[local = lv1]; + v34 = hir.load_local : i32 #[local = lv0]; + v280 = arith.constant 16 : i32; + v37 = arith.add v34, v280 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/>::from(v34, v37) + v38 = hir.load_local : i32 #[local = lv0]; + v279 = arith.constant 16 : i32; + v40 = arith.add v38, v279 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/miden_base_sys::bindings::faucet::burn(v40, v38) + v42 = hir.load_local : i32 #[local = lv1]; + v251 = arith.constant 1048584 : i32; + v44 = arith.add v42, v251 : i32 #[overflow = wrapping]; + hir.store_local v44 #[local = lv1]; + v45 = hir.load_local : i32 #[local = lv0]; + v250 = arith.constant 24 : u32; + v46 = hir.bitcast v45 : u32; + v48 = arith.add v46, v250 : u32 #[overflow = checked]; + v249 = arith.constant 8 : u32; + v50 = arith.mod v48, v249 : u32; + hir.assertz v50 #[code = 250]; + v51 = hir.int_to_ptr v48 : ptr; + v52 = hir.load v51 : i64; + v278 = arith.constant 8 : u32; + v53 = hir.bitcast v44 : u32; + v55 = arith.add v53, v278 : u32 #[overflow = checked]; + v277 = arith.constant 4 : u32; + v57 = arith.mod v55, v277 : u32; hir.assertz v57 #[code = 250]; v58 = hir.int_to_ptr v55 : ptr; - v59 = hir.load v58 : i64; - v60 = hir.bitcast v39 : u32; - v380 = arith.constant 4 : u32; - v62 = arith.mod v60, v380 : u32; - hir.assertz v62 #[code = 250]; - v63 = hir.int_to_ptr v60 : ptr; - hir.store v63, v59; - v379 = arith.constant 32 : i32; - v65 = arith.add v371, v379 : i32 #[overflow = wrapping]; - v66 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__stack_pointer : ptr - v67 = hir.bitcast v66 : ptr; - hir.store v67, v65; - builtin.ret v39; + hir.store v58, v52; + v59 = hir.load_local : i32 #[local = lv1]; + v60 = hir.load_local : i32 #[local = lv0]; + v247 = arith.constant 16 : u32; + v61 = hir.bitcast v60 : u32; + v63 = arith.add v61, v247 : u32 #[overflow = checked]; + v276 = arith.constant 8 : u32; + v65 = arith.mod v63, v276 : u32; + hir.assertz v65 #[code = 250]; + v66 = hir.int_to_ptr v63 : ptr; + v67 = hir.load v66 : i64; + v68 = hir.bitcast v59 : u32; + v275 = arith.constant 4 : u32; + v70 = arith.mod v68, v275 : u32; + hir.assertz v70 #[code = 250]; + v71 = hir.int_to_ptr v68 : ptr; + hir.store v71, v67; + v72 = hir.load_local : i32 #[local = lv0]; + v274 = arith.constant 32 : i32; + v74 = arith.add v72, v274 : i32 #[overflow = wrapping]; + v75 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__stack_pointer : ptr + v76 = hir.bitcast v75 : ptr; + hir.store v76, v74; + v77 = hir.load_local : i32 #[local = lv1]; + builtin.ret v77; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block15: - v69 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/GOT.data.internal.__memory_base : ptr - v70 = hir.bitcast v69 : ptr; - v71 = hir.load v70 : i32; - v72 = arith.constant 1048600 : i32; - v73 = arith.add v71, v72 : i32 #[overflow = wrapping]; - v74 = hir.bitcast v73 : u32; - v75 = hir.int_to_ptr v74 : ptr; - v76 = hir.load v75 : u8; - v68 = arith.constant 0 : i32; - v77 = arith.zext v76 : u32; - v78 = hir.bitcast v77 : i32; - v80 = arith.neq v78, v68 : i1; - scf.if v80{ + v78 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/GOT.data.internal.__memory_base : ptr + v79 = hir.bitcast v78 : ptr; + v80 = hir.load v79 : i32; + v287 = arith.constant 1048600 : i32; + v82 = arith.add v80, v287 : i32 #[overflow = wrapping]; + v83 = hir.bitcast v82 : u32; + v84 = hir.int_to_ptr v83 : ptr; + v85 = hir.load v84 : u8; + v286 = arith.constant 0 : i32; + v86 = arith.zext v85 : u32; + v87 = hir.bitcast v86 : i32; + v89 = arith.neq v87, v286 : i1; + scf.if v89{ ^block17: scf.yield ; } else { ^block18: - v81 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/GOT.data.internal.__memory_base : ptr - v82 = hir.bitcast v81 : ptr; - v83 = hir.load v82 : i32; + v90 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/GOT.data.internal.__memory_base : ptr + v91 = hir.bitcast v90 : ptr; + v92 = hir.load v91 : i32; + hir.store_local v92 #[local = lv0]; hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__wasm_call_ctors() - v391 = arith.constant 1 : u8; - v393 = arith.constant 1048600 : i32; - v85 = arith.add v83, v393 : i32 #[overflow = wrapping]; - v89 = hir.bitcast v85 : u32; - v90 = hir.int_to_ptr v89 : ptr; - hir.store v90, v391; + v93 = hir.load_local : i32 #[local = lv0]; + v285 = arith.constant 1 : u8; + v290 = arith.constant 1048600 : i32; + v95 = arith.add v93, v290 : i32 #[overflow = wrapping]; + v99 = hir.bitcast v95 : u32; + v100 = hir.int_to_ptr v99 : ptr; + hir.store v100, v285; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::faucet::burn(v91: i32, v92: i32) { - ^block19(v91: i32, v92: i32): - v94 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__stack_pointer : ptr - v95 = hir.bitcast v94 : ptr; - v96 = hir.load v95 : i32; - v97 = arith.constant 32 : i32; - v98 = arith.sub v96, v97 : i32 #[overflow = wrapping]; - v99 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__stack_pointer : ptr - v100 = hir.bitcast v99 : ptr; - hir.store v100, v98; - v102 = arith.constant 12 : u32; - v101 = hir.bitcast v92 : u32; - v103 = arith.add v101, v102 : u32 #[overflow = checked]; - v104 = arith.constant 4 : u32; - v105 = arith.mod v103, v104 : u32; - hir.assertz v105 #[code = 250]; - v106 = hir.int_to_ptr v103 : ptr; - v107 = hir.load v106 : felt; - v109 = arith.constant 8 : u32; - v108 = hir.bitcast v92 : u32; - v110 = arith.add v108, v109 : u32 #[overflow = checked]; - v403 = arith.constant 4 : u32; - v112 = arith.mod v110, v403 : u32; - hir.assertz v112 #[code = 250]; - v113 = hir.int_to_ptr v110 : ptr; - v114 = hir.load v113 : felt; - v402 = arith.constant 4 : u32; - v115 = hir.bitcast v92 : u32; - v117 = arith.add v115, v402 : u32 #[overflow = checked]; - v401 = arith.constant 4 : u32; - v119 = arith.mod v117, v401 : u32; - hir.assertz v119 #[code = 250]; - v120 = hir.int_to_ptr v117 : ptr; - v121 = hir.load v120 : felt; - v122 = hir.bitcast v92 : u32; - v400 = arith.constant 4 : u32; - v124 = arith.mod v122, v400 : u32; - hir.assertz v124 #[code = 250]; - v125 = hir.int_to_ptr v122 : ptr; - v126 = hir.load v125 : felt; - hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/miden::faucet::burn(v107, v114, v121, v126, v98) - v399 = arith.constant 8 : u32; - v127 = hir.bitcast v98 : u32; - v129 = arith.add v127, v399 : u32 #[overflow = checked]; - v398 = arith.constant 8 : u32; - v131 = arith.mod v129, v398 : u32; + private builtin.function @miden_base_sys::bindings::faucet::burn(v101: i32, v102: i32) { + ^block19(v101: i32, v102: i32): + hir.store_local v101 #[local = lv0]; + hir.store_local v102 #[local = lv1]; + v103 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__stack_pointer : ptr + v104 = hir.bitcast v103 : ptr; + v105 = hir.load v104 : i32; + v300 = arith.constant 16 : i32; + v107 = arith.sub v105, v300 : i32 #[overflow = wrapping]; + hir.store_local v107 #[local = lv2]; + v108 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__stack_pointer : ptr + v109 = hir.bitcast v108 : ptr; + hir.store v109, v107; + v110 = hir.load_local : i32 #[local = lv1]; + v299 = arith.constant 12 : u32; + v111 = hir.bitcast v110 : u32; + v113 = arith.add v111, v299 : u32 #[overflow = checked]; + v298 = arith.constant 4 : u32; + v115 = arith.mod v113, v298 : u32; + hir.assertz v115 #[code = 250]; + v116 = hir.int_to_ptr v113 : ptr; + v117 = hir.load v116 : felt; + v118 = hir.load_local : i32 #[local = lv1]; + v297 = arith.constant 8 : u32; + v119 = hir.bitcast v118 : u32; + v121 = arith.add v119, v297 : u32 #[overflow = checked]; + v322 = arith.constant 4 : u32; + v123 = arith.mod v121, v322 : u32; + hir.assertz v123 #[code = 250]; + v124 = hir.int_to_ptr v121 : ptr; + v125 = hir.load v124 : felt; + v126 = hir.load_local : i32 #[local = lv1]; + v321 = arith.constant 4 : u32; + v127 = hir.bitcast v126 : u32; + v129 = arith.add v127, v321 : u32 #[overflow = checked]; + v320 = arith.constant 4 : u32; + v131 = arith.mod v129, v320 : u32; hir.assertz v131 #[code = 250]; - v132 = hir.int_to_ptr v129 : ptr; - v133 = hir.load v132 : i64; - v135 = arith.constant 24 : u32; - v134 = hir.bitcast v98 : u32; - v136 = arith.add v134, v135 : u32 #[overflow = checked]; - v397 = arith.constant 8 : u32; - v138 = arith.mod v136, v397 : u32; - hir.assertz v138 #[code = 250]; - v139 = hir.int_to_ptr v136 : ptr; - hir.store v139, v133; - v140 = hir.bitcast v98 : u32; - v396 = arith.constant 8 : u32; - v142 = arith.mod v140, v396 : u32; - hir.assertz v142 #[code = 250]; - v143 = hir.int_to_ptr v140 : ptr; - v144 = hir.load v143 : i64; - v146 = arith.constant 16 : u32; - v145 = hir.bitcast v98 : u32; - v147 = arith.add v145, v146 : u32 #[overflow = checked]; - v395 = arith.constant 8 : u32; - v149 = arith.mod v147, v395 : u32; - hir.assertz v149 #[code = 250]; - v150 = hir.int_to_ptr v147 : ptr; - hir.store v150, v144; - v151 = arith.constant 16 : i32; - v152 = arith.add v98, v151 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/::reverse(v91, v152) - v394 = arith.constant 32 : i32; - v154 = arith.add v98, v394 : i32 #[overflow = wrapping]; - v155 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__stack_pointer : ptr - v156 = hir.bitcast v155 : ptr; - hir.store v156, v154; - builtin.ret ; - }; - - private builtin.function @>::from(v157: i32, v158: i32) { - ^block21(v157: i32, v158: i32): - v160 = arith.constant 8 : u32; + v132 = hir.int_to_ptr v129 : ptr; + v133 = hir.load v132 : felt; + v134 = hir.load_local : i32 #[local = lv1]; + v135 = hir.bitcast v134 : u32; + v319 = arith.constant 4 : u32; + v137 = arith.mod v135, v319 : u32; + hir.assertz v137 #[code = 250]; + v138 = hir.int_to_ptr v135 : ptr; + v139 = hir.load v138 : felt; + v140 = hir.load_local : i32 #[local = lv2]; + hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/miden::protocol::faucet::burn(v117, v125, v133, v139, v140) + v141 = hir.load_local : i32 #[local = lv0]; + v142 = hir.load_local : i32 #[local = lv2]; + v143 = hir.bitcast v142 : u32; + v318 = arith.constant 8 : u32; + v145 = arith.mod v143, v318 : u32; + hir.assertz v145 #[code = 250]; + v146 = hir.int_to_ptr v143 : ptr; + v147 = hir.load v146 : i64; + v294, v295 = arith.split v147 : felt, felt; + v317 = arith.constant 8 : u32; + v151 = hir.bitcast v141 : u32; + v153 = arith.add v151, v317 : u32 #[overflow = checked]; + v316 = arith.constant 8 : u32; + v155 = arith.mod v153, v316 : u32; + hir.assertz v155 #[code = 250]; + v296 = arith.join v295, v294 : i64; + v156 = hir.int_to_ptr v153 : ptr; + hir.store v156, v296; + v157 = hir.load_local : i32 #[local = lv0]; + v158 = hir.load_local : i32 #[local = lv2]; + v315 = arith.constant 8 : u32; v159 = hir.bitcast v158 : u32; - v161 = arith.add v159, v160 : u32 #[overflow = checked]; - v162 = arith.constant 4 : u32; - v163 = arith.mod v161, v162 : u32; + v161 = arith.add v159, v315 : u32 #[overflow = checked]; + v314 = arith.constant 8 : u32; + v163 = arith.mod v161, v314 : u32; hir.assertz v163 #[code = 250]; v164 = hir.int_to_ptr v161 : ptr; v165 = hir.load v164 : i64; - v407 = arith.constant 8 : u32; - v166 = hir.bitcast v157 : u32; - v168 = arith.add v166, v407 : u32 #[overflow = checked]; - v406 = arith.constant 8 : u32; - v170 = arith.mod v168, v406 : u32; - hir.assertz v170 #[code = 250]; - v171 = hir.int_to_ptr v168 : ptr; - hir.store v171, v165; - v172 = hir.bitcast v158 : u32; - v405 = arith.constant 4 : u32; - v174 = arith.mod v172, v405 : u32; - hir.assertz v174 #[code = 250]; - v175 = hir.int_to_ptr v172 : ptr; - v176 = hir.load v175 : i64; - v177 = hir.bitcast v157 : u32; - v404 = arith.constant 8 : u32; - v179 = arith.mod v177, v404 : u32; - hir.assertz v179 #[code = 250]; - v180 = hir.int_to_ptr v177 : ptr; - hir.store v180, v176; + v291, v292 = arith.split v165 : felt, felt; + v169 = hir.bitcast v157 : u32; + v313 = arith.constant 8 : u32; + v171 = arith.mod v169, v313 : u32; + hir.assertz v171 #[code = 250]; + v293 = arith.join v292, v291 : i64; + v172 = hir.int_to_ptr v169 : ptr; + hir.store v172, v293; + v173 = hir.load_local : i32 #[local = lv2]; + v312 = arith.constant 16 : i32; + v175 = arith.add v173, v312 : i32 #[overflow = wrapping]; + v176 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__stack_pointer : ptr + v177 = hir.bitcast v176 : ptr; + hir.store v177, v175; builtin.ret ; }; - private builtin.function @::reverse(v181: i32, v182: i32) { - ^block23(v181: i32, v182: i32): - v185 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__stack_pointer : ptr - v186 = hir.bitcast v185 : ptr; - v187 = hir.load v186 : i32; - v188 = arith.constant 16 : i32; - v189 = arith.sub v187, v188 : i32 #[overflow = wrapping]; - v191 = arith.constant 8 : u32; - v190 = hir.bitcast v182 : u32; - v192 = arith.add v190, v191 : u32 #[overflow = checked]; - v494 = arith.constant 8 : u32; - v194 = arith.mod v192, v494 : u32; - hir.assertz v194 #[code = 250]; - v195 = hir.int_to_ptr v192 : ptr; - v196 = hir.load v195 : i64; - v493 = arith.constant 8 : u32; - v197 = hir.bitcast v189 : u32; - v199 = arith.add v197, v493 : u32 #[overflow = checked]; - v200 = arith.constant 4 : u32; - v201 = arith.mod v199, v200 : u32; - hir.assertz v201 #[code = 250]; - v202 = hir.int_to_ptr v199 : ptr; - hir.store v202, v196; - v203 = hir.bitcast v182 : u32; - v492 = arith.constant 8 : u32; - v205 = arith.mod v203, v492 : u32; - hir.assertz v205 #[code = 250]; - v206 = hir.int_to_ptr v203 : ptr; - v207 = hir.load v206 : i64; - v208 = hir.bitcast v189 : u32; - v491 = arith.constant 4 : u32; - v210 = arith.mod v208, v491 : u32; - hir.assertz v210 #[code = 250]; - v211 = hir.int_to_ptr v208 : ptr; - hir.store v211, v207; - v212 = arith.constant 12 : i32; - v213 = arith.add v189, v212 : i32 #[overflow = wrapping]; - v183 = arith.constant 0 : i32; - v462, v463, v464, v465, v466, v467 = scf.while v183, v189, v213, v181 : i32, i32, i32, i32, i32, i32 { - ^block54(v468: i32, v469: i32, v470: i32, v471: i32): - v490 = arith.constant 0 : i32; - v216 = arith.constant 8 : i32; - v217 = arith.eq v468, v216 : i1; - v218 = arith.zext v217 : u32; - v219 = hir.bitcast v218 : i32; - v221 = arith.neq v219, v490 : i1; - v456, v457 = scf.if v221 : i32, i32 { - ^block53: - v416 = ub.poison i32 : i32; - scf.yield v416, v416; - } else { - ^block28: - v223 = arith.add v469, v468 : i32 #[overflow = wrapping]; - v224 = hir.bitcast v223 : u32; - v489 = arith.constant 4 : u32; - v226 = arith.mod v224, v489 : u32; - hir.assertz v226 #[code = 250]; - v227 = hir.int_to_ptr v224 : ptr; - v228 = hir.load v227 : felt; - v230 = hir.bitcast v470 : u32; - v488 = arith.constant 4 : u32; - v232 = arith.mod v230, v488 : u32; - hir.assertz v232 #[code = 250]; - v233 = hir.int_to_ptr v230 : ptr; - v234 = hir.load v233 : i32; - v235 = hir.bitcast v223 : u32; - v487 = arith.constant 4 : u32; - v237 = arith.mod v235, v487 : u32; - hir.assertz v237 #[code = 250]; - v238 = hir.int_to_ptr v235 : ptr; - hir.store v238, v234; - v239 = hir.bitcast v470 : u32; - v486 = arith.constant 4 : u32; - v241 = arith.mod v239, v486 : u32; - hir.assertz v241 #[code = 250]; - v242 = hir.int_to_ptr v239 : ptr; - hir.store v242, v228; - v245 = arith.constant -4 : i32; - v246 = arith.add v470, v245 : i32 #[overflow = wrapping]; - v243 = arith.constant 4 : i32; - v244 = arith.add v468, v243 : i32 #[overflow = wrapping]; - scf.yield v244, v246; - }; - v484 = ub.poison i32 : i32; - v459 = cf.select v221, v484, v471 : i32; - v485 = ub.poison i32 : i32; - v458 = cf.select v221, v485, v469 : i32; - v415 = arith.constant 1 : u32; - v408 = arith.constant 0 : u32; - v461 = cf.select v221, v408, v415 : u32; - v449 = arith.trunc v461 : i1; - scf.condition v449, v456, v458, v457, v459, v469, v471; - } do { - ^block55(v472: i32, v473: i32, v474: i32, v475: i32, v476: i32, v477: i32): - scf.yield v472, v473, v474, v475; - }; - v483 = arith.constant 8 : u32; - v248 = hir.bitcast v466 : u32; - v250 = arith.add v248, v483 : u32 #[overflow = checked]; - v482 = arith.constant 4 : u32; - v252 = arith.mod v250, v482 : u32; - hir.assertz v252 #[code = 250]; - v253 = hir.int_to_ptr v250 : ptr; - v254 = hir.load v253 : i64; - v481 = arith.constant 8 : u32; - v255 = hir.bitcast v467 : u32; - v257 = arith.add v255, v481 : u32 #[overflow = checked]; - v480 = arith.constant 8 : u32; - v259 = arith.mod v257, v480 : u32; - hir.assertz v259 #[code = 250]; - v260 = hir.int_to_ptr v257 : ptr; - hir.store v260, v254; - v261 = hir.bitcast v466 : u32; - v479 = arith.constant 4 : u32; - v263 = arith.mod v261, v479 : u32; - hir.assertz v263 #[code = 250]; - v264 = hir.int_to_ptr v261 : ptr; - v265 = hir.load v264 : i64; - v266 = hir.bitcast v467 : u32; - v478 = arith.constant 8 : u32; - v268 = arith.mod v266, v478 : u32; - hir.assertz v268 #[code = 250]; - v269 = hir.int_to_ptr v266 : ptr; - hir.store v269, v265; + private builtin.function @>::from(v178: i32, v179: i32) { + ^block21(v178: i32, v179: i32): + hir.store_local v178 #[local = lv0]; + hir.store_local v179 #[local = lv1]; + v180 = hir.load_local : i32 #[local = lv0]; + v181 = hir.load_local : i32 #[local = lv1]; + v324 = arith.constant 8 : u32; + v182 = hir.bitcast v181 : u32; + v184 = arith.add v182, v324 : u32 #[overflow = checked]; + v323 = arith.constant 4 : u32; + v186 = arith.mod v184, v323 : u32; + hir.assertz v186 #[code = 250]; + v187 = hir.int_to_ptr v184 : ptr; + v188 = hir.load v187 : i64; + v332 = arith.constant 8 : u32; + v189 = hir.bitcast v180 : u32; + v191 = arith.add v189, v332 : u32 #[overflow = checked]; + v331 = arith.constant 8 : u32; + v193 = arith.mod v191, v331 : u32; + hir.assertz v193 #[code = 250]; + v194 = hir.int_to_ptr v191 : ptr; + hir.store v194, v188; + v195 = hir.load_local : i32 #[local = lv0]; + v196 = hir.load_local : i32 #[local = lv1]; + v197 = hir.bitcast v196 : u32; + v330 = arith.constant 4 : u32; + v199 = arith.mod v197, v330 : u32; + hir.assertz v199 #[code = 250]; + v200 = hir.int_to_ptr v197 : ptr; + v201 = hir.load v200 : i64; + v202 = hir.bitcast v195 : u32; + v329 = arith.constant 8 : u32; + v204 = arith.mod v202, v329 : u32; + hir.assertz v204 #[code = 250]; + v205 = hir.int_to_ptr v202 : ptr; + hir.store v205, v201; builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v270: i32) -> felt { - ^block29(v270: i32): - v271 = hir.bitcast v270 : felt; - builtin.ret v271; - }; - - private builtin.function @miden::faucet::burn(v273: felt, v274: felt, v275: felt, v276: felt, v277: i32) { - ^block31(v273: felt, v274: felt, v275: felt, v276: felt, v277: i32): - v278, v279, v280, v281 = hir.exec @miden/faucet/burn(v273, v274, v275, v276) : felt, felt, felt, felt - v282 = hir.bitcast v277 : u32; - v283 = hir.int_to_ptr v282 : ptr; - hir.store v283, v278; - v284 = arith.constant 4 : u32; - v285 = arith.add v282, v284 : u32 #[overflow = checked]; - v286 = hir.int_to_ptr v285 : ptr; - hir.store v286, v279; - v287 = arith.constant 8 : u32; - v288 = arith.add v282, v287 : u32 #[overflow = checked]; - v289 = hir.int_to_ptr v288 : ptr; - hir.store v289, v280; - v290 = arith.constant 12 : u32; - v291 = arith.add v282, v290 : u32 #[overflow = checked]; - v292 = hir.int_to_ptr v291 : ptr; - hir.store v292, v281; - builtin.ret ; + private builtin.function @miden::protocol::faucet::burn(v206: felt, v207: felt, v208: felt, v209: felt, v210: i32) { + ^block23(v206: felt, v207: felt, v208: felt, v209: felt, v210: i32): + ub.unreachable ; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -428,36 +312,36 @@ builtin.component miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-fa }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block35: - v293 = hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1#binding() : i32 - v500 = arith.constant 0 : i32; - v294 = arith.constant 0 : i32; - v295 = arith.add v293, v294 : i32 #[overflow = unchecked]; - v297 = arith.add v295, v500 : i32 #[overflow = unchecked]; - v498 = arith.constant 0 : i32; - v499 = arith.constant 0 : i32; - v299 = arith.add v297, v499 : i32 #[overflow = unchecked]; - v301 = arith.add v299, v498 : i32 #[overflow = unchecked]; - v302 = hir.int_to_ptr v301 : ptr; - v303 = hir.load v302 : felt; - v497 = arith.constant 0 : i32; - v304 = arith.constant 4 : i32; - v305 = arith.add v297, v304 : i32 #[overflow = unchecked]; - v307 = arith.add v305, v497 : i32 #[overflow = unchecked]; - v308 = hir.int_to_ptr v307 : ptr; - v309 = hir.load v308 : felt; - v496 = arith.constant 0 : i32; - v310 = arith.constant 8 : i32; - v311 = arith.add v297, v310 : i32 #[overflow = unchecked]; - v313 = arith.add v311, v496 : i32 #[overflow = unchecked]; - v314 = hir.int_to_ptr v313 : ptr; - v315 = hir.load v314 : felt; - v495 = arith.constant 0 : i32; - v316 = arith.constant 12 : i32; - v317 = arith.add v297, v316 : i32 #[overflow = unchecked]; - v319 = arith.add v317, v495 : i32 #[overflow = unchecked]; - v320 = hir.int_to_ptr v319 : ptr; - v321 = hir.load v320 : felt; - builtin.ret v303, v309, v315, v321; + ^block25: + v211 = hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1#binding() : i32 + v348 = arith.constant 0 : i32; + v342 = arith.constant 0 : i32; + v213 = arith.add v211, v342 : i32 #[overflow = unchecked]; + v215 = arith.add v213, v348 : i32 #[overflow = unchecked]; + v346 = arith.constant 0 : i32; + v347 = arith.constant 0 : i32; + v217 = arith.add v215, v347 : i32 #[overflow = unchecked]; + v219 = arith.add v217, v346 : i32 #[overflow = unchecked]; + v220 = hir.int_to_ptr v219 : ptr; + v221 = hir.load v220 : felt; + v345 = arith.constant 0 : i32; + v335 = arith.constant 4 : i32; + v223 = arith.add v215, v335 : i32 #[overflow = unchecked]; + v225 = arith.add v223, v345 : i32 #[overflow = unchecked]; + v226 = hir.int_to_ptr v225 : ptr; + v227 = hir.load v226 : felt; + v344 = arith.constant 0 : i32; + v334 = arith.constant 8 : i32; + v229 = arith.add v215, v334 : i32 #[overflow = unchecked]; + v231 = arith.add v229, v344 : i32 #[overflow = unchecked]; + v232 = hir.int_to_ptr v231 : ptr; + v233 = hir.load v232 : felt; + v343 = arith.constant 0 : i32; + v333 = arith.constant 12 : i32; + v235 = arith.add v215, v333 : i32 #[overflow = unchecked]; + v237 = arith.add v235, v343 : i32 #[overflow = unchecked]; + v238 = hir.int_to_ptr v237 : ptr; + v239 = hir.load v238 : felt; + builtin.ret v221, v227, v233, v239; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.masm index 5a11a910a..d9d832de1 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.masm @@ -1,13 +1,13 @@ -# mod miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1 +# mod ::"miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> (felt, felt, felt, felt) - exec.::miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1::init + exec."miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1::rust_sdk_account_faucet_burn_binding::miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1#binding + exec.::"miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1"::rust_sdk_account_faucet_burn_binding::"miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1#binding" trace.252 nop push.0 @@ -65,7 +65,7 @@ pub proc binding( nop movdn.3 swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -78,7 +78,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -89,7 +89,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1::rust_sdk_account_faucet_burn_binding +# mod ::"miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1"::rust_sdk_account_faucet_burn_binding @callconv("C") proc __wasm_call_ctors( @@ -105,6 +105,7 @@ proc rust_sdk_account_faucet_burn_binding::bindings::__link_custom_section_descr nop end +@locals("3") @callconv("C") proc miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1#binding( @@ -119,9 +120,16 @@ proc miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-bin nop push.32 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -131,35 +139,74 @@ proc miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-bin nop trace.240 nop - exec.::miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1::rust_sdk_account_faucet_burn_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1"::rust_sdk_account_faucet_burn_binding::wit_bindgen::rt::run_ctors_once trace.252 nop push.0 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1::rust_sdk_account_faucet_burn_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_sw trace.252 nop push.0 - movup.2 + locaddr.2 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1 while.true + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.16 - dup.2 + movup.2 eq neq dup.0 if.true - swap.1 - drop - push.3735929054 + nop else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.16 - dup.3 + movup.3 u32wrapping_add - dup.2 + movup.2 u32wrapping_add push.4 dup.1 @@ -167,8 +214,6 @@ proc miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-bin u32mod u32assert assertz - dup.4 - swap.1 u32divmod.4 swap.1 trace.240 @@ -176,41 +221,37 @@ proc miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-bin exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - movup.2 u32wrapping_add + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.3735929054 - dup.2 - movup.2 - swap.5 - movdn.2 - cdrop - push.3735929054 - dup.2 - dup.4 - swap.2 - swap.1 - cdrop push.1 push.0 - movup.4 + movup.2 cdrop push.1 u32and - movup.4 - swap.1 if.true - movup.3 - drop push.1 else push.0 end end - drop - drop - drop push.1114148 u32divmod.4 swap.1 @@ -219,29 +260,76 @@ proc miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-bin exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - dup.2 + dup.1 u32wrapping_add - dup.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1"::rust_sdk_account_faucet_burn_binding::>::from + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1::rust_sdk_account_faucet_burn_binding::>::from + exec.::intrinsics::mem::load_sw trace.252 nop push.16 - dup.2 + dup.1 u32wrapping_add - dup.2 + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1"::rust_sdk_account_faucet_burn_binding::miden_base_sys::bindings::faucet::burn + trace.252 + nop + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1::rust_sdk_account_faucet_burn_binding::miden_base_sys::bindings::faucet::burn + exec.::intrinsics::mem::load_sw trace.252 nop push.1048584 u32wrapping_add + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.24 - dup.2 + swap.1 add u32assert push.8 @@ -259,7 +347,7 @@ proc miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-bin nop swap.1 push.8 - dup.3 + movup.3 add u32assert push.4 @@ -277,8 +365,24 @@ proc miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-bin exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - dup.2 + swap.1 add u32assert push.8 @@ -295,7 +399,7 @@ proc miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-bin trace.252 nop swap.1 - dup.2 + movup.2 push.4 dup.1 swap.1 @@ -311,8 +415,15 @@ proc miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-bin exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.32 - movup.2 u32wrapping_add push.1114144 u32divmod.4 @@ -322,8 +433,17 @@ proc miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-bin exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -365,9 +485,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1"::rust_sdk_account_faucet_burn_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1::rust_sdk_account_faucet_burn_binding::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -398,8 +534,25 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("3") @callconv("C") proc miden_base_sys::bindings::faucet::burn(i32, i32) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -408,11 +561,18 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop - push.32 + push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.2 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -420,8 +580,16 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.3 + swap.1 add u32assert push.4 @@ -437,8 +605,16 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.4 + swap.1 add u32assert push.4 @@ -454,8 +630,16 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.5 + swap.1 add u32assert push.4 @@ -471,7 +655,14 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - movup.5 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -485,54 +676,39 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - dup.4 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop swap.1 swap.3 swap.1 swap.4 trace.240 nop - exec.::miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1::rust_sdk_account_faucet_burn_binding::miden::faucet::burn + exec.::"miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1"::rust_sdk_account_faucet_burn_binding::"miden::protocol::faucet::burn" trace.252 nop - push.8 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 swap.1 - push.24 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - dup.0 push.8 dup.1 swap.1 @@ -547,8 +723,8 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) trace.252 nop swap.1 - push.16 - dup.3 + push.8 + movup.3 add u32assert push.8 @@ -557,6 +733,8 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -566,37 +744,27 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop - push.16 - dup.1 - u32wrapping_add - movup.2 + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1::rust_sdk_account_faucet_burn_binding::::reverse + exec.::intrinsics::mem::load_sw trace.252 nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop -end - -@callconv("C") -proc >::from( - i32, - i32 -) push.8 - dup.2 + swap.1 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod @@ -610,16 +778,15 @@ proc ::reverse( +proc >::from( i32, i32 ) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 swap.1 - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.1 + push.0 swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop push.8 - dup.1 + swap.1 add u32assert push.4 @@ -889,7 +873,7 @@ proc ::reverse( nop swap.1 push.8 - dup.4 + movup.3 add u32assert push.8 @@ -907,6 +891,22 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -939,64 +939,15 @@ proc ::reverse( nop end +@locals("5") @callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc miden::faucet::burn(felt, felt, felt, felt, i32) - trace.240 - nop - exec.::miden::faucet::burn - trace.252 - nop - movup.4 - dup.0 - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.12 - add - u32assert - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop +proc miden::protocol::faucet::burn(felt, felt, felt, felt, i32) + drop + drop + drop + drop + drop + push.0 + assert end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.wat index e3ffb6438..efa59c439 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.wat @@ -65,7 +65,7 @@ local.get 0 i32.const 16 i32.add - call $>::from + call $>::from local.get 0 i32.const 16 i32.add @@ -109,7 +109,7 @@ (func $miden_base_sys::bindings::faucet::burn (;4;) (type 2) (param i32 i32) (local i32) global.get $__stack_pointer - i32.const 32 + i32.const 16 i32.sub local.tee 2 global.set $__stack_pointer @@ -122,26 +122,25 @@ local.get 1 f32.load local.get 2 - call $miden::faucet::burn - local.get 2 - local.get 2 - i64.load offset=8 - i64.store offset=24 - local.get 2 + call $miden::protocol::faucet::burn + local.get 0 local.get 2 i64.load - i64.store offset=16 + i64.const 32 + i64.rotl + i64.store offset=8 local.get 0 local.get 2 - i32.const 16 - i32.add - call $::reverse + i64.load offset=8 + i64.const 32 + i64.rotl + i64.store local.get 2 - i32.const 32 + i32.const 16 i32.add global.set $__stack_pointer ) - (func $>::from (;5;) (type 2) (param i32 i32) + (func $>::from (;5;) (type 2) (param i32 i32) local.get 0 local.get 1 i64.load offset=8 align=4 @@ -151,72 +150,14 @@ i64.load align=4 i64.store ) - (func $::reverse (;6;) (type 2) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store - ) - (func $intrinsics::felt::from_u32 (;7;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;6;) (type 3) (param i32) (result f32) unreachable ) - (func $miden::faucet::burn (;8;) (type 4) (param f32 f32 f32 f32 i32) + (func $miden::protocol::faucet::burn (;7;) (type 4) (param f32 f32 f32 f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "Irust_sdk_account_faucet_burn_binding\01\0b0.0.1\05\02\03\01") + (@custom "rodata,miden_account" (after data) "Irust_sdk_account_faucet_burn_binding\01\0b0.0.1\05\02\03\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "asset" (type $asset (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.hir index 0452bc2ca..9b83f6155 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.hir @@ -12,297 +12,164 @@ builtin.component miden:rust-sdk-account-faucet-create-fungible-asset-binding/ru private builtin.function @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1#binding() -> i32 { ^block9: - v2 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__stack_pointer : ptr - v3 = hir.bitcast v2 : ptr; - v4 = hir.load v3 : i32; - v5 = arith.constant 16 : i32; - v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; - v7 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__stack_pointer : ptr - v8 = hir.bitcast v7 : ptr; - hir.store v8, v6; + v1 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v158 = arith.constant 16 : i32; + v5 = arith.sub v3, v158 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; hir.exec @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/wit_bindgen::rt::run_ctors_once() - v9 = arith.constant 10 : i32; - v10 = hir.exec @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/intrinsics::felt::from_u32(v9) : felt - hir.exec @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/miden_base_sys::bindings::faucet::create_fungible_asset(v6, v10) + v8 = hir.load_local : i32 #[local = lv0]; + v154 = arith.constant 10 : felt; + hir.exec @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/miden_base_sys::bindings::faucet::create_fungible_asset(v8, v154) v11 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/GOT.data.internal.__memory_base : ptr v12 = hir.bitcast v11 : ptr; v13 = hir.load v12 : i32; - v14 = arith.constant 1048584 : i32; - v15 = arith.add v13, v14 : i32 #[overflow = wrapping]; - v17 = arith.constant 8 : u32; - v16 = hir.bitcast v6 : u32; - v18 = arith.add v16, v17 : u32 #[overflow = checked]; - v251 = arith.constant 8 : u32; - v20 = arith.mod v18, v251 : u32; - hir.assertz v20 #[code = 250]; - v21 = hir.int_to_ptr v18 : ptr; - v22 = hir.load v21 : i64; - v250 = arith.constant 8 : u32; - v23 = hir.bitcast v15 : u32; - v25 = arith.add v23, v250 : u32 #[overflow = checked]; - v26 = arith.constant 4 : u32; - v27 = arith.mod v25, v26 : u32; - hir.assertz v27 #[code = 250]; - v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v22; - v29 = hir.bitcast v6 : u32; - v249 = arith.constant 8 : u32; - v31 = arith.mod v29, v249 : u32; - hir.assertz v31 #[code = 250]; - v32 = hir.int_to_ptr v29 : ptr; - v33 = hir.load v32 : i64; - v34 = hir.bitcast v15 : u32; - v248 = arith.constant 4 : u32; - v36 = arith.mod v34, v248 : u32; - hir.assertz v36 #[code = 250]; - v37 = hir.int_to_ptr v34 : ptr; - hir.store v37, v33; - v247 = arith.constant 16 : i32; - v39 = arith.add v6, v247 : i32 #[overflow = wrapping]; - v40 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__stack_pointer : ptr - v41 = hir.bitcast v40 : ptr; - hir.store v41, v39; - builtin.ret v15; + v157 = arith.constant 1048584 : i32; + v15 = arith.add v13, v157 : i32 #[overflow = wrapping]; + hir.store_local v15 #[local = lv1]; + v16 = hir.load_local : i32 #[local = lv0]; + v156 = arith.constant 8 : u32; + v17 = hir.bitcast v16 : u32; + v19 = arith.add v17, v156 : u32 #[overflow = checked]; + v168 = arith.constant 8 : u32; + v21 = arith.mod v19, v168 : u32; + hir.assertz v21 #[code = 250]; + v22 = hir.int_to_ptr v19 : ptr; + v23 = hir.load v22 : i64; + v167 = arith.constant 8 : u32; + v24 = hir.bitcast v15 : u32; + v26 = arith.add v24, v167 : u32 #[overflow = checked]; + v155 = arith.constant 4 : u32; + v28 = arith.mod v26, v155 : u32; + hir.assertz v28 #[code = 250]; + v29 = hir.int_to_ptr v26 : ptr; + hir.store v29, v23; + v30 = hir.load_local : i32 #[local = lv1]; + v31 = hir.load_local : i32 #[local = lv0]; + v32 = hir.bitcast v31 : u32; + v166 = arith.constant 8 : u32; + v34 = arith.mod v32, v166 : u32; + hir.assertz v34 #[code = 250]; + v35 = hir.int_to_ptr v32 : ptr; + v36 = hir.load v35 : i64; + v37 = hir.bitcast v30 : u32; + v165 = arith.constant 4 : u32; + v39 = arith.mod v37, v165 : u32; + hir.assertz v39 #[code = 250]; + v40 = hir.int_to_ptr v37 : ptr; + hir.store v40, v36; + v41 = hir.load_local : i32 #[local = lv0]; + v164 = arith.constant 16 : i32; + v43 = arith.add v41, v164 : i32 #[overflow = wrapping]; + v44 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__stack_pointer : ptr + v45 = hir.bitcast v44 : ptr; + hir.store v45, v43; + v46 = hir.load_local : i32 #[local = lv1]; + builtin.ret v46; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v43 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/GOT.data.internal.__memory_base : ptr - v44 = hir.bitcast v43 : ptr; - v45 = hir.load v44 : i32; - v46 = arith.constant 1048600 : i32; - v47 = arith.add v45, v46 : i32 #[overflow = wrapping]; - v48 = hir.bitcast v47 : u32; - v49 = hir.int_to_ptr v48 : ptr; - v50 = hir.load v49 : u8; - v42 = arith.constant 0 : i32; - v51 = arith.zext v50 : u32; - v52 = hir.bitcast v51 : i32; - v54 = arith.neq v52, v42 : i1; - scf.if v54{ + v47 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v48 = hir.bitcast v47 : ptr; + v49 = hir.load v48 : i32; + v173 = arith.constant 1048600 : i32; + v51 = arith.add v49, v173 : i32 #[overflow = wrapping]; + v52 = hir.bitcast v51 : u32; + v53 = hir.int_to_ptr v52 : ptr; + v54 = hir.load v53 : u8; + v172 = arith.constant 0 : i32; + v55 = arith.zext v54 : u32; + v56 = hir.bitcast v55 : i32; + v58 = arith.neq v56, v172 : i1; + scf.if v58{ ^block13: scf.yield ; } else { ^block14: - v55 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/GOT.data.internal.__memory_base : ptr - v56 = hir.bitcast v55 : ptr; - v57 = hir.load v56 : i32; + v59 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v60 = hir.bitcast v59 : ptr; + v61 = hir.load v60 : i32; + hir.store_local v61 #[local = lv0]; hir.exec @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__wasm_call_ctors() - v253 = arith.constant 1 : u8; - v255 = arith.constant 1048600 : i32; - v59 = arith.add v57, v255 : i32 #[overflow = wrapping]; - v63 = hir.bitcast v59 : u32; - v64 = hir.int_to_ptr v63 : ptr; - hir.store v64, v253; + v62 = hir.load_local : i32 #[local = lv0]; + v171 = arith.constant 1 : u8; + v176 = arith.constant 1048600 : i32; + v64 = arith.add v62, v176 : i32 #[overflow = wrapping]; + v68 = hir.bitcast v64 : u32; + v69 = hir.int_to_ptr v68 : ptr; + hir.store v69, v171; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::faucet::create_fungible_asset(v65: i32, v66: felt) { - ^block15(v65: i32, v66: felt): - v68 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__stack_pointer : ptr - v69 = hir.bitcast v68 : ptr; - v70 = hir.load v69 : i32; - v71 = arith.constant 32 : i32; - v72 = arith.sub v70, v71 : i32 #[overflow = wrapping]; - v73 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__stack_pointer : ptr - v74 = hir.bitcast v73 : ptr; - hir.store v74, v72; - hir.exec @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/miden::faucet::create_fungible_asset(v66, v72) - v76 = arith.constant 8 : u32; - v75 = hir.bitcast v72 : u32; - v77 = arith.add v75, v76 : u32 #[overflow = checked]; - v260 = arith.constant 8 : u32; - v79 = arith.mod v77, v260 : u32; - hir.assertz v79 #[code = 250]; - v80 = hir.int_to_ptr v77 : ptr; - v81 = hir.load v80 : i64; - v83 = arith.constant 24 : u32; - v82 = hir.bitcast v72 : u32; - v84 = arith.add v82, v83 : u32 #[overflow = checked]; - v259 = arith.constant 8 : u32; - v86 = arith.mod v84, v259 : u32; - hir.assertz v86 #[code = 250]; - v87 = hir.int_to_ptr v84 : ptr; - hir.store v87, v81; - v88 = hir.bitcast v72 : u32; - v258 = arith.constant 8 : u32; - v90 = arith.mod v88, v258 : u32; - hir.assertz v90 #[code = 250]; - v91 = hir.int_to_ptr v88 : ptr; - v92 = hir.load v91 : i64; - v94 = arith.constant 16 : u32; - v93 = hir.bitcast v72 : u32; - v95 = arith.add v93, v94 : u32 #[overflow = checked]; - v257 = arith.constant 8 : u32; - v97 = arith.mod v95, v257 : u32; - hir.assertz v97 #[code = 250]; - v98 = hir.int_to_ptr v95 : ptr; - hir.store v98, v92; - v99 = arith.constant 16 : i32; - v100 = arith.add v72, v99 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/::reverse(v65, v100) - v256 = arith.constant 32 : i32; - v102 = arith.add v72, v256 : i32 #[overflow = wrapping]; - v103 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__stack_pointer : ptr - v104 = hir.bitcast v103 : ptr; - hir.store v104, v102; + private builtin.function @miden_base_sys::bindings::faucet::create_fungible_asset(v70: i32, v71: felt) { + ^block15(v70: i32, v71: felt): + hir.store_local v70 #[local = lv0]; + v72 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__stack_pointer : ptr + v73 = hir.bitcast v72 : ptr; + v74 = hir.load v73 : i32; + v184 = arith.constant 16 : i32; + v76 = arith.sub v74, v184 : i32 #[overflow = wrapping]; + hir.store_local v76 #[local = lv2]; + v77 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__stack_pointer : ptr + v78 = hir.bitcast v77 : ptr; + hir.store v78, v76; + v80 = hir.load_local : i32 #[local = lv2]; + hir.exec @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/miden::protocol::faucet::create_fungible_asset(v71, v80) + v81 = hir.load_local : i32 #[local = lv0]; + v82 = hir.load_local : i32 #[local = lv2]; + v83 = hir.bitcast v82 : u32; + v183 = arith.constant 8 : u32; + v85 = arith.mod v83, v183 : u32; + hir.assertz v85 #[code = 250]; + v86 = hir.int_to_ptr v83 : ptr; + v87 = hir.load v86 : i64; + v180, v181 = arith.split v87 : felt, felt; + v196 = arith.constant 8 : u32; + v91 = hir.bitcast v81 : u32; + v93 = arith.add v91, v196 : u32 #[overflow = checked]; + v195 = arith.constant 8 : u32; + v95 = arith.mod v93, v195 : u32; + hir.assertz v95 #[code = 250]; + v182 = arith.join v181, v180 : i64; + v96 = hir.int_to_ptr v93 : ptr; + hir.store v96, v182; + v97 = hir.load_local : i32 #[local = lv0]; + v98 = hir.load_local : i32 #[local = lv2]; + v194 = arith.constant 8 : u32; + v99 = hir.bitcast v98 : u32; + v101 = arith.add v99, v194 : u32 #[overflow = checked]; + v193 = arith.constant 8 : u32; + v103 = arith.mod v101, v193 : u32; + hir.assertz v103 #[code = 250]; + v104 = hir.int_to_ptr v101 : ptr; + v105 = hir.load v104 : i64; + v177, v178 = arith.split v105 : felt, felt; + v109 = hir.bitcast v97 : u32; + v192 = arith.constant 8 : u32; + v111 = arith.mod v109, v192 : u32; + hir.assertz v111 #[code = 250]; + v179 = arith.join v178, v177 : i64; + v112 = hir.int_to_ptr v109 : ptr; + hir.store v112, v179; + v113 = hir.load_local : i32 #[local = lv2]; + v191 = arith.constant 16 : i32; + v115 = arith.add v113, v191 : i32 #[overflow = wrapping]; + v116 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__stack_pointer : ptr + v117 = hir.bitcast v116 : ptr; + hir.store v117, v115; builtin.ret ; }; - private builtin.function @::reverse(v105: i32, v106: i32) { - ^block17(v105: i32, v106: i32): - v109 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__stack_pointer : ptr - v110 = hir.bitcast v109 : ptr; - v111 = hir.load v110 : i32; - v112 = arith.constant 16 : i32; - v113 = arith.sub v111, v112 : i32 #[overflow = wrapping]; - v115 = arith.constant 8 : u32; - v114 = hir.bitcast v106 : u32; - v116 = arith.add v114, v115 : u32 #[overflow = checked]; - v347 = arith.constant 8 : u32; - v118 = arith.mod v116, v347 : u32; - hir.assertz v118 #[code = 250]; - v119 = hir.int_to_ptr v116 : ptr; - v120 = hir.load v119 : i64; - v346 = arith.constant 8 : u32; - v121 = hir.bitcast v113 : u32; - v123 = arith.add v121, v346 : u32 #[overflow = checked]; - v124 = arith.constant 4 : u32; - v125 = arith.mod v123, v124 : u32; - hir.assertz v125 #[code = 250]; - v126 = hir.int_to_ptr v123 : ptr; - hir.store v126, v120; - v127 = hir.bitcast v106 : u32; - v345 = arith.constant 8 : u32; - v129 = arith.mod v127, v345 : u32; - hir.assertz v129 #[code = 250]; - v130 = hir.int_to_ptr v127 : ptr; - v131 = hir.load v130 : i64; - v132 = hir.bitcast v113 : u32; - v344 = arith.constant 4 : u32; - v134 = arith.mod v132, v344 : u32; - hir.assertz v134 #[code = 250]; - v135 = hir.int_to_ptr v132 : ptr; - hir.store v135, v131; - v136 = arith.constant 12 : i32; - v137 = arith.add v113, v136 : i32 #[overflow = wrapping]; - v107 = arith.constant 0 : i32; - v315, v316, v317, v318, v319, v320 = scf.while v107, v113, v137, v105 : i32, i32, i32, i32, i32, i32 { - ^block39(v321: i32, v322: i32, v323: i32, v324: i32): - v343 = arith.constant 0 : i32; - v140 = arith.constant 8 : i32; - v141 = arith.eq v321, v140 : i1; - v142 = arith.zext v141 : u32; - v143 = hir.bitcast v142 : i32; - v145 = arith.neq v143, v343 : i1; - v309, v310 = scf.if v145 : i32, i32 { - ^block38: - v269 = ub.poison i32 : i32; - scf.yield v269, v269; - } else { - ^block22: - v147 = arith.add v322, v321 : i32 #[overflow = wrapping]; - v148 = hir.bitcast v147 : u32; - v342 = arith.constant 4 : u32; - v150 = arith.mod v148, v342 : u32; - hir.assertz v150 #[code = 250]; - v151 = hir.int_to_ptr v148 : ptr; - v152 = hir.load v151 : felt; - v154 = hir.bitcast v323 : u32; - v341 = arith.constant 4 : u32; - v156 = arith.mod v154, v341 : u32; - hir.assertz v156 #[code = 250]; - v157 = hir.int_to_ptr v154 : ptr; - v158 = hir.load v157 : i32; - v159 = hir.bitcast v147 : u32; - v340 = arith.constant 4 : u32; - v161 = arith.mod v159, v340 : u32; - hir.assertz v161 #[code = 250]; - v162 = hir.int_to_ptr v159 : ptr; - hir.store v162, v158; - v163 = hir.bitcast v323 : u32; - v339 = arith.constant 4 : u32; - v165 = arith.mod v163, v339 : u32; - hir.assertz v165 #[code = 250]; - v166 = hir.int_to_ptr v163 : ptr; - hir.store v166, v152; - v169 = arith.constant -4 : i32; - v170 = arith.add v323, v169 : i32 #[overflow = wrapping]; - v167 = arith.constant 4 : i32; - v168 = arith.add v321, v167 : i32 #[overflow = wrapping]; - scf.yield v168, v170; - }; - v337 = ub.poison i32 : i32; - v312 = cf.select v145, v337, v324 : i32; - v338 = ub.poison i32 : i32; - v311 = cf.select v145, v338, v322 : i32; - v268 = arith.constant 1 : u32; - v261 = arith.constant 0 : u32; - v314 = cf.select v145, v261, v268 : u32; - v302 = arith.trunc v314 : i1; - scf.condition v302, v309, v311, v310, v312, v322, v324; - } do { - ^block40(v325: i32, v326: i32, v327: i32, v328: i32, v329: i32, v330: i32): - scf.yield v325, v326, v327, v328; - }; - v336 = arith.constant 8 : u32; - v172 = hir.bitcast v319 : u32; - v174 = arith.add v172, v336 : u32 #[overflow = checked]; - v335 = arith.constant 4 : u32; - v176 = arith.mod v174, v335 : u32; - hir.assertz v176 #[code = 250]; - v177 = hir.int_to_ptr v174 : ptr; - v178 = hir.load v177 : i64; - v334 = arith.constant 8 : u32; - v179 = hir.bitcast v320 : u32; - v181 = arith.add v179, v334 : u32 #[overflow = checked]; - v333 = arith.constant 8 : u32; - v183 = arith.mod v181, v333 : u32; - hir.assertz v183 #[code = 250]; - v184 = hir.int_to_ptr v181 : ptr; - hir.store v184, v178; - v185 = hir.bitcast v319 : u32; - v332 = arith.constant 4 : u32; - v187 = arith.mod v185, v332 : u32; - hir.assertz v187 #[code = 250]; - v188 = hir.int_to_ptr v185 : ptr; - v189 = hir.load v188 : i64; - v190 = hir.bitcast v320 : u32; - v331 = arith.constant 8 : u32; - v192 = arith.mod v190, v331 : u32; - hir.assertz v192 #[code = 250]; - v193 = hir.int_to_ptr v190 : ptr; - hir.store v193, v189; - builtin.ret ; - }; - - private builtin.function @intrinsics::felt::from_u32(v194: i32) -> felt { - ^block23(v194: i32): - v195 = hir.bitcast v194 : felt; - builtin.ret v195; - }; - - private builtin.function @miden::faucet::create_fungible_asset(v197: felt, v198: i32) { - ^block25(v197: felt, v198: i32): - v199, v200, v201, v202 = hir.exec @miden/faucet/create_fungible_asset(v197) : felt, felt, felt, felt - v203 = hir.bitcast v198 : u32; - v204 = hir.int_to_ptr v203 : ptr; - hir.store v204, v199; - v205 = arith.constant 4 : u32; - v206 = arith.add v203, v205 : u32 #[overflow = checked]; - v207 = hir.int_to_ptr v206 : ptr; - hir.store v207, v200; - v208 = arith.constant 8 : u32; - v209 = arith.add v203, v208 : u32 #[overflow = checked]; - v210 = hir.int_to_ptr v209 : ptr; - hir.store v210, v201; - v211 = arith.constant 12 : u32; - v212 = arith.add v203, v211 : u32 #[overflow = checked]; - v213 = hir.int_to_ptr v212 : ptr; - hir.store v213, v202; - builtin.ret ; + private builtin.function @miden::protocol::faucet::create_fungible_asset(v118: felt, v119: i32) { + ^block17(v118: felt, v119: i32): + ub.unreachable ; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -317,36 +184,36 @@ builtin.component miden:rust-sdk-account-faucet-create-fungible-asset-binding/ru }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block29: - v214 = hir.exec @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1#binding() : i32 - v353 = arith.constant 0 : i32; - v215 = arith.constant 0 : i32; - v216 = arith.add v214, v215 : i32 #[overflow = unchecked]; - v218 = arith.add v216, v353 : i32 #[overflow = unchecked]; - v351 = arith.constant 0 : i32; - v352 = arith.constant 0 : i32; - v220 = arith.add v218, v352 : i32 #[overflow = unchecked]; - v222 = arith.add v220, v351 : i32 #[overflow = unchecked]; - v223 = hir.int_to_ptr v222 : ptr; - v224 = hir.load v223 : felt; - v350 = arith.constant 0 : i32; - v225 = arith.constant 4 : i32; - v226 = arith.add v218, v225 : i32 #[overflow = unchecked]; - v228 = arith.add v226, v350 : i32 #[overflow = unchecked]; - v229 = hir.int_to_ptr v228 : ptr; - v230 = hir.load v229 : felt; - v349 = arith.constant 0 : i32; - v231 = arith.constant 8 : i32; - v232 = arith.add v218, v231 : i32 #[overflow = unchecked]; - v234 = arith.add v232, v349 : i32 #[overflow = unchecked]; - v235 = hir.int_to_ptr v234 : ptr; - v236 = hir.load v235 : felt; - v348 = arith.constant 0 : i32; - v237 = arith.constant 12 : i32; - v238 = arith.add v218, v237 : i32 #[overflow = unchecked]; - v240 = arith.add v238, v348 : i32 #[overflow = unchecked]; - v241 = hir.int_to_ptr v240 : ptr; - v242 = hir.load v241 : felt; - builtin.ret v224, v230, v236, v242; + ^block19: + v120 = hir.exec @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1#binding() : i32 + v212 = arith.constant 0 : i32; + v206 = arith.constant 0 : i32; + v122 = arith.add v120, v206 : i32 #[overflow = unchecked]; + v124 = arith.add v122, v212 : i32 #[overflow = unchecked]; + v210 = arith.constant 0 : i32; + v211 = arith.constant 0 : i32; + v126 = arith.add v124, v211 : i32 #[overflow = unchecked]; + v128 = arith.add v126, v210 : i32 #[overflow = unchecked]; + v129 = hir.int_to_ptr v128 : ptr; + v130 = hir.load v129 : felt; + v209 = arith.constant 0 : i32; + v199 = arith.constant 4 : i32; + v132 = arith.add v124, v199 : i32 #[overflow = unchecked]; + v134 = arith.add v132, v209 : i32 #[overflow = unchecked]; + v135 = hir.int_to_ptr v134 : ptr; + v136 = hir.load v135 : felt; + v208 = arith.constant 0 : i32; + v198 = arith.constant 8 : i32; + v138 = arith.add v124, v198 : i32 #[overflow = unchecked]; + v140 = arith.add v138, v208 : i32 #[overflow = unchecked]; + v141 = hir.int_to_ptr v140 : ptr; + v142 = hir.load v141 : felt; + v207 = arith.constant 0 : i32; + v197 = arith.constant 12 : i32; + v144 = arith.add v124, v197 : i32 #[overflow = unchecked]; + v146 = arith.add v144, v207 : i32 #[overflow = unchecked]; + v147 = hir.int_to_ptr v146 : ptr; + v148 = hir.load v147 : felt; + builtin.ret v130, v136, v142, v148; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.masm index 6b29a040b..356f5e296 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.masm @@ -1,13 +1,13 @@ -# mod miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1 +# mod ::"miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> (felt, felt, felt, felt) - exec.::miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1::init + exec."miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_fungible_asset_binding::miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1#binding + exec.::"miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1"::rust_sdk_account_faucet_create_fungible_asset_binding::"miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1#binding" trace.252 nop push.0 @@ -65,7 +65,7 @@ pub proc binding( nop movdn.3 swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -78,7 +78,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -89,7 +89,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_fungible_asset_binding +# mod ::"miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1"::rust_sdk_account_faucet_create_fungible_asset_binding @callconv("C") proc __wasm_call_ctors( @@ -105,6 +105,7 @@ proc rust_sdk_account_faucet_create_fungible_asset_binding::bindings::__link_cus nop end +@locals("2") @callconv("C") proc miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1#binding( @@ -119,9 +120,16 @@ proc miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-accoun nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -131,19 +139,22 @@ proc miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-accoun nop trace.240 nop - exec.::miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_fungible_asset_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1"::rust_sdk_account_faucet_create_fungible_asset_binding::wit_bindgen::rt::run_ctors_once trace.252 nop - push.10 + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_fungible_asset_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop - dup.1 + push.10 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_fungible_asset_binding::miden_base_sys::bindings::faucet::create_fungible_asset + exec.::"miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1"::rust_sdk_account_faucet_create_fungible_asset_binding::miden_base_sys::bindings::faucet::create_fungible_asset trace.252 nop push.1114148 @@ -156,8 +167,25 @@ proc miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-accoun nop push.1048584 u32wrapping_add + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.2 + swap.1 add u32assert push.8 @@ -175,7 +203,7 @@ proc miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-accoun nop swap.1 push.8 - dup.3 + movup.3 add u32assert push.4 @@ -193,7 +221,22 @@ proc miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-accoun exec.::intrinsics::mem::store_dw trace.252 nop - dup.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 dup.1 swap.1 @@ -208,7 +251,7 @@ proc miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-accoun trace.252 nop swap.1 - dup.2 + movup.2 push.4 dup.1 swap.1 @@ -224,8 +267,15 @@ proc miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-accoun exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - movup.2 u32wrapping_add push.1114144 u32divmod.4 @@ -235,8 +285,17 @@ proc miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-accoun exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -278,9 +337,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1"::rust_sdk_account_faucet_create_fungible_asset_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_fungible_asset_binding::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -311,149 +386,77 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("3") @callconv("C") proc miden_base_sys::bindings::faucet::create_fungible_asset( i32, felt ) - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::store_sw trace.252 nop - push.32 - u32wrapping_sub push.1114144 - dup.1 - swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop + push.16 + u32wrapping_sub dup.0 - movup.3 - trace.240 - nop - exec.::miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_fungible_asset_binding::miden::faucet::create_fungible_asset - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_sw trace.252 nop - swap.1 - push.24 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.1114144 u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop - dup.0 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop swap.1 - push.16 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.16 - dup.1 - u32wrapping_add - movup.2 trace.240 nop - exec.::miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_fungible_asset_binding::::reverse + exec.::"miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1"::rust_sdk_account_faucet_create_fungible_asset_binding::"miden::protocol::faucet::create_fungible_asset" trace.252 nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop -end - -@callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert push.8 dup.1 swap.1 @@ -469,15 +472,17 @@ proc ::reverse( nop swap.1 push.8 - dup.3 + movup.3 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -487,182 +492,24 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.12 - dup.1 - u32wrapping_add + locaddr.2 push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop - swap.1 push.8 - dup.4 + swap.1 add u32assert push.8 @@ -673,21 +520,6 @@ proc ::reverse( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 trace.240 nop exec.::intrinsics::mem::load_dw @@ -701,6 +533,8 @@ proc ::reverse( u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -710,66 +544,32 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc miden::faucet::create_fungible_asset(felt, i32) - trace.240 - nop - exec.::miden::faucet::create_fungible_asset - trace.252 - nop - movup.4 - dup.0 - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_sw trace.252 nop - push.12 - add - u32assert + push.16 + u32wrapping_add + push.1114144 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::store_sw trace.252 nop end +@locals("2") +@callconv("C") +proc miden::protocol::faucet::create_fungible_asset(felt, i32) + drop + drop + push.0 + assert +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.wat index 9e232b484..aee457930 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.wat @@ -15,9 +15,8 @@ (type (;0;) (func)) (type (;1;) (func (result i32))) (type (;2;) (func (param i32 f32))) - (type (;3;) (func (param i32 i32))) - (type (;4;) (func (param i32) (result f32))) - (type (;5;) (func (param f32 i32))) + (type (;3;) (func (param i32) (result f32))) + (type (;4;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -77,97 +76,38 @@ (func $miden_base_sys::bindings::faucet::create_fungible_asset (;4;) (type 2) (param i32 f32) (local i32) global.get $__stack_pointer - i32.const 32 + i32.const 16 i32.sub local.tee 2 global.set $__stack_pointer local.get 1 local.get 2 - call $miden::faucet::create_fungible_asset - local.get 2 - local.get 2 - i64.load offset=8 - i64.store offset=24 - local.get 2 - local.get 2 - i64.load - i64.store offset=16 + call $miden::protocol::faucet::create_fungible_asset local.get 0 local.get 2 - i32.const 16 - i32.add - call $::reverse - local.get 2 - i32.const 32 - i32.add - global.set $__stack_pointer - ) - (func $::reverse (;5;) (type 3) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 + i64.const 32 + i64.rotl i64.store offset=8 local.get 0 local.get 2 - i64.load align=4 + i64.load offset=8 + i64.const 32 + i64.rotl i64.store + local.get 2 + i32.const 16 + i32.add + global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) unreachable ) - (func $miden::faucet::create_fungible_asset (;7;) (type 5) (param f32 i32) + (func $miden::protocol::faucet::create_fungible_asset (;6;) (type 4) (param f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "krust_sdk_account_faucet_create_fungible_asset_binding\01\0b0.0.1\05\02\03\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "krust_sdk_account_faucet_create_fungible_asset_binding\01\0b0.0.1\05\02\03\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "asset" (type $asset (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.hir index 5096ba1bb..f9722958e 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.hir @@ -12,402 +12,281 @@ builtin.component miden:rust-sdk-account-faucet-create-non-fungible-asset-bindin private builtin.function @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1#binding() -> i32 { ^block9: - v3 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr - v4 = hir.bitcast v3 : ptr; - v5 = hir.load v4 : i32; - v6 = arith.constant 32 : i32; - v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; - v8 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr - v9 = hir.bitcast v8 : ptr; - hir.store v9, v7; + v1 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v250 = arith.constant 32 : i32; + v5 = arith.sub v3, v250 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/wit_bindgen::rt::run_ctors_once() - v1 = arith.constant 0 : i32; - v12 = hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/intrinsics::felt::from_u32(v1) : felt - v393 = arith.constant 0 : i32; - v366, v367, v368, v369 = scf.while v393, v7, v12 : i32, i32, felt, i32 { - ^block42(v370: i32, v371: i32, v372: felt): - v392 = arith.constant 0 : i32; - v58 = arith.constant 16 : i32; - v15 = arith.eq v370, v58 : i1; - v16 = arith.zext v15 : u32; - v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v392 : i1; - v361 = scf.if v19 : i32 { - ^block41: - v332 = ub.poison i32 : i32; - scf.yield v332; + v249 = arith.constant 0 : i32; + hir.store_local v249 #[local = lv1]; + v241 = arith.constant 0 : felt; + hir.store_local v241 #[local = lv2]; + scf.while { + ^block12: + v11 = hir.load_local : i32 #[local = lv1]; + v290 = arith.constant 0 : i32; + v254 = arith.constant 16 : i32; + v13 = arith.eq v11, v254 : i1; + v14 = arith.zext v13 : u32; + v15 = hir.bitcast v14 : i32; + v17 = arith.neq v15, v290 : i1; + scf.if v17{ + ^block31: + scf.yield ; } else { ^block14: - v391 = arith.constant 16 : i32; - v22 = arith.add v371, v391 : i32 #[overflow = wrapping]; - v23 = arith.add v22, v370 : i32 #[overflow = wrapping]; - v25 = hir.bitcast v23 : u32; - v34 = arith.constant 4 : u32; - v27 = arith.mod v25, v34 : u32; - hir.assertz v27 #[code = 250]; - v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v372; - v29 = arith.constant 4 : i32; - v30 = arith.add v370, v29 : i32 #[overflow = wrapping]; - scf.yield v30; + v18 = hir.load_local : i32 #[local = lv0]; + v21 = hir.load_local : i32 #[local = lv1]; + v23 = hir.load_local : felt #[local = lv2]; + v289 = arith.constant 16 : i32; + v20 = arith.add v18, v289 : i32 #[overflow = wrapping]; + v22 = arith.add v20, v21 : i32 #[overflow = wrapping]; + v24 = hir.bitcast v22 : u32; + v251 = arith.constant 4 : u32; + v26 = arith.mod v24, v251 : u32; + hir.assertz v26 #[code = 250]; + v27 = hir.int_to_ptr v24 : ptr; + hir.store v27, v23; + v28 = hir.load_local : i32 #[local = lv1]; + v242 = arith.constant 4 : i32; + v30 = arith.add v28, v242 : i32 #[overflow = wrapping]; + hir.store_local v30 #[local = lv1]; + scf.yield ; }; - v333 = ub.poison felt : felt; - v363 = cf.select v19, v333, v372 : felt; - v390 = ub.poison i32 : i32; - v362 = cf.select v19, v390, v371 : i32; - v331 = arith.constant 1 : u32; - v325 = arith.constant 0 : u32; - v365 = cf.select v19, v325, v331 : u32; - v355 = arith.trunc v365 : i1; - scf.condition v355, v361, v362, v363, v371; + v270 = arith.constant 1 : u32; + v267 = arith.constant 0 : u32; + v275 = cf.select v17, v267, v270 : u32; + v271 = arith.trunc v275 : i1; + scf.condition v271; } do { - ^block43(v373: i32, v374: i32, v375: felt, v376: i32): - scf.yield v373, v374, v375; + ^block30: + scf.yield ; }; - v32 = arith.constant 24 : u32; - v31 = hir.bitcast v369 : u32; - v33 = arith.add v31, v32 : u32 #[overflow = checked]; - v389 = arith.constant 4 : u32; - v35 = arith.mod v33, v389 : u32; - hir.assertz v35 #[code = 250]; - v36 = hir.int_to_ptr v33 : ptr; - v37 = hir.load v36 : i64; - v39 = arith.constant 8 : u32; - v38 = hir.bitcast v369 : u32; - v40 = arith.add v38, v39 : u32 #[overflow = checked]; - v388 = arith.constant 8 : u32; - v42 = arith.mod v40, v388 : u32; - hir.assertz v42 #[code = 250]; - v43 = hir.int_to_ptr v40 : ptr; - hir.store v43, v37; - v45 = arith.constant 16 : u32; - v44 = hir.bitcast v369 : u32; - v46 = arith.add v44, v45 : u32 #[overflow = checked]; - v387 = arith.constant 4 : u32; - v48 = arith.mod v46, v387 : u32; - hir.assertz v48 #[code = 250]; - v49 = hir.int_to_ptr v46 : ptr; - v50 = hir.load v49 : i64; - v51 = hir.bitcast v369 : u32; - v386 = arith.constant 8 : u32; - v53 = arith.mod v51, v386 : u32; - hir.assertz v53 #[code = 250]; - v54 = hir.int_to_ptr v51 : ptr; - hir.store v54, v50; - v55 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr - v56 = hir.bitcast v55 : ptr; - v57 = hir.load v56 : i32; - v385 = arith.constant 16 : i32; - v59 = arith.add v369, v385 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/miden_base_sys::bindings::faucet::create_non_fungible_asset(v59, v369) - v60 = arith.constant 1048584 : i32; - v61 = arith.add v57, v60 : i32 #[overflow = wrapping]; - v384 = arith.constant 24 : u32; - v62 = hir.bitcast v369 : u32; - v64 = arith.add v62, v384 : u32 #[overflow = checked]; - v383 = arith.constant 8 : u32; - v66 = arith.mod v64, v383 : u32; - hir.assertz v66 #[code = 250]; - v67 = hir.int_to_ptr v64 : ptr; - v68 = hir.load v67 : i64; - v382 = arith.constant 8 : u32; - v69 = hir.bitcast v61 : u32; - v71 = arith.add v69, v382 : u32 #[overflow = checked]; - v381 = arith.constant 4 : u32; - v73 = arith.mod v71, v381 : u32; - hir.assertz v73 #[code = 250]; - v74 = hir.int_to_ptr v71 : ptr; - hir.store v74, v68; - v380 = arith.constant 16 : u32; - v75 = hir.bitcast v369 : u32; - v77 = arith.add v75, v380 : u32 #[overflow = checked]; - v379 = arith.constant 8 : u32; - v79 = arith.mod v77, v379 : u32; - hir.assertz v79 #[code = 250]; - v80 = hir.int_to_ptr v77 : ptr; - v81 = hir.load v80 : i64; - v82 = hir.bitcast v61 : u32; - v378 = arith.constant 4 : u32; - v84 = arith.mod v82, v378 : u32; - hir.assertz v84 #[code = 250]; - v85 = hir.int_to_ptr v82 : ptr; - hir.store v85, v81; - v377 = arith.constant 32 : i32; - v87 = arith.add v369, v377 : i32 #[overflow = wrapping]; - v88 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr - v89 = hir.bitcast v88 : ptr; - hir.store v89, v87; - builtin.ret v61; + v31 = hir.load_local : i32 #[local = lv0]; + v248 = arith.constant 24 : u32; + v33 = hir.bitcast v31 : u32; + v35 = arith.add v33, v248 : u32 #[overflow = checked]; + v288 = arith.constant 4 : u32; + v37 = arith.mod v35, v288 : u32; + hir.assertz v37 #[code = 250]; + v38 = hir.int_to_ptr v35 : ptr; + v39 = hir.load v38 : i64; + v246 = arith.constant 8 : u32; + v40 = hir.bitcast v31 : u32; + v42 = arith.add v40, v246 : u32 #[overflow = checked]; + v287 = arith.constant 8 : u32; + v44 = arith.mod v42, v287 : u32; + hir.assertz v44 #[code = 250]; + v45 = hir.int_to_ptr v42 : ptr; + hir.store v45, v39; + v46 = hir.load_local : i32 #[local = lv0]; + v245 = arith.constant 16 : u32; + v48 = hir.bitcast v46 : u32; + v50 = arith.add v48, v245 : u32 #[overflow = checked]; + v286 = arith.constant 4 : u32; + v52 = arith.mod v50, v286 : u32; + hir.assertz v52 #[code = 250]; + v53 = hir.int_to_ptr v50 : ptr; + v54 = hir.load v53 : i64; + v55 = hir.bitcast v46 : u32; + v285 = arith.constant 8 : u32; + v57 = arith.mod v55, v285 : u32; + hir.assertz v57 #[code = 250]; + v58 = hir.int_to_ptr v55 : ptr; + hir.store v58, v54; + v59 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v60 = hir.bitcast v59 : ptr; + v61 = hir.load v60 : i32; + hir.store_local v61 #[local = lv1]; + v62 = hir.load_local : i32 #[local = lv0]; + v284 = arith.constant 16 : i32; + v64 = arith.add v62, v284 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/miden_base_sys::bindings::faucet::create_non_fungible_asset(v64, v62) + v66 = hir.load_local : i32 #[local = lv1]; + v243 = arith.constant 1048584 : i32; + v68 = arith.add v66, v243 : i32 #[overflow = wrapping]; + hir.store_local v68 #[local = lv1]; + v69 = hir.load_local : i32 #[local = lv0]; + v283 = arith.constant 24 : u32; + v70 = hir.bitcast v69 : u32; + v72 = arith.add v70, v283 : u32 #[overflow = checked]; + v282 = arith.constant 8 : u32; + v74 = arith.mod v72, v282 : u32; + hir.assertz v74 #[code = 250]; + v75 = hir.int_to_ptr v72 : ptr; + v76 = hir.load v75 : i64; + v281 = arith.constant 8 : u32; + v77 = hir.bitcast v68 : u32; + v79 = arith.add v77, v281 : u32 #[overflow = checked]; + v280 = arith.constant 4 : u32; + v81 = arith.mod v79, v280 : u32; + hir.assertz v81 #[code = 250]; + v82 = hir.int_to_ptr v79 : ptr; + hir.store v82, v76; + v83 = hir.load_local : i32 #[local = lv1]; + v84 = hir.load_local : i32 #[local = lv0]; + v279 = arith.constant 16 : u32; + v85 = hir.bitcast v84 : u32; + v87 = arith.add v85, v279 : u32 #[overflow = checked]; + v278 = arith.constant 8 : u32; + v89 = arith.mod v87, v278 : u32; + hir.assertz v89 #[code = 250]; + v90 = hir.int_to_ptr v87 : ptr; + v91 = hir.load v90 : i64; + v92 = hir.bitcast v83 : u32; + v277 = arith.constant 4 : u32; + v94 = arith.mod v92, v277 : u32; + hir.assertz v94 #[code = 250]; + v95 = hir.int_to_ptr v92 : ptr; + hir.store v95, v91; + v96 = hir.load_local : i32 #[local = lv0]; + v276 = arith.constant 32 : i32; + v98 = arith.add v96, v276 : i32 #[overflow = wrapping]; + v99 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr + v100 = hir.bitcast v99 : ptr; + hir.store v100, v98; + v101 = hir.load_local : i32 #[local = lv1]; + builtin.ret v101; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block15: - v91 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr - v92 = hir.bitcast v91 : ptr; - v93 = hir.load v92 : i32; - v94 = arith.constant 1048600 : i32; - v95 = arith.add v93, v94 : i32 #[overflow = wrapping]; - v96 = hir.bitcast v95 : u32; - v97 = hir.int_to_ptr v96 : ptr; - v98 = hir.load v97 : u8; - v90 = arith.constant 0 : i32; - v99 = arith.zext v98 : u32; - v100 = hir.bitcast v99 : i32; - v102 = arith.neq v100, v90 : i1; - scf.if v102{ + v102 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v103 = hir.bitcast v102 : ptr; + v104 = hir.load v103 : i32; + v295 = arith.constant 1048600 : i32; + v106 = arith.add v104, v295 : i32 #[overflow = wrapping]; + v107 = hir.bitcast v106 : u32; + v108 = hir.int_to_ptr v107 : ptr; + v109 = hir.load v108 : u8; + v294 = arith.constant 0 : i32; + v110 = arith.zext v109 : u32; + v111 = hir.bitcast v110 : i32; + v113 = arith.neq v111, v294 : i1; + scf.if v113{ ^block17: scf.yield ; } else { ^block18: - v103 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr - v104 = hir.bitcast v103 : ptr; - v105 = hir.load v104 : i32; + v114 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v115 = hir.bitcast v114 : ptr; + v116 = hir.load v115 : i32; + hir.store_local v116 #[local = lv0]; hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__wasm_call_ctors() - v395 = arith.constant 1 : u8; - v397 = arith.constant 1048600 : i32; - v107 = arith.add v105, v397 : i32 #[overflow = wrapping]; - v111 = hir.bitcast v107 : u32; - v112 = hir.int_to_ptr v111 : ptr; - hir.store v112, v395; + v117 = hir.load_local : i32 #[local = lv0]; + v293 = arith.constant 1 : u8; + v298 = arith.constant 1048600 : i32; + v119 = arith.add v117, v298 : i32 #[overflow = wrapping]; + v123 = hir.bitcast v119 : u32; + v124 = hir.int_to_ptr v123 : ptr; + hir.store v124, v293; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::faucet::create_non_fungible_asset(v113: i32, v114: i32) { - ^block19(v113: i32, v114: i32): - v116 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr - v117 = hir.bitcast v116 : ptr; - v118 = hir.load v117 : i32; - v119 = arith.constant 32 : i32; - v120 = arith.sub v118, v119 : i32 #[overflow = wrapping]; - v121 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr - v122 = hir.bitcast v121 : ptr; - hir.store v122, v120; - v124 = arith.constant 12 : u32; - v123 = hir.bitcast v114 : u32; - v125 = arith.add v123, v124 : u32 #[overflow = checked]; - v126 = arith.constant 4 : u32; - v127 = arith.mod v125, v126 : u32; - hir.assertz v127 #[code = 250]; - v128 = hir.int_to_ptr v125 : ptr; - v129 = hir.load v128 : felt; - v131 = arith.constant 8 : u32; - v130 = hir.bitcast v114 : u32; - v132 = arith.add v130, v131 : u32 #[overflow = checked]; - v407 = arith.constant 4 : u32; - v134 = arith.mod v132, v407 : u32; - hir.assertz v134 #[code = 250]; - v135 = hir.int_to_ptr v132 : ptr; - v136 = hir.load v135 : felt; - v406 = arith.constant 4 : u32; - v137 = hir.bitcast v114 : u32; - v139 = arith.add v137, v406 : u32 #[overflow = checked]; - v405 = arith.constant 4 : u32; - v141 = arith.mod v139, v405 : u32; - hir.assertz v141 #[code = 250]; - v142 = hir.int_to_ptr v139 : ptr; - v143 = hir.load v142 : felt; - v144 = hir.bitcast v114 : u32; - v404 = arith.constant 4 : u32; - v146 = arith.mod v144, v404 : u32; - hir.assertz v146 #[code = 250]; - v147 = hir.int_to_ptr v144 : ptr; - v148 = hir.load v147 : felt; - hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/miden::faucet::create_non_fungible_asset(v129, v136, v143, v148, v120) - v403 = arith.constant 8 : u32; - v149 = hir.bitcast v120 : u32; - v151 = arith.add v149, v403 : u32 #[overflow = checked]; - v402 = arith.constant 8 : u32; - v153 = arith.mod v151, v402 : u32; - hir.assertz v153 #[code = 250]; - v154 = hir.int_to_ptr v151 : ptr; - v155 = hir.load v154 : i64; - v157 = arith.constant 24 : u32; - v156 = hir.bitcast v120 : u32; - v158 = arith.add v156, v157 : u32 #[overflow = checked]; - v401 = arith.constant 8 : u32; - v160 = arith.mod v158, v401 : u32; - hir.assertz v160 #[code = 250]; - v161 = hir.int_to_ptr v158 : ptr; - hir.store v161, v155; - v162 = hir.bitcast v120 : u32; - v400 = arith.constant 8 : u32; - v164 = arith.mod v162, v400 : u32; - hir.assertz v164 #[code = 250]; - v165 = hir.int_to_ptr v162 : ptr; - v166 = hir.load v165 : i64; - v168 = arith.constant 16 : u32; - v167 = hir.bitcast v120 : u32; - v169 = arith.add v167, v168 : u32 #[overflow = checked]; - v399 = arith.constant 8 : u32; - v171 = arith.mod v169, v399 : u32; - hir.assertz v171 #[code = 250]; - v172 = hir.int_to_ptr v169 : ptr; - hir.store v172, v166; - v173 = arith.constant 16 : i32; - v174 = arith.add v120, v173 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/::reverse(v113, v174) - v398 = arith.constant 32 : i32; - v176 = arith.add v120, v398 : i32 #[overflow = wrapping]; - v177 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr - v178 = hir.bitcast v177 : ptr; - hir.store v178, v176; + private builtin.function @miden_base_sys::bindings::faucet::create_non_fungible_asset(v125: i32, v126: i32) { + ^block19(v125: i32, v126: i32): + hir.store_local v125 #[local = lv0]; + hir.store_local v126 #[local = lv1]; + v127 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr + v128 = hir.bitcast v127 : ptr; + v129 = hir.load v128 : i32; + v308 = arith.constant 16 : i32; + v131 = arith.sub v129, v308 : i32 #[overflow = wrapping]; + hir.store_local v131 #[local = lv2]; + v132 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr + v133 = hir.bitcast v132 : ptr; + hir.store v133, v131; + v134 = hir.load_local : i32 #[local = lv1]; + v307 = arith.constant 12 : u32; + v135 = hir.bitcast v134 : u32; + v137 = arith.add v135, v307 : u32 #[overflow = checked]; + v306 = arith.constant 4 : u32; + v139 = arith.mod v137, v306 : u32; + hir.assertz v139 #[code = 250]; + v140 = hir.int_to_ptr v137 : ptr; + v141 = hir.load v140 : felt; + v142 = hir.load_local : i32 #[local = lv1]; + v305 = arith.constant 8 : u32; + v143 = hir.bitcast v142 : u32; + v145 = arith.add v143, v305 : u32 #[overflow = checked]; + v330 = arith.constant 4 : u32; + v147 = arith.mod v145, v330 : u32; + hir.assertz v147 #[code = 250]; + v148 = hir.int_to_ptr v145 : ptr; + v149 = hir.load v148 : felt; + v150 = hir.load_local : i32 #[local = lv1]; + v329 = arith.constant 4 : u32; + v151 = hir.bitcast v150 : u32; + v153 = arith.add v151, v329 : u32 #[overflow = checked]; + v328 = arith.constant 4 : u32; + v155 = arith.mod v153, v328 : u32; + hir.assertz v155 #[code = 250]; + v156 = hir.int_to_ptr v153 : ptr; + v157 = hir.load v156 : felt; + v158 = hir.load_local : i32 #[local = lv1]; + v159 = hir.bitcast v158 : u32; + v327 = arith.constant 4 : u32; + v161 = arith.mod v159, v327 : u32; + hir.assertz v161 #[code = 250]; + v162 = hir.int_to_ptr v159 : ptr; + v163 = hir.load v162 : felt; + v164 = hir.load_local : i32 #[local = lv2]; + hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/miden::protocol::faucet::create_non_fungible_asset(v141, v149, v157, v163, v164) + v165 = hir.load_local : i32 #[local = lv0]; + v166 = hir.load_local : i32 #[local = lv2]; + v167 = hir.bitcast v166 : u32; + v326 = arith.constant 8 : u32; + v169 = arith.mod v167, v326 : u32; + hir.assertz v169 #[code = 250]; + v170 = hir.int_to_ptr v167 : ptr; + v171 = hir.load v170 : i64; + v302, v303 = arith.split v171 : felt, felt; + v325 = arith.constant 8 : u32; + v175 = hir.bitcast v165 : u32; + v177 = arith.add v175, v325 : u32 #[overflow = checked]; + v324 = arith.constant 8 : u32; + v179 = arith.mod v177, v324 : u32; + hir.assertz v179 #[code = 250]; + v304 = arith.join v303, v302 : i64; + v180 = hir.int_to_ptr v177 : ptr; + hir.store v180, v304; + v181 = hir.load_local : i32 #[local = lv0]; + v182 = hir.load_local : i32 #[local = lv2]; + v323 = arith.constant 8 : u32; + v183 = hir.bitcast v182 : u32; + v185 = arith.add v183, v323 : u32 #[overflow = checked]; + v322 = arith.constant 8 : u32; + v187 = arith.mod v185, v322 : u32; + hir.assertz v187 #[code = 250]; + v188 = hir.int_to_ptr v185 : ptr; + v189 = hir.load v188 : i64; + v299, v300 = arith.split v189 : felt, felt; + v193 = hir.bitcast v181 : u32; + v321 = arith.constant 8 : u32; + v195 = arith.mod v193, v321 : u32; + hir.assertz v195 #[code = 250]; + v301 = arith.join v300, v299 : i64; + v196 = hir.int_to_ptr v193 : ptr; + hir.store v196, v301; + v197 = hir.load_local : i32 #[local = lv2]; + v320 = arith.constant 16 : i32; + v199 = arith.add v197, v320 : i32 #[overflow = wrapping]; + v200 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr + v201 = hir.bitcast v200 : ptr; + hir.store v201, v199; builtin.ret ; }; - private builtin.function @::reverse(v179: i32, v180: i32) { - ^block21(v179: i32, v180: i32): - v183 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr - v184 = hir.bitcast v183 : ptr; - v185 = hir.load v184 : i32; - v186 = arith.constant 16 : i32; - v187 = arith.sub v185, v186 : i32 #[overflow = wrapping]; - v189 = arith.constant 8 : u32; - v188 = hir.bitcast v180 : u32; - v190 = arith.add v188, v189 : u32 #[overflow = checked]; - v494 = arith.constant 8 : u32; - v192 = arith.mod v190, v494 : u32; - hir.assertz v192 #[code = 250]; - v193 = hir.int_to_ptr v190 : ptr; - v194 = hir.load v193 : i64; - v493 = arith.constant 8 : u32; - v195 = hir.bitcast v187 : u32; - v197 = arith.add v195, v493 : u32 #[overflow = checked]; - v198 = arith.constant 4 : u32; - v199 = arith.mod v197, v198 : u32; - hir.assertz v199 #[code = 250]; - v200 = hir.int_to_ptr v197 : ptr; - hir.store v200, v194; - v201 = hir.bitcast v180 : u32; - v492 = arith.constant 8 : u32; - v203 = arith.mod v201, v492 : u32; - hir.assertz v203 #[code = 250]; - v204 = hir.int_to_ptr v201 : ptr; - v205 = hir.load v204 : i64; - v206 = hir.bitcast v187 : u32; - v491 = arith.constant 4 : u32; - v208 = arith.mod v206, v491 : u32; - hir.assertz v208 #[code = 250]; - v209 = hir.int_to_ptr v206 : ptr; - hir.store v209, v205; - v210 = arith.constant 12 : i32; - v211 = arith.add v187, v210 : i32 #[overflow = wrapping]; - v181 = arith.constant 0 : i32; - v462, v463, v464, v465, v466, v467 = scf.while v181, v187, v211, v179 : i32, i32, i32, i32, i32, i32 { - ^block52(v468: i32, v469: i32, v470: i32, v471: i32): - v490 = arith.constant 0 : i32; - v214 = arith.constant 8 : i32; - v215 = arith.eq v468, v214 : i1; - v216 = arith.zext v215 : u32; - v217 = hir.bitcast v216 : i32; - v219 = arith.neq v217, v490 : i1; - v456, v457 = scf.if v219 : i32, i32 { - ^block51: - v416 = ub.poison i32 : i32; - scf.yield v416, v416; - } else { - ^block26: - v221 = arith.add v469, v468 : i32 #[overflow = wrapping]; - v222 = hir.bitcast v221 : u32; - v489 = arith.constant 4 : u32; - v224 = arith.mod v222, v489 : u32; - hir.assertz v224 #[code = 250]; - v225 = hir.int_to_ptr v222 : ptr; - v226 = hir.load v225 : felt; - v228 = hir.bitcast v470 : u32; - v488 = arith.constant 4 : u32; - v230 = arith.mod v228, v488 : u32; - hir.assertz v230 #[code = 250]; - v231 = hir.int_to_ptr v228 : ptr; - v232 = hir.load v231 : i32; - v233 = hir.bitcast v221 : u32; - v487 = arith.constant 4 : u32; - v235 = arith.mod v233, v487 : u32; - hir.assertz v235 #[code = 250]; - v236 = hir.int_to_ptr v233 : ptr; - hir.store v236, v232; - v237 = hir.bitcast v470 : u32; - v486 = arith.constant 4 : u32; - v239 = arith.mod v237, v486 : u32; - hir.assertz v239 #[code = 250]; - v240 = hir.int_to_ptr v237 : ptr; - hir.store v240, v226; - v243 = arith.constant -4 : i32; - v244 = arith.add v470, v243 : i32 #[overflow = wrapping]; - v241 = arith.constant 4 : i32; - v242 = arith.add v468, v241 : i32 #[overflow = wrapping]; - scf.yield v242, v244; - }; - v484 = ub.poison i32 : i32; - v459 = cf.select v219, v484, v471 : i32; - v485 = ub.poison i32 : i32; - v458 = cf.select v219, v485, v469 : i32; - v415 = arith.constant 1 : u32; - v408 = arith.constant 0 : u32; - v461 = cf.select v219, v408, v415 : u32; - v449 = arith.trunc v461 : i1; - scf.condition v449, v456, v458, v457, v459, v469, v471; - } do { - ^block53(v472: i32, v473: i32, v474: i32, v475: i32, v476: i32, v477: i32): - scf.yield v472, v473, v474, v475; - }; - v483 = arith.constant 8 : u32; - v246 = hir.bitcast v466 : u32; - v248 = arith.add v246, v483 : u32 #[overflow = checked]; - v482 = arith.constant 4 : u32; - v250 = arith.mod v248, v482 : u32; - hir.assertz v250 #[code = 250]; - v251 = hir.int_to_ptr v248 : ptr; - v252 = hir.load v251 : i64; - v481 = arith.constant 8 : u32; - v253 = hir.bitcast v467 : u32; - v255 = arith.add v253, v481 : u32 #[overflow = checked]; - v480 = arith.constant 8 : u32; - v257 = arith.mod v255, v480 : u32; - hir.assertz v257 #[code = 250]; - v258 = hir.int_to_ptr v255 : ptr; - hir.store v258, v252; - v259 = hir.bitcast v466 : u32; - v479 = arith.constant 4 : u32; - v261 = arith.mod v259, v479 : u32; - hir.assertz v261 #[code = 250]; - v262 = hir.int_to_ptr v259 : ptr; - v263 = hir.load v262 : i64; - v264 = hir.bitcast v467 : u32; - v478 = arith.constant 8 : u32; - v266 = arith.mod v264, v478 : u32; - hir.assertz v266 #[code = 250]; - v267 = hir.int_to_ptr v264 : ptr; - hir.store v267, v263; - builtin.ret ; - }; - - private builtin.function @intrinsics::felt::from_u32(v268: i32) -> felt { - ^block27(v268: i32): - v269 = hir.bitcast v268 : felt; - builtin.ret v269; - }; - - private builtin.function @miden::faucet::create_non_fungible_asset(v271: felt, v272: felt, v273: felt, v274: felt, v275: i32) { - ^block29(v271: felt, v272: felt, v273: felt, v274: felt, v275: i32): - v276, v277, v278, v279 = hir.exec @miden/faucet/create_non_fungible_asset(v271, v272, v273, v274) : felt, felt, felt, felt - v280 = hir.bitcast v275 : u32; - v281 = hir.int_to_ptr v280 : ptr; - hir.store v281, v276; - v282 = arith.constant 4 : u32; - v283 = arith.add v280, v282 : u32 #[overflow = checked]; - v284 = hir.int_to_ptr v283 : ptr; - hir.store v284, v277; - v285 = arith.constant 8 : u32; - v286 = arith.add v280, v285 : u32 #[overflow = checked]; - v287 = hir.int_to_ptr v286 : ptr; - hir.store v287, v278; - v288 = arith.constant 12 : u32; - v289 = arith.add v280, v288 : u32 #[overflow = checked]; - v290 = hir.int_to_ptr v289 : ptr; - hir.store v290, v279; - builtin.ret ; + private builtin.function @miden::protocol::faucet::create_non_fungible_asset(v202: felt, v203: felt, v204: felt, v205: felt, v206: i32) { + ^block21(v202: felt, v203: felt, v204: felt, v205: felt, v206: i32): + ub.unreachable ; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -422,36 +301,36 @@ builtin.component miden:rust-sdk-account-faucet-create-non-fungible-asset-bindin }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block33: - v291 = hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1#binding() : i32 - v500 = arith.constant 0 : i32; - v292 = arith.constant 0 : i32; - v293 = arith.add v291, v292 : i32 #[overflow = unchecked]; - v295 = arith.add v293, v500 : i32 #[overflow = unchecked]; - v498 = arith.constant 0 : i32; - v499 = arith.constant 0 : i32; - v297 = arith.add v295, v499 : i32 #[overflow = unchecked]; - v299 = arith.add v297, v498 : i32 #[overflow = unchecked]; - v300 = hir.int_to_ptr v299 : ptr; - v301 = hir.load v300 : felt; - v497 = arith.constant 0 : i32; - v302 = arith.constant 4 : i32; - v303 = arith.add v295, v302 : i32 #[overflow = unchecked]; - v305 = arith.add v303, v497 : i32 #[overflow = unchecked]; - v306 = hir.int_to_ptr v305 : ptr; - v307 = hir.load v306 : felt; - v496 = arith.constant 0 : i32; - v308 = arith.constant 8 : i32; - v309 = arith.add v295, v308 : i32 #[overflow = unchecked]; - v311 = arith.add v309, v496 : i32 #[overflow = unchecked]; - v312 = hir.int_to_ptr v311 : ptr; - v313 = hir.load v312 : felt; - v495 = arith.constant 0 : i32; - v314 = arith.constant 12 : i32; - v315 = arith.add v295, v314 : i32 #[overflow = unchecked]; - v317 = arith.add v315, v495 : i32 #[overflow = unchecked]; - v318 = hir.int_to_ptr v317 : ptr; - v319 = hir.load v318 : felt; - builtin.ret v301, v307, v313, v319; + ^block23: + v207 = hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1#binding() : i32 + v346 = arith.constant 0 : i32; + v340 = arith.constant 0 : i32; + v209 = arith.add v207, v340 : i32 #[overflow = unchecked]; + v211 = arith.add v209, v346 : i32 #[overflow = unchecked]; + v344 = arith.constant 0 : i32; + v345 = arith.constant 0 : i32; + v213 = arith.add v211, v345 : i32 #[overflow = unchecked]; + v215 = arith.add v213, v344 : i32 #[overflow = unchecked]; + v216 = hir.int_to_ptr v215 : ptr; + v217 = hir.load v216 : felt; + v343 = arith.constant 0 : i32; + v333 = arith.constant 4 : i32; + v219 = arith.add v211, v333 : i32 #[overflow = unchecked]; + v221 = arith.add v219, v343 : i32 #[overflow = unchecked]; + v222 = hir.int_to_ptr v221 : ptr; + v223 = hir.load v222 : felt; + v342 = arith.constant 0 : i32; + v332 = arith.constant 8 : i32; + v225 = arith.add v211, v332 : i32 #[overflow = unchecked]; + v227 = arith.add v225, v342 : i32 #[overflow = unchecked]; + v228 = hir.int_to_ptr v227 : ptr; + v229 = hir.load v228 : felt; + v341 = arith.constant 0 : i32; + v331 = arith.constant 12 : i32; + v231 = arith.add v211, v331 : i32 #[overflow = unchecked]; + v233 = arith.add v231, v341 : i32 #[overflow = unchecked]; + v234 = hir.int_to_ptr v233 : ptr; + v235 = hir.load v234 : felt; + builtin.ret v217, v223, v229, v235; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.masm index e8dc4d3a4..4d3678714 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.masm @@ -1,13 +1,13 @@ -# mod miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1 +# mod ::"miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> (felt, felt, felt, felt) - exec.::miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1::init + exec."miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_non_fungible_asset_binding::miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1#binding + exec.::"miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1"::rust_sdk_account_faucet_create_non_fungible_asset_binding::"miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1#binding" trace.252 nop push.0 @@ -65,7 +65,7 @@ pub proc binding( nop movdn.3 swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -78,7 +78,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -89,7 +89,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_non_fungible_asset_binding +# mod ::"miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1"::rust_sdk_account_faucet_create_non_fungible_asset_binding @callconv("C") proc __wasm_call_ctors( @@ -105,6 +105,7 @@ proc rust_sdk_account_faucet_create_non_fungible_asset_binding::bindings::__link nop end +@locals("3") @callconv("C") proc miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1#binding( @@ -119,9 +120,16 @@ proc miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-ac nop push.32 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -131,35 +139,74 @@ proc miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-ac nop trace.240 nop - exec.::miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_non_fungible_asset_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1"::rust_sdk_account_faucet_create_non_fungible_asset_binding::wit_bindgen::rt::run_ctors_once trace.252 nop push.0 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_non_fungible_asset_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_sw trace.252 nop push.0 - movup.2 + locaddr.2 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1 while.true + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.16 - dup.2 + movup.2 eq neq dup.0 if.true - swap.1 - drop - push.3735929054 + nop else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.16 - dup.3 + movup.3 u32wrapping_add - dup.2 + movup.2 u32wrapping_add push.4 dup.1 @@ -167,8 +214,6 @@ proc miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-ac u32mod u32assert assertz - dup.4 - swap.1 u32divmod.4 swap.1 trace.240 @@ -176,41 +221,45 @@ proc miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-ac exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - movup.2 u32wrapping_add + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.3735929054 - dup.2 - movup.2 - swap.5 - movdn.2 - cdrop - push.3735929054 - dup.2 - dup.4 - swap.2 - swap.1 - cdrop push.1 push.0 - movup.4 + movup.2 cdrop push.1 u32and - movup.4 - swap.1 if.true - movup.3 - drop push.1 else push.0 end end - drop - drop - drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.24 dup.1 add @@ -230,7 +279,7 @@ proc miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-ac nop swap.1 push.8 - dup.3 + movup.3 add u32assert push.8 @@ -248,6 +297,14 @@ proc miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-ac exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 dup.1 add @@ -266,7 +323,7 @@ proc miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-ac trace.252 nop swap.1 - dup.2 + movup.2 push.8 dup.1 swap.1 @@ -290,20 +347,59 @@ proc miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-ac exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - dup.2 + dup.1 u32wrapping_add - dup.2 + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1"::rust_sdk_account_faucet_create_non_fungible_asset_binding::miden_base_sys::bindings::faucet::create_non_fungible_asset + trace.252 + nop + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_non_fungible_asset_binding::miden_base_sys::bindings::faucet::create_non_fungible_asset + exec.::intrinsics::mem::load_sw trace.252 nop push.1048584 u32wrapping_add + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.24 - dup.2 + swap.1 add u32assert push.8 @@ -321,7 +417,7 @@ proc miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-ac nop swap.1 push.8 - dup.3 + movup.3 add u32assert push.4 @@ -339,8 +435,24 @@ proc miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-ac exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - dup.2 + swap.1 add u32assert push.8 @@ -357,7 +469,7 @@ proc miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-ac trace.252 nop swap.1 - dup.2 + movup.2 push.4 dup.1 swap.1 @@ -373,8 +485,15 @@ proc miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-ac exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.32 - movup.2 u32wrapping_add push.1114144 u32divmod.4 @@ -384,8 +503,17 @@ proc miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-ac exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -427,9 +555,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1"::rust_sdk_account_faucet_create_non_fungible_asset_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_non_fungible_asset_binding::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -460,11 +604,28 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("3") @callconv("C") proc miden_base_sys::bindings::faucet::create_non_fungible_asset( i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -473,11 +634,18 @@ proc miden_base_sys::bindings::faucet::create_non_fungible_asset( exec.::intrinsics::mem::load_sw trace.252 nop - push.32 + push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.2 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -485,8 +653,16 @@ proc miden_base_sys::bindings::faucet::create_non_fungible_asset( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.3 + swap.1 add u32assert push.4 @@ -502,8 +678,16 @@ proc miden_base_sys::bindings::faucet::create_non_fungible_asset( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.4 + swap.1 add u32assert push.4 @@ -519,8 +703,16 @@ proc miden_base_sys::bindings::faucet::create_non_fungible_asset( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.5 + swap.1 add u32assert push.4 @@ -536,7 +728,14 @@ proc miden_base_sys::bindings::faucet::create_non_fungible_asset( exec.::intrinsics::mem::load_felt trace.252 nop - movup.5 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -550,54 +749,39 @@ proc miden_base_sys::bindings::faucet::create_non_fungible_asset( exec.::intrinsics::mem::load_felt trace.252 nop - dup.4 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop swap.1 swap.3 swap.1 swap.4 trace.240 nop - exec.::miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_non_fungible_asset_binding::miden::faucet::create_non_fungible_asset + exec.::"miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1"::rust_sdk_account_faucet_create_non_fungible_asset_binding::"miden::protocol::faucet::create_non_fungible_asset" trace.252 nop - push.8 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 swap.1 - push.24 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - dup.0 push.8 dup.1 swap.1 @@ -612,8 +796,8 @@ proc miden_base_sys::bindings::faucet::create_non_fungible_asset( trace.252 nop swap.1 - push.16 - dup.3 + push.8 + movup.3 add u32assert push.8 @@ -622,6 +806,8 @@ proc miden_base_sys::bindings::faucet::create_non_fungible_asset( u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -631,80 +817,26 @@ proc miden_base_sys::bindings::faucet::create_non_fungible_asset( exec.::intrinsics::mem::store_dw trace.252 nop - push.16 - dup.1 - u32wrapping_add - movup.2 - trace.240 - nop - exec.::miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_non_fungible_asset_binding::::reverse - trace.252 - nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop -end - -@callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop swap.1 - push.8 - dup.3 add u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - movup.2 push.8 dup.1 swap.1 @@ -719,175 +851,15 @@ proc ::reverse( trace.252 nop swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.12 - dup.1 - u32wrapping_add - push.0 movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.4 - add - u32assert push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -897,96 +869,41 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop - swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.16 + u32wrapping_add + push.1114144 u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop end +@locals("5") @callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc miden::faucet::create_non_fungible_asset(felt, felt, felt, felt, i32) - trace.240 - nop - exec.::miden::faucet::create_non_fungible_asset - trace.252 - nop - movup.4 - dup.0 - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.12 - add - u32assert - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop +proc miden::protocol::faucet::create_non_fungible_asset( + felt, + felt, + felt, + felt, + i32 +) + drop + drop + drop + drop + drop + push.0 + assert end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.wat index 81d15beed..2b439c7b3 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.wat @@ -112,7 +112,7 @@ (func $miden_base_sys::bindings::faucet::create_non_fungible_asset (;4;) (type 2) (param i32 i32) (local i32) global.get $__stack_pointer - i32.const 32 + i32.const 16 i32.sub local.tee 2 global.set $__stack_pointer @@ -125,91 +125,32 @@ local.get 1 f32.load local.get 2 - call $miden::faucet::create_non_fungible_asset - local.get 2 - local.get 2 - i64.load offset=8 - i64.store offset=24 - local.get 2 - local.get 2 - i64.load - i64.store offset=16 + call $miden::protocol::faucet::create_non_fungible_asset local.get 0 local.get 2 - i32.const 16 - i32.add - call $::reverse - local.get 2 - i32.const 32 - i32.add - global.set $__stack_pointer - ) - (func $::reverse (;5;) (type 2) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 + i64.const 32 + i64.rotl i64.store offset=8 local.get 0 local.get 2 - i64.load align=4 + i64.load offset=8 + i64.const 32 + i64.rotl i64.store + local.get 2 + i32.const 16 + i32.add + global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;6;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) unreachable ) - (func $miden::faucet::create_non_fungible_asset (;7;) (type 4) (param f32 f32 f32 f32 i32) + (func $miden::protocol::faucet::create_non_fungible_asset (;6;) (type 4) (param f32 f32 f32 f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "srust_sdk_account_faucet_create_non_fungible_asset_binding\01\0b0.0.1\05\02\03\01\00\00\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "srust_sdk_account_faucet_create_non_fungible_asset_binding\01\0b0.0.1\05\02\03\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "asset" (type $asset (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_get_total_issuance_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_get_total_issuance_binding.hir index 3e0633ed9..61ec7f1b6 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_get_total_issuance_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_get_total_issuance_binding.hir @@ -13,36 +13,38 @@ builtin.component miden:rust-sdk-account-faucet-get-total-issuance-binding/rust- private builtin.function @miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1#binding() -> felt { ^block9: hir.exec @miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1/rust_sdk_account_faucet_get_total_issuance_binding/wit_bindgen::rt::run_ctors_once() - v1 = hir.exec @miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1/rust_sdk_account_faucet_get_total_issuance_binding/miden::faucet::get_total_issuance() : felt + v1 = hir.exec @miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1/rust_sdk_account_faucet_get_total_issuance_binding/miden::protocol::faucet::get_total_issuance() : felt builtin.ret v1; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v3 = builtin.global_symbol @miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1/rust_sdk_account_faucet_get_total_issuance_binding/GOT.data.internal.__memory_base : ptr - v4 = hir.bitcast v3 : ptr; - v5 = hir.load v4 : i32; - v6 = arith.constant 1048584 : i32; - v7 = arith.add v5, v6 : i32 #[overflow = wrapping]; - v8 = hir.bitcast v7 : u32; - v9 = hir.int_to_ptr v8 : ptr; - v10 = hir.load v9 : u8; - v2 = arith.constant 0 : i32; - v11 = arith.zext v10 : u32; - v12 = hir.bitcast v11 : i32; - v14 = arith.neq v12, v2 : i1; - scf.if v14{ + v2 = builtin.global_symbol @miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1/rust_sdk_account_faucet_get_total_issuance_binding/GOT.data.internal.__memory_base : ptr + v3 = hir.bitcast v2 : ptr; + v4 = hir.load v3 : i32; + v31 = arith.constant 1048584 : i32; + v6 = arith.add v4, v31 : i32 #[overflow = wrapping]; + v7 = hir.bitcast v6 : u32; + v8 = hir.int_to_ptr v7 : ptr; + v9 = hir.load v8 : u8; + v30 = arith.constant 0 : i32; + v10 = arith.zext v9 : u32; + v11 = hir.bitcast v10 : i32; + v13 = arith.neq v11, v30 : i1; + scf.if v13{ ^block13: scf.yield ; } else { ^block14: - v15 = builtin.global_symbol @miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1/rust_sdk_account_faucet_get_total_issuance_binding/GOT.data.internal.__memory_base : ptr - v16 = hir.bitcast v15 : ptr; - v17 = hir.load v16 : i32; + v14 = builtin.global_symbol @miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1/rust_sdk_account_faucet_get_total_issuance_binding/GOT.data.internal.__memory_base : ptr + v15 = hir.bitcast v14 : ptr; + v16 = hir.load v15 : i32; + hir.store_local v16 #[local = lv0]; hir.exec @miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1/rust_sdk_account_faucet_get_total_issuance_binding/__wasm_call_ctors() + v17 = hir.load_local : i32 #[local = lv0]; v29 = arith.constant 1 : u8; - v31 = arith.constant 1048584 : i32; - v19 = arith.add v17, v31 : i32 #[overflow = wrapping]; + v34 = arith.constant 1048584 : i32; + v19 = arith.add v17, v34 : i32 #[overflow = wrapping]; v23 = hir.bitcast v19 : u32; v24 = hir.int_to_ptr v23 : ptr; hir.store v24, v29; @@ -51,10 +53,9 @@ builtin.component miden:rust-sdk-account-faucet-get-total-issuance-binding/rust- builtin.ret ; }; - private builtin.function @miden::faucet::get_total_issuance() -> felt { + private builtin.function @miden::protocol::faucet::get_total_issuance() -> felt { ^block15: - v25 = hir.exec @miden/faucet/get_total_issuance() : felt - builtin.ret v25; + ub.unreachable ; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -69,8 +70,8 @@ builtin.component miden:rust-sdk-account-faucet-get-total-issuance-binding/rust- }; public builtin.function @binding() -> felt { - ^block19: - v27 = hir.exec @miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1/rust_sdk_account_faucet_get_total_issuance_binding/miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1#binding() : felt - builtin.ret v27; + ^block17: + v26 = hir.exec @miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1/rust_sdk_account_faucet_get_total_issuance_binding/miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1#binding() : felt + builtin.ret v26; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_get_total_issuance_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_get_total_issuance_binding.masm index 44bcf1f77..beaf06632 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_get_total_issuance_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_get_total_issuance_binding.masm @@ -1,16 +1,16 @@ -# mod miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1 +# mod ::"miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> felt - exec.::miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1::init + exec."miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1::rust_sdk_account_faucet_get_total_issuance_binding::miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1#binding + exec.::"miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1"::rust_sdk_account_faucet_get_total_issuance_binding::"miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1#binding" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -23,7 +23,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -34,7 +34,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1::rust_sdk_account_faucet_get_total_issuance_binding +# mod ::"miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1"::rust_sdk_account_faucet_get_total_issuance_binding @callconv("C") proc __wasm_call_ctors( @@ -56,16 +56,17 @@ proc miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-f ) -> felt trace.240 nop - exec.::miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1::rust_sdk_account_faucet_get_total_issuance_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1"::rust_sdk_account_faucet_get_total_issuance_binding::wit_bindgen::rt::run_ctors_once trace.252 nop trace.240 nop - exec.::miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1::rust_sdk_account_faucet_get_total_issuance_binding::miden::faucet::get_total_issuance + exec.::"miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1"::rust_sdk_account_faucet_get_total_issuance_binding::"miden::protocol::faucet::get_total_issuance" trace.252 nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -107,9 +108,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1"::rust_sdk_account_faucet_get_total_issuance_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1::rust_sdk_account_faucet_get_total_issuance_binding::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -141,13 +158,10 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc miden::faucet::get_total_issuance( +proc miden::protocol::faucet::get_total_issuance( ) -> felt - trace.240 - nop - exec.::miden::faucet::get_total_issuance - trace.252 - nop + push.0 + assert end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_get_total_issuance_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_get_total_issuance_binding.wat index fcbbee612..0a2afe4d6 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_get_total_issuance_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_get_total_issuance_binding.wat @@ -20,7 +20,7 @@ (func $rust_sdk_account_faucet_get_total_issuance_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) (func $miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1#binding (;2;) (type 1) (result f32) call $wit_bindgen::rt::run_ctors_once - call $miden::faucet::get_total_issuance + call $miden::protocol::faucet::get_total_issuance ) (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) (local i32) @@ -40,11 +40,11 @@ i32.store8 end ) - (func $miden::faucet::get_total_issuance (;4;) (type 1) (result f32) + (func $miden::protocol::faucet::get_total_issuance (;4;) (type 1) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "erust_sdk_account_faucet_get_total_issuance_binding\01\0b0.0.1\05\02\03\01\00\00") + (@custom "rodata,miden_account" (after data) "erust_sdk_account_faucet_get_total_issuance_binding\01\0b0.0.1\05\02\03\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.hir index 7759bb76c..dc7aafb4f 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.hir @@ -12,192 +12,197 @@ builtin.component miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-bin private builtin.function @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1#binding() -> felt { ^block9: - v3 = builtin.global_symbol @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/__stack_pointer : ptr - v4 = hir.bitcast v3 : ptr; - v5 = hir.load v4 : i32; - v6 = arith.constant 32 : i32; - v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; - v8 = builtin.global_symbol @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/__stack_pointer : ptr - v9 = hir.bitcast v8 : ptr; - hir.store v9, v7; + v1 = builtin.global_symbol @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v148 = arith.constant 32 : i32; + v5 = arith.sub v3, v148 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/wit_bindgen::rt::run_ctors_once() - v1 = arith.constant 0 : i32; - v12 = hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/intrinsics::felt::from_u32(v1) : felt - v198 = arith.constant 0 : i32; - v176, v177, v178, v179 = scf.while v198, v7, v12 : i32, i32, felt, i32 { - ^block38(v180: i32, v181: i32, v182: felt): - v197 = arith.constant 0 : i32; - v31 = arith.constant 16 : i32; - v15 = arith.eq v180, v31 : i1; - v16 = arith.zext v15 : u32; - v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v197 : i1; - v171 = scf.if v19 : i32 { - ^block37: - v142 = ub.poison i32 : i32; - scf.yield v142; + v147 = arith.constant 0 : i32; + hir.store_local v147 #[local = lv1]; + v140 = arith.constant 0 : felt; + hir.store_local v140 #[local = lv2]; + scf.while { + ^block12: + v11 = hir.load_local : i32 #[local = lv1]; + v178 = arith.constant 0 : i32; + v152 = arith.constant 16 : i32; + v13 = arith.eq v11, v152 : i1; + v14 = arith.zext v13 : u32; + v15 = hir.bitcast v14 : i32; + v17 = arith.neq v15, v178 : i1; + scf.if v17{ + ^block31: + scf.yield ; } else { ^block14: - v196 = arith.constant 16 : i32; - v22 = arith.add v181, v196 : i32 #[overflow = wrapping]; - v23 = arith.add v22, v180 : i32 #[overflow = wrapping]; - v25 = hir.bitcast v23 : u32; - v36 = arith.constant 4 : u32; - v27 = arith.mod v25, v36 : u32; - hir.assertz v27 #[code = 250]; - v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v182; - v29 = arith.constant 4 : i32; - v30 = arith.add v180, v29 : i32 #[overflow = wrapping]; - scf.yield v30; + v18 = hir.load_local : i32 #[local = lv0]; + v21 = hir.load_local : i32 #[local = lv1]; + v23 = hir.load_local : felt #[local = lv2]; + v177 = arith.constant 16 : i32; + v20 = arith.add v18, v177 : i32 #[overflow = wrapping]; + v22 = arith.add v20, v21 : i32 #[overflow = wrapping]; + v24 = hir.bitcast v22 : u32; + v149 = arith.constant 4 : u32; + v26 = arith.mod v24, v149 : u32; + hir.assertz v26 #[code = 250]; + v27 = hir.int_to_ptr v24 : ptr; + hir.store v27, v23; + v28 = hir.load_local : i32 #[local = lv1]; + v141 = arith.constant 4 : i32; + v30 = arith.add v28, v141 : i32 #[overflow = wrapping]; + hir.store_local v30 #[local = lv1]; + scf.yield ; }; - v143 = ub.poison felt : felt; - v173 = cf.select v19, v143, v182 : felt; - v195 = ub.poison i32 : i32; - v172 = cf.select v19, v195, v181 : i32; - v141 = arith.constant 1 : u32; - v135 = arith.constant 0 : u32; - v175 = cf.select v19, v135, v141 : u32; - v165 = arith.trunc v175 : i1; - scf.condition v165, v171, v172, v173, v181; + v163 = arith.constant 1 : u32; + v160 = arith.constant 0 : u32; + v168 = cf.select v17, v160, v163 : u32; + v164 = arith.trunc v168 : i1; + scf.condition v164; } do { - ^block39(v183: i32, v184: i32, v185: felt, v186: i32): - scf.yield v183, v184, v185; + ^block30: + scf.yield ; }; - v194 = arith.constant 16 : i32; - v32 = arith.add v179, v194 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/>::from(v179, v32) - v34 = arith.constant 12 : u32; - v33 = hir.bitcast v179 : u32; - v35 = arith.add v33, v34 : u32 #[overflow = checked]; - v193 = arith.constant 4 : u32; - v37 = arith.mod v35, v193 : u32; - hir.assertz v37 #[code = 250]; - v38 = hir.int_to_ptr v35 : ptr; - v39 = hir.load v38 : felt; - v41 = arith.constant 8 : u32; - v40 = hir.bitcast v179 : u32; - v42 = arith.add v40, v41 : u32 #[overflow = checked]; - v192 = arith.constant 4 : u32; - v44 = arith.mod v42, v192 : u32; - hir.assertz v44 #[code = 250]; - v45 = hir.int_to_ptr v42 : ptr; - v46 = hir.load v45 : felt; - v191 = arith.constant 4 : u32; - v47 = hir.bitcast v179 : u32; - v49 = arith.add v47, v191 : u32 #[overflow = checked]; - v190 = arith.constant 4 : u32; - v51 = arith.mod v49, v190 : u32; - hir.assertz v51 #[code = 250]; - v52 = hir.int_to_ptr v49 : ptr; - v53 = hir.load v52 : felt; - v54 = hir.bitcast v179 : u32; - v189 = arith.constant 4 : u32; - v56 = arith.mod v54, v189 : u32; + v31 = hir.load_local : i32 #[local = lv0]; + v176 = arith.constant 16 : i32; + v34 = arith.add v31, v176 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/>::from(v31, v34) + v35 = hir.load_local : i32 #[local = lv0]; + v145 = arith.constant 12 : u32; + v36 = hir.bitcast v35 : u32; + v38 = arith.add v36, v145 : u32 #[overflow = checked]; + v175 = arith.constant 4 : u32; + v40 = arith.mod v38, v175 : u32; + hir.assertz v40 #[code = 250]; + v41 = hir.int_to_ptr v38 : ptr; + v42 = hir.load v41 : felt; + v43 = hir.load_local : i32 #[local = lv0]; + v143 = arith.constant 8 : u32; + v44 = hir.bitcast v43 : u32; + v46 = arith.add v44, v143 : u32 #[overflow = checked]; + v174 = arith.constant 4 : u32; + v48 = arith.mod v46, v174 : u32; + hir.assertz v48 #[code = 250]; + v49 = hir.int_to_ptr v46 : ptr; + v50 = hir.load v49 : felt; + v51 = hir.load_local : i32 #[local = lv0]; + v173 = arith.constant 4 : u32; + v52 = hir.bitcast v51 : u32; + v54 = arith.add v52, v173 : u32 #[overflow = checked]; + v172 = arith.constant 4 : u32; + v56 = arith.mod v54, v172 : u32; hir.assertz v56 #[code = 250]; v57 = hir.int_to_ptr v54 : ptr; v58 = hir.load v57 : felt; - v59 = hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/miden::faucet::is_non_fungible_asset_issued(v39, v46, v53, v58) : felt - v188 = arith.constant 0 : i32; - v61 = hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/intrinsics::felt::from_u32(v188) : felt - v62 = hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/intrinsics::felt::eq(v59, v61) : i32 - v63 = arith.constant 1 : i32; - v64 = arith.neq v62, v63 : i1; - v65 = arith.zext v64 : u32; - v66 = hir.bitcast v65 : i32; - v67 = hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/intrinsics::felt::from_u32(v66) : felt - v187 = arith.constant 32 : i32; - v69 = arith.add v179, v187 : i32 #[overflow = wrapping]; - v70 = builtin.global_symbol @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/__stack_pointer : ptr - v71 = hir.bitcast v70 : ptr; - hir.store v71, v69; - builtin.ret v67; + v59 = hir.load_local : i32 #[local = lv0]; + v60 = hir.bitcast v59 : u32; + v171 = arith.constant 4 : u32; + v62 = arith.mod v60, v171 : u32; + hir.assertz v62 #[code = 250]; + v63 = hir.int_to_ptr v60 : ptr; + v64 = hir.load v63 : felt; + v65 = hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/miden::protocol::faucet::is_non_fungible_asset_issued(v42, v50, v58, v64) : felt + v142 = arith.constant 1 : i32; + v170 = arith.constant 0 : felt; + v68 = arith.eq v65, v170 : i1; + v69 = hir.cast v68 : i32; + v71 = arith.neq v69, v142 : i1; + v72 = arith.zext v71 : u32; + v73 = hir.bitcast v72 : i32; + v74 = hir.bitcast v73 : felt; + hir.store_local v74 #[local = lv2]; + v75 = hir.load_local : i32 #[local = lv0]; + v169 = arith.constant 32 : i32; + v77 = arith.add v75, v169 : i32 #[overflow = wrapping]; + v78 = builtin.global_symbol @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/__stack_pointer : ptr + v79 = hir.bitcast v78 : ptr; + hir.store v79, v77; + v80 = hir.load_local : felt #[local = lv2]; + builtin.ret v80; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block15: - v73 = builtin.global_symbol @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/GOT.data.internal.__memory_base : ptr - v74 = hir.bitcast v73 : ptr; - v75 = hir.load v74 : i32; - v76 = arith.constant 1048584 : i32; - v77 = arith.add v75, v76 : i32 #[overflow = wrapping]; - v78 = hir.bitcast v77 : u32; - v79 = hir.int_to_ptr v78 : ptr; - v80 = hir.load v79 : u8; - v72 = arith.constant 0 : i32; - v81 = arith.zext v80 : u32; - v82 = hir.bitcast v81 : i32; - v84 = arith.neq v82, v72 : i1; - scf.if v84{ + v81 = builtin.global_symbol @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/GOT.data.internal.__memory_base : ptr + v82 = hir.bitcast v81 : ptr; + v83 = hir.load v82 : i32; + v183 = arith.constant 1048584 : i32; + v85 = arith.add v83, v183 : i32 #[overflow = wrapping]; + v86 = hir.bitcast v85 : u32; + v87 = hir.int_to_ptr v86 : ptr; + v88 = hir.load v87 : u8; + v182 = arith.constant 0 : i32; + v89 = arith.zext v88 : u32; + v90 = hir.bitcast v89 : i32; + v92 = arith.neq v90, v182 : i1; + scf.if v92{ ^block17: scf.yield ; } else { ^block18: - v85 = builtin.global_symbol @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/GOT.data.internal.__memory_base : ptr - v86 = hir.bitcast v85 : ptr; - v87 = hir.load v86 : i32; + v93 = builtin.global_symbol @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/GOT.data.internal.__memory_base : ptr + v94 = hir.bitcast v93 : ptr; + v95 = hir.load v94 : i32; + hir.store_local v95 #[local = lv0]; hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/__wasm_call_ctors() - v200 = arith.constant 1 : u8; - v202 = arith.constant 1048584 : i32; - v89 = arith.add v87, v202 : i32 #[overflow = wrapping]; - v93 = hir.bitcast v89 : u32; - v94 = hir.int_to_ptr v93 : ptr; - hir.store v94, v200; + v96 = hir.load_local : i32 #[local = lv0]; + v181 = arith.constant 1 : u8; + v186 = arith.constant 1048584 : i32; + v98 = arith.add v96, v186 : i32 #[overflow = wrapping]; + v102 = hir.bitcast v98 : u32; + v103 = hir.int_to_ptr v102 : ptr; + hir.store v103, v181; scf.yield ; }; builtin.ret ; }; - private builtin.function @>::from(v95: i32, v96: i32) { - ^block19(v95: i32, v96: i32): - v98 = arith.constant 8 : u32; - v97 = hir.bitcast v96 : u32; - v99 = arith.add v97, v98 : u32 #[overflow = checked]; - v100 = arith.constant 4 : u32; - v101 = arith.mod v99, v100 : u32; - hir.assertz v101 #[code = 250]; - v102 = hir.int_to_ptr v99 : ptr; - v103 = hir.load v102 : i64; - v206 = arith.constant 8 : u32; - v104 = hir.bitcast v95 : u32; - v106 = arith.add v104, v206 : u32 #[overflow = checked]; - v205 = arith.constant 8 : u32; - v108 = arith.mod v106, v205 : u32; - hir.assertz v108 #[code = 250]; - v109 = hir.int_to_ptr v106 : ptr; - hir.store v109, v103; - v110 = hir.bitcast v96 : u32; - v204 = arith.constant 4 : u32; - v112 = arith.mod v110, v204 : u32; + private builtin.function @>::from(v104: i32, v105: i32) { + ^block19(v104: i32, v105: i32): + hir.store_local v104 #[local = lv0]; + hir.store_local v105 #[local = lv1]; + v106 = hir.load_local : i32 #[local = lv0]; + v107 = hir.load_local : i32 #[local = lv1]; + v188 = arith.constant 8 : u32; + v108 = hir.bitcast v107 : u32; + v110 = arith.add v108, v188 : u32 #[overflow = checked]; + v187 = arith.constant 4 : u32; + v112 = arith.mod v110, v187 : u32; hir.assertz v112 #[code = 250]; v113 = hir.int_to_ptr v110 : ptr; v114 = hir.load v113 : i64; - v115 = hir.bitcast v95 : u32; - v203 = arith.constant 8 : u32; - v117 = arith.mod v115, v203 : u32; - hir.assertz v117 #[code = 250]; - v118 = hir.int_to_ptr v115 : ptr; - hir.store v118, v114; + v196 = arith.constant 8 : u32; + v115 = hir.bitcast v106 : u32; + v117 = arith.add v115, v196 : u32 #[overflow = checked]; + v195 = arith.constant 8 : u32; + v119 = arith.mod v117, v195 : u32; + hir.assertz v119 #[code = 250]; + v120 = hir.int_to_ptr v117 : ptr; + hir.store v120, v114; + v121 = hir.load_local : i32 #[local = lv0]; + v122 = hir.load_local : i32 #[local = lv1]; + v123 = hir.bitcast v122 : u32; + v194 = arith.constant 4 : u32; + v125 = arith.mod v123, v194 : u32; + hir.assertz v125 #[code = 250]; + v126 = hir.int_to_ptr v123 : ptr; + v127 = hir.load v126 : i64; + v128 = hir.bitcast v121 : u32; + v193 = arith.constant 8 : u32; + v130 = arith.mod v128, v193 : u32; + hir.assertz v130 #[code = 250]; + v131 = hir.int_to_ptr v128 : ptr; + hir.store v131, v127; builtin.ret ; }; - private builtin.function @intrinsics::felt::eq(v119: felt, v120: felt) -> i32 { - ^block21(v119: felt, v120: felt): - v121 = arith.eq v119, v120 : i1; - v122 = hir.cast v121 : i32; - builtin.ret v122; - }; - - private builtin.function @intrinsics::felt::from_u32(v124: i32) -> felt { - ^block23(v124: i32): - v125 = hir.bitcast v124 : felt; - builtin.ret v125; - }; - - private builtin.function @miden::faucet::is_non_fungible_asset_issued(v127: felt, v128: felt, v129: felt, v130: felt) -> felt { - ^block25(v127: felt, v128: felt, v129: felt, v130: felt): - v131 = hir.exec @miden/faucet/is_non_fungible_asset_issued(v127, v128, v129, v130) : felt - builtin.ret v131; + private builtin.function @miden::protocol::faucet::is_non_fungible_asset_issued(v132: felt, v133: felt, v134: felt, v135: felt) -> felt { + ^block21(v132: felt, v133: felt, v134: felt, v135: felt): + ub.unreachable ; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -212,8 +217,8 @@ builtin.component miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-bin }; public builtin.function @binding() -> felt { - ^block29: - v133 = hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1#binding() : felt - builtin.ret v133; + ^block23: + v137 = hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1#binding() : felt + builtin.ret v137; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.masm index 60cf7c54b..1cc2b3170 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.masm @@ -1,16 +1,16 @@ -# mod miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1 +# mod ::"miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> felt - exec.::miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1::init + exec."miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1#binding + exec.::"miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1"::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::"miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1#binding" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -23,7 +23,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -34,7 +34,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding +# mod ::"miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1"::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding @callconv("C") proc __wasm_call_ctors( @@ -50,6 +50,7 @@ proc rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::bindings::__l nop end +@locals("3") @callconv("C") proc miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1#binding( @@ -64,9 +65,16 @@ proc miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk nop push.32 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -76,35 +84,74 @@ proc miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk nop trace.240 nop - exec.::miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1"::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::wit_bindgen::rt::run_ctors_once trace.252 nop push.0 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_sw trace.252 nop push.0 - movup.2 + locaddr.2 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1 while.true + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.16 - dup.2 + movup.2 eq neq dup.0 if.true - swap.1 - drop - push.3735929054 + nop else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.16 - dup.3 + movup.3 u32wrapping_add - dup.2 + movup.2 u32wrapping_add push.4 dup.1 @@ -112,8 +159,6 @@ proc miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk u32mod u32assert assertz - dup.4 - swap.1 u32divmod.4 swap.1 trace.240 @@ -121,52 +166,64 @@ proc miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - movup.2 u32wrapping_add + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.3735929054 - dup.2 - movup.2 - swap.5 - movdn.2 - cdrop - push.3735929054 - dup.2 - dup.4 - swap.2 - swap.1 - cdrop push.1 push.0 - movup.4 + movup.2 cdrop push.1 u32and - movup.4 - swap.1 if.true - movup.3 - drop push.1 else push.0 end end - drop - drop - drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 dup.1 u32wrapping_add - dup.1 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::>::from + exec.::"miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1"::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::>::from + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.12 - dup.1 + swap.1 add u32assert push.4 @@ -182,8 +239,16 @@ proc miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.2 + swap.1 add u32assert push.4 @@ -199,8 +264,16 @@ proc miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.3 + swap.1 add u32assert push.4 @@ -216,7 +289,14 @@ proc miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk exec.::intrinsics::mem::load_felt trace.252 nop - dup.3 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -234,30 +314,31 @@ proc miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk swap.2 trace.240 nop - exec.::miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::miden::faucet::is_non_fungible_asset_issued + exec.::"miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1"::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::"miden::protocol::faucet::is_non_fungible_asset_issued" trace.252 nop + push.1 + push.0 + movup.2 + eq + neq + locaddr.2 push.0 - trace.240 - nop - exec.::miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::intrinsics::felt::from_u32 - trace.252 - nop swap.1 trace.240 nop - exec.::miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::intrinsics::felt::eq + exec.::intrinsics::mem::store_felt trace.252 nop - push.1 - neq + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop push.32 - movup.2 u32wrapping_add push.1114144 u32divmod.4 @@ -267,8 +348,17 @@ proc miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -310,9 +400,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1"::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -343,13 +449,46 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("2") @callconv("C") -proc >::from( +proc >::from( i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.2 + swap.1 add u32assert push.4 @@ -367,7 +506,7 @@ proc i32 - eq -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc miden::faucet::is_non_fungible_asset_issued(felt, felt, felt, felt) -> felt - trace.240 - nop - exec.::miden::faucet::is_non_fungible_asset_issued - trace.252 - nop +proc miden::protocol::faucet::is_non_fungible_asset_issued( + felt, + felt, + felt, + felt +) -> felt + drop + drop + drop + drop + push.0 + assert end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.wat index a521d7335..540d9163f 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.wat @@ -59,7 +59,7 @@ local.get 0 i32.const 16 i32.add - call $>::from + call $>::from local.get 0 f32.load offset=12 local.get 0 @@ -68,7 +68,7 @@ f32.load offset=4 local.get 0 f32.load - call $miden::faucet::is_non_fungible_asset_issued + call $miden::protocol::faucet::is_non_fungible_asset_issued i32.const 0 call $intrinsics::felt::from_u32 call $intrinsics::felt::eq @@ -100,7 +100,7 @@ i32.store8 end ) - (func $>::from (;4;) (type 2) (param i32 i32) + (func $>::from (;4;) (type 2) (param i32 i32) local.get 0 local.get 1 i64.load offset=8 align=4 @@ -116,11 +116,11 @@ (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) unreachable ) - (func $miden::faucet::is_non_fungible_asset_issued (;7;) (type 5) (param f32 f32 f32 f32) (result f32) + (func $miden::protocol::faucet::is_non_fungible_asset_issued (;7;) (type 5) (param f32 f32 f32 f32) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "yrust_sdk_account_faucet_is_non_fungible_asset_issued_binding\01\0b0.0.1\05\02\03\01\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "yrust_sdk_account_faucet_is_non_fungible_asset_issued_binding\01\0b0.0.1\05\02\03\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.hir index b54f917ff..d384c2077 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.hir @@ -12,408 +12,292 @@ builtin.component miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-fa private builtin.function @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1#binding() -> i32 { ^block9: - v3 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__stack_pointer : ptr - v4 = hir.bitcast v3 : ptr; - v5 = hir.load v4 : i32; - v6 = arith.constant 32 : i32; - v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; - v8 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__stack_pointer : ptr - v9 = hir.bitcast v8 : ptr; - hir.store v9, v7; + v1 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v254 = arith.constant 32 : i32; + v5 = arith.sub v3, v254 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/wit_bindgen::rt::run_ctors_once() - v1 = arith.constant 0 : i32; - v12 = hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/intrinsics::felt::from_u32(v1) : felt - v389 = arith.constant 0 : i32; - v368, v369, v370, v371 = scf.while v389, v7, v12 : i32, i32, felt, i32 { - ^block44(v372: i32, v373: i32, v374: felt): - v388 = arith.constant 0 : i32; - v34 = arith.constant 16 : i32; - v15 = arith.eq v372, v34 : i1; - v16 = arith.zext v15 : u32; - v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v388 : i1; - v363 = scf.if v19 : i32 { - ^block43: - v334 = ub.poison i32 : i32; - scf.yield v334; + v253 = arith.constant 0 : i32; + hir.store_local v253 #[local = lv1]; + v245 = arith.constant 0 : felt; + hir.store_local v245 #[local = lv2]; + scf.while { + ^block12: + v11 = hir.load_local : i32 #[local = lv1]; + v282 = arith.constant 0 : i32; + v258 = arith.constant 16 : i32; + v13 = arith.eq v11, v258 : i1; + v14 = arith.zext v13 : u32; + v15 = hir.bitcast v14 : i32; + v17 = arith.neq v15, v282 : i1; + scf.if v17{ + ^block33: + scf.yield ; } else { ^block14: - v387 = arith.constant 16 : i32; - v22 = arith.add v373, v387 : i32 #[overflow = wrapping]; - v23 = arith.add v22, v372 : i32 #[overflow = wrapping]; - v25 = hir.bitcast v23 : u32; - v50 = arith.constant 4 : u32; - v27 = arith.mod v25, v50 : u32; - hir.assertz v27 #[code = 250]; - v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v374; - v29 = arith.constant 4 : i32; - v30 = arith.add v372, v29 : i32 #[overflow = wrapping]; - scf.yield v30; + v18 = hir.load_local : i32 #[local = lv0]; + v21 = hir.load_local : i32 #[local = lv1]; + v23 = hir.load_local : felt #[local = lv2]; + v281 = arith.constant 16 : i32; + v20 = arith.add v18, v281 : i32 #[overflow = wrapping]; + v22 = arith.add v20, v21 : i32 #[overflow = wrapping]; + v24 = hir.bitcast v22 : u32; + v255 = arith.constant 4 : u32; + v26 = arith.mod v24, v255 : u32; + hir.assertz v26 #[code = 250]; + v27 = hir.int_to_ptr v24 : ptr; + hir.store v27, v23; + v28 = hir.load_local : i32 #[local = lv1]; + v246 = arith.constant 4 : i32; + v30 = arith.add v28, v246 : i32 #[overflow = wrapping]; + hir.store_local v30 #[local = lv1]; + scf.yield ; }; - v335 = ub.poison felt : felt; - v365 = cf.select v19, v335, v374 : felt; - v386 = ub.poison i32 : i32; - v364 = cf.select v19, v386, v373 : i32; - v333 = arith.constant 1 : u32; - v327 = arith.constant 0 : u32; - v367 = cf.select v19, v327, v333 : u32; - v357 = arith.trunc v367 : i1; - scf.condition v357, v363, v364, v365, v373; + v268 = arith.constant 1 : u32; + v265 = arith.constant 0 : u32; + v273 = cf.select v17, v265, v268 : u32; + v269 = arith.trunc v273 : i1; + scf.condition v269; } do { - ^block45(v375: i32, v376: i32, v377: felt, v378: i32): - scf.yield v375, v376, v377; + ^block32: + scf.yield ; }; v31 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/GOT.data.internal.__memory_base : ptr v32 = hir.bitcast v31 : ptr; v33 = hir.load v32 : i32; - v385 = arith.constant 16 : i32; - v35 = arith.add v371, v385 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/>::from(v371, v35) - v384 = arith.constant 16 : i32; - v37 = arith.add v371, v384 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/miden_base_sys::bindings::faucet::mint(v37, v371) - v38 = arith.constant 1048584 : i32; - v39 = arith.add v33, v38 : i32 #[overflow = wrapping]; - v41 = arith.constant 24 : u32; - v40 = hir.bitcast v371 : u32; - v42 = arith.add v40, v41 : u32 #[overflow = checked]; - v43 = arith.constant 8 : u32; - v44 = arith.mod v42, v43 : u32; - hir.assertz v44 #[code = 250]; - v45 = hir.int_to_ptr v42 : ptr; - v46 = hir.load v45 : i64; - v383 = arith.constant 8 : u32; - v47 = hir.bitcast v39 : u32; - v49 = arith.add v47, v383 : u32 #[overflow = checked]; - v382 = arith.constant 4 : u32; - v51 = arith.mod v49, v382 : u32; - hir.assertz v51 #[code = 250]; - v52 = hir.int_to_ptr v49 : ptr; - hir.store v52, v46; - v54 = arith.constant 16 : u32; - v53 = hir.bitcast v371 : u32; - v55 = arith.add v53, v54 : u32 #[overflow = checked]; - v381 = arith.constant 8 : u32; - v57 = arith.mod v55, v381 : u32; + hir.store_local v33 #[local = lv1]; + v34 = hir.load_local : i32 #[local = lv0]; + v280 = arith.constant 16 : i32; + v37 = arith.add v34, v280 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/>::from(v34, v37) + v38 = hir.load_local : i32 #[local = lv0]; + v279 = arith.constant 16 : i32; + v40 = arith.add v38, v279 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/miden_base_sys::bindings::faucet::mint(v40, v38) + v42 = hir.load_local : i32 #[local = lv1]; + v251 = arith.constant 1048584 : i32; + v44 = arith.add v42, v251 : i32 #[overflow = wrapping]; + hir.store_local v44 #[local = lv1]; + v45 = hir.load_local : i32 #[local = lv0]; + v250 = arith.constant 24 : u32; + v46 = hir.bitcast v45 : u32; + v48 = arith.add v46, v250 : u32 #[overflow = checked]; + v249 = arith.constant 8 : u32; + v50 = arith.mod v48, v249 : u32; + hir.assertz v50 #[code = 250]; + v51 = hir.int_to_ptr v48 : ptr; + v52 = hir.load v51 : i64; + v278 = arith.constant 8 : u32; + v53 = hir.bitcast v44 : u32; + v55 = arith.add v53, v278 : u32 #[overflow = checked]; + v277 = arith.constant 4 : u32; + v57 = arith.mod v55, v277 : u32; hir.assertz v57 #[code = 250]; v58 = hir.int_to_ptr v55 : ptr; - v59 = hir.load v58 : i64; - v60 = hir.bitcast v39 : u32; - v380 = arith.constant 4 : u32; - v62 = arith.mod v60, v380 : u32; - hir.assertz v62 #[code = 250]; - v63 = hir.int_to_ptr v60 : ptr; - hir.store v63, v59; - v379 = arith.constant 32 : i32; - v65 = arith.add v371, v379 : i32 #[overflow = wrapping]; - v66 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__stack_pointer : ptr - v67 = hir.bitcast v66 : ptr; - hir.store v67, v65; - builtin.ret v39; + hir.store v58, v52; + v59 = hir.load_local : i32 #[local = lv1]; + v60 = hir.load_local : i32 #[local = lv0]; + v247 = arith.constant 16 : u32; + v61 = hir.bitcast v60 : u32; + v63 = arith.add v61, v247 : u32 #[overflow = checked]; + v276 = arith.constant 8 : u32; + v65 = arith.mod v63, v276 : u32; + hir.assertz v65 #[code = 250]; + v66 = hir.int_to_ptr v63 : ptr; + v67 = hir.load v66 : i64; + v68 = hir.bitcast v59 : u32; + v275 = arith.constant 4 : u32; + v70 = arith.mod v68, v275 : u32; + hir.assertz v70 #[code = 250]; + v71 = hir.int_to_ptr v68 : ptr; + hir.store v71, v67; + v72 = hir.load_local : i32 #[local = lv0]; + v274 = arith.constant 32 : i32; + v74 = arith.add v72, v274 : i32 #[overflow = wrapping]; + v75 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__stack_pointer : ptr + v76 = hir.bitcast v75 : ptr; + hir.store v76, v74; + v77 = hir.load_local : i32 #[local = lv1]; + builtin.ret v77; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block15: - v69 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/GOT.data.internal.__memory_base : ptr - v70 = hir.bitcast v69 : ptr; - v71 = hir.load v70 : i32; - v72 = arith.constant 1048600 : i32; - v73 = arith.add v71, v72 : i32 #[overflow = wrapping]; - v74 = hir.bitcast v73 : u32; - v75 = hir.int_to_ptr v74 : ptr; - v76 = hir.load v75 : u8; - v68 = arith.constant 0 : i32; - v77 = arith.zext v76 : u32; - v78 = hir.bitcast v77 : i32; - v80 = arith.neq v78, v68 : i1; - scf.if v80{ + v78 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/GOT.data.internal.__memory_base : ptr + v79 = hir.bitcast v78 : ptr; + v80 = hir.load v79 : i32; + v287 = arith.constant 1048600 : i32; + v82 = arith.add v80, v287 : i32 #[overflow = wrapping]; + v83 = hir.bitcast v82 : u32; + v84 = hir.int_to_ptr v83 : ptr; + v85 = hir.load v84 : u8; + v286 = arith.constant 0 : i32; + v86 = arith.zext v85 : u32; + v87 = hir.bitcast v86 : i32; + v89 = arith.neq v87, v286 : i1; + scf.if v89{ ^block17: scf.yield ; } else { ^block18: - v81 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/GOT.data.internal.__memory_base : ptr - v82 = hir.bitcast v81 : ptr; - v83 = hir.load v82 : i32; + v90 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/GOT.data.internal.__memory_base : ptr + v91 = hir.bitcast v90 : ptr; + v92 = hir.load v91 : i32; + hir.store_local v92 #[local = lv0]; hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__wasm_call_ctors() - v391 = arith.constant 1 : u8; - v393 = arith.constant 1048600 : i32; - v85 = arith.add v83, v393 : i32 #[overflow = wrapping]; - v89 = hir.bitcast v85 : u32; - v90 = hir.int_to_ptr v89 : ptr; - hir.store v90, v391; + v93 = hir.load_local : i32 #[local = lv0]; + v285 = arith.constant 1 : u8; + v290 = arith.constant 1048600 : i32; + v95 = arith.add v93, v290 : i32 #[overflow = wrapping]; + v99 = hir.bitcast v95 : u32; + v100 = hir.int_to_ptr v99 : ptr; + hir.store v100, v285; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::faucet::mint(v91: i32, v92: i32) { - ^block19(v91: i32, v92: i32): - v94 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__stack_pointer : ptr - v95 = hir.bitcast v94 : ptr; - v96 = hir.load v95 : i32; - v97 = arith.constant 32 : i32; - v98 = arith.sub v96, v97 : i32 #[overflow = wrapping]; - v99 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__stack_pointer : ptr - v100 = hir.bitcast v99 : ptr; - hir.store v100, v98; - v102 = arith.constant 12 : u32; - v101 = hir.bitcast v92 : u32; - v103 = arith.add v101, v102 : u32 #[overflow = checked]; - v104 = arith.constant 4 : u32; - v105 = arith.mod v103, v104 : u32; - hir.assertz v105 #[code = 250]; - v106 = hir.int_to_ptr v103 : ptr; - v107 = hir.load v106 : felt; - v109 = arith.constant 8 : u32; - v108 = hir.bitcast v92 : u32; - v110 = arith.add v108, v109 : u32 #[overflow = checked]; - v403 = arith.constant 4 : u32; - v112 = arith.mod v110, v403 : u32; - hir.assertz v112 #[code = 250]; - v113 = hir.int_to_ptr v110 : ptr; - v114 = hir.load v113 : felt; - v402 = arith.constant 4 : u32; - v115 = hir.bitcast v92 : u32; - v117 = arith.add v115, v402 : u32 #[overflow = checked]; - v401 = arith.constant 4 : u32; - v119 = arith.mod v117, v401 : u32; - hir.assertz v119 #[code = 250]; - v120 = hir.int_to_ptr v117 : ptr; - v121 = hir.load v120 : felt; - v122 = hir.bitcast v92 : u32; - v400 = arith.constant 4 : u32; - v124 = arith.mod v122, v400 : u32; - hir.assertz v124 #[code = 250]; - v125 = hir.int_to_ptr v122 : ptr; - v126 = hir.load v125 : felt; - hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/miden::faucet::mint(v107, v114, v121, v126, v98) - v399 = arith.constant 8 : u32; - v127 = hir.bitcast v98 : u32; - v129 = arith.add v127, v399 : u32 #[overflow = checked]; - v398 = arith.constant 8 : u32; - v131 = arith.mod v129, v398 : u32; + private builtin.function @miden_base_sys::bindings::faucet::mint(v101: i32, v102: i32) { + ^block19(v101: i32, v102: i32): + hir.store_local v101 #[local = lv0]; + hir.store_local v102 #[local = lv1]; + v103 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__stack_pointer : ptr + v104 = hir.bitcast v103 : ptr; + v105 = hir.load v104 : i32; + v300 = arith.constant 16 : i32; + v107 = arith.sub v105, v300 : i32 #[overflow = wrapping]; + hir.store_local v107 #[local = lv2]; + v108 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__stack_pointer : ptr + v109 = hir.bitcast v108 : ptr; + hir.store v109, v107; + v110 = hir.load_local : i32 #[local = lv1]; + v299 = arith.constant 12 : u32; + v111 = hir.bitcast v110 : u32; + v113 = arith.add v111, v299 : u32 #[overflow = checked]; + v298 = arith.constant 4 : u32; + v115 = arith.mod v113, v298 : u32; + hir.assertz v115 #[code = 250]; + v116 = hir.int_to_ptr v113 : ptr; + v117 = hir.load v116 : felt; + v118 = hir.load_local : i32 #[local = lv1]; + v297 = arith.constant 8 : u32; + v119 = hir.bitcast v118 : u32; + v121 = arith.add v119, v297 : u32 #[overflow = checked]; + v322 = arith.constant 4 : u32; + v123 = arith.mod v121, v322 : u32; + hir.assertz v123 #[code = 250]; + v124 = hir.int_to_ptr v121 : ptr; + v125 = hir.load v124 : felt; + v126 = hir.load_local : i32 #[local = lv1]; + v321 = arith.constant 4 : u32; + v127 = hir.bitcast v126 : u32; + v129 = arith.add v127, v321 : u32 #[overflow = checked]; + v320 = arith.constant 4 : u32; + v131 = arith.mod v129, v320 : u32; hir.assertz v131 #[code = 250]; - v132 = hir.int_to_ptr v129 : ptr; - v133 = hir.load v132 : i64; - v135 = arith.constant 24 : u32; - v134 = hir.bitcast v98 : u32; - v136 = arith.add v134, v135 : u32 #[overflow = checked]; - v397 = arith.constant 8 : u32; - v138 = arith.mod v136, v397 : u32; - hir.assertz v138 #[code = 250]; - v139 = hir.int_to_ptr v136 : ptr; - hir.store v139, v133; - v140 = hir.bitcast v98 : u32; - v396 = arith.constant 8 : u32; - v142 = arith.mod v140, v396 : u32; - hir.assertz v142 #[code = 250]; - v143 = hir.int_to_ptr v140 : ptr; - v144 = hir.load v143 : i64; - v146 = arith.constant 16 : u32; - v145 = hir.bitcast v98 : u32; - v147 = arith.add v145, v146 : u32 #[overflow = checked]; - v395 = arith.constant 8 : u32; - v149 = arith.mod v147, v395 : u32; - hir.assertz v149 #[code = 250]; - v150 = hir.int_to_ptr v147 : ptr; - hir.store v150, v144; - v151 = arith.constant 16 : i32; - v152 = arith.add v98, v151 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/::reverse(v91, v152) - v394 = arith.constant 32 : i32; - v154 = arith.add v98, v394 : i32 #[overflow = wrapping]; - v155 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__stack_pointer : ptr - v156 = hir.bitcast v155 : ptr; - hir.store v156, v154; - builtin.ret ; - }; - - private builtin.function @>::from(v157: i32, v158: i32) { - ^block21(v157: i32, v158: i32): - v160 = arith.constant 8 : u32; + v132 = hir.int_to_ptr v129 : ptr; + v133 = hir.load v132 : felt; + v134 = hir.load_local : i32 #[local = lv1]; + v135 = hir.bitcast v134 : u32; + v319 = arith.constant 4 : u32; + v137 = arith.mod v135, v319 : u32; + hir.assertz v137 #[code = 250]; + v138 = hir.int_to_ptr v135 : ptr; + v139 = hir.load v138 : felt; + v140 = hir.load_local : i32 #[local = lv2]; + hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/miden::protocol::faucet::mint(v117, v125, v133, v139, v140) + v141 = hir.load_local : i32 #[local = lv0]; + v142 = hir.load_local : i32 #[local = lv2]; + v143 = hir.bitcast v142 : u32; + v318 = arith.constant 8 : u32; + v145 = arith.mod v143, v318 : u32; + hir.assertz v145 #[code = 250]; + v146 = hir.int_to_ptr v143 : ptr; + v147 = hir.load v146 : i64; + v294, v295 = arith.split v147 : felt, felt; + v317 = arith.constant 8 : u32; + v151 = hir.bitcast v141 : u32; + v153 = arith.add v151, v317 : u32 #[overflow = checked]; + v316 = arith.constant 8 : u32; + v155 = arith.mod v153, v316 : u32; + hir.assertz v155 #[code = 250]; + v296 = arith.join v295, v294 : i64; + v156 = hir.int_to_ptr v153 : ptr; + hir.store v156, v296; + v157 = hir.load_local : i32 #[local = lv0]; + v158 = hir.load_local : i32 #[local = lv2]; + v315 = arith.constant 8 : u32; v159 = hir.bitcast v158 : u32; - v161 = arith.add v159, v160 : u32 #[overflow = checked]; - v162 = arith.constant 4 : u32; - v163 = arith.mod v161, v162 : u32; + v161 = arith.add v159, v315 : u32 #[overflow = checked]; + v314 = arith.constant 8 : u32; + v163 = arith.mod v161, v314 : u32; hir.assertz v163 #[code = 250]; v164 = hir.int_to_ptr v161 : ptr; v165 = hir.load v164 : i64; - v407 = arith.constant 8 : u32; - v166 = hir.bitcast v157 : u32; - v168 = arith.add v166, v407 : u32 #[overflow = checked]; - v406 = arith.constant 8 : u32; - v170 = arith.mod v168, v406 : u32; - hir.assertz v170 #[code = 250]; - v171 = hir.int_to_ptr v168 : ptr; - hir.store v171, v165; - v172 = hir.bitcast v158 : u32; - v405 = arith.constant 4 : u32; - v174 = arith.mod v172, v405 : u32; - hir.assertz v174 #[code = 250]; - v175 = hir.int_to_ptr v172 : ptr; - v176 = hir.load v175 : i64; - v177 = hir.bitcast v157 : u32; - v404 = arith.constant 8 : u32; - v179 = arith.mod v177, v404 : u32; - hir.assertz v179 #[code = 250]; - v180 = hir.int_to_ptr v177 : ptr; - hir.store v180, v176; + v291, v292 = arith.split v165 : felt, felt; + v169 = hir.bitcast v157 : u32; + v313 = arith.constant 8 : u32; + v171 = arith.mod v169, v313 : u32; + hir.assertz v171 #[code = 250]; + v293 = arith.join v292, v291 : i64; + v172 = hir.int_to_ptr v169 : ptr; + hir.store v172, v293; + v173 = hir.load_local : i32 #[local = lv2]; + v312 = arith.constant 16 : i32; + v175 = arith.add v173, v312 : i32 #[overflow = wrapping]; + v176 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__stack_pointer : ptr + v177 = hir.bitcast v176 : ptr; + hir.store v177, v175; builtin.ret ; }; - private builtin.function @::reverse(v181: i32, v182: i32) { - ^block23(v181: i32, v182: i32): - v185 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__stack_pointer : ptr - v186 = hir.bitcast v185 : ptr; - v187 = hir.load v186 : i32; - v188 = arith.constant 16 : i32; - v189 = arith.sub v187, v188 : i32 #[overflow = wrapping]; - v191 = arith.constant 8 : u32; - v190 = hir.bitcast v182 : u32; - v192 = arith.add v190, v191 : u32 #[overflow = checked]; - v494 = arith.constant 8 : u32; - v194 = arith.mod v192, v494 : u32; - hir.assertz v194 #[code = 250]; - v195 = hir.int_to_ptr v192 : ptr; - v196 = hir.load v195 : i64; - v493 = arith.constant 8 : u32; - v197 = hir.bitcast v189 : u32; - v199 = arith.add v197, v493 : u32 #[overflow = checked]; - v200 = arith.constant 4 : u32; - v201 = arith.mod v199, v200 : u32; - hir.assertz v201 #[code = 250]; - v202 = hir.int_to_ptr v199 : ptr; - hir.store v202, v196; - v203 = hir.bitcast v182 : u32; - v492 = arith.constant 8 : u32; - v205 = arith.mod v203, v492 : u32; - hir.assertz v205 #[code = 250]; - v206 = hir.int_to_ptr v203 : ptr; - v207 = hir.load v206 : i64; - v208 = hir.bitcast v189 : u32; - v491 = arith.constant 4 : u32; - v210 = arith.mod v208, v491 : u32; - hir.assertz v210 #[code = 250]; - v211 = hir.int_to_ptr v208 : ptr; - hir.store v211, v207; - v212 = arith.constant 12 : i32; - v213 = arith.add v189, v212 : i32 #[overflow = wrapping]; - v183 = arith.constant 0 : i32; - v462, v463, v464, v465, v466, v467 = scf.while v183, v189, v213, v181 : i32, i32, i32, i32, i32, i32 { - ^block54(v468: i32, v469: i32, v470: i32, v471: i32): - v490 = arith.constant 0 : i32; - v216 = arith.constant 8 : i32; - v217 = arith.eq v468, v216 : i1; - v218 = arith.zext v217 : u32; - v219 = hir.bitcast v218 : i32; - v221 = arith.neq v219, v490 : i1; - v456, v457 = scf.if v221 : i32, i32 { - ^block53: - v416 = ub.poison i32 : i32; - scf.yield v416, v416; - } else { - ^block28: - v223 = arith.add v469, v468 : i32 #[overflow = wrapping]; - v224 = hir.bitcast v223 : u32; - v489 = arith.constant 4 : u32; - v226 = arith.mod v224, v489 : u32; - hir.assertz v226 #[code = 250]; - v227 = hir.int_to_ptr v224 : ptr; - v228 = hir.load v227 : felt; - v230 = hir.bitcast v470 : u32; - v488 = arith.constant 4 : u32; - v232 = arith.mod v230, v488 : u32; - hir.assertz v232 #[code = 250]; - v233 = hir.int_to_ptr v230 : ptr; - v234 = hir.load v233 : i32; - v235 = hir.bitcast v223 : u32; - v487 = arith.constant 4 : u32; - v237 = arith.mod v235, v487 : u32; - hir.assertz v237 #[code = 250]; - v238 = hir.int_to_ptr v235 : ptr; - hir.store v238, v234; - v239 = hir.bitcast v470 : u32; - v486 = arith.constant 4 : u32; - v241 = arith.mod v239, v486 : u32; - hir.assertz v241 #[code = 250]; - v242 = hir.int_to_ptr v239 : ptr; - hir.store v242, v228; - v245 = arith.constant -4 : i32; - v246 = arith.add v470, v245 : i32 #[overflow = wrapping]; - v243 = arith.constant 4 : i32; - v244 = arith.add v468, v243 : i32 #[overflow = wrapping]; - scf.yield v244, v246; - }; - v484 = ub.poison i32 : i32; - v459 = cf.select v221, v484, v471 : i32; - v485 = ub.poison i32 : i32; - v458 = cf.select v221, v485, v469 : i32; - v415 = arith.constant 1 : u32; - v408 = arith.constant 0 : u32; - v461 = cf.select v221, v408, v415 : u32; - v449 = arith.trunc v461 : i1; - scf.condition v449, v456, v458, v457, v459, v469, v471; - } do { - ^block55(v472: i32, v473: i32, v474: i32, v475: i32, v476: i32, v477: i32): - scf.yield v472, v473, v474, v475; - }; - v483 = arith.constant 8 : u32; - v248 = hir.bitcast v466 : u32; - v250 = arith.add v248, v483 : u32 #[overflow = checked]; - v482 = arith.constant 4 : u32; - v252 = arith.mod v250, v482 : u32; - hir.assertz v252 #[code = 250]; - v253 = hir.int_to_ptr v250 : ptr; - v254 = hir.load v253 : i64; - v481 = arith.constant 8 : u32; - v255 = hir.bitcast v467 : u32; - v257 = arith.add v255, v481 : u32 #[overflow = checked]; - v480 = arith.constant 8 : u32; - v259 = arith.mod v257, v480 : u32; - hir.assertz v259 #[code = 250]; - v260 = hir.int_to_ptr v257 : ptr; - hir.store v260, v254; - v261 = hir.bitcast v466 : u32; - v479 = arith.constant 4 : u32; - v263 = arith.mod v261, v479 : u32; - hir.assertz v263 #[code = 250]; - v264 = hir.int_to_ptr v261 : ptr; - v265 = hir.load v264 : i64; - v266 = hir.bitcast v467 : u32; - v478 = arith.constant 8 : u32; - v268 = arith.mod v266, v478 : u32; - hir.assertz v268 #[code = 250]; - v269 = hir.int_to_ptr v266 : ptr; - hir.store v269, v265; + private builtin.function @>::from(v178: i32, v179: i32) { + ^block21(v178: i32, v179: i32): + hir.store_local v178 #[local = lv0]; + hir.store_local v179 #[local = lv1]; + v180 = hir.load_local : i32 #[local = lv0]; + v181 = hir.load_local : i32 #[local = lv1]; + v324 = arith.constant 8 : u32; + v182 = hir.bitcast v181 : u32; + v184 = arith.add v182, v324 : u32 #[overflow = checked]; + v323 = arith.constant 4 : u32; + v186 = arith.mod v184, v323 : u32; + hir.assertz v186 #[code = 250]; + v187 = hir.int_to_ptr v184 : ptr; + v188 = hir.load v187 : i64; + v332 = arith.constant 8 : u32; + v189 = hir.bitcast v180 : u32; + v191 = arith.add v189, v332 : u32 #[overflow = checked]; + v331 = arith.constant 8 : u32; + v193 = arith.mod v191, v331 : u32; + hir.assertz v193 #[code = 250]; + v194 = hir.int_to_ptr v191 : ptr; + hir.store v194, v188; + v195 = hir.load_local : i32 #[local = lv0]; + v196 = hir.load_local : i32 #[local = lv1]; + v197 = hir.bitcast v196 : u32; + v330 = arith.constant 4 : u32; + v199 = arith.mod v197, v330 : u32; + hir.assertz v199 #[code = 250]; + v200 = hir.int_to_ptr v197 : ptr; + v201 = hir.load v200 : i64; + v202 = hir.bitcast v195 : u32; + v329 = arith.constant 8 : u32; + v204 = arith.mod v202, v329 : u32; + hir.assertz v204 #[code = 250]; + v205 = hir.int_to_ptr v202 : ptr; + hir.store v205, v201; builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v270: i32) -> felt { - ^block29(v270: i32): - v271 = hir.bitcast v270 : felt; - builtin.ret v271; - }; - - private builtin.function @miden::faucet::mint(v273: felt, v274: felt, v275: felt, v276: felt, v277: i32) { - ^block31(v273: felt, v274: felt, v275: felt, v276: felt, v277: i32): - v278, v279, v280, v281 = hir.exec @miden/faucet/mint(v273, v274, v275, v276) : felt, felt, felt, felt - v282 = hir.bitcast v277 : u32; - v283 = hir.int_to_ptr v282 : ptr; - hir.store v283, v278; - v284 = arith.constant 4 : u32; - v285 = arith.add v282, v284 : u32 #[overflow = checked]; - v286 = hir.int_to_ptr v285 : ptr; - hir.store v286, v279; - v287 = arith.constant 8 : u32; - v288 = arith.add v282, v287 : u32 #[overflow = checked]; - v289 = hir.int_to_ptr v288 : ptr; - hir.store v289, v280; - v290 = arith.constant 12 : u32; - v291 = arith.add v282, v290 : u32 #[overflow = checked]; - v292 = hir.int_to_ptr v291 : ptr; - hir.store v292, v281; - builtin.ret ; + private builtin.function @miden::protocol::faucet::mint(v206: felt, v207: felt, v208: felt, v209: felt, v210: i32) { + ^block23(v206: felt, v207: felt, v208: felt, v209: felt, v210: i32): + ub.unreachable ; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -428,36 +312,36 @@ builtin.component miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-fa }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block35: - v293 = hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1#binding() : i32 - v500 = arith.constant 0 : i32; - v294 = arith.constant 0 : i32; - v295 = arith.add v293, v294 : i32 #[overflow = unchecked]; - v297 = arith.add v295, v500 : i32 #[overflow = unchecked]; - v498 = arith.constant 0 : i32; - v499 = arith.constant 0 : i32; - v299 = arith.add v297, v499 : i32 #[overflow = unchecked]; - v301 = arith.add v299, v498 : i32 #[overflow = unchecked]; - v302 = hir.int_to_ptr v301 : ptr; - v303 = hir.load v302 : felt; - v497 = arith.constant 0 : i32; - v304 = arith.constant 4 : i32; - v305 = arith.add v297, v304 : i32 #[overflow = unchecked]; - v307 = arith.add v305, v497 : i32 #[overflow = unchecked]; - v308 = hir.int_to_ptr v307 : ptr; - v309 = hir.load v308 : felt; - v496 = arith.constant 0 : i32; - v310 = arith.constant 8 : i32; - v311 = arith.add v297, v310 : i32 #[overflow = unchecked]; - v313 = arith.add v311, v496 : i32 #[overflow = unchecked]; - v314 = hir.int_to_ptr v313 : ptr; - v315 = hir.load v314 : felt; - v495 = arith.constant 0 : i32; - v316 = arith.constant 12 : i32; - v317 = arith.add v297, v316 : i32 #[overflow = unchecked]; - v319 = arith.add v317, v495 : i32 #[overflow = unchecked]; - v320 = hir.int_to_ptr v319 : ptr; - v321 = hir.load v320 : felt; - builtin.ret v303, v309, v315, v321; + ^block25: + v211 = hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1#binding() : i32 + v348 = arith.constant 0 : i32; + v342 = arith.constant 0 : i32; + v213 = arith.add v211, v342 : i32 #[overflow = unchecked]; + v215 = arith.add v213, v348 : i32 #[overflow = unchecked]; + v346 = arith.constant 0 : i32; + v347 = arith.constant 0 : i32; + v217 = arith.add v215, v347 : i32 #[overflow = unchecked]; + v219 = arith.add v217, v346 : i32 #[overflow = unchecked]; + v220 = hir.int_to_ptr v219 : ptr; + v221 = hir.load v220 : felt; + v345 = arith.constant 0 : i32; + v335 = arith.constant 4 : i32; + v223 = arith.add v215, v335 : i32 #[overflow = unchecked]; + v225 = arith.add v223, v345 : i32 #[overflow = unchecked]; + v226 = hir.int_to_ptr v225 : ptr; + v227 = hir.load v226 : felt; + v344 = arith.constant 0 : i32; + v334 = arith.constant 8 : i32; + v229 = arith.add v215, v334 : i32 #[overflow = unchecked]; + v231 = arith.add v229, v344 : i32 #[overflow = unchecked]; + v232 = hir.int_to_ptr v231 : ptr; + v233 = hir.load v232 : felt; + v343 = arith.constant 0 : i32; + v333 = arith.constant 12 : i32; + v235 = arith.add v215, v333 : i32 #[overflow = unchecked]; + v237 = arith.add v235, v343 : i32 #[overflow = unchecked]; + v238 = hir.int_to_ptr v237 : ptr; + v239 = hir.load v238 : felt; + builtin.ret v221, v227, v233, v239; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.masm index c12ec5296..22c7d720d 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.masm @@ -1,13 +1,13 @@ -# mod miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1 +# mod ::"miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> (felt, felt, felt, felt) - exec.::miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1::init + exec."miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1::rust_sdk_account_faucet_mint_binding::miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1#binding + exec.::"miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1"::rust_sdk_account_faucet_mint_binding::"miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1#binding" trace.252 nop push.0 @@ -65,7 +65,7 @@ pub proc binding( nop movdn.3 swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -78,7 +78,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -89,7 +89,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1::rust_sdk_account_faucet_mint_binding +# mod ::"miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1"::rust_sdk_account_faucet_mint_binding @callconv("C") proc __wasm_call_ctors( @@ -105,6 +105,7 @@ proc rust_sdk_account_faucet_mint_binding::bindings::__link_custom_section_descr nop end +@locals("3") @callconv("C") proc miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1#binding( @@ -119,9 +120,16 @@ proc miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-bin nop push.32 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -131,35 +139,74 @@ proc miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-bin nop trace.240 nop - exec.::miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1::rust_sdk_account_faucet_mint_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1"::rust_sdk_account_faucet_mint_binding::wit_bindgen::rt::run_ctors_once trace.252 nop push.0 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1::rust_sdk_account_faucet_mint_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_sw trace.252 nop push.0 - movup.2 + locaddr.2 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1 while.true + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.16 - dup.2 + movup.2 eq neq dup.0 if.true - swap.1 - drop - push.3735929054 + nop else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.16 - dup.3 + movup.3 u32wrapping_add - dup.2 + movup.2 u32wrapping_add push.4 dup.1 @@ -167,8 +214,6 @@ proc miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-bin u32mod u32assert assertz - dup.4 - swap.1 u32divmod.4 swap.1 trace.240 @@ -176,41 +221,37 @@ proc miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-bin exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - movup.2 u32wrapping_add + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.3735929054 - dup.2 - movup.2 - swap.5 - movdn.2 - cdrop - push.3735929054 - dup.2 - dup.4 - swap.2 - swap.1 - cdrop push.1 push.0 - movup.4 + movup.2 cdrop push.1 u32and - movup.4 - swap.1 if.true - movup.3 - drop push.1 else push.0 end end - drop - drop - drop push.1114148 u32divmod.4 swap.1 @@ -219,29 +260,76 @@ proc miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-bin exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - dup.2 + dup.1 u32wrapping_add - dup.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1"::rust_sdk_account_faucet_mint_binding::>::from + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1::rust_sdk_account_faucet_mint_binding::>::from + exec.::intrinsics::mem::load_sw trace.252 nop push.16 - dup.2 + dup.1 u32wrapping_add - dup.2 + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1"::rust_sdk_account_faucet_mint_binding::miden_base_sys::bindings::faucet::mint + trace.252 + nop + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1::rust_sdk_account_faucet_mint_binding::miden_base_sys::bindings::faucet::mint + exec.::intrinsics::mem::load_sw trace.252 nop push.1048584 u32wrapping_add + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.24 - dup.2 + swap.1 add u32assert push.8 @@ -259,7 +347,7 @@ proc miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-bin nop swap.1 push.8 - dup.3 + movup.3 add u32assert push.4 @@ -277,8 +365,24 @@ proc miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-bin exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - dup.2 + swap.1 add u32assert push.8 @@ -295,7 +399,7 @@ proc miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-bin trace.252 nop swap.1 - dup.2 + movup.2 push.4 dup.1 swap.1 @@ -311,8 +415,15 @@ proc miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-bin exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.32 - movup.2 u32wrapping_add push.1114144 u32divmod.4 @@ -322,8 +433,17 @@ proc miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-bin exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -365,9 +485,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1"::rust_sdk_account_faucet_mint_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1::rust_sdk_account_faucet_mint_binding::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -398,8 +534,25 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("3") @callconv("C") proc miden_base_sys::bindings::faucet::mint(i32, i32) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -408,11 +561,18 @@ proc miden_base_sys::bindings::faucet::mint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop - push.32 + push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.2 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -420,8 +580,16 @@ proc miden_base_sys::bindings::faucet::mint(i32, i32) exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.3 + swap.1 add u32assert push.4 @@ -437,8 +605,16 @@ proc miden_base_sys::bindings::faucet::mint(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.4 + swap.1 add u32assert push.4 @@ -454,8 +630,16 @@ proc miden_base_sys::bindings::faucet::mint(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.5 + swap.1 add u32assert push.4 @@ -471,7 +655,14 @@ proc miden_base_sys::bindings::faucet::mint(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - movup.5 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -485,54 +676,39 @@ proc miden_base_sys::bindings::faucet::mint(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - dup.4 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop swap.1 swap.3 swap.1 swap.4 trace.240 nop - exec.::miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1::rust_sdk_account_faucet_mint_binding::miden::faucet::mint + exec.::"miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1"::rust_sdk_account_faucet_mint_binding::"miden::protocol::faucet::mint" trace.252 nop - push.8 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 swap.1 - push.24 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - dup.0 push.8 dup.1 swap.1 @@ -547,8 +723,8 @@ proc miden_base_sys::bindings::faucet::mint(i32, i32) trace.252 nop swap.1 - push.16 - dup.3 + push.8 + movup.3 add u32assert push.8 @@ -557,6 +733,8 @@ proc miden_base_sys::bindings::faucet::mint(i32, i32) u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -566,37 +744,27 @@ proc miden_base_sys::bindings::faucet::mint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop - push.16 - dup.1 - u32wrapping_add - movup.2 + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1::rust_sdk_account_faucet_mint_binding::::reverse + exec.::intrinsics::mem::load_sw trace.252 nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop -end - -@callconv("C") -proc >::from( - i32, - i32 -) push.8 - dup.2 + swap.1 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod @@ -610,16 +778,15 @@ proc ::reverse( +proc >::from( i32, i32 ) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 swap.1 - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.1 + push.0 swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop push.8 - dup.1 + swap.1 add u32assert push.4 @@ -889,7 +873,7 @@ proc ::reverse( nop swap.1 push.8 - dup.4 + movup.3 add u32assert push.8 @@ -907,6 +891,22 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -939,64 +939,15 @@ proc ::reverse( nop end +@locals("5") @callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc miden::faucet::mint(felt, felt, felt, felt, i32) - trace.240 - nop - exec.::miden::faucet::mint - trace.252 - nop - movup.4 - dup.0 - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.12 - add - u32assert - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop +proc miden::protocol::faucet::mint(felt, felt, felt, felt, i32) + drop + drop + drop + drop + drop + push.0 + assert end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.wat index 8f5fecc26..83f918091 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.wat @@ -65,7 +65,7 @@ local.get 0 i32.const 16 i32.add - call $>::from + call $>::from local.get 0 i32.const 16 i32.add @@ -109,7 +109,7 @@ (func $miden_base_sys::bindings::faucet::mint (;4;) (type 2) (param i32 i32) (local i32) global.get $__stack_pointer - i32.const 32 + i32.const 16 i32.sub local.tee 2 global.set $__stack_pointer @@ -122,26 +122,25 @@ local.get 1 f32.load local.get 2 - call $miden::faucet::mint - local.get 2 - local.get 2 - i64.load offset=8 - i64.store offset=24 - local.get 2 + call $miden::protocol::faucet::mint + local.get 0 local.get 2 i64.load - i64.store offset=16 + i64.const 32 + i64.rotl + i64.store offset=8 local.get 0 local.get 2 - i32.const 16 - i32.add - call $::reverse + i64.load offset=8 + i64.const 32 + i64.rotl + i64.store local.get 2 - i32.const 32 + i32.const 16 i32.add global.set $__stack_pointer ) - (func $>::from (;5;) (type 2) (param i32 i32) + (func $>::from (;5;) (type 2) (param i32 i32) local.get 0 local.get 1 i64.load offset=8 align=4 @@ -151,72 +150,14 @@ i64.load align=4 i64.store ) - (func $::reverse (;6;) (type 2) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store - ) - (func $intrinsics::felt::from_u32 (;7;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;6;) (type 3) (param i32) (result f32) unreachable ) - (func $miden::faucet::mint (;8;) (type 4) (param f32 f32 f32 f32 i32) + (func $miden::protocol::faucet::mint (;7;) (type 4) (param f32 f32 f32 f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "Irust_sdk_account_faucet_mint_binding\01\0b0.0.1\05\02\03\01") + (@custom "rodata,miden_account" (after data) "Irust_sdk_account_faucet_mint_binding\01\0b0.0.1\05\02\03\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "asset" (type $asset (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.hir index e44b3f046..2ee5a0946 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.hir @@ -12,273 +12,157 @@ builtin.component miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-ac private builtin.function @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1#binding() -> i32 { ^block9: - v2 = builtin.global_symbol @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/__stack_pointer : ptr - v3 = hir.bitcast v2 : ptr; - v4 = hir.load v3 : i32; - v5 = arith.constant 48 : i32; - v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; - v7 = builtin.global_symbol @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/__stack_pointer : ptr - v8 = hir.bitcast v7 : ptr; - hir.store v8, v6; + v1 = builtin.global_symbol @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v150 = arith.constant 16 : i32; + v5 = arith.sub v3, v150 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; + v8 = builtin.global_symbol @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/GOT.data.internal.__memory_base : ptr + v9 = hir.bitcast v8 : ptr; + v10 = hir.load v9 : i32; + hir.store_local v10 #[local = lv1]; hir.exec @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/wit_bindgen::rt::run_ctors_once() - v9 = arith.constant 16 : i32; - v10 = arith.add v6, v9 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/miden::active_account::get_code_commitment(v10) - v12 = arith.constant 24 : u32; - v11 = hir.bitcast v6 : u32; - v13 = arith.add v11, v12 : u32 #[overflow = checked]; - v14 = arith.constant 8 : u32; - v15 = arith.mod v13, v14 : u32; - hir.assertz v15 #[code = 250]; - v16 = hir.int_to_ptr v13 : ptr; - v17 = hir.load v16 : i64; - v19 = arith.constant 40 : u32; - v18 = hir.bitcast v6 : u32; - v20 = arith.add v18, v19 : u32 #[overflow = checked]; - v237 = arith.constant 8 : u32; - v22 = arith.mod v20, v237 : u32; - hir.assertz v22 #[code = 250]; - v23 = hir.int_to_ptr v20 : ptr; - hir.store v23, v17; - v25 = arith.constant 16 : u32; - v24 = hir.bitcast v6 : u32; - v26 = arith.add v24, v25 : u32 #[overflow = checked]; - v236 = arith.constant 8 : u32; - v28 = arith.mod v26, v236 : u32; - hir.assertz v28 #[code = 250]; - v29 = hir.int_to_ptr v26 : ptr; - v30 = hir.load v29 : i64; - v32 = arith.constant 32 : u32; - v31 = hir.bitcast v6 : u32; - v33 = arith.add v31, v32 : u32 #[overflow = checked]; - v235 = arith.constant 8 : u32; - v35 = arith.mod v33, v235 : u32; - hir.assertz v35 #[code = 250]; - v36 = hir.int_to_ptr v33 : ptr; - hir.store v36, v30; - v37 = builtin.global_symbol @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/GOT.data.internal.__memory_base : ptr - v38 = hir.bitcast v37 : ptr; - v39 = hir.load v38 : i32; - v40 = arith.constant 32 : i32; - v41 = arith.add v6, v40 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/::reverse(v6, v41) - v42 = arith.constant 1048584 : i32; - v43 = arith.add v39, v42 : i32 #[overflow = wrapping]; - v234 = arith.constant 8 : u32; - v44 = hir.bitcast v6 : u32; - v46 = arith.add v44, v234 : u32 #[overflow = checked]; - v233 = arith.constant 8 : u32; - v48 = arith.mod v46, v233 : u32; + v11 = hir.load_local : i32 #[local = lv0]; + hir.exec @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/miden::protocol::active_account::get_code_commitment(v11) + v12 = hir.load_local : i32 #[local = lv1]; + v149 = arith.constant 1048584 : i32; + v14 = arith.add v12, v149 : i32 #[overflow = wrapping]; + hir.store_local v14 #[local = lv1]; + v15 = hir.load_local : i32 #[local = lv0]; + v16 = hir.bitcast v15 : u32; + v148 = arith.constant 4 : u32; + v18 = arith.mod v16, v148 : u32; + hir.assertz v18 #[code = 250]; + v19 = hir.int_to_ptr v16 : ptr; + v20 = hir.load v19 : felt; + v147 = arith.constant 12 : u32; + v21 = hir.bitcast v14 : u32; + v23 = arith.add v21, v147 : u32 #[overflow = checked]; + v174 = arith.constant 4 : u32; + v25 = arith.mod v23, v174 : u32; + hir.assertz v25 #[code = 250]; + v26 = hir.int_to_ptr v23 : ptr; + hir.store v26, v20; + v27 = hir.load_local : i32 #[local = lv1]; + v28 = hir.load_local : i32 #[local = lv0]; + v173 = arith.constant 4 : u32; + v29 = hir.bitcast v28 : u32; + v31 = arith.add v29, v173 : u32 #[overflow = checked]; + v172 = arith.constant 4 : u32; + v33 = arith.mod v31, v172 : u32; + hir.assertz v33 #[code = 250]; + v34 = hir.int_to_ptr v31 : ptr; + v35 = hir.load v34 : felt; + v146 = arith.constant 8 : u32; + v36 = hir.bitcast v27 : u32; + v38 = arith.add v36, v146 : u32 #[overflow = checked]; + v171 = arith.constant 4 : u32; + v40 = arith.mod v38, v171 : u32; + hir.assertz v40 #[code = 250]; + v41 = hir.int_to_ptr v38 : ptr; + hir.store v41, v35; + v42 = hir.load_local : i32 #[local = lv1]; + v43 = hir.load_local : i32 #[local = lv0]; + v170 = arith.constant 8 : u32; + v44 = hir.bitcast v43 : u32; + v46 = arith.add v44, v170 : u32 #[overflow = checked]; + v169 = arith.constant 4 : u32; + v48 = arith.mod v46, v169 : u32; hir.assertz v48 #[code = 250]; - v49 = hir.int_to_ptr v46 : ptr; - v50 = hir.load v49 : i64; - v232 = arith.constant 8 : u32; - v51 = hir.bitcast v43 : u32; - v53 = arith.add v51, v232 : u32 #[overflow = checked]; - v54 = arith.constant 4 : u32; - v55 = arith.mod v53, v54 : u32; + v49 = hir.int_to_ptr v46 : ptr; + v50 = hir.load v49 : felt; + v168 = arith.constant 4 : u32; + v51 = hir.bitcast v42 : u32; + v53 = arith.add v51, v168 : u32 #[overflow = checked]; + v167 = arith.constant 4 : u32; + v55 = arith.mod v53, v167 : u32; hir.assertz v55 #[code = 250]; - v56 = hir.int_to_ptr v53 : ptr; + v56 = hir.int_to_ptr v53 : ptr; hir.store v56, v50; - v57 = hir.bitcast v6 : u32; - v231 = arith.constant 8 : u32; - v59 = arith.mod v57, v231 : u32; - hir.assertz v59 #[code = 250]; - v60 = hir.int_to_ptr v57 : ptr; - v61 = hir.load v60 : i64; - v62 = hir.bitcast v43 : u32; - v230 = arith.constant 4 : u32; - v64 = arith.mod v62, v230 : u32; - hir.assertz v64 #[code = 250]; - v65 = hir.int_to_ptr v62 : ptr; - hir.store v65, v61; - v229 = arith.constant 48 : i32; - v67 = arith.add v6, v229 : i32 #[overflow = wrapping]; - v68 = builtin.global_symbol @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/__stack_pointer : ptr - v69 = hir.bitcast v68 : ptr; - hir.store v69, v67; - builtin.ret v43; + v57 = hir.load_local : i32 #[local = lv1]; + v58 = hir.load_local : i32 #[local = lv0]; + v166 = arith.constant 12 : u32; + v59 = hir.bitcast v58 : u32; + v61 = arith.add v59, v166 : u32 #[overflow = checked]; + v165 = arith.constant 4 : u32; + v63 = arith.mod v61, v165 : u32; + hir.assertz v63 #[code = 250]; + v64 = hir.int_to_ptr v61 : ptr; + v65 = hir.load v64 : felt; + v66 = hir.bitcast v57 : u32; + v164 = arith.constant 4 : u32; + v68 = arith.mod v66, v164 : u32; + hir.assertz v68 #[code = 250]; + v69 = hir.int_to_ptr v66 : ptr; + hir.store v69, v65; + v70 = hir.load_local : i32 #[local = lv0]; + v163 = arith.constant 16 : i32; + v72 = arith.add v70, v163 : i32 #[overflow = wrapping]; + v73 = builtin.global_symbol @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/__stack_pointer : ptr + v74 = hir.bitcast v73 : ptr; + hir.store v74, v72; + v75 = hir.load_local : i32 #[local = lv1]; + builtin.ret v75; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v71 = builtin.global_symbol @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/GOT.data.internal.__memory_base : ptr - v72 = hir.bitcast v71 : ptr; - v73 = hir.load v72 : i32; - v74 = arith.constant 1048600 : i32; - v75 = arith.add v73, v74 : i32 #[overflow = wrapping]; - v76 = hir.bitcast v75 : u32; - v77 = hir.int_to_ptr v76 : ptr; - v78 = hir.load v77 : u8; - v70 = arith.constant 0 : i32; - v79 = arith.zext v78 : u32; - v80 = hir.bitcast v79 : i32; - v82 = arith.neq v80, v70 : i1; - scf.if v82{ + v76 = builtin.global_symbol @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/GOT.data.internal.__memory_base : ptr + v77 = hir.bitcast v76 : ptr; + v78 = hir.load v77 : i32; + v179 = arith.constant 1048600 : i32; + v80 = arith.add v78, v179 : i32 #[overflow = wrapping]; + v81 = hir.bitcast v80 : u32; + v82 = hir.int_to_ptr v81 : ptr; + v83 = hir.load v82 : u8; + v178 = arith.constant 0 : i32; + v84 = arith.zext v83 : u32; + v85 = hir.bitcast v84 : i32; + v87 = arith.neq v85, v178 : i1; + scf.if v87{ ^block13: scf.yield ; } else { ^block14: - v83 = builtin.global_symbol @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/GOT.data.internal.__memory_base : ptr - v84 = hir.bitcast v83 : ptr; - v85 = hir.load v84 : i32; + v88 = builtin.global_symbol @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/GOT.data.internal.__memory_base : ptr + v89 = hir.bitcast v88 : ptr; + v90 = hir.load v89 : i32; + hir.store_local v90 #[local = lv0]; hir.exec @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/__wasm_call_ctors() - v239 = arith.constant 1 : u8; - v241 = arith.constant 1048600 : i32; - v87 = arith.add v85, v241 : i32 #[overflow = wrapping]; - v91 = hir.bitcast v87 : u32; - v92 = hir.int_to_ptr v91 : ptr; - hir.store v92, v239; + v91 = hir.load_local : i32 #[local = lv0]; + v177 = arith.constant 1 : u8; + v182 = arith.constant 1048600 : i32; + v93 = arith.add v91, v182 : i32 #[overflow = wrapping]; + v97 = hir.bitcast v93 : u32; + v98 = hir.int_to_ptr v97 : ptr; + hir.store v98, v177; scf.yield ; }; builtin.ret ; }; - private builtin.function @::reverse(v93: i32, v94: i32) { - ^block15(v93: i32, v94: i32): - v97 = builtin.global_symbol @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/__stack_pointer : ptr - v98 = hir.bitcast v97 : ptr; - v99 = hir.load v98 : i32; - v100 = arith.constant 16 : i32; - v101 = arith.sub v99, v100 : i32 #[overflow = wrapping]; - v103 = arith.constant 8 : u32; - v102 = hir.bitcast v94 : u32; - v104 = arith.add v102, v103 : u32 #[overflow = checked]; - v328 = arith.constant 8 : u32; - v106 = arith.mod v104, v328 : u32; - hir.assertz v106 #[code = 250]; - v107 = hir.int_to_ptr v104 : ptr; - v108 = hir.load v107 : i64; - v327 = arith.constant 8 : u32; - v109 = hir.bitcast v101 : u32; - v111 = arith.add v109, v327 : u32 #[overflow = checked]; - v112 = arith.constant 4 : u32; - v113 = arith.mod v111, v112 : u32; - hir.assertz v113 #[code = 250]; - v114 = hir.int_to_ptr v111 : ptr; - hir.store v114, v108; - v115 = hir.bitcast v94 : u32; - v326 = arith.constant 8 : u32; - v117 = arith.mod v115, v326 : u32; - hir.assertz v117 #[code = 250]; - v118 = hir.int_to_ptr v115 : ptr; - v119 = hir.load v118 : i64; - v120 = hir.bitcast v101 : u32; - v325 = arith.constant 4 : u32; - v122 = arith.mod v120, v325 : u32; - hir.assertz v122 #[code = 250]; - v123 = hir.int_to_ptr v120 : ptr; - hir.store v123, v119; - v124 = arith.constant 12 : i32; - v125 = arith.add v101, v124 : i32 #[overflow = wrapping]; - v95 = arith.constant 0 : i32; - v296, v297, v298, v299, v300, v301 = scf.while v95, v101, v125, v93 : i32, i32, i32, i32, i32, i32 { - ^block35(v302: i32, v303: i32, v304: i32, v305: i32): - v324 = arith.constant 0 : i32; - v128 = arith.constant 8 : i32; - v129 = arith.eq v302, v128 : i1; - v130 = arith.zext v129 : u32; - v131 = hir.bitcast v130 : i32; - v133 = arith.neq v131, v324 : i1; - v290, v291 = scf.if v133 : i32, i32 { - ^block34: - v250 = ub.poison i32 : i32; - scf.yield v250, v250; - } else { - ^block20: - v135 = arith.add v303, v302 : i32 #[overflow = wrapping]; - v136 = hir.bitcast v135 : u32; - v323 = arith.constant 4 : u32; - v138 = arith.mod v136, v323 : u32; - hir.assertz v138 #[code = 250]; - v139 = hir.int_to_ptr v136 : ptr; - v140 = hir.load v139 : felt; - v142 = hir.bitcast v304 : u32; - v322 = arith.constant 4 : u32; - v144 = arith.mod v142, v322 : u32; - hir.assertz v144 #[code = 250]; - v145 = hir.int_to_ptr v142 : ptr; - v146 = hir.load v145 : i32; - v147 = hir.bitcast v135 : u32; - v321 = arith.constant 4 : u32; - v149 = arith.mod v147, v321 : u32; - hir.assertz v149 #[code = 250]; - v150 = hir.int_to_ptr v147 : ptr; - hir.store v150, v146; - v151 = hir.bitcast v304 : u32; - v320 = arith.constant 4 : u32; - v153 = arith.mod v151, v320 : u32; - hir.assertz v153 #[code = 250]; - v154 = hir.int_to_ptr v151 : ptr; - hir.store v154, v140; - v157 = arith.constant -4 : i32; - v158 = arith.add v304, v157 : i32 #[overflow = wrapping]; - v155 = arith.constant 4 : i32; - v156 = arith.add v302, v155 : i32 #[overflow = wrapping]; - scf.yield v156, v158; - }; - v318 = ub.poison i32 : i32; - v293 = cf.select v133, v318, v305 : i32; - v319 = ub.poison i32 : i32; - v292 = cf.select v133, v319, v303 : i32; - v249 = arith.constant 1 : u32; - v242 = arith.constant 0 : u32; - v295 = cf.select v133, v242, v249 : u32; - v283 = arith.trunc v295 : i1; - scf.condition v283, v290, v292, v291, v293, v303, v305; - } do { - ^block36(v306: i32, v307: i32, v308: i32, v309: i32, v310: i32, v311: i32): - scf.yield v306, v307, v308, v309; - }; - v317 = arith.constant 8 : u32; - v160 = hir.bitcast v300 : u32; - v162 = arith.add v160, v317 : u32 #[overflow = checked]; - v316 = arith.constant 4 : u32; - v164 = arith.mod v162, v316 : u32; - hir.assertz v164 #[code = 250]; - v165 = hir.int_to_ptr v162 : ptr; - v166 = hir.load v165 : i64; - v315 = arith.constant 8 : u32; - v167 = hir.bitcast v301 : u32; - v169 = arith.add v167, v315 : u32 #[overflow = checked]; - v314 = arith.constant 8 : u32; - v171 = arith.mod v169, v314 : u32; - hir.assertz v171 #[code = 250]; - v172 = hir.int_to_ptr v169 : ptr; - hir.store v172, v166; - v173 = hir.bitcast v300 : u32; - v313 = arith.constant 4 : u32; - v175 = arith.mod v173, v313 : u32; - hir.assertz v175 #[code = 250]; - v176 = hir.int_to_ptr v173 : ptr; - v177 = hir.load v176 : i64; - v178 = hir.bitcast v301 : u32; - v312 = arith.constant 8 : u32; - v180 = arith.mod v178, v312 : u32; - hir.assertz v180 #[code = 250]; - v181 = hir.int_to_ptr v178 : ptr; - hir.store v181, v177; - builtin.ret ; - }; - - private builtin.function @miden::active_account::get_code_commitment(v182: i32) { - ^block21(v182: i32): - v183, v184, v185, v186 = hir.exec @miden/active_account/get_code_commitment() : felt, felt, felt, felt - v187 = hir.bitcast v182 : u32; - v188 = hir.int_to_ptr v187 : ptr; - hir.store v188, v183; - v189 = arith.constant 4 : u32; - v190 = arith.add v187, v189 : u32 #[overflow = checked]; - v191 = hir.int_to_ptr v190 : ptr; - hir.store v191, v184; - v192 = arith.constant 8 : u32; - v193 = arith.add v187, v192 : u32 #[overflow = checked]; - v194 = hir.int_to_ptr v193 : ptr; - hir.store v194, v185; - v195 = arith.constant 12 : u32; - v196 = arith.add v187, v195 : u32 #[overflow = checked]; - v197 = hir.int_to_ptr v196 : ptr; - hir.store v197, v186; + private builtin.function @miden::protocol::active_account::get_code_commitment(v99: i32) { + ^block15(v99: i32): + v100, v101, v102, v103 = hir.exec @miden/protocol/active_account/get_code_commitment() : felt, felt, felt, felt + v104 = hir.bitcast v99 : u32; + v105 = hir.int_to_ptr v104 : ptr; + hir.store v105, v100; + v185 = arith.constant 4 : u32; + v107 = arith.add v104, v185 : u32 #[overflow = checked]; + v108 = hir.int_to_ptr v107 : ptr; + hir.store v108, v101; + v184 = arith.constant 8 : u32; + v110 = arith.add v104, v184 : u32 #[overflow = checked]; + v111 = hir.int_to_ptr v110 : ptr; + hir.store v111, v102; + v183 = arith.constant 12 : u32; + v113 = arith.add v104, v183 : u32 #[overflow = checked]; + v114 = hir.int_to_ptr v113 : ptr; + hir.store v114, v103; builtin.ret ; }; @@ -294,34 +178,34 @@ builtin.component miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-ac }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block25: - v198 = hir.exec @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1#binding() : i32 + ^block20: + v115 = hir.exec @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1#binding() : i32 + v189 = arith.constant 0 : i32; + v117 = arith.add v115, v189 : i32 #[overflow = unchecked]; + v198 = arith.constant 0 : i32; v199 = arith.constant 0 : i32; - v200 = arith.add v198, v199 : i32 #[overflow = unchecked]; - v332 = arith.constant 0 : i32; - v333 = arith.constant 0 : i32; - v202 = arith.add v200, v333 : i32 #[overflow = unchecked]; - v204 = arith.add v202, v332 : i32 #[overflow = unchecked]; - v205 = hir.int_to_ptr v204 : ptr; - v206 = hir.load v205 : felt; - v331 = arith.constant 0 : i32; - v207 = arith.constant 4 : i32; - v208 = arith.add v200, v207 : i32 #[overflow = unchecked]; - v210 = arith.add v208, v331 : i32 #[overflow = unchecked]; - v211 = hir.int_to_ptr v210 : ptr; - v212 = hir.load v211 : felt; - v330 = arith.constant 0 : i32; - v213 = arith.constant 8 : i32; - v214 = arith.add v200, v213 : i32 #[overflow = unchecked]; - v216 = arith.add v214, v330 : i32 #[overflow = unchecked]; - v217 = hir.int_to_ptr v216 : ptr; - v218 = hir.load v217 : felt; - v329 = arith.constant 0 : i32; - v219 = arith.constant 12 : i32; - v220 = arith.add v200, v219 : i32 #[overflow = unchecked]; - v222 = arith.add v220, v329 : i32 #[overflow = unchecked]; - v223 = hir.int_to_ptr v222 : ptr; - v224 = hir.load v223 : felt; - builtin.ret v206, v212, v218, v224; + v119 = arith.add v117, v199 : i32 #[overflow = unchecked]; + v121 = arith.add v119, v198 : i32 #[overflow = unchecked]; + v122 = hir.int_to_ptr v121 : ptr; + v123 = hir.load v122 : felt; + v197 = arith.constant 0 : i32; + v188 = arith.constant 4 : i32; + v125 = arith.add v117, v188 : i32 #[overflow = unchecked]; + v127 = arith.add v125, v197 : i32 #[overflow = unchecked]; + v128 = hir.int_to_ptr v127 : ptr; + v129 = hir.load v128 : felt; + v196 = arith.constant 0 : i32; + v187 = arith.constant 8 : i32; + v131 = arith.add v117, v187 : i32 #[overflow = unchecked]; + v133 = arith.add v131, v196 : i32 #[overflow = unchecked]; + v134 = hir.int_to_ptr v133 : ptr; + v135 = hir.load v134 : felt; + v195 = arith.constant 0 : i32; + v186 = arith.constant 12 : i32; + v137 = arith.add v117, v186 : i32 #[overflow = unchecked]; + v139 = arith.add v137, v195 : i32 #[overflow = unchecked]; + v140 = hir.int_to_ptr v139 : ptr; + v141 = hir.load v140 : felt; + builtin.ret v123, v129, v135, v141; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.masm index cacd0e0fe..57479973e 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.masm @@ -1,13 +1,13 @@ -# mod miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1 +# mod ::"miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> (felt, felt, felt, felt) - exec.::miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1::init + exec."miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1::rust_sdk_account_get_code_commitment_binding::miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1#binding + exec.::"miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1"::rust_sdk_account_get_code_commitment_binding::"miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1#binding" trace.252 nop push.0 @@ -62,7 +62,7 @@ pub proc binding( nop movdn.3 swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -75,7 +75,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -86,7 +86,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1::rust_sdk_account_get_code_commitment_binding +# mod ::"miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1"::rust_sdk_account_get_code_commitment_binding @callconv("C") proc __wasm_call_ctors( @@ -102,6 +102,7 @@ proc rust_sdk_account_get_code_commitment_binding::bindings::__link_custom_secti nop end +@locals("2") @callconv("C") proc miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1#binding( @@ -114,36 +115,87 @@ proc miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-cod exec.::intrinsics::mem::load_sw trace.252 nop - push.48 + push.16 u32wrapping_sub + dup.0 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 - dup.1 + u32divmod.4 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114148 u32divmod.4 swap.1 trace.240 nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop exec.::intrinsics::mem::store_sw trace.252 nop trace.240 nop - exec.::miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1::rust_sdk_account_get_code_commitment_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1"::rust_sdk_account_get_code_commitment_binding::wit_bindgen::rt::run_ctors_once trace.252 nop - push.16 - dup.1 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1"::rust_sdk_account_get_code_commitment_binding::"miden::protocol::active_account::get_code_commitment" + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 u32wrapping_add + dup.0 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1::rust_sdk_account_get_code_commitment_binding::miden::active_account::get_code_commitment + exec.::intrinsics::mem::store_sw trace.252 nop - push.24 - dup.1 - add - u32assert - push.8 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 dup.1 swap.1 u32mod @@ -153,15 +205,14 @@ proc miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-cod swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.40 - dup.3 + push.12 + movup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -169,18 +220,32 @@ proc miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-cod assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.16 - dup.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -190,15 +255,14 @@ proc miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-cod swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.32 - dup.3 + push.8 + movup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -206,37 +270,32 @@ proc miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-cod assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.1114148 - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.32 - dup.2 - u32wrapping_add - dup.2 + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1::rust_sdk_account_get_code_commitment_binding::::reverse + exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 - u32wrapping_add push.8 - dup.2 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -246,12 +305,11 @@ proc miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-cod swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.8 - dup.3 + push.4 + movup.2 add u32assert push.4 @@ -262,15 +320,32 @@ proc miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-cod assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - dup.1 - push.8 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + swap.1 + add + u32assert + push.4 dup.1 swap.1 u32mod @@ -280,11 +355,10 @@ proc miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-cod swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop swap.1 - dup.2 push.4 dup.1 swap.1 @@ -293,15 +367,20 @@ proc miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-cod assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.48 - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 u32wrapping_add push.1114144 u32divmod.4 @@ -311,8 +390,17 @@ proc miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-cod exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -354,9 +442,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop trace.240 nop - exec.::miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1::rust_sdk_account_get_code_commitment_binding::__wasm_call_ctors + exec.::"miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1"::rust_sdk_account_get_code_commitment_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -388,287 +492,10 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.4 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop -end - -@callconv("C") -proc miden::active_account::get_code_commitment(i32) +proc miden::protocol::active_account::get_code_commitment(i32) trace.240 nop - exec.::miden::active_account::get_code_commitment + exec.::miden::protocol::active_account::get_code_commitment trace.252 nop movup.4 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.wat index 21eb9c1ae..6c28cd845 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.wat @@ -12,8 +12,7 @@ (core module $main (;0;) (type (;0;) (func)) (type (;1;) (func (result i32))) - (type (;2;) (func (param i32 i32))) - (type (;3;) (func (param i32))) + (type (;2;) (func (param i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -26,43 +25,36 @@ (func $miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1#binding (;2;) (type 1) (result i32) (local i32 i32) global.get $__stack_pointer - i32.const 48 + i32.const 16 i32.sub local.tee 0 global.set $__stack_pointer - call $wit_bindgen::rt::run_ctors_once - local.get 0 - i32.const 16 - i32.add - call $miden::active_account::get_code_commitment - local.get 0 - local.get 0 - i64.load offset=24 - i64.store offset=40 - local.get 0 - local.get 0 - i64.load offset=16 - i64.store offset=32 global.get $GOT.data.internal.__memory_base local.set 1 + call $wit_bindgen::rt::run_ctors_once local.get 0 - local.get 0 - i32.const 32 - i32.add - call $::reverse + call $miden::protocol::active_account::get_code_commitment local.get 1 i32.const 1048584 i32.add local.tee 1 local.get 0 - i64.load offset=8 - i64.store offset=8 align=4 + f32.load + f32.store offset=12 local.get 1 local.get 0 - i64.load - i64.store align=4 + f32.load offset=4 + f32.store offset=8 + local.get 1 + local.get 0 + f32.load offset=8 + f32.store offset=4 + local.get 1 local.get 0 - i32.const 48 + f32.load offset=12 + f32.store + local.get 0 + i32.const 16 i32.add global.set $__stack_pointer local.get 1 @@ -85,69 +77,11 @@ i32.store8 end ) - (func $::reverse (;4;) (type 2) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store - ) - (func $miden::active_account::get_code_commitment (;5;) (type 3) (param i32) + (func $miden::protocol::active_account::get_code_commitment (;4;) (type 2) (param i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "Yrust_sdk_account_get_code_commitment_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "Yrust_sdk_account_get_code_commitment_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.hir index d26bdb565..91daad549 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.hir @@ -13,58 +13,52 @@ builtin.component miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-ac private builtin.function @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1#binding() -> felt { ^block9: hir.exec @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1/rust_sdk_account_get_initial_balance_binding/wit_bindgen::rt::run_ctors_once() - v1 = arith.constant 1 : i32; - v2 = hir.exec @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1/rust_sdk_account_get_initial_balance_binding/intrinsics::felt::from_u32(v1) : felt - v3 = arith.constant 0 : i32; - v4 = hir.exec @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1/rust_sdk_account_get_initial_balance_binding/intrinsics::felt::from_u32(v3) : felt - v5 = hir.exec @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1/rust_sdk_account_get_initial_balance_binding/miden::active_account::get_initial_balance(v2, v4) : felt + v36 = arith.constant 0 : felt; + v37 = arith.constant 1 : felt; + v5 = hir.exec @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1/rust_sdk_account_get_initial_balance_binding/miden::protocol::active_account::get_initial_balance(v37, v36) : felt builtin.ret v5; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v7 = builtin.global_symbol @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1/rust_sdk_account_get_initial_balance_binding/GOT.data.internal.__memory_base : ptr - v8 = hir.bitcast v7 : ptr; - v9 = hir.load v8 : i32; - v10 = arith.constant 1048584 : i32; - v11 = arith.add v9, v10 : i32 #[overflow = wrapping]; - v12 = hir.bitcast v11 : u32; - v13 = hir.int_to_ptr v12 : ptr; - v14 = hir.load v13 : u8; - v6 = arith.constant 0 : i32; - v15 = arith.zext v14 : u32; - v16 = hir.bitcast v15 : i32; - v18 = arith.neq v16, v6 : i1; - scf.if v18{ + v6 = builtin.global_symbol @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1/rust_sdk_account_get_initial_balance_binding/GOT.data.internal.__memory_base : ptr + v7 = hir.bitcast v6 : ptr; + v8 = hir.load v7 : i32; + v42 = arith.constant 1048584 : i32; + v10 = arith.add v8, v42 : i32 #[overflow = wrapping]; + v11 = hir.bitcast v10 : u32; + v12 = hir.int_to_ptr v11 : ptr; + v13 = hir.load v12 : u8; + v41 = arith.constant 0 : i32; + v14 = arith.zext v13 : u32; + v15 = hir.bitcast v14 : i32; + v17 = arith.neq v15, v41 : i1; + scf.if v17{ ^block13: scf.yield ; } else { ^block14: - v19 = builtin.global_symbol @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1/rust_sdk_account_get_initial_balance_binding/GOT.data.internal.__memory_base : ptr - v20 = hir.bitcast v19 : ptr; - v21 = hir.load v20 : i32; + v18 = builtin.global_symbol @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1/rust_sdk_account_get_initial_balance_binding/GOT.data.internal.__memory_base : ptr + v19 = hir.bitcast v18 : ptr; + v20 = hir.load v19 : i32; + hir.store_local v20 #[local = lv0]; hir.exec @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1/rust_sdk_account_get_initial_balance_binding/__wasm_call_ctors() - v38 = arith.constant 1 : u8; - v40 = arith.constant 1048584 : i32; - v23 = arith.add v21, v40 : i32 #[overflow = wrapping]; + v21 = hir.load_local : i32 #[local = lv0]; + v40 = arith.constant 1 : u8; + v45 = arith.constant 1048584 : i32; + v23 = arith.add v21, v45 : i32 #[overflow = wrapping]; v27 = hir.bitcast v23 : u32; v28 = hir.int_to_ptr v27 : ptr; - hir.store v28, v38; + hir.store v28, v40; scf.yield ; }; builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v29: i32) -> felt { - ^block15(v29: i32): - v30 = hir.bitcast v29 : felt; - builtin.ret v30; - }; - - private builtin.function @miden::active_account::get_initial_balance(v32: felt, v33: felt) -> felt { - ^block17(v32: felt, v33: felt): - v34 = hir.exec @miden/active_account/get_initial_balance(v32, v33) : felt - builtin.ret v34; + private builtin.function @miden::protocol::active_account::get_initial_balance(v29: felt, v30: felt) -> felt { + ^block15(v29: felt, v30: felt): + v31 = hir.exec @miden/protocol/active_account/get_initial_balance(v29, v30) : felt + builtin.ret v31; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -79,8 +73,8 @@ builtin.component miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-ac }; public builtin.function @binding() -> felt { - ^block21: - v36 = hir.exec @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1/rust_sdk_account_get_initial_balance_binding/miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1#binding() : felt - builtin.ret v36; + ^block20: + v33 = hir.exec @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1/rust_sdk_account_get_initial_balance_binding/miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1#binding() : felt + builtin.ret v33; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.masm index 17d403288..76ad17e43 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.masm @@ -1,16 +1,16 @@ -# mod miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1 +# mod ::"miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> felt - exec.::miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1::init + exec."miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1::rust_sdk_account_get_initial_balance_binding::miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1#binding + exec.::"miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1"::rust_sdk_account_get_initial_balance_binding::"miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1#binding" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -23,7 +23,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -34,7 +34,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1::rust_sdk_account_get_initial_balance_binding +# mod ::"miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1"::rust_sdk_account_get_initial_balance_binding @callconv("C") proc __wasm_call_ctors( @@ -56,29 +56,19 @@ proc miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-ini ) -> felt trace.240 nop - exec.::miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1::rust_sdk_account_get_initial_balance_binding::wit_bindgen::rt::run_ctors_once - trace.252 - nop - push.1 - trace.240 - nop - exec.::miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1::rust_sdk_account_get_initial_balance_binding::intrinsics::felt::from_u32 + exec.::"miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1"::rust_sdk_account_get_initial_balance_binding::wit_bindgen::rt::run_ctors_once trace.252 nop push.0 + push.1 trace.240 nop - exec.::miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1::rust_sdk_account_get_initial_balance_binding::intrinsics::felt::from_u32 - trace.252 - nop - swap.1 - trace.240 - nop - exec.::miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1::rust_sdk_account_get_initial_balance_binding::miden::active_account::get_initial_balance + exec.::"miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1"::rust_sdk_account_get_initial_balance_binding::"miden::protocol::active_account::get_initial_balance" trace.252 nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -120,9 +110,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop trace.240 nop - exec.::miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1::rust_sdk_account_get_initial_balance_binding::__wasm_call_ctors + exec.::"miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1"::rust_sdk_account_get_initial_balance_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -154,15 +160,10 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc miden::active_account::get_initial_balance(felt, felt) -> felt +proc miden::protocol::active_account::get_initial_balance(felt, felt) -> felt trace.240 nop - exec.::miden::active_account::get_initial_balance + exec.::miden::protocol::active_account::get_initial_balance trace.252 nop end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.wat index f66a1b91b..735623e2c 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.wat @@ -26,7 +26,7 @@ call $intrinsics::felt::from_u32 i32.const 0 call $intrinsics::felt::from_u32 - call $miden::active_account::get_initial_balance + call $miden::protocol::active_account::get_initial_balance ) (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) (local i32) @@ -49,11 +49,11 @@ (func $intrinsics::felt::from_u32 (;4;) (type 2) (param i32) (result f32) unreachable ) - (func $miden::active_account::get_initial_balance (;5;) (type 3) (param f32 f32) (result f32) + (func $miden::protocol::active_account::get_initial_balance (;5;) (type 3) (param f32 f32) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "Yrust_sdk_account_get_initial_balance_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "Yrust_sdk_account_get_initial_balance_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.hir index 7403d4a7b..1d8eb6e17 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.hir @@ -12,273 +12,157 @@ builtin.component miden:rust-sdk-account-get-initial-storage-commitment-binding/ private builtin.function @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1#binding() -> i32 { ^block9: - v2 = builtin.global_symbol @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/__stack_pointer : ptr - v3 = hir.bitcast v2 : ptr; - v4 = hir.load v3 : i32; - v5 = arith.constant 48 : i32; - v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; - v7 = builtin.global_symbol @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/__stack_pointer : ptr - v8 = hir.bitcast v7 : ptr; - hir.store v8, v6; + v1 = builtin.global_symbol @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v150 = arith.constant 16 : i32; + v5 = arith.sub v3, v150 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; + v8 = builtin.global_symbol @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/GOT.data.internal.__memory_base : ptr + v9 = hir.bitcast v8 : ptr; + v10 = hir.load v9 : i32; + hir.store_local v10 #[local = lv1]; hir.exec @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/wit_bindgen::rt::run_ctors_once() - v9 = arith.constant 16 : i32; - v10 = arith.add v6, v9 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/miden::active_account::get_initial_storage_commitment(v10) - v12 = arith.constant 24 : u32; - v11 = hir.bitcast v6 : u32; - v13 = arith.add v11, v12 : u32 #[overflow = checked]; - v14 = arith.constant 8 : u32; - v15 = arith.mod v13, v14 : u32; - hir.assertz v15 #[code = 250]; - v16 = hir.int_to_ptr v13 : ptr; - v17 = hir.load v16 : i64; - v19 = arith.constant 40 : u32; - v18 = hir.bitcast v6 : u32; - v20 = arith.add v18, v19 : u32 #[overflow = checked]; - v237 = arith.constant 8 : u32; - v22 = arith.mod v20, v237 : u32; - hir.assertz v22 #[code = 250]; - v23 = hir.int_to_ptr v20 : ptr; - hir.store v23, v17; - v25 = arith.constant 16 : u32; - v24 = hir.bitcast v6 : u32; - v26 = arith.add v24, v25 : u32 #[overflow = checked]; - v236 = arith.constant 8 : u32; - v28 = arith.mod v26, v236 : u32; - hir.assertz v28 #[code = 250]; - v29 = hir.int_to_ptr v26 : ptr; - v30 = hir.load v29 : i64; - v32 = arith.constant 32 : u32; - v31 = hir.bitcast v6 : u32; - v33 = arith.add v31, v32 : u32 #[overflow = checked]; - v235 = arith.constant 8 : u32; - v35 = arith.mod v33, v235 : u32; - hir.assertz v35 #[code = 250]; - v36 = hir.int_to_ptr v33 : ptr; - hir.store v36, v30; - v37 = builtin.global_symbol @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/GOT.data.internal.__memory_base : ptr - v38 = hir.bitcast v37 : ptr; - v39 = hir.load v38 : i32; - v40 = arith.constant 32 : i32; - v41 = arith.add v6, v40 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/::reverse(v6, v41) - v42 = arith.constant 1048584 : i32; - v43 = arith.add v39, v42 : i32 #[overflow = wrapping]; - v234 = arith.constant 8 : u32; - v44 = hir.bitcast v6 : u32; - v46 = arith.add v44, v234 : u32 #[overflow = checked]; - v233 = arith.constant 8 : u32; - v48 = arith.mod v46, v233 : u32; + v11 = hir.load_local : i32 #[local = lv0]; + hir.exec @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/miden::protocol::active_account::get_initial_storage_commitment(v11) + v12 = hir.load_local : i32 #[local = lv1]; + v149 = arith.constant 1048584 : i32; + v14 = arith.add v12, v149 : i32 #[overflow = wrapping]; + hir.store_local v14 #[local = lv1]; + v15 = hir.load_local : i32 #[local = lv0]; + v16 = hir.bitcast v15 : u32; + v148 = arith.constant 4 : u32; + v18 = arith.mod v16, v148 : u32; + hir.assertz v18 #[code = 250]; + v19 = hir.int_to_ptr v16 : ptr; + v20 = hir.load v19 : felt; + v147 = arith.constant 12 : u32; + v21 = hir.bitcast v14 : u32; + v23 = arith.add v21, v147 : u32 #[overflow = checked]; + v174 = arith.constant 4 : u32; + v25 = arith.mod v23, v174 : u32; + hir.assertz v25 #[code = 250]; + v26 = hir.int_to_ptr v23 : ptr; + hir.store v26, v20; + v27 = hir.load_local : i32 #[local = lv1]; + v28 = hir.load_local : i32 #[local = lv0]; + v173 = arith.constant 4 : u32; + v29 = hir.bitcast v28 : u32; + v31 = arith.add v29, v173 : u32 #[overflow = checked]; + v172 = arith.constant 4 : u32; + v33 = arith.mod v31, v172 : u32; + hir.assertz v33 #[code = 250]; + v34 = hir.int_to_ptr v31 : ptr; + v35 = hir.load v34 : felt; + v146 = arith.constant 8 : u32; + v36 = hir.bitcast v27 : u32; + v38 = arith.add v36, v146 : u32 #[overflow = checked]; + v171 = arith.constant 4 : u32; + v40 = arith.mod v38, v171 : u32; + hir.assertz v40 #[code = 250]; + v41 = hir.int_to_ptr v38 : ptr; + hir.store v41, v35; + v42 = hir.load_local : i32 #[local = lv1]; + v43 = hir.load_local : i32 #[local = lv0]; + v170 = arith.constant 8 : u32; + v44 = hir.bitcast v43 : u32; + v46 = arith.add v44, v170 : u32 #[overflow = checked]; + v169 = arith.constant 4 : u32; + v48 = arith.mod v46, v169 : u32; hir.assertz v48 #[code = 250]; - v49 = hir.int_to_ptr v46 : ptr; - v50 = hir.load v49 : i64; - v232 = arith.constant 8 : u32; - v51 = hir.bitcast v43 : u32; - v53 = arith.add v51, v232 : u32 #[overflow = checked]; - v54 = arith.constant 4 : u32; - v55 = arith.mod v53, v54 : u32; + v49 = hir.int_to_ptr v46 : ptr; + v50 = hir.load v49 : felt; + v168 = arith.constant 4 : u32; + v51 = hir.bitcast v42 : u32; + v53 = arith.add v51, v168 : u32 #[overflow = checked]; + v167 = arith.constant 4 : u32; + v55 = arith.mod v53, v167 : u32; hir.assertz v55 #[code = 250]; - v56 = hir.int_to_ptr v53 : ptr; + v56 = hir.int_to_ptr v53 : ptr; hir.store v56, v50; - v57 = hir.bitcast v6 : u32; - v231 = arith.constant 8 : u32; - v59 = arith.mod v57, v231 : u32; - hir.assertz v59 #[code = 250]; - v60 = hir.int_to_ptr v57 : ptr; - v61 = hir.load v60 : i64; - v62 = hir.bitcast v43 : u32; - v230 = arith.constant 4 : u32; - v64 = arith.mod v62, v230 : u32; - hir.assertz v64 #[code = 250]; - v65 = hir.int_to_ptr v62 : ptr; - hir.store v65, v61; - v229 = arith.constant 48 : i32; - v67 = arith.add v6, v229 : i32 #[overflow = wrapping]; - v68 = builtin.global_symbol @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/__stack_pointer : ptr - v69 = hir.bitcast v68 : ptr; - hir.store v69, v67; - builtin.ret v43; + v57 = hir.load_local : i32 #[local = lv1]; + v58 = hir.load_local : i32 #[local = lv0]; + v166 = arith.constant 12 : u32; + v59 = hir.bitcast v58 : u32; + v61 = arith.add v59, v166 : u32 #[overflow = checked]; + v165 = arith.constant 4 : u32; + v63 = arith.mod v61, v165 : u32; + hir.assertz v63 #[code = 250]; + v64 = hir.int_to_ptr v61 : ptr; + v65 = hir.load v64 : felt; + v66 = hir.bitcast v57 : u32; + v164 = arith.constant 4 : u32; + v68 = arith.mod v66, v164 : u32; + hir.assertz v68 #[code = 250]; + v69 = hir.int_to_ptr v66 : ptr; + hir.store v69, v65; + v70 = hir.load_local : i32 #[local = lv0]; + v163 = arith.constant 16 : i32; + v72 = arith.add v70, v163 : i32 #[overflow = wrapping]; + v73 = builtin.global_symbol @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/__stack_pointer : ptr + v74 = hir.bitcast v73 : ptr; + hir.store v74, v72; + v75 = hir.load_local : i32 #[local = lv1]; + builtin.ret v75; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v71 = builtin.global_symbol @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/GOT.data.internal.__memory_base : ptr - v72 = hir.bitcast v71 : ptr; - v73 = hir.load v72 : i32; - v74 = arith.constant 1048600 : i32; - v75 = arith.add v73, v74 : i32 #[overflow = wrapping]; - v76 = hir.bitcast v75 : u32; - v77 = hir.int_to_ptr v76 : ptr; - v78 = hir.load v77 : u8; - v70 = arith.constant 0 : i32; - v79 = arith.zext v78 : u32; - v80 = hir.bitcast v79 : i32; - v82 = arith.neq v80, v70 : i1; - scf.if v82{ + v76 = builtin.global_symbol @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/GOT.data.internal.__memory_base : ptr + v77 = hir.bitcast v76 : ptr; + v78 = hir.load v77 : i32; + v179 = arith.constant 1048600 : i32; + v80 = arith.add v78, v179 : i32 #[overflow = wrapping]; + v81 = hir.bitcast v80 : u32; + v82 = hir.int_to_ptr v81 : ptr; + v83 = hir.load v82 : u8; + v178 = arith.constant 0 : i32; + v84 = arith.zext v83 : u32; + v85 = hir.bitcast v84 : i32; + v87 = arith.neq v85, v178 : i1; + scf.if v87{ ^block13: scf.yield ; } else { ^block14: - v83 = builtin.global_symbol @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/GOT.data.internal.__memory_base : ptr - v84 = hir.bitcast v83 : ptr; - v85 = hir.load v84 : i32; + v88 = builtin.global_symbol @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/GOT.data.internal.__memory_base : ptr + v89 = hir.bitcast v88 : ptr; + v90 = hir.load v89 : i32; + hir.store_local v90 #[local = lv0]; hir.exec @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/__wasm_call_ctors() - v239 = arith.constant 1 : u8; - v241 = arith.constant 1048600 : i32; - v87 = arith.add v85, v241 : i32 #[overflow = wrapping]; - v91 = hir.bitcast v87 : u32; - v92 = hir.int_to_ptr v91 : ptr; - hir.store v92, v239; + v91 = hir.load_local : i32 #[local = lv0]; + v177 = arith.constant 1 : u8; + v182 = arith.constant 1048600 : i32; + v93 = arith.add v91, v182 : i32 #[overflow = wrapping]; + v97 = hir.bitcast v93 : u32; + v98 = hir.int_to_ptr v97 : ptr; + hir.store v98, v177; scf.yield ; }; builtin.ret ; }; - private builtin.function @::reverse(v93: i32, v94: i32) { - ^block15(v93: i32, v94: i32): - v97 = builtin.global_symbol @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/__stack_pointer : ptr - v98 = hir.bitcast v97 : ptr; - v99 = hir.load v98 : i32; - v100 = arith.constant 16 : i32; - v101 = arith.sub v99, v100 : i32 #[overflow = wrapping]; - v103 = arith.constant 8 : u32; - v102 = hir.bitcast v94 : u32; - v104 = arith.add v102, v103 : u32 #[overflow = checked]; - v328 = arith.constant 8 : u32; - v106 = arith.mod v104, v328 : u32; - hir.assertz v106 #[code = 250]; - v107 = hir.int_to_ptr v104 : ptr; - v108 = hir.load v107 : i64; - v327 = arith.constant 8 : u32; - v109 = hir.bitcast v101 : u32; - v111 = arith.add v109, v327 : u32 #[overflow = checked]; - v112 = arith.constant 4 : u32; - v113 = arith.mod v111, v112 : u32; - hir.assertz v113 #[code = 250]; - v114 = hir.int_to_ptr v111 : ptr; - hir.store v114, v108; - v115 = hir.bitcast v94 : u32; - v326 = arith.constant 8 : u32; - v117 = arith.mod v115, v326 : u32; - hir.assertz v117 #[code = 250]; - v118 = hir.int_to_ptr v115 : ptr; - v119 = hir.load v118 : i64; - v120 = hir.bitcast v101 : u32; - v325 = arith.constant 4 : u32; - v122 = arith.mod v120, v325 : u32; - hir.assertz v122 #[code = 250]; - v123 = hir.int_to_ptr v120 : ptr; - hir.store v123, v119; - v124 = arith.constant 12 : i32; - v125 = arith.add v101, v124 : i32 #[overflow = wrapping]; - v95 = arith.constant 0 : i32; - v296, v297, v298, v299, v300, v301 = scf.while v95, v101, v125, v93 : i32, i32, i32, i32, i32, i32 { - ^block35(v302: i32, v303: i32, v304: i32, v305: i32): - v324 = arith.constant 0 : i32; - v128 = arith.constant 8 : i32; - v129 = arith.eq v302, v128 : i1; - v130 = arith.zext v129 : u32; - v131 = hir.bitcast v130 : i32; - v133 = arith.neq v131, v324 : i1; - v290, v291 = scf.if v133 : i32, i32 { - ^block34: - v250 = ub.poison i32 : i32; - scf.yield v250, v250; - } else { - ^block20: - v135 = arith.add v303, v302 : i32 #[overflow = wrapping]; - v136 = hir.bitcast v135 : u32; - v323 = arith.constant 4 : u32; - v138 = arith.mod v136, v323 : u32; - hir.assertz v138 #[code = 250]; - v139 = hir.int_to_ptr v136 : ptr; - v140 = hir.load v139 : felt; - v142 = hir.bitcast v304 : u32; - v322 = arith.constant 4 : u32; - v144 = arith.mod v142, v322 : u32; - hir.assertz v144 #[code = 250]; - v145 = hir.int_to_ptr v142 : ptr; - v146 = hir.load v145 : i32; - v147 = hir.bitcast v135 : u32; - v321 = arith.constant 4 : u32; - v149 = arith.mod v147, v321 : u32; - hir.assertz v149 #[code = 250]; - v150 = hir.int_to_ptr v147 : ptr; - hir.store v150, v146; - v151 = hir.bitcast v304 : u32; - v320 = arith.constant 4 : u32; - v153 = arith.mod v151, v320 : u32; - hir.assertz v153 #[code = 250]; - v154 = hir.int_to_ptr v151 : ptr; - hir.store v154, v140; - v157 = arith.constant -4 : i32; - v158 = arith.add v304, v157 : i32 #[overflow = wrapping]; - v155 = arith.constant 4 : i32; - v156 = arith.add v302, v155 : i32 #[overflow = wrapping]; - scf.yield v156, v158; - }; - v318 = ub.poison i32 : i32; - v293 = cf.select v133, v318, v305 : i32; - v319 = ub.poison i32 : i32; - v292 = cf.select v133, v319, v303 : i32; - v249 = arith.constant 1 : u32; - v242 = arith.constant 0 : u32; - v295 = cf.select v133, v242, v249 : u32; - v283 = arith.trunc v295 : i1; - scf.condition v283, v290, v292, v291, v293, v303, v305; - } do { - ^block36(v306: i32, v307: i32, v308: i32, v309: i32, v310: i32, v311: i32): - scf.yield v306, v307, v308, v309; - }; - v317 = arith.constant 8 : u32; - v160 = hir.bitcast v300 : u32; - v162 = arith.add v160, v317 : u32 #[overflow = checked]; - v316 = arith.constant 4 : u32; - v164 = arith.mod v162, v316 : u32; - hir.assertz v164 #[code = 250]; - v165 = hir.int_to_ptr v162 : ptr; - v166 = hir.load v165 : i64; - v315 = arith.constant 8 : u32; - v167 = hir.bitcast v301 : u32; - v169 = arith.add v167, v315 : u32 #[overflow = checked]; - v314 = arith.constant 8 : u32; - v171 = arith.mod v169, v314 : u32; - hir.assertz v171 #[code = 250]; - v172 = hir.int_to_ptr v169 : ptr; - hir.store v172, v166; - v173 = hir.bitcast v300 : u32; - v313 = arith.constant 4 : u32; - v175 = arith.mod v173, v313 : u32; - hir.assertz v175 #[code = 250]; - v176 = hir.int_to_ptr v173 : ptr; - v177 = hir.load v176 : i64; - v178 = hir.bitcast v301 : u32; - v312 = arith.constant 8 : u32; - v180 = arith.mod v178, v312 : u32; - hir.assertz v180 #[code = 250]; - v181 = hir.int_to_ptr v178 : ptr; - hir.store v181, v177; - builtin.ret ; - }; - - private builtin.function @miden::active_account::get_initial_storage_commitment(v182: i32) { - ^block21(v182: i32): - v183, v184, v185, v186 = hir.exec @miden/active_account/get_initial_storage_commitment() : felt, felt, felt, felt - v187 = hir.bitcast v182 : u32; - v188 = hir.int_to_ptr v187 : ptr; - hir.store v188, v183; - v189 = arith.constant 4 : u32; - v190 = arith.add v187, v189 : u32 #[overflow = checked]; - v191 = hir.int_to_ptr v190 : ptr; - hir.store v191, v184; - v192 = arith.constant 8 : u32; - v193 = arith.add v187, v192 : u32 #[overflow = checked]; - v194 = hir.int_to_ptr v193 : ptr; - hir.store v194, v185; - v195 = arith.constant 12 : u32; - v196 = arith.add v187, v195 : u32 #[overflow = checked]; - v197 = hir.int_to_ptr v196 : ptr; - hir.store v197, v186; + private builtin.function @miden::protocol::active_account::get_initial_storage_commitment(v99: i32) { + ^block15(v99: i32): + v100, v101, v102, v103 = hir.exec @miden/protocol/active_account/get_initial_storage_commitment() : felt, felt, felt, felt + v104 = hir.bitcast v99 : u32; + v105 = hir.int_to_ptr v104 : ptr; + hir.store v105, v100; + v185 = arith.constant 4 : u32; + v107 = arith.add v104, v185 : u32 #[overflow = checked]; + v108 = hir.int_to_ptr v107 : ptr; + hir.store v108, v101; + v184 = arith.constant 8 : u32; + v110 = arith.add v104, v184 : u32 #[overflow = checked]; + v111 = hir.int_to_ptr v110 : ptr; + hir.store v111, v102; + v183 = arith.constant 12 : u32; + v113 = arith.add v104, v183 : u32 #[overflow = checked]; + v114 = hir.int_to_ptr v113 : ptr; + hir.store v114, v103; builtin.ret ; }; @@ -294,34 +178,34 @@ builtin.component miden:rust-sdk-account-get-initial-storage-commitment-binding/ }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block25: - v198 = hir.exec @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1#binding() : i32 + ^block20: + v115 = hir.exec @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1#binding() : i32 + v189 = arith.constant 0 : i32; + v117 = arith.add v115, v189 : i32 #[overflow = unchecked]; + v198 = arith.constant 0 : i32; v199 = arith.constant 0 : i32; - v200 = arith.add v198, v199 : i32 #[overflow = unchecked]; - v332 = arith.constant 0 : i32; - v333 = arith.constant 0 : i32; - v202 = arith.add v200, v333 : i32 #[overflow = unchecked]; - v204 = arith.add v202, v332 : i32 #[overflow = unchecked]; - v205 = hir.int_to_ptr v204 : ptr; - v206 = hir.load v205 : felt; - v331 = arith.constant 0 : i32; - v207 = arith.constant 4 : i32; - v208 = arith.add v200, v207 : i32 #[overflow = unchecked]; - v210 = arith.add v208, v331 : i32 #[overflow = unchecked]; - v211 = hir.int_to_ptr v210 : ptr; - v212 = hir.load v211 : felt; - v330 = arith.constant 0 : i32; - v213 = arith.constant 8 : i32; - v214 = arith.add v200, v213 : i32 #[overflow = unchecked]; - v216 = arith.add v214, v330 : i32 #[overflow = unchecked]; - v217 = hir.int_to_ptr v216 : ptr; - v218 = hir.load v217 : felt; - v329 = arith.constant 0 : i32; - v219 = arith.constant 12 : i32; - v220 = arith.add v200, v219 : i32 #[overflow = unchecked]; - v222 = arith.add v220, v329 : i32 #[overflow = unchecked]; - v223 = hir.int_to_ptr v222 : ptr; - v224 = hir.load v223 : felt; - builtin.ret v206, v212, v218, v224; + v119 = arith.add v117, v199 : i32 #[overflow = unchecked]; + v121 = arith.add v119, v198 : i32 #[overflow = unchecked]; + v122 = hir.int_to_ptr v121 : ptr; + v123 = hir.load v122 : felt; + v197 = arith.constant 0 : i32; + v188 = arith.constant 4 : i32; + v125 = arith.add v117, v188 : i32 #[overflow = unchecked]; + v127 = arith.add v125, v197 : i32 #[overflow = unchecked]; + v128 = hir.int_to_ptr v127 : ptr; + v129 = hir.load v128 : felt; + v196 = arith.constant 0 : i32; + v187 = arith.constant 8 : i32; + v131 = arith.add v117, v187 : i32 #[overflow = unchecked]; + v133 = arith.add v131, v196 : i32 #[overflow = unchecked]; + v134 = hir.int_to_ptr v133 : ptr; + v135 = hir.load v134 : felt; + v195 = arith.constant 0 : i32; + v186 = arith.constant 12 : i32; + v137 = arith.add v117, v186 : i32 #[overflow = unchecked]; + v139 = arith.add v137, v195 : i32 #[overflow = unchecked]; + v140 = hir.int_to_ptr v139 : ptr; + v141 = hir.load v140 : felt; + builtin.ret v123, v129, v135, v141; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.masm index 665e28f98..3d9e67714 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.masm @@ -1,13 +1,13 @@ -# mod miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1 +# mod ::"miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> (felt, felt, felt, felt) - exec.::miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1::init + exec."miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1::rust_sdk_account_get_initial_storage_commitment_binding::miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1#binding + exec.::"miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1"::rust_sdk_account_get_initial_storage_commitment_binding::"miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1#binding" trace.252 nop push.0 @@ -62,7 +62,7 @@ pub proc binding( nop movdn.3 swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -75,7 +75,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -86,7 +86,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1::rust_sdk_account_get_initial_storage_commitment_binding +# mod ::"miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1"::rust_sdk_account_get_initial_storage_commitment_binding @callconv("C") proc __wasm_call_ctors( @@ -102,6 +102,7 @@ proc rust_sdk_account_get_initial_storage_commitment_binding::bindings::__link_c nop end +@locals("2") @callconv("C") proc miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1#binding( @@ -114,36 +115,87 @@ proc miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-acco exec.::intrinsics::mem::load_sw trace.252 nop - push.48 + push.16 u32wrapping_sub + dup.0 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 - dup.1 + u32divmod.4 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114148 u32divmod.4 swap.1 trace.240 nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop exec.::intrinsics::mem::store_sw trace.252 nop trace.240 nop - exec.::miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1::rust_sdk_account_get_initial_storage_commitment_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1"::rust_sdk_account_get_initial_storage_commitment_binding::wit_bindgen::rt::run_ctors_once trace.252 nop - push.16 - dup.1 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1"::rust_sdk_account_get_initial_storage_commitment_binding::"miden::protocol::active_account::get_initial_storage_commitment" + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 u32wrapping_add + dup.0 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1::rust_sdk_account_get_initial_storage_commitment_binding::miden::active_account::get_initial_storage_commitment + exec.::intrinsics::mem::store_sw trace.252 nop - push.24 - dup.1 - add - u32assert - push.8 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 dup.1 swap.1 u32mod @@ -153,15 +205,14 @@ proc miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-acco swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.40 - dup.3 + push.12 + movup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -169,18 +220,32 @@ proc miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-acco assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.16 - dup.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -190,15 +255,14 @@ proc miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-acco swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.32 - dup.3 + push.8 + movup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -206,37 +270,32 @@ proc miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-acco assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.1114148 - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.32 - dup.2 - u32wrapping_add - dup.2 + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1::rust_sdk_account_get_initial_storage_commitment_binding::::reverse + exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 - u32wrapping_add push.8 - dup.2 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -246,12 +305,11 @@ proc miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-acco swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.8 - dup.3 + push.4 + movup.2 add u32assert push.4 @@ -262,15 +320,32 @@ proc miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-acco assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - dup.1 - push.8 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + swap.1 + add + u32assert + push.4 dup.1 swap.1 u32mod @@ -280,11 +355,10 @@ proc miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-acco swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop swap.1 - dup.2 push.4 dup.1 swap.1 @@ -293,15 +367,20 @@ proc miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-acco assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.48 - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 u32wrapping_add push.1114144 u32divmod.4 @@ -311,8 +390,17 @@ proc miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-acco exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -354,9 +442,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop trace.240 nop - exec.::miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1::rust_sdk_account_get_initial_storage_commitment_binding::__wasm_call_ctors + exec.::"miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1"::rust_sdk_account_get_initial_storage_commitment_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -388,287 +492,10 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.4 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop -end - -@callconv("C") -proc miden::active_account::get_initial_storage_commitment(i32) +proc miden::protocol::active_account::get_initial_storage_commitment(i32) trace.240 nop - exec.::miden::active_account::get_initial_storage_commitment + exec.::miden::protocol::active_account::get_initial_storage_commitment trace.252 nop movup.4 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.wat index 5a66e339d..aaa4611f4 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.wat @@ -12,8 +12,7 @@ (core module $main (;0;) (type (;0;) (func)) (type (;1;) (func (result i32))) - (type (;2;) (func (param i32 i32))) - (type (;3;) (func (param i32))) + (type (;2;) (func (param i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -26,43 +25,36 @@ (func $miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1#binding (;2;) (type 1) (result i32) (local i32 i32) global.get $__stack_pointer - i32.const 48 + i32.const 16 i32.sub local.tee 0 global.set $__stack_pointer - call $wit_bindgen::rt::run_ctors_once - local.get 0 - i32.const 16 - i32.add - call $miden::active_account::get_initial_storage_commitment - local.get 0 - local.get 0 - i64.load offset=24 - i64.store offset=40 - local.get 0 - local.get 0 - i64.load offset=16 - i64.store offset=32 global.get $GOT.data.internal.__memory_base local.set 1 + call $wit_bindgen::rt::run_ctors_once local.get 0 - local.get 0 - i32.const 32 - i32.add - call $::reverse + call $miden::protocol::active_account::get_initial_storage_commitment local.get 1 i32.const 1048584 i32.add local.tee 1 local.get 0 - i64.load offset=8 - i64.store offset=8 align=4 + f32.load + f32.store offset=12 local.get 1 local.get 0 - i64.load - i64.store align=4 + f32.load offset=4 + f32.store offset=8 + local.get 1 + local.get 0 + f32.load offset=8 + f32.store offset=4 + local.get 1 local.get 0 - i32.const 48 + f32.load offset=12 + f32.store + local.get 0 + i32.const 16 i32.add global.set $__stack_pointer local.get 1 @@ -85,69 +77,11 @@ i32.store8 end ) - (func $::reverse (;4;) (type 2) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store - ) - (func $miden::active_account::get_initial_storage_commitment (;5;) (type 3) (param i32) + (func $miden::protocol::active_account::get_initial_storage_commitment (;4;) (type 2) (param i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "orust_sdk_account_get_initial_storage_commitment_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "orust_sdk_account_get_initial_storage_commitment_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.hir index d8e13a4ee..ef72b0f7a 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.hir @@ -12,273 +12,157 @@ builtin.component miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk private builtin.function @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1#binding() -> i32 { ^block9: - v2 = builtin.global_symbol @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/__stack_pointer : ptr - v3 = hir.bitcast v2 : ptr; - v4 = hir.load v3 : i32; - v5 = arith.constant 48 : i32; - v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; - v7 = builtin.global_symbol @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/__stack_pointer : ptr - v8 = hir.bitcast v7 : ptr; - hir.store v8, v6; + v1 = builtin.global_symbol @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v150 = arith.constant 16 : i32; + v5 = arith.sub v3, v150 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; + v8 = builtin.global_symbol @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/GOT.data.internal.__memory_base : ptr + v9 = hir.bitcast v8 : ptr; + v10 = hir.load v9 : i32; + hir.store_local v10 #[local = lv1]; hir.exec @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/wit_bindgen::rt::run_ctors_once() - v9 = arith.constant 16 : i32; - v10 = arith.add v6, v9 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/miden::active_account::get_initial_vault_root(v10) - v12 = arith.constant 24 : u32; - v11 = hir.bitcast v6 : u32; - v13 = arith.add v11, v12 : u32 #[overflow = checked]; - v14 = arith.constant 8 : u32; - v15 = arith.mod v13, v14 : u32; - hir.assertz v15 #[code = 250]; - v16 = hir.int_to_ptr v13 : ptr; - v17 = hir.load v16 : i64; - v19 = arith.constant 40 : u32; - v18 = hir.bitcast v6 : u32; - v20 = arith.add v18, v19 : u32 #[overflow = checked]; - v237 = arith.constant 8 : u32; - v22 = arith.mod v20, v237 : u32; - hir.assertz v22 #[code = 250]; - v23 = hir.int_to_ptr v20 : ptr; - hir.store v23, v17; - v25 = arith.constant 16 : u32; - v24 = hir.bitcast v6 : u32; - v26 = arith.add v24, v25 : u32 #[overflow = checked]; - v236 = arith.constant 8 : u32; - v28 = arith.mod v26, v236 : u32; - hir.assertz v28 #[code = 250]; - v29 = hir.int_to_ptr v26 : ptr; - v30 = hir.load v29 : i64; - v32 = arith.constant 32 : u32; - v31 = hir.bitcast v6 : u32; - v33 = arith.add v31, v32 : u32 #[overflow = checked]; - v235 = arith.constant 8 : u32; - v35 = arith.mod v33, v235 : u32; - hir.assertz v35 #[code = 250]; - v36 = hir.int_to_ptr v33 : ptr; - hir.store v36, v30; - v37 = builtin.global_symbol @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/GOT.data.internal.__memory_base : ptr - v38 = hir.bitcast v37 : ptr; - v39 = hir.load v38 : i32; - v40 = arith.constant 32 : i32; - v41 = arith.add v6, v40 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/::reverse(v6, v41) - v42 = arith.constant 1048584 : i32; - v43 = arith.add v39, v42 : i32 #[overflow = wrapping]; - v234 = arith.constant 8 : u32; - v44 = hir.bitcast v6 : u32; - v46 = arith.add v44, v234 : u32 #[overflow = checked]; - v233 = arith.constant 8 : u32; - v48 = arith.mod v46, v233 : u32; + v11 = hir.load_local : i32 #[local = lv0]; + hir.exec @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/miden::protocol::active_account::get_initial_vault_root(v11) + v12 = hir.load_local : i32 #[local = lv1]; + v149 = arith.constant 1048584 : i32; + v14 = arith.add v12, v149 : i32 #[overflow = wrapping]; + hir.store_local v14 #[local = lv1]; + v15 = hir.load_local : i32 #[local = lv0]; + v16 = hir.bitcast v15 : u32; + v148 = arith.constant 4 : u32; + v18 = arith.mod v16, v148 : u32; + hir.assertz v18 #[code = 250]; + v19 = hir.int_to_ptr v16 : ptr; + v20 = hir.load v19 : felt; + v147 = arith.constant 12 : u32; + v21 = hir.bitcast v14 : u32; + v23 = arith.add v21, v147 : u32 #[overflow = checked]; + v174 = arith.constant 4 : u32; + v25 = arith.mod v23, v174 : u32; + hir.assertz v25 #[code = 250]; + v26 = hir.int_to_ptr v23 : ptr; + hir.store v26, v20; + v27 = hir.load_local : i32 #[local = lv1]; + v28 = hir.load_local : i32 #[local = lv0]; + v173 = arith.constant 4 : u32; + v29 = hir.bitcast v28 : u32; + v31 = arith.add v29, v173 : u32 #[overflow = checked]; + v172 = arith.constant 4 : u32; + v33 = arith.mod v31, v172 : u32; + hir.assertz v33 #[code = 250]; + v34 = hir.int_to_ptr v31 : ptr; + v35 = hir.load v34 : felt; + v146 = arith.constant 8 : u32; + v36 = hir.bitcast v27 : u32; + v38 = arith.add v36, v146 : u32 #[overflow = checked]; + v171 = arith.constant 4 : u32; + v40 = arith.mod v38, v171 : u32; + hir.assertz v40 #[code = 250]; + v41 = hir.int_to_ptr v38 : ptr; + hir.store v41, v35; + v42 = hir.load_local : i32 #[local = lv1]; + v43 = hir.load_local : i32 #[local = lv0]; + v170 = arith.constant 8 : u32; + v44 = hir.bitcast v43 : u32; + v46 = arith.add v44, v170 : u32 #[overflow = checked]; + v169 = arith.constant 4 : u32; + v48 = arith.mod v46, v169 : u32; hir.assertz v48 #[code = 250]; - v49 = hir.int_to_ptr v46 : ptr; - v50 = hir.load v49 : i64; - v232 = arith.constant 8 : u32; - v51 = hir.bitcast v43 : u32; - v53 = arith.add v51, v232 : u32 #[overflow = checked]; - v54 = arith.constant 4 : u32; - v55 = arith.mod v53, v54 : u32; + v49 = hir.int_to_ptr v46 : ptr; + v50 = hir.load v49 : felt; + v168 = arith.constant 4 : u32; + v51 = hir.bitcast v42 : u32; + v53 = arith.add v51, v168 : u32 #[overflow = checked]; + v167 = arith.constant 4 : u32; + v55 = arith.mod v53, v167 : u32; hir.assertz v55 #[code = 250]; - v56 = hir.int_to_ptr v53 : ptr; + v56 = hir.int_to_ptr v53 : ptr; hir.store v56, v50; - v57 = hir.bitcast v6 : u32; - v231 = arith.constant 8 : u32; - v59 = arith.mod v57, v231 : u32; - hir.assertz v59 #[code = 250]; - v60 = hir.int_to_ptr v57 : ptr; - v61 = hir.load v60 : i64; - v62 = hir.bitcast v43 : u32; - v230 = arith.constant 4 : u32; - v64 = arith.mod v62, v230 : u32; - hir.assertz v64 #[code = 250]; - v65 = hir.int_to_ptr v62 : ptr; - hir.store v65, v61; - v229 = arith.constant 48 : i32; - v67 = arith.add v6, v229 : i32 #[overflow = wrapping]; - v68 = builtin.global_symbol @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/__stack_pointer : ptr - v69 = hir.bitcast v68 : ptr; - hir.store v69, v67; - builtin.ret v43; + v57 = hir.load_local : i32 #[local = lv1]; + v58 = hir.load_local : i32 #[local = lv0]; + v166 = arith.constant 12 : u32; + v59 = hir.bitcast v58 : u32; + v61 = arith.add v59, v166 : u32 #[overflow = checked]; + v165 = arith.constant 4 : u32; + v63 = arith.mod v61, v165 : u32; + hir.assertz v63 #[code = 250]; + v64 = hir.int_to_ptr v61 : ptr; + v65 = hir.load v64 : felt; + v66 = hir.bitcast v57 : u32; + v164 = arith.constant 4 : u32; + v68 = arith.mod v66, v164 : u32; + hir.assertz v68 #[code = 250]; + v69 = hir.int_to_ptr v66 : ptr; + hir.store v69, v65; + v70 = hir.load_local : i32 #[local = lv0]; + v163 = arith.constant 16 : i32; + v72 = arith.add v70, v163 : i32 #[overflow = wrapping]; + v73 = builtin.global_symbol @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/__stack_pointer : ptr + v74 = hir.bitcast v73 : ptr; + hir.store v74, v72; + v75 = hir.load_local : i32 #[local = lv1]; + builtin.ret v75; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v71 = builtin.global_symbol @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/GOT.data.internal.__memory_base : ptr - v72 = hir.bitcast v71 : ptr; - v73 = hir.load v72 : i32; - v74 = arith.constant 1048600 : i32; - v75 = arith.add v73, v74 : i32 #[overflow = wrapping]; - v76 = hir.bitcast v75 : u32; - v77 = hir.int_to_ptr v76 : ptr; - v78 = hir.load v77 : u8; - v70 = arith.constant 0 : i32; - v79 = arith.zext v78 : u32; - v80 = hir.bitcast v79 : i32; - v82 = arith.neq v80, v70 : i1; - scf.if v82{ + v76 = builtin.global_symbol @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/GOT.data.internal.__memory_base : ptr + v77 = hir.bitcast v76 : ptr; + v78 = hir.load v77 : i32; + v179 = arith.constant 1048600 : i32; + v80 = arith.add v78, v179 : i32 #[overflow = wrapping]; + v81 = hir.bitcast v80 : u32; + v82 = hir.int_to_ptr v81 : ptr; + v83 = hir.load v82 : u8; + v178 = arith.constant 0 : i32; + v84 = arith.zext v83 : u32; + v85 = hir.bitcast v84 : i32; + v87 = arith.neq v85, v178 : i1; + scf.if v87{ ^block13: scf.yield ; } else { ^block14: - v83 = builtin.global_symbol @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/GOT.data.internal.__memory_base : ptr - v84 = hir.bitcast v83 : ptr; - v85 = hir.load v84 : i32; + v88 = builtin.global_symbol @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/GOT.data.internal.__memory_base : ptr + v89 = hir.bitcast v88 : ptr; + v90 = hir.load v89 : i32; + hir.store_local v90 #[local = lv0]; hir.exec @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/__wasm_call_ctors() - v239 = arith.constant 1 : u8; - v241 = arith.constant 1048600 : i32; - v87 = arith.add v85, v241 : i32 #[overflow = wrapping]; - v91 = hir.bitcast v87 : u32; - v92 = hir.int_to_ptr v91 : ptr; - hir.store v92, v239; + v91 = hir.load_local : i32 #[local = lv0]; + v177 = arith.constant 1 : u8; + v182 = arith.constant 1048600 : i32; + v93 = arith.add v91, v182 : i32 #[overflow = wrapping]; + v97 = hir.bitcast v93 : u32; + v98 = hir.int_to_ptr v97 : ptr; + hir.store v98, v177; scf.yield ; }; builtin.ret ; }; - private builtin.function @::reverse(v93: i32, v94: i32) { - ^block15(v93: i32, v94: i32): - v97 = builtin.global_symbol @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/__stack_pointer : ptr - v98 = hir.bitcast v97 : ptr; - v99 = hir.load v98 : i32; - v100 = arith.constant 16 : i32; - v101 = arith.sub v99, v100 : i32 #[overflow = wrapping]; - v103 = arith.constant 8 : u32; - v102 = hir.bitcast v94 : u32; - v104 = arith.add v102, v103 : u32 #[overflow = checked]; - v328 = arith.constant 8 : u32; - v106 = arith.mod v104, v328 : u32; - hir.assertz v106 #[code = 250]; - v107 = hir.int_to_ptr v104 : ptr; - v108 = hir.load v107 : i64; - v327 = arith.constant 8 : u32; - v109 = hir.bitcast v101 : u32; - v111 = arith.add v109, v327 : u32 #[overflow = checked]; - v112 = arith.constant 4 : u32; - v113 = arith.mod v111, v112 : u32; - hir.assertz v113 #[code = 250]; - v114 = hir.int_to_ptr v111 : ptr; - hir.store v114, v108; - v115 = hir.bitcast v94 : u32; - v326 = arith.constant 8 : u32; - v117 = arith.mod v115, v326 : u32; - hir.assertz v117 #[code = 250]; - v118 = hir.int_to_ptr v115 : ptr; - v119 = hir.load v118 : i64; - v120 = hir.bitcast v101 : u32; - v325 = arith.constant 4 : u32; - v122 = arith.mod v120, v325 : u32; - hir.assertz v122 #[code = 250]; - v123 = hir.int_to_ptr v120 : ptr; - hir.store v123, v119; - v124 = arith.constant 12 : i32; - v125 = arith.add v101, v124 : i32 #[overflow = wrapping]; - v95 = arith.constant 0 : i32; - v296, v297, v298, v299, v300, v301 = scf.while v95, v101, v125, v93 : i32, i32, i32, i32, i32, i32 { - ^block35(v302: i32, v303: i32, v304: i32, v305: i32): - v324 = arith.constant 0 : i32; - v128 = arith.constant 8 : i32; - v129 = arith.eq v302, v128 : i1; - v130 = arith.zext v129 : u32; - v131 = hir.bitcast v130 : i32; - v133 = arith.neq v131, v324 : i1; - v290, v291 = scf.if v133 : i32, i32 { - ^block34: - v250 = ub.poison i32 : i32; - scf.yield v250, v250; - } else { - ^block20: - v135 = arith.add v303, v302 : i32 #[overflow = wrapping]; - v136 = hir.bitcast v135 : u32; - v323 = arith.constant 4 : u32; - v138 = arith.mod v136, v323 : u32; - hir.assertz v138 #[code = 250]; - v139 = hir.int_to_ptr v136 : ptr; - v140 = hir.load v139 : felt; - v142 = hir.bitcast v304 : u32; - v322 = arith.constant 4 : u32; - v144 = arith.mod v142, v322 : u32; - hir.assertz v144 #[code = 250]; - v145 = hir.int_to_ptr v142 : ptr; - v146 = hir.load v145 : i32; - v147 = hir.bitcast v135 : u32; - v321 = arith.constant 4 : u32; - v149 = arith.mod v147, v321 : u32; - hir.assertz v149 #[code = 250]; - v150 = hir.int_to_ptr v147 : ptr; - hir.store v150, v146; - v151 = hir.bitcast v304 : u32; - v320 = arith.constant 4 : u32; - v153 = arith.mod v151, v320 : u32; - hir.assertz v153 #[code = 250]; - v154 = hir.int_to_ptr v151 : ptr; - hir.store v154, v140; - v157 = arith.constant -4 : i32; - v158 = arith.add v304, v157 : i32 #[overflow = wrapping]; - v155 = arith.constant 4 : i32; - v156 = arith.add v302, v155 : i32 #[overflow = wrapping]; - scf.yield v156, v158; - }; - v318 = ub.poison i32 : i32; - v293 = cf.select v133, v318, v305 : i32; - v319 = ub.poison i32 : i32; - v292 = cf.select v133, v319, v303 : i32; - v249 = arith.constant 1 : u32; - v242 = arith.constant 0 : u32; - v295 = cf.select v133, v242, v249 : u32; - v283 = arith.trunc v295 : i1; - scf.condition v283, v290, v292, v291, v293, v303, v305; - } do { - ^block36(v306: i32, v307: i32, v308: i32, v309: i32, v310: i32, v311: i32): - scf.yield v306, v307, v308, v309; - }; - v317 = arith.constant 8 : u32; - v160 = hir.bitcast v300 : u32; - v162 = arith.add v160, v317 : u32 #[overflow = checked]; - v316 = arith.constant 4 : u32; - v164 = arith.mod v162, v316 : u32; - hir.assertz v164 #[code = 250]; - v165 = hir.int_to_ptr v162 : ptr; - v166 = hir.load v165 : i64; - v315 = arith.constant 8 : u32; - v167 = hir.bitcast v301 : u32; - v169 = arith.add v167, v315 : u32 #[overflow = checked]; - v314 = arith.constant 8 : u32; - v171 = arith.mod v169, v314 : u32; - hir.assertz v171 #[code = 250]; - v172 = hir.int_to_ptr v169 : ptr; - hir.store v172, v166; - v173 = hir.bitcast v300 : u32; - v313 = arith.constant 4 : u32; - v175 = arith.mod v173, v313 : u32; - hir.assertz v175 #[code = 250]; - v176 = hir.int_to_ptr v173 : ptr; - v177 = hir.load v176 : i64; - v178 = hir.bitcast v301 : u32; - v312 = arith.constant 8 : u32; - v180 = arith.mod v178, v312 : u32; - hir.assertz v180 #[code = 250]; - v181 = hir.int_to_ptr v178 : ptr; - hir.store v181, v177; - builtin.ret ; - }; - - private builtin.function @miden::active_account::get_initial_vault_root(v182: i32) { - ^block21(v182: i32): - v183, v184, v185, v186 = hir.exec @miden/active_account/get_initial_vault_root() : felt, felt, felt, felt - v187 = hir.bitcast v182 : u32; - v188 = hir.int_to_ptr v187 : ptr; - hir.store v188, v183; - v189 = arith.constant 4 : u32; - v190 = arith.add v187, v189 : u32 #[overflow = checked]; - v191 = hir.int_to_ptr v190 : ptr; - hir.store v191, v184; - v192 = arith.constant 8 : u32; - v193 = arith.add v187, v192 : u32 #[overflow = checked]; - v194 = hir.int_to_ptr v193 : ptr; - hir.store v194, v185; - v195 = arith.constant 12 : u32; - v196 = arith.add v187, v195 : u32 #[overflow = checked]; - v197 = hir.int_to_ptr v196 : ptr; - hir.store v197, v186; + private builtin.function @miden::protocol::active_account::get_initial_vault_root(v99: i32) { + ^block15(v99: i32): + v100, v101, v102, v103 = hir.exec @miden/protocol/active_account/get_initial_vault_root() : felt, felt, felt, felt + v104 = hir.bitcast v99 : u32; + v105 = hir.int_to_ptr v104 : ptr; + hir.store v105, v100; + v185 = arith.constant 4 : u32; + v107 = arith.add v104, v185 : u32 #[overflow = checked]; + v108 = hir.int_to_ptr v107 : ptr; + hir.store v108, v101; + v184 = arith.constant 8 : u32; + v110 = arith.add v104, v184 : u32 #[overflow = checked]; + v111 = hir.int_to_ptr v110 : ptr; + hir.store v111, v102; + v183 = arith.constant 12 : u32; + v113 = arith.add v104, v183 : u32 #[overflow = checked]; + v114 = hir.int_to_ptr v113 : ptr; + hir.store v114, v103; builtin.ret ; }; @@ -294,34 +178,34 @@ builtin.component miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block25: - v198 = hir.exec @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1#binding() : i32 + ^block20: + v115 = hir.exec @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1#binding() : i32 + v189 = arith.constant 0 : i32; + v117 = arith.add v115, v189 : i32 #[overflow = unchecked]; + v198 = arith.constant 0 : i32; v199 = arith.constant 0 : i32; - v200 = arith.add v198, v199 : i32 #[overflow = unchecked]; - v332 = arith.constant 0 : i32; - v333 = arith.constant 0 : i32; - v202 = arith.add v200, v333 : i32 #[overflow = unchecked]; - v204 = arith.add v202, v332 : i32 #[overflow = unchecked]; - v205 = hir.int_to_ptr v204 : ptr; - v206 = hir.load v205 : felt; - v331 = arith.constant 0 : i32; - v207 = arith.constant 4 : i32; - v208 = arith.add v200, v207 : i32 #[overflow = unchecked]; - v210 = arith.add v208, v331 : i32 #[overflow = unchecked]; - v211 = hir.int_to_ptr v210 : ptr; - v212 = hir.load v211 : felt; - v330 = arith.constant 0 : i32; - v213 = arith.constant 8 : i32; - v214 = arith.add v200, v213 : i32 #[overflow = unchecked]; - v216 = arith.add v214, v330 : i32 #[overflow = unchecked]; - v217 = hir.int_to_ptr v216 : ptr; - v218 = hir.load v217 : felt; - v329 = arith.constant 0 : i32; - v219 = arith.constant 12 : i32; - v220 = arith.add v200, v219 : i32 #[overflow = unchecked]; - v222 = arith.add v220, v329 : i32 #[overflow = unchecked]; - v223 = hir.int_to_ptr v222 : ptr; - v224 = hir.load v223 : felt; - builtin.ret v206, v212, v218, v224; + v119 = arith.add v117, v199 : i32 #[overflow = unchecked]; + v121 = arith.add v119, v198 : i32 #[overflow = unchecked]; + v122 = hir.int_to_ptr v121 : ptr; + v123 = hir.load v122 : felt; + v197 = arith.constant 0 : i32; + v188 = arith.constant 4 : i32; + v125 = arith.add v117, v188 : i32 #[overflow = unchecked]; + v127 = arith.add v125, v197 : i32 #[overflow = unchecked]; + v128 = hir.int_to_ptr v127 : ptr; + v129 = hir.load v128 : felt; + v196 = arith.constant 0 : i32; + v187 = arith.constant 8 : i32; + v131 = arith.add v117, v187 : i32 #[overflow = unchecked]; + v133 = arith.add v131, v196 : i32 #[overflow = unchecked]; + v134 = hir.int_to_ptr v133 : ptr; + v135 = hir.load v134 : felt; + v195 = arith.constant 0 : i32; + v186 = arith.constant 12 : i32; + v137 = arith.add v117, v186 : i32 #[overflow = unchecked]; + v139 = arith.add v137, v195 : i32 #[overflow = unchecked]; + v140 = hir.int_to_ptr v139 : ptr; + v141 = hir.load v140 : felt; + builtin.ret v123, v129, v135, v141; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.masm index 02bc36a4e..a8545e8fe 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.masm @@ -1,13 +1,13 @@ -# mod miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1 +# mod ::"miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> (felt, felt, felt, felt) - exec.::miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1::init + exec."miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1::rust_sdk_account_get_initial_vault_root_binding::miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1#binding + exec.::"miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1"::rust_sdk_account_get_initial_vault_root_binding::"miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1#binding" trace.252 nop push.0 @@ -62,7 +62,7 @@ pub proc binding( nop movdn.3 swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -75,7 +75,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -86,7 +86,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1::rust_sdk_account_get_initial_vault_root_binding +# mod ::"miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1"::rust_sdk_account_get_initial_vault_root_binding @callconv("C") proc __wasm_call_ctors( @@ -102,6 +102,7 @@ proc rust_sdk_account_get_initial_vault_root_binding::bindings::__link_custom_se nop end +@locals("2") @callconv("C") proc miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1#binding( @@ -114,36 +115,87 @@ proc miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get- exec.::intrinsics::mem::load_sw trace.252 nop - push.48 + push.16 u32wrapping_sub + dup.0 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 - dup.1 + u32divmod.4 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114148 u32divmod.4 swap.1 trace.240 nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop exec.::intrinsics::mem::store_sw trace.252 nop trace.240 nop - exec.::miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1::rust_sdk_account_get_initial_vault_root_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1"::rust_sdk_account_get_initial_vault_root_binding::wit_bindgen::rt::run_ctors_once trace.252 nop - push.16 - dup.1 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1"::rust_sdk_account_get_initial_vault_root_binding::"miden::protocol::active_account::get_initial_vault_root" + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 u32wrapping_add + dup.0 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1::rust_sdk_account_get_initial_vault_root_binding::miden::active_account::get_initial_vault_root + exec.::intrinsics::mem::store_sw trace.252 nop - push.24 - dup.1 - add - u32assert - push.8 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 dup.1 swap.1 u32mod @@ -153,15 +205,14 @@ proc miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get- swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.40 - dup.3 + push.12 + movup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -169,18 +220,32 @@ proc miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get- assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.16 - dup.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -190,15 +255,14 @@ proc miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get- swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.32 - dup.3 + push.8 + movup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -206,37 +270,32 @@ proc miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get- assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.1114148 - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.32 - dup.2 - u32wrapping_add - dup.2 + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1::rust_sdk_account_get_initial_vault_root_binding::::reverse + exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 - u32wrapping_add push.8 - dup.2 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -246,12 +305,11 @@ proc miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get- swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.8 - dup.3 + push.4 + movup.2 add u32assert push.4 @@ -262,15 +320,32 @@ proc miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get- assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - dup.1 - push.8 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + swap.1 + add + u32assert + push.4 dup.1 swap.1 u32mod @@ -280,11 +355,10 @@ proc miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get- swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop swap.1 - dup.2 push.4 dup.1 swap.1 @@ -293,15 +367,20 @@ proc miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get- assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.48 - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 u32wrapping_add push.1114144 u32divmod.4 @@ -311,8 +390,17 @@ proc miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get- exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -354,9 +442,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop trace.240 nop - exec.::miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1::rust_sdk_account_get_initial_vault_root_binding::__wasm_call_ctors + exec.::"miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1"::rust_sdk_account_get_initial_vault_root_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -388,287 +492,10 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.4 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop -end - -@callconv("C") -proc miden::active_account::get_initial_vault_root(i32) +proc miden::protocol::active_account::get_initial_vault_root(i32) trace.240 nop - exec.::miden::active_account::get_initial_vault_root + exec.::miden::protocol::active_account::get_initial_vault_root trace.252 nop movup.4 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.wat index 36249d65c..84b33ad8c 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.wat @@ -12,8 +12,7 @@ (core module $main (;0;) (type (;0;) (func)) (type (;1;) (func (result i32))) - (type (;2;) (func (param i32 i32))) - (type (;3;) (func (param i32))) + (type (;2;) (func (param i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -26,43 +25,36 @@ (func $miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1#binding (;2;) (type 1) (result i32) (local i32 i32) global.get $__stack_pointer - i32.const 48 + i32.const 16 i32.sub local.tee 0 global.set $__stack_pointer - call $wit_bindgen::rt::run_ctors_once - local.get 0 - i32.const 16 - i32.add - call $miden::active_account::get_initial_vault_root - local.get 0 - local.get 0 - i64.load offset=24 - i64.store offset=40 - local.get 0 - local.get 0 - i64.load offset=16 - i64.store offset=32 global.get $GOT.data.internal.__memory_base local.set 1 + call $wit_bindgen::rt::run_ctors_once local.get 0 - local.get 0 - i32.const 32 - i32.add - call $::reverse + call $miden::protocol::active_account::get_initial_vault_root local.get 1 i32.const 1048584 i32.add local.tee 1 local.get 0 - i64.load offset=8 - i64.store offset=8 align=4 + f32.load + f32.store offset=12 local.get 1 local.get 0 - i64.load - i64.store align=4 + f32.load offset=4 + f32.store offset=8 + local.get 1 + local.get 0 + f32.load offset=8 + f32.store offset=4 + local.get 1 local.get 0 - i32.const 48 + f32.load offset=12 + f32.store + local.get 0 + i32.const 16 i32.add global.set $__stack_pointer local.get 1 @@ -85,69 +77,11 @@ i32.store8 end ) - (func $::reverse (;4;) (type 2) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store - ) - (func $miden::active_account::get_initial_vault_root (;5;) (type 3) (param i32) + (func $miden::protocol::active_account::get_initial_vault_root (;4;) (type 2) (param i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "_rust_sdk_account_get_initial_vault_root_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "_rust_sdk_account_get_initial_vault_root_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_num_procedures_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_get_num_procedures_binding.hir index 871bf4a55..5014944e8 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_num_procedures_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_num_procedures_binding.hir @@ -13,47 +13,49 @@ builtin.component miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-acc private builtin.function @miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1#binding() -> felt { ^block9: hir.exec @miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1/rust_sdk_account_get_num_procedures_binding/wit_bindgen::rt::run_ctors_once() - v1 = hir.exec @miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1/rust_sdk_account_get_num_procedures_binding/miden::active_account::get_num_procedures() : felt + v1 = hir.exec @miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1/rust_sdk_account_get_num_procedures_binding/miden::protocol::active_account::get_num_procedures() : felt builtin.ret v1; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v3 = builtin.global_symbol @miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1/rust_sdk_account_get_num_procedures_binding/GOT.data.internal.__memory_base : ptr - v4 = hir.bitcast v3 : ptr; - v5 = hir.load v4 : i32; - v6 = arith.constant 1048584 : i32; - v7 = arith.add v5, v6 : i32 #[overflow = wrapping]; - v8 = hir.bitcast v7 : u32; - v9 = hir.int_to_ptr v8 : ptr; - v10 = hir.load v9 : u8; - v2 = arith.constant 0 : i32; - v11 = arith.zext v10 : u32; - v12 = hir.bitcast v11 : i32; - v14 = arith.neq v12, v2 : i1; - scf.if v14{ + v2 = builtin.global_symbol @miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1/rust_sdk_account_get_num_procedures_binding/GOT.data.internal.__memory_base : ptr + v3 = hir.bitcast v2 : ptr; + v4 = hir.load v3 : i32; + v32 = arith.constant 1048584 : i32; + v6 = arith.add v4, v32 : i32 #[overflow = wrapping]; + v7 = hir.bitcast v6 : u32; + v8 = hir.int_to_ptr v7 : ptr; + v9 = hir.load v8 : u8; + v31 = arith.constant 0 : i32; + v10 = arith.zext v9 : u32; + v11 = hir.bitcast v10 : i32; + v13 = arith.neq v11, v31 : i1; + scf.if v13{ ^block13: scf.yield ; } else { ^block14: - v15 = builtin.global_symbol @miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1/rust_sdk_account_get_num_procedures_binding/GOT.data.internal.__memory_base : ptr - v16 = hir.bitcast v15 : ptr; - v17 = hir.load v16 : i32; + v14 = builtin.global_symbol @miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1/rust_sdk_account_get_num_procedures_binding/GOT.data.internal.__memory_base : ptr + v15 = hir.bitcast v14 : ptr; + v16 = hir.load v15 : i32; + hir.store_local v16 #[local = lv0]; hir.exec @miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1/rust_sdk_account_get_num_procedures_binding/__wasm_call_ctors() - v29 = arith.constant 1 : u8; - v31 = arith.constant 1048584 : i32; - v19 = arith.add v17, v31 : i32 #[overflow = wrapping]; + v17 = hir.load_local : i32 #[local = lv0]; + v30 = arith.constant 1 : u8; + v35 = arith.constant 1048584 : i32; + v19 = arith.add v17, v35 : i32 #[overflow = wrapping]; v23 = hir.bitcast v19 : u32; v24 = hir.int_to_ptr v23 : ptr; - hir.store v24, v29; + hir.store v24, v30; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden::active_account::get_num_procedures() -> felt { + private builtin.function @miden::protocol::active_account::get_num_procedures() -> felt { ^block15: - v25 = hir.exec @miden/active_account/get_num_procedures() : felt + v25 = hir.exec @miden/protocol/active_account/get_num_procedures() : felt builtin.ret v25; }; @@ -69,7 +71,7 @@ builtin.component miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-acc }; public builtin.function @binding() -> felt { - ^block19: + ^block20: v27 = hir.exec @miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1/rust_sdk_account_get_num_procedures_binding/miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1#binding() : felt builtin.ret v27; }; diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_num_procedures_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_get_num_procedures_binding.masm index e9e34a47e..dd9aeab9b 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_num_procedures_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_num_procedures_binding.masm @@ -1,16 +1,16 @@ -# mod miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1 +# mod ::"miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> felt - exec.::miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1::init + exec."miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1::rust_sdk_account_get_num_procedures_binding::miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1#binding + exec.::"miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1"::rust_sdk_account_get_num_procedures_binding::"miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1#binding" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -23,7 +23,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -34,7 +34,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1::rust_sdk_account_get_num_procedures_binding +# mod ::"miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1"::rust_sdk_account_get_num_procedures_binding @callconv("C") proc __wasm_call_ctors( @@ -56,16 +56,17 @@ proc miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num- ) -> felt trace.240 nop - exec.::miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1::rust_sdk_account_get_num_procedures_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1"::rust_sdk_account_get_num_procedures_binding::wit_bindgen::rt::run_ctors_once trace.252 nop trace.240 nop - exec.::miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1::rust_sdk_account_get_num_procedures_binding::miden::active_account::get_num_procedures + exec.::"miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1"::rust_sdk_account_get_num_procedures_binding::"miden::protocol::active_account::get_num_procedures" trace.252 nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -107,9 +108,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop trace.240 nop - exec.::miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1::rust_sdk_account_get_num_procedures_binding::__wasm_call_ctors + exec.::"miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1"::rust_sdk_account_get_num_procedures_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -141,12 +158,12 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc miden::active_account::get_num_procedures( +proc miden::protocol::active_account::get_num_procedures( ) -> felt trace.240 nop - exec.::miden::active_account::get_num_procedures + exec.::miden::protocol::active_account::get_num_procedures trace.252 nop end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_num_procedures_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_get_num_procedures_binding.wat index 6508d8ebc..597136fed 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_num_procedures_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_num_procedures_binding.wat @@ -20,7 +20,7 @@ (func $rust_sdk_account_get_num_procedures_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) (func $miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1#binding (;2;) (type 1) (result f32) call $wit_bindgen::rt::run_ctors_once - call $miden::active_account::get_num_procedures + call $miden::protocol::active_account::get_num_procedures ) (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) (local i32) @@ -40,11 +40,11 @@ i32.store8 end ) - (func $miden::active_account::get_num_procedures (;4;) (type 1) (result f32) + (func $miden::protocol::active_account::get_num_procedures (;4;) (type 1) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "Wrust_sdk_account_get_num_procedures_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "Wrust_sdk_account_get_num_procedures_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.hir index 90bc41dfe..9367b5bd1 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.hir @@ -12,283 +12,165 @@ builtin.component miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-acc private builtin.function @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1#binding() -> i32 { ^block9: - v2 = builtin.global_symbol @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/__stack_pointer : ptr - v3 = hir.bitcast v2 : ptr; - v4 = hir.load v3 : i32; - v5 = arith.constant 48 : i32; - v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; - v7 = builtin.global_symbol @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/__stack_pointer : ptr - v8 = hir.bitcast v7 : ptr; - hir.store v8, v6; + v1 = builtin.global_symbol @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v159 = arith.constant 16 : i32; + v5 = arith.sub v3, v159 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; hir.exec @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/wit_bindgen::rt::run_ctors_once() - v1 = arith.constant 0 : i32; - v10 = hir.exec @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/>::from(v1) : felt - v11 = arith.constant 16 : i32; - v12 = arith.add v6, v11 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/miden::active_account::get_procedure_root(v10, v12) - v14 = arith.constant 24 : u32; - v13 = hir.bitcast v6 : u32; - v15 = arith.add v13, v14 : u32 #[overflow = checked]; - v16 = arith.constant 8 : u32; - v17 = arith.mod v15, v16 : u32; - hir.assertz v17 #[code = 250]; - v18 = hir.int_to_ptr v15 : ptr; - v19 = hir.load v18 : i64; - v21 = arith.constant 40 : u32; - v20 = hir.bitcast v6 : u32; - v22 = arith.add v20, v21 : u32 #[overflow = checked]; - v245 = arith.constant 8 : u32; - v24 = arith.mod v22, v245 : u32; - hir.assertz v24 #[code = 250]; - v25 = hir.int_to_ptr v22 : ptr; - hir.store v25, v19; - v27 = arith.constant 16 : u32; - v26 = hir.bitcast v6 : u32; - v28 = arith.add v26, v27 : u32 #[overflow = checked]; - v244 = arith.constant 8 : u32; - v30 = arith.mod v28, v244 : u32; - hir.assertz v30 #[code = 250]; - v31 = hir.int_to_ptr v28 : ptr; - v32 = hir.load v31 : i64; - v34 = arith.constant 32 : u32; - v33 = hir.bitcast v6 : u32; - v35 = arith.add v33, v34 : u32 #[overflow = checked]; - v243 = arith.constant 8 : u32; - v37 = arith.mod v35, v243 : u32; - hir.assertz v37 #[code = 250]; - v38 = hir.int_to_ptr v35 : ptr; - hir.store v38, v32; - v39 = builtin.global_symbol @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/GOT.data.internal.__memory_base : ptr - v40 = hir.bitcast v39 : ptr; - v41 = hir.load v40 : i32; - v42 = arith.constant 32 : i32; - v43 = arith.add v6, v42 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/::reverse(v6, v43) - v44 = arith.constant 1048584 : i32; - v45 = arith.add v41, v44 : i32 #[overflow = wrapping]; - v242 = arith.constant 8 : u32; - v46 = hir.bitcast v6 : u32; - v48 = arith.add v46, v242 : u32 #[overflow = checked]; - v241 = arith.constant 8 : u32; - v50 = arith.mod v48, v241 : u32; - hir.assertz v50 #[code = 250]; - v51 = hir.int_to_ptr v48 : ptr; - v52 = hir.load v51 : i64; - v240 = arith.constant 8 : u32; - v53 = hir.bitcast v45 : u32; - v55 = arith.add v53, v240 : u32 #[overflow = checked]; - v56 = arith.constant 4 : u32; - v57 = arith.mod v55, v56 : u32; - hir.assertz v57 #[code = 250]; - v58 = hir.int_to_ptr v55 : ptr; - hir.store v58, v52; - v59 = hir.bitcast v6 : u32; - v239 = arith.constant 8 : u32; - v61 = arith.mod v59, v239 : u32; - hir.assertz v61 #[code = 250]; - v62 = hir.int_to_ptr v59 : ptr; - v63 = hir.load v62 : i64; - v64 = hir.bitcast v45 : u32; - v238 = arith.constant 4 : u32; - v66 = arith.mod v64, v238 : u32; - hir.assertz v66 #[code = 250]; - v67 = hir.int_to_ptr v64 : ptr; - hir.store v67, v63; - v237 = arith.constant 48 : i32; - v69 = arith.add v6, v237 : i32 #[overflow = wrapping]; - v70 = builtin.global_symbol @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/__stack_pointer : ptr - v71 = hir.bitcast v70 : ptr; - hir.store v71, v69; - builtin.ret v45; + v158 = arith.constant 0 : i32; + v9 = hir.exec @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/>::from(v158) : felt + v10 = hir.load_local : i32 #[local = lv0]; + hir.exec @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/miden::protocol::active_account::get_procedure_root(v9, v10) + v11 = builtin.global_symbol @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/GOT.data.internal.__memory_base : ptr + v12 = hir.bitcast v11 : ptr; + v13 = hir.load v12 : i32; + v157 = arith.constant 1048584 : i32; + v15 = arith.add v13, v157 : i32 #[overflow = wrapping]; + hir.store_local v15 #[local = lv1]; + v16 = hir.load_local : i32 #[local = lv0]; + v17 = hir.bitcast v16 : u32; + v156 = arith.constant 4 : u32; + v19 = arith.mod v17, v156 : u32; + hir.assertz v19 #[code = 250]; + v20 = hir.int_to_ptr v17 : ptr; + v21 = hir.load v20 : felt; + v155 = arith.constant 12 : u32; + v22 = hir.bitcast v15 : u32; + v24 = arith.add v22, v155 : u32 #[overflow = checked]; + v183 = arith.constant 4 : u32; + v26 = arith.mod v24, v183 : u32; + hir.assertz v26 #[code = 250]; + v27 = hir.int_to_ptr v24 : ptr; + hir.store v27, v21; + v28 = hir.load_local : i32 #[local = lv1]; + v29 = hir.load_local : i32 #[local = lv0]; + v182 = arith.constant 4 : u32; + v30 = hir.bitcast v29 : u32; + v32 = arith.add v30, v182 : u32 #[overflow = checked]; + v181 = arith.constant 4 : u32; + v34 = arith.mod v32, v181 : u32; + hir.assertz v34 #[code = 250]; + v35 = hir.int_to_ptr v32 : ptr; + v36 = hir.load v35 : felt; + v154 = arith.constant 8 : u32; + v37 = hir.bitcast v28 : u32; + v39 = arith.add v37, v154 : u32 #[overflow = checked]; + v180 = arith.constant 4 : u32; + v41 = arith.mod v39, v180 : u32; + hir.assertz v41 #[code = 250]; + v42 = hir.int_to_ptr v39 : ptr; + hir.store v42, v36; + v43 = hir.load_local : i32 #[local = lv1]; + v44 = hir.load_local : i32 #[local = lv0]; + v179 = arith.constant 8 : u32; + v45 = hir.bitcast v44 : u32; + v47 = arith.add v45, v179 : u32 #[overflow = checked]; + v178 = arith.constant 4 : u32; + v49 = arith.mod v47, v178 : u32; + hir.assertz v49 #[code = 250]; + v50 = hir.int_to_ptr v47 : ptr; + v51 = hir.load v50 : felt; + v177 = arith.constant 4 : u32; + v52 = hir.bitcast v43 : u32; + v54 = arith.add v52, v177 : u32 #[overflow = checked]; + v176 = arith.constant 4 : u32; + v56 = arith.mod v54, v176 : u32; + hir.assertz v56 #[code = 250]; + v57 = hir.int_to_ptr v54 : ptr; + hir.store v57, v51; + v58 = hir.load_local : i32 #[local = lv1]; + v59 = hir.load_local : i32 #[local = lv0]; + v175 = arith.constant 12 : u32; + v60 = hir.bitcast v59 : u32; + v62 = arith.add v60, v175 : u32 #[overflow = checked]; + v174 = arith.constant 4 : u32; + v64 = arith.mod v62, v174 : u32; + hir.assertz v64 #[code = 250]; + v65 = hir.int_to_ptr v62 : ptr; + v66 = hir.load v65 : felt; + v67 = hir.bitcast v58 : u32; + v173 = arith.constant 4 : u32; + v69 = arith.mod v67, v173 : u32; + hir.assertz v69 #[code = 250]; + v70 = hir.int_to_ptr v67 : ptr; + hir.store v70, v66; + v71 = hir.load_local : i32 #[local = lv0]; + v172 = arith.constant 16 : i32; + v73 = arith.add v71, v172 : i32 #[overflow = wrapping]; + v74 = builtin.global_symbol @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/__stack_pointer : ptr + v75 = hir.bitcast v74 : ptr; + hir.store v75, v73; + v76 = hir.load_local : i32 #[local = lv1]; + builtin.ret v76; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v73 = builtin.global_symbol @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/GOT.data.internal.__memory_base : ptr - v74 = hir.bitcast v73 : ptr; - v75 = hir.load v74 : i32; - v76 = arith.constant 1048600 : i32; - v77 = arith.add v75, v76 : i32 #[overflow = wrapping]; - v78 = hir.bitcast v77 : u32; - v79 = hir.int_to_ptr v78 : ptr; - v80 = hir.load v79 : u8; - v72 = arith.constant 0 : i32; - v81 = arith.zext v80 : u32; - v82 = hir.bitcast v81 : i32; - v84 = arith.neq v82, v72 : i1; - scf.if v84{ + v77 = builtin.global_symbol @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/GOT.data.internal.__memory_base : ptr + v78 = hir.bitcast v77 : ptr; + v79 = hir.load v78 : i32; + v188 = arith.constant 1048600 : i32; + v81 = arith.add v79, v188 : i32 #[overflow = wrapping]; + v82 = hir.bitcast v81 : u32; + v83 = hir.int_to_ptr v82 : ptr; + v84 = hir.load v83 : u8; + v187 = arith.constant 0 : i32; + v85 = arith.zext v84 : u32; + v86 = hir.bitcast v85 : i32; + v88 = arith.neq v86, v187 : i1; + scf.if v88{ ^block13: scf.yield ; } else { ^block14: - v85 = builtin.global_symbol @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/GOT.data.internal.__memory_base : ptr - v86 = hir.bitcast v85 : ptr; - v87 = hir.load v86 : i32; + v89 = builtin.global_symbol @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/GOT.data.internal.__memory_base : ptr + v90 = hir.bitcast v89 : ptr; + v91 = hir.load v90 : i32; + hir.store_local v91 #[local = lv0]; hir.exec @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/__wasm_call_ctors() - v247 = arith.constant 1 : u8; - v249 = arith.constant 1048600 : i32; - v89 = arith.add v87, v249 : i32 #[overflow = wrapping]; - v93 = hir.bitcast v89 : u32; - v94 = hir.int_to_ptr v93 : ptr; - hir.store v94, v247; + v92 = hir.load_local : i32 #[local = lv0]; + v186 = arith.constant 1 : u8; + v191 = arith.constant 1048600 : i32; + v94 = arith.add v92, v191 : i32 #[overflow = wrapping]; + v98 = hir.bitcast v94 : u32; + v99 = hir.int_to_ptr v98 : ptr; + hir.store v99, v186; scf.yield ; }; builtin.ret ; }; - private builtin.function @::reverse(v95: i32, v96: i32) { - ^block15(v95: i32, v96: i32): - v99 = builtin.global_symbol @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/__stack_pointer : ptr - v100 = hir.bitcast v99 : ptr; - v101 = hir.load v100 : i32; - v102 = arith.constant 16 : i32; - v103 = arith.sub v101, v102 : i32 #[overflow = wrapping]; - v105 = arith.constant 8 : u32; - v104 = hir.bitcast v96 : u32; - v106 = arith.add v104, v105 : u32 #[overflow = checked]; - v336 = arith.constant 8 : u32; - v108 = arith.mod v106, v336 : u32; - hir.assertz v108 #[code = 250]; - v109 = hir.int_to_ptr v106 : ptr; - v110 = hir.load v109 : i64; - v335 = arith.constant 8 : u32; - v111 = hir.bitcast v103 : u32; - v113 = arith.add v111, v335 : u32 #[overflow = checked]; - v114 = arith.constant 4 : u32; - v115 = arith.mod v113, v114 : u32; - hir.assertz v115 #[code = 250]; - v116 = hir.int_to_ptr v113 : ptr; - hir.store v116, v110; - v117 = hir.bitcast v96 : u32; - v334 = arith.constant 8 : u32; - v119 = arith.mod v117, v334 : u32; - hir.assertz v119 #[code = 250]; - v120 = hir.int_to_ptr v117 : ptr; - v121 = hir.load v120 : i64; - v122 = hir.bitcast v103 : u32; - v333 = arith.constant 4 : u32; - v124 = arith.mod v122, v333 : u32; - hir.assertz v124 #[code = 250]; - v125 = hir.int_to_ptr v122 : ptr; - hir.store v125, v121; - v126 = arith.constant 12 : i32; - v127 = arith.add v103, v126 : i32 #[overflow = wrapping]; - v97 = arith.constant 0 : i32; - v304, v305, v306, v307, v308, v309 = scf.while v97, v103, v127, v95 : i32, i32, i32, i32, i32, i32 { - ^block37(v310: i32, v311: i32, v312: i32, v313: i32): - v332 = arith.constant 0 : i32; - v130 = arith.constant 8 : i32; - v131 = arith.eq v310, v130 : i1; - v132 = arith.zext v131 : u32; - v133 = hir.bitcast v132 : i32; - v135 = arith.neq v133, v332 : i1; - v298, v299 = scf.if v135 : i32, i32 { - ^block36: - v258 = ub.poison i32 : i32; - scf.yield v258, v258; - } else { - ^block20: - v137 = arith.add v311, v310 : i32 #[overflow = wrapping]; - v138 = hir.bitcast v137 : u32; - v331 = arith.constant 4 : u32; - v140 = arith.mod v138, v331 : u32; - hir.assertz v140 #[code = 250]; - v141 = hir.int_to_ptr v138 : ptr; - v142 = hir.load v141 : felt; - v144 = hir.bitcast v312 : u32; - v330 = arith.constant 4 : u32; - v146 = arith.mod v144, v330 : u32; - hir.assertz v146 #[code = 250]; - v147 = hir.int_to_ptr v144 : ptr; - v148 = hir.load v147 : i32; - v149 = hir.bitcast v137 : u32; - v329 = arith.constant 4 : u32; - v151 = arith.mod v149, v329 : u32; - hir.assertz v151 #[code = 250]; - v152 = hir.int_to_ptr v149 : ptr; - hir.store v152, v148; - v153 = hir.bitcast v312 : u32; - v328 = arith.constant 4 : u32; - v155 = arith.mod v153, v328 : u32; - hir.assertz v155 #[code = 250]; - v156 = hir.int_to_ptr v153 : ptr; - hir.store v156, v142; - v159 = arith.constant -4 : i32; - v160 = arith.add v312, v159 : i32 #[overflow = wrapping]; - v157 = arith.constant 4 : i32; - v158 = arith.add v310, v157 : i32 #[overflow = wrapping]; - scf.yield v158, v160; - }; - v326 = ub.poison i32 : i32; - v301 = cf.select v135, v326, v313 : i32; - v327 = ub.poison i32 : i32; - v300 = cf.select v135, v327, v311 : i32; - v257 = arith.constant 1 : u32; - v250 = arith.constant 0 : u32; - v303 = cf.select v135, v250, v257 : u32; - v291 = arith.trunc v303 : i1; - scf.condition v291, v298, v300, v299, v301, v311, v313; - } do { - ^block38(v314: i32, v315: i32, v316: i32, v317: i32, v318: i32, v319: i32): - scf.yield v314, v315, v316, v317; - }; - v325 = arith.constant 8 : u32; - v162 = hir.bitcast v308 : u32; - v164 = arith.add v162, v325 : u32 #[overflow = checked]; - v324 = arith.constant 4 : u32; - v166 = arith.mod v164, v324 : u32; - hir.assertz v166 #[code = 250]; - v167 = hir.int_to_ptr v164 : ptr; - v168 = hir.load v167 : i64; - v323 = arith.constant 8 : u32; - v169 = hir.bitcast v309 : u32; - v171 = arith.add v169, v323 : u32 #[overflow = checked]; - v322 = arith.constant 8 : u32; - v173 = arith.mod v171, v322 : u32; - hir.assertz v173 #[code = 250]; - v174 = hir.int_to_ptr v171 : ptr; - hir.store v174, v168; - v175 = hir.bitcast v308 : u32; - v321 = arith.constant 4 : u32; - v177 = arith.mod v175, v321 : u32; - hir.assertz v177 #[code = 250]; - v178 = hir.int_to_ptr v175 : ptr; - v179 = hir.load v178 : i64; - v180 = hir.bitcast v309 : u32; - v320 = arith.constant 8 : u32; - v182 = arith.mod v180, v320 : u32; - hir.assertz v182 #[code = 250]; - v183 = hir.int_to_ptr v180 : ptr; - hir.store v183, v179; - builtin.ret ; - }; - - private builtin.function @>::from(v184: i32) -> felt { - ^block21(v184: i32): - v186 = arith.constant 255 : i32; - v187 = arith.band v184, v186 : i32; - v188 = hir.bitcast v187 : felt; - builtin.ret v188; + private builtin.function @>::from(v100: i32) -> felt { + ^block15(v100: i32): + v192 = arith.constant 255 : i32; + v104 = arith.band v100, v192 : i32; + v105 = hir.bitcast v104 : felt; + builtin.ret v105; }; - private builtin.function @miden::active_account::get_procedure_root(v189: felt, v190: i32) { - ^block23(v189: felt, v190: i32): - v191, v192, v193, v194 = hir.exec @miden/active_account/get_procedure_root(v189) : felt, felt, felt, felt - v195 = hir.bitcast v190 : u32; - v196 = hir.int_to_ptr v195 : ptr; - hir.store v196, v191; - v197 = arith.constant 4 : u32; - v198 = arith.add v195, v197 : u32 #[overflow = checked]; - v199 = hir.int_to_ptr v198 : ptr; - hir.store v199, v192; - v200 = arith.constant 8 : u32; - v201 = arith.add v195, v200 : u32 #[overflow = checked]; - v202 = hir.int_to_ptr v201 : ptr; - hir.store v202, v193; - v203 = arith.constant 12 : u32; - v204 = arith.add v195, v203 : u32 #[overflow = checked]; - v205 = hir.int_to_ptr v204 : ptr; - hir.store v205, v194; + private builtin.function @miden::protocol::active_account::get_procedure_root(v106: felt, v107: i32) { + ^block17(v106: felt, v107: i32): + v108, v109, v110, v111 = hir.exec @miden/protocol/active_account/get_procedure_root(v106) : felt, felt, felt, felt + v112 = hir.bitcast v107 : u32; + v113 = hir.int_to_ptr v112 : ptr; + hir.store v113, v108; + v195 = arith.constant 4 : u32; + v115 = arith.add v112, v195 : u32 #[overflow = checked]; + v116 = hir.int_to_ptr v115 : ptr; + hir.store v116, v109; + v194 = arith.constant 8 : u32; + v118 = arith.add v112, v194 : u32 #[overflow = checked]; + v119 = hir.int_to_ptr v118 : ptr; + hir.store v119, v110; + v193 = arith.constant 12 : u32; + v121 = arith.add v112, v193 : u32 #[overflow = checked]; + v122 = hir.int_to_ptr v121 : ptr; + hir.store v122, v111; builtin.ret ; }; @@ -304,34 +186,34 @@ builtin.component miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-acc }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block27: - v206 = hir.exec @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1#binding() : i32 + ^block22: + v123 = hir.exec @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1#binding() : i32 + v199 = arith.constant 0 : i32; + v125 = arith.add v123, v199 : i32 #[overflow = unchecked]; + v208 = arith.constant 0 : i32; + v209 = arith.constant 0 : i32; + v127 = arith.add v125, v209 : i32 #[overflow = unchecked]; + v129 = arith.add v127, v208 : i32 #[overflow = unchecked]; + v130 = hir.int_to_ptr v129 : ptr; + v131 = hir.load v130 : felt; v207 = arith.constant 0 : i32; - v208 = arith.add v206, v207 : i32 #[overflow = unchecked]; - v340 = arith.constant 0 : i32; - v341 = arith.constant 0 : i32; - v210 = arith.add v208, v341 : i32 #[overflow = unchecked]; - v212 = arith.add v210, v340 : i32 #[overflow = unchecked]; - v213 = hir.int_to_ptr v212 : ptr; - v214 = hir.load v213 : felt; - v339 = arith.constant 0 : i32; - v215 = arith.constant 4 : i32; - v216 = arith.add v208, v215 : i32 #[overflow = unchecked]; - v218 = arith.add v216, v339 : i32 #[overflow = unchecked]; - v219 = hir.int_to_ptr v218 : ptr; - v220 = hir.load v219 : felt; - v338 = arith.constant 0 : i32; - v221 = arith.constant 8 : i32; - v222 = arith.add v208, v221 : i32 #[overflow = unchecked]; - v224 = arith.add v222, v338 : i32 #[overflow = unchecked]; - v225 = hir.int_to_ptr v224 : ptr; - v226 = hir.load v225 : felt; - v337 = arith.constant 0 : i32; - v227 = arith.constant 12 : i32; - v228 = arith.add v208, v227 : i32 #[overflow = unchecked]; - v230 = arith.add v228, v337 : i32 #[overflow = unchecked]; - v231 = hir.int_to_ptr v230 : ptr; - v232 = hir.load v231 : felt; - builtin.ret v214, v220, v226, v232; + v198 = arith.constant 4 : i32; + v133 = arith.add v125, v198 : i32 #[overflow = unchecked]; + v135 = arith.add v133, v207 : i32 #[overflow = unchecked]; + v136 = hir.int_to_ptr v135 : ptr; + v137 = hir.load v136 : felt; + v206 = arith.constant 0 : i32; + v197 = arith.constant 8 : i32; + v139 = arith.add v125, v197 : i32 #[overflow = unchecked]; + v141 = arith.add v139, v206 : i32 #[overflow = unchecked]; + v142 = hir.int_to_ptr v141 : ptr; + v143 = hir.load v142 : felt; + v205 = arith.constant 0 : i32; + v196 = arith.constant 12 : i32; + v145 = arith.add v125, v196 : i32 #[overflow = unchecked]; + v147 = arith.add v145, v205 : i32 #[overflow = unchecked]; + v148 = hir.int_to_ptr v147 : ptr; + v149 = hir.load v148 : felt; + builtin.ret v131, v137, v143, v149; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.masm index 50e493edf..48cc15aca 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.masm @@ -1,13 +1,13 @@ -# mod miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1 +# mod ::"miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> (felt, felt, felt, felt) - exec.::miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1::init + exec."miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1::rust_sdk_account_get_procedure_root_binding::miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1#binding + exec.::"miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1"::rust_sdk_account_get_procedure_root_binding::"miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1#binding" trace.252 nop push.0 @@ -62,7 +62,7 @@ pub proc binding( nop movdn.3 swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -75,7 +75,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -86,7 +86,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1::rust_sdk_account_get_procedure_root_binding +# mod ::"miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1"::rust_sdk_account_get_procedure_root_binding @callconv("C") proc __wasm_call_ctors( @@ -102,6 +102,7 @@ proc rust_sdk_account_get_procedure_root_binding::bindings::__link_custom_sectio nop end +@locals("2") @callconv("C") proc miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1#binding( @@ -114,11 +115,18 @@ proc miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-proc exec.::intrinsics::mem::load_sw trace.252 nop - push.48 + push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -128,29 +136,57 @@ proc miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-proc nop trace.240 nop - exec.::miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1::rust_sdk_account_get_procedure_root_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1"::rust_sdk_account_get_procedure_root_binding::wit_bindgen::rt::run_ctors_once trace.252 nop push.0 trace.240 nop - exec.::miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1::rust_sdk_account_get_procedure_root_binding::>::from + exec.::"miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1"::rust_sdk_account_get_procedure_root_binding::>::from trace.252 nop - push.16 - dup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1"::rust_sdk_account_get_procedure_root_binding::"miden::protocol::active_account::get_procedure_root" + trace.252 + nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 u32wrapping_add + dup.0 + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1::rust_sdk_account_get_procedure_root_binding::miden::active_account::get_procedure_root + exec.::intrinsics::mem::store_sw trace.252 nop - push.24 - dup.1 - add - u32assert - push.8 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 dup.1 swap.1 u32mod @@ -160,15 +196,14 @@ proc miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-proc swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.40 - dup.3 + push.12 + movup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -176,18 +211,32 @@ proc miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-proc assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.16 - dup.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -197,15 +246,14 @@ proc miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-proc swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.32 - dup.3 + push.8 + movup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -213,37 +261,32 @@ proc miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-proc assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.1114148 - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.32 - dup.2 - u32wrapping_add - dup.2 + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1::rust_sdk_account_get_procedure_root_binding::::reverse + exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 - u32wrapping_add push.8 - dup.2 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -253,12 +296,11 @@ proc miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-proc swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.8 - dup.3 + push.4 + movup.2 add u32assert push.4 @@ -269,15 +311,32 @@ proc miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-proc assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - dup.1 - push.8 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + swap.1 + add + u32assert + push.4 dup.1 swap.1 u32mod @@ -287,11 +346,10 @@ proc miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-proc swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop swap.1 - dup.2 push.4 dup.1 swap.1 @@ -300,15 +358,20 @@ proc miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-proc assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.48 - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 u32wrapping_add push.1114144 u32divmod.4 @@ -318,8 +381,17 @@ proc miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-proc exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -361,9 +433,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1"::rust_sdk_account_get_procedure_root_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1::rust_sdk_account_get_procedure_root_binding::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -394,285 +482,9 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("1") @callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.4 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop -end - -@callconv("C") -proc >::from( +proc >::from( i32 ) -> felt push.255 @@ -680,10 +492,10 @@ proc >::from end @callconv("C") -proc miden::active_account::get_procedure_root(felt, i32) +proc miden::protocol::active_account::get_procedure_root(felt, i32) trace.240 nop - exec.::miden::active_account::get_procedure_root + exec.::miden::protocol::active_account::get_procedure_root trace.252 nop movup.4 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.wat index 2ac6df6ad..39c4bea14 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.wat @@ -12,9 +12,8 @@ (core module $main (;0;) (type (;0;) (func)) (type (;1;) (func (result i32))) - (type (;2;) (func (param i32 i32))) - (type (;3;) (func (param i32) (result f32))) - (type (;4;) (func (param f32 i32))) + (type (;2;) (func (param i32) (result f32))) + (type (;3;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -27,45 +26,36 @@ (func $miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1#binding (;2;) (type 1) (result i32) (local i32 i32) global.get $__stack_pointer - i32.const 48 + i32.const 16 i32.sub local.tee 0 global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once i32.const 0 - call $>::from - local.get 0 - i32.const 16 - i32.add - call $miden::active_account::get_procedure_root - local.get 0 - local.get 0 - i64.load offset=24 - i64.store offset=40 - local.get 0 + call $>::from local.get 0 - i64.load offset=16 - i64.store offset=32 + call $miden::protocol::active_account::get_procedure_root global.get $GOT.data.internal.__memory_base - local.set 1 - local.get 0 - local.get 0 - i32.const 32 - i32.add - call $::reverse - local.get 1 i32.const 1048584 i32.add local.tee 1 local.get 0 - i64.load offset=8 - i64.store offset=8 align=4 + f32.load + f32.store offset=12 + local.get 1 + local.get 0 + f32.load offset=4 + f32.store offset=8 + local.get 1 + local.get 0 + f32.load offset=8 + f32.store offset=4 local.get 1 local.get 0 - i64.load - i64.store align=4 + f32.load offset=12 + f32.store local.get 0 - i32.const 48 + i32.const 16 i32.add global.set $__stack_pointer local.get 1 @@ -88,75 +78,17 @@ i32.store8 end ) - (func $::reverse (;4;) (type 2) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store - ) - (func $>::from (;5;) (type 3) (param i32) (result f32) + (func $>::from (;4;) (type 2) (param i32) (result f32) local.get 0 i32.const 255 i32.and f32.reinterpret_i32 ) - (func $miden::active_account::get_procedure_root (;6;) (type 4) (param f32 i32) + (func $miden::protocol::active_account::get_procedure_root (;5;) (type 3) (param f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "Wrust_sdk_account_get_procedure_root_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "Wrust_sdk_account_get_procedure_root_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.hir index 447135f4b..6921027a1 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.hir @@ -12,273 +12,157 @@ builtin.component miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account private builtin.function @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1#binding() -> i32 { ^block9: - v2 = builtin.global_symbol @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/__stack_pointer : ptr - v3 = hir.bitcast v2 : ptr; - v4 = hir.load v3 : i32; - v5 = arith.constant 48 : i32; - v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; - v7 = builtin.global_symbol @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/__stack_pointer : ptr - v8 = hir.bitcast v7 : ptr; - hir.store v8, v6; + v1 = builtin.global_symbol @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v150 = arith.constant 16 : i32; + v5 = arith.sub v3, v150 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; + v8 = builtin.global_symbol @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/GOT.data.internal.__memory_base : ptr + v9 = hir.bitcast v8 : ptr; + v10 = hir.load v9 : i32; + hir.store_local v10 #[local = lv1]; hir.exec @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/wit_bindgen::rt::run_ctors_once() - v9 = arith.constant 16 : i32; - v10 = arith.add v6, v9 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/miden::active_account::get_vault_root(v10) - v12 = arith.constant 24 : u32; - v11 = hir.bitcast v6 : u32; - v13 = arith.add v11, v12 : u32 #[overflow = checked]; - v14 = arith.constant 8 : u32; - v15 = arith.mod v13, v14 : u32; - hir.assertz v15 #[code = 250]; - v16 = hir.int_to_ptr v13 : ptr; - v17 = hir.load v16 : i64; - v19 = arith.constant 40 : u32; - v18 = hir.bitcast v6 : u32; - v20 = arith.add v18, v19 : u32 #[overflow = checked]; - v237 = arith.constant 8 : u32; - v22 = arith.mod v20, v237 : u32; - hir.assertz v22 #[code = 250]; - v23 = hir.int_to_ptr v20 : ptr; - hir.store v23, v17; - v25 = arith.constant 16 : u32; - v24 = hir.bitcast v6 : u32; - v26 = arith.add v24, v25 : u32 #[overflow = checked]; - v236 = arith.constant 8 : u32; - v28 = arith.mod v26, v236 : u32; - hir.assertz v28 #[code = 250]; - v29 = hir.int_to_ptr v26 : ptr; - v30 = hir.load v29 : i64; - v32 = arith.constant 32 : u32; - v31 = hir.bitcast v6 : u32; - v33 = arith.add v31, v32 : u32 #[overflow = checked]; - v235 = arith.constant 8 : u32; - v35 = arith.mod v33, v235 : u32; - hir.assertz v35 #[code = 250]; - v36 = hir.int_to_ptr v33 : ptr; - hir.store v36, v30; - v37 = builtin.global_symbol @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/GOT.data.internal.__memory_base : ptr - v38 = hir.bitcast v37 : ptr; - v39 = hir.load v38 : i32; - v40 = arith.constant 32 : i32; - v41 = arith.add v6, v40 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/::reverse(v6, v41) - v42 = arith.constant 1048584 : i32; - v43 = arith.add v39, v42 : i32 #[overflow = wrapping]; - v234 = arith.constant 8 : u32; - v44 = hir.bitcast v6 : u32; - v46 = arith.add v44, v234 : u32 #[overflow = checked]; - v233 = arith.constant 8 : u32; - v48 = arith.mod v46, v233 : u32; + v11 = hir.load_local : i32 #[local = lv0]; + hir.exec @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/miden::protocol::active_account::get_vault_root(v11) + v12 = hir.load_local : i32 #[local = lv1]; + v149 = arith.constant 1048584 : i32; + v14 = arith.add v12, v149 : i32 #[overflow = wrapping]; + hir.store_local v14 #[local = lv1]; + v15 = hir.load_local : i32 #[local = lv0]; + v16 = hir.bitcast v15 : u32; + v148 = arith.constant 4 : u32; + v18 = arith.mod v16, v148 : u32; + hir.assertz v18 #[code = 250]; + v19 = hir.int_to_ptr v16 : ptr; + v20 = hir.load v19 : felt; + v147 = arith.constant 12 : u32; + v21 = hir.bitcast v14 : u32; + v23 = arith.add v21, v147 : u32 #[overflow = checked]; + v174 = arith.constant 4 : u32; + v25 = arith.mod v23, v174 : u32; + hir.assertz v25 #[code = 250]; + v26 = hir.int_to_ptr v23 : ptr; + hir.store v26, v20; + v27 = hir.load_local : i32 #[local = lv1]; + v28 = hir.load_local : i32 #[local = lv0]; + v173 = arith.constant 4 : u32; + v29 = hir.bitcast v28 : u32; + v31 = arith.add v29, v173 : u32 #[overflow = checked]; + v172 = arith.constant 4 : u32; + v33 = arith.mod v31, v172 : u32; + hir.assertz v33 #[code = 250]; + v34 = hir.int_to_ptr v31 : ptr; + v35 = hir.load v34 : felt; + v146 = arith.constant 8 : u32; + v36 = hir.bitcast v27 : u32; + v38 = arith.add v36, v146 : u32 #[overflow = checked]; + v171 = arith.constant 4 : u32; + v40 = arith.mod v38, v171 : u32; + hir.assertz v40 #[code = 250]; + v41 = hir.int_to_ptr v38 : ptr; + hir.store v41, v35; + v42 = hir.load_local : i32 #[local = lv1]; + v43 = hir.load_local : i32 #[local = lv0]; + v170 = arith.constant 8 : u32; + v44 = hir.bitcast v43 : u32; + v46 = arith.add v44, v170 : u32 #[overflow = checked]; + v169 = arith.constant 4 : u32; + v48 = arith.mod v46, v169 : u32; hir.assertz v48 #[code = 250]; - v49 = hir.int_to_ptr v46 : ptr; - v50 = hir.load v49 : i64; - v232 = arith.constant 8 : u32; - v51 = hir.bitcast v43 : u32; - v53 = arith.add v51, v232 : u32 #[overflow = checked]; - v54 = arith.constant 4 : u32; - v55 = arith.mod v53, v54 : u32; + v49 = hir.int_to_ptr v46 : ptr; + v50 = hir.load v49 : felt; + v168 = arith.constant 4 : u32; + v51 = hir.bitcast v42 : u32; + v53 = arith.add v51, v168 : u32 #[overflow = checked]; + v167 = arith.constant 4 : u32; + v55 = arith.mod v53, v167 : u32; hir.assertz v55 #[code = 250]; - v56 = hir.int_to_ptr v53 : ptr; + v56 = hir.int_to_ptr v53 : ptr; hir.store v56, v50; - v57 = hir.bitcast v6 : u32; - v231 = arith.constant 8 : u32; - v59 = arith.mod v57, v231 : u32; - hir.assertz v59 #[code = 250]; - v60 = hir.int_to_ptr v57 : ptr; - v61 = hir.load v60 : i64; - v62 = hir.bitcast v43 : u32; - v230 = arith.constant 4 : u32; - v64 = arith.mod v62, v230 : u32; - hir.assertz v64 #[code = 250]; - v65 = hir.int_to_ptr v62 : ptr; - hir.store v65, v61; - v229 = arith.constant 48 : i32; - v67 = arith.add v6, v229 : i32 #[overflow = wrapping]; - v68 = builtin.global_symbol @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/__stack_pointer : ptr - v69 = hir.bitcast v68 : ptr; - hir.store v69, v67; - builtin.ret v43; + v57 = hir.load_local : i32 #[local = lv1]; + v58 = hir.load_local : i32 #[local = lv0]; + v166 = arith.constant 12 : u32; + v59 = hir.bitcast v58 : u32; + v61 = arith.add v59, v166 : u32 #[overflow = checked]; + v165 = arith.constant 4 : u32; + v63 = arith.mod v61, v165 : u32; + hir.assertz v63 #[code = 250]; + v64 = hir.int_to_ptr v61 : ptr; + v65 = hir.load v64 : felt; + v66 = hir.bitcast v57 : u32; + v164 = arith.constant 4 : u32; + v68 = arith.mod v66, v164 : u32; + hir.assertz v68 #[code = 250]; + v69 = hir.int_to_ptr v66 : ptr; + hir.store v69, v65; + v70 = hir.load_local : i32 #[local = lv0]; + v163 = arith.constant 16 : i32; + v72 = arith.add v70, v163 : i32 #[overflow = wrapping]; + v73 = builtin.global_symbol @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/__stack_pointer : ptr + v74 = hir.bitcast v73 : ptr; + hir.store v74, v72; + v75 = hir.load_local : i32 #[local = lv1]; + builtin.ret v75; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v71 = builtin.global_symbol @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/GOT.data.internal.__memory_base : ptr - v72 = hir.bitcast v71 : ptr; - v73 = hir.load v72 : i32; - v74 = arith.constant 1048600 : i32; - v75 = arith.add v73, v74 : i32 #[overflow = wrapping]; - v76 = hir.bitcast v75 : u32; - v77 = hir.int_to_ptr v76 : ptr; - v78 = hir.load v77 : u8; - v70 = arith.constant 0 : i32; - v79 = arith.zext v78 : u32; - v80 = hir.bitcast v79 : i32; - v82 = arith.neq v80, v70 : i1; - scf.if v82{ + v76 = builtin.global_symbol @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/GOT.data.internal.__memory_base : ptr + v77 = hir.bitcast v76 : ptr; + v78 = hir.load v77 : i32; + v179 = arith.constant 1048600 : i32; + v80 = arith.add v78, v179 : i32 #[overflow = wrapping]; + v81 = hir.bitcast v80 : u32; + v82 = hir.int_to_ptr v81 : ptr; + v83 = hir.load v82 : u8; + v178 = arith.constant 0 : i32; + v84 = arith.zext v83 : u32; + v85 = hir.bitcast v84 : i32; + v87 = arith.neq v85, v178 : i1; + scf.if v87{ ^block13: scf.yield ; } else { ^block14: - v83 = builtin.global_symbol @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/GOT.data.internal.__memory_base : ptr - v84 = hir.bitcast v83 : ptr; - v85 = hir.load v84 : i32; + v88 = builtin.global_symbol @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/GOT.data.internal.__memory_base : ptr + v89 = hir.bitcast v88 : ptr; + v90 = hir.load v89 : i32; + hir.store_local v90 #[local = lv0]; hir.exec @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/__wasm_call_ctors() - v239 = arith.constant 1 : u8; - v241 = arith.constant 1048600 : i32; - v87 = arith.add v85, v241 : i32 #[overflow = wrapping]; - v91 = hir.bitcast v87 : u32; - v92 = hir.int_to_ptr v91 : ptr; - hir.store v92, v239; + v91 = hir.load_local : i32 #[local = lv0]; + v177 = arith.constant 1 : u8; + v182 = arith.constant 1048600 : i32; + v93 = arith.add v91, v182 : i32 #[overflow = wrapping]; + v97 = hir.bitcast v93 : u32; + v98 = hir.int_to_ptr v97 : ptr; + hir.store v98, v177; scf.yield ; }; builtin.ret ; }; - private builtin.function @::reverse(v93: i32, v94: i32) { - ^block15(v93: i32, v94: i32): - v97 = builtin.global_symbol @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/__stack_pointer : ptr - v98 = hir.bitcast v97 : ptr; - v99 = hir.load v98 : i32; - v100 = arith.constant 16 : i32; - v101 = arith.sub v99, v100 : i32 #[overflow = wrapping]; - v103 = arith.constant 8 : u32; - v102 = hir.bitcast v94 : u32; - v104 = arith.add v102, v103 : u32 #[overflow = checked]; - v328 = arith.constant 8 : u32; - v106 = arith.mod v104, v328 : u32; - hir.assertz v106 #[code = 250]; - v107 = hir.int_to_ptr v104 : ptr; - v108 = hir.load v107 : i64; - v327 = arith.constant 8 : u32; - v109 = hir.bitcast v101 : u32; - v111 = arith.add v109, v327 : u32 #[overflow = checked]; - v112 = arith.constant 4 : u32; - v113 = arith.mod v111, v112 : u32; - hir.assertz v113 #[code = 250]; - v114 = hir.int_to_ptr v111 : ptr; - hir.store v114, v108; - v115 = hir.bitcast v94 : u32; - v326 = arith.constant 8 : u32; - v117 = arith.mod v115, v326 : u32; - hir.assertz v117 #[code = 250]; - v118 = hir.int_to_ptr v115 : ptr; - v119 = hir.load v118 : i64; - v120 = hir.bitcast v101 : u32; - v325 = arith.constant 4 : u32; - v122 = arith.mod v120, v325 : u32; - hir.assertz v122 #[code = 250]; - v123 = hir.int_to_ptr v120 : ptr; - hir.store v123, v119; - v124 = arith.constant 12 : i32; - v125 = arith.add v101, v124 : i32 #[overflow = wrapping]; - v95 = arith.constant 0 : i32; - v296, v297, v298, v299, v300, v301 = scf.while v95, v101, v125, v93 : i32, i32, i32, i32, i32, i32 { - ^block35(v302: i32, v303: i32, v304: i32, v305: i32): - v324 = arith.constant 0 : i32; - v128 = arith.constant 8 : i32; - v129 = arith.eq v302, v128 : i1; - v130 = arith.zext v129 : u32; - v131 = hir.bitcast v130 : i32; - v133 = arith.neq v131, v324 : i1; - v290, v291 = scf.if v133 : i32, i32 { - ^block34: - v250 = ub.poison i32 : i32; - scf.yield v250, v250; - } else { - ^block20: - v135 = arith.add v303, v302 : i32 #[overflow = wrapping]; - v136 = hir.bitcast v135 : u32; - v323 = arith.constant 4 : u32; - v138 = arith.mod v136, v323 : u32; - hir.assertz v138 #[code = 250]; - v139 = hir.int_to_ptr v136 : ptr; - v140 = hir.load v139 : felt; - v142 = hir.bitcast v304 : u32; - v322 = arith.constant 4 : u32; - v144 = arith.mod v142, v322 : u32; - hir.assertz v144 #[code = 250]; - v145 = hir.int_to_ptr v142 : ptr; - v146 = hir.load v145 : i32; - v147 = hir.bitcast v135 : u32; - v321 = arith.constant 4 : u32; - v149 = arith.mod v147, v321 : u32; - hir.assertz v149 #[code = 250]; - v150 = hir.int_to_ptr v147 : ptr; - hir.store v150, v146; - v151 = hir.bitcast v304 : u32; - v320 = arith.constant 4 : u32; - v153 = arith.mod v151, v320 : u32; - hir.assertz v153 #[code = 250]; - v154 = hir.int_to_ptr v151 : ptr; - hir.store v154, v140; - v157 = arith.constant -4 : i32; - v158 = arith.add v304, v157 : i32 #[overflow = wrapping]; - v155 = arith.constant 4 : i32; - v156 = arith.add v302, v155 : i32 #[overflow = wrapping]; - scf.yield v156, v158; - }; - v318 = ub.poison i32 : i32; - v293 = cf.select v133, v318, v305 : i32; - v319 = ub.poison i32 : i32; - v292 = cf.select v133, v319, v303 : i32; - v249 = arith.constant 1 : u32; - v242 = arith.constant 0 : u32; - v295 = cf.select v133, v242, v249 : u32; - v283 = arith.trunc v295 : i1; - scf.condition v283, v290, v292, v291, v293, v303, v305; - } do { - ^block36(v306: i32, v307: i32, v308: i32, v309: i32, v310: i32, v311: i32): - scf.yield v306, v307, v308, v309; - }; - v317 = arith.constant 8 : u32; - v160 = hir.bitcast v300 : u32; - v162 = arith.add v160, v317 : u32 #[overflow = checked]; - v316 = arith.constant 4 : u32; - v164 = arith.mod v162, v316 : u32; - hir.assertz v164 #[code = 250]; - v165 = hir.int_to_ptr v162 : ptr; - v166 = hir.load v165 : i64; - v315 = arith.constant 8 : u32; - v167 = hir.bitcast v301 : u32; - v169 = arith.add v167, v315 : u32 #[overflow = checked]; - v314 = arith.constant 8 : u32; - v171 = arith.mod v169, v314 : u32; - hir.assertz v171 #[code = 250]; - v172 = hir.int_to_ptr v169 : ptr; - hir.store v172, v166; - v173 = hir.bitcast v300 : u32; - v313 = arith.constant 4 : u32; - v175 = arith.mod v173, v313 : u32; - hir.assertz v175 #[code = 250]; - v176 = hir.int_to_ptr v173 : ptr; - v177 = hir.load v176 : i64; - v178 = hir.bitcast v301 : u32; - v312 = arith.constant 8 : u32; - v180 = arith.mod v178, v312 : u32; - hir.assertz v180 #[code = 250]; - v181 = hir.int_to_ptr v178 : ptr; - hir.store v181, v177; - builtin.ret ; - }; - - private builtin.function @miden::active_account::get_vault_root(v182: i32) { - ^block21(v182: i32): - v183, v184, v185, v186 = hir.exec @miden/active_account/get_vault_root() : felt, felt, felt, felt - v187 = hir.bitcast v182 : u32; - v188 = hir.int_to_ptr v187 : ptr; - hir.store v188, v183; - v189 = arith.constant 4 : u32; - v190 = arith.add v187, v189 : u32 #[overflow = checked]; - v191 = hir.int_to_ptr v190 : ptr; - hir.store v191, v184; - v192 = arith.constant 8 : u32; - v193 = arith.add v187, v192 : u32 #[overflow = checked]; - v194 = hir.int_to_ptr v193 : ptr; - hir.store v194, v185; - v195 = arith.constant 12 : u32; - v196 = arith.add v187, v195 : u32 #[overflow = checked]; - v197 = hir.int_to_ptr v196 : ptr; - hir.store v197, v186; + private builtin.function @miden::protocol::active_account::get_vault_root(v99: i32) { + ^block15(v99: i32): + v100, v101, v102, v103 = hir.exec @miden/protocol/active_account/get_vault_root() : felt, felt, felt, felt + v104 = hir.bitcast v99 : u32; + v105 = hir.int_to_ptr v104 : ptr; + hir.store v105, v100; + v185 = arith.constant 4 : u32; + v107 = arith.add v104, v185 : u32 #[overflow = checked]; + v108 = hir.int_to_ptr v107 : ptr; + hir.store v108, v101; + v184 = arith.constant 8 : u32; + v110 = arith.add v104, v184 : u32 #[overflow = checked]; + v111 = hir.int_to_ptr v110 : ptr; + hir.store v111, v102; + v183 = arith.constant 12 : u32; + v113 = arith.add v104, v183 : u32 #[overflow = checked]; + v114 = hir.int_to_ptr v113 : ptr; + hir.store v114, v103; builtin.ret ; }; @@ -294,34 +178,34 @@ builtin.component miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block25: - v198 = hir.exec @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1#binding() : i32 + ^block20: + v115 = hir.exec @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1#binding() : i32 + v189 = arith.constant 0 : i32; + v117 = arith.add v115, v189 : i32 #[overflow = unchecked]; + v198 = arith.constant 0 : i32; v199 = arith.constant 0 : i32; - v200 = arith.add v198, v199 : i32 #[overflow = unchecked]; - v332 = arith.constant 0 : i32; - v333 = arith.constant 0 : i32; - v202 = arith.add v200, v333 : i32 #[overflow = unchecked]; - v204 = arith.add v202, v332 : i32 #[overflow = unchecked]; - v205 = hir.int_to_ptr v204 : ptr; - v206 = hir.load v205 : felt; - v331 = arith.constant 0 : i32; - v207 = arith.constant 4 : i32; - v208 = arith.add v200, v207 : i32 #[overflow = unchecked]; - v210 = arith.add v208, v331 : i32 #[overflow = unchecked]; - v211 = hir.int_to_ptr v210 : ptr; - v212 = hir.load v211 : felt; - v330 = arith.constant 0 : i32; - v213 = arith.constant 8 : i32; - v214 = arith.add v200, v213 : i32 #[overflow = unchecked]; - v216 = arith.add v214, v330 : i32 #[overflow = unchecked]; - v217 = hir.int_to_ptr v216 : ptr; - v218 = hir.load v217 : felt; - v329 = arith.constant 0 : i32; - v219 = arith.constant 12 : i32; - v220 = arith.add v200, v219 : i32 #[overflow = unchecked]; - v222 = arith.add v220, v329 : i32 #[overflow = unchecked]; - v223 = hir.int_to_ptr v222 : ptr; - v224 = hir.load v223 : felt; - builtin.ret v206, v212, v218, v224; + v119 = arith.add v117, v199 : i32 #[overflow = unchecked]; + v121 = arith.add v119, v198 : i32 #[overflow = unchecked]; + v122 = hir.int_to_ptr v121 : ptr; + v123 = hir.load v122 : felt; + v197 = arith.constant 0 : i32; + v188 = arith.constant 4 : i32; + v125 = arith.add v117, v188 : i32 #[overflow = unchecked]; + v127 = arith.add v125, v197 : i32 #[overflow = unchecked]; + v128 = hir.int_to_ptr v127 : ptr; + v129 = hir.load v128 : felt; + v196 = arith.constant 0 : i32; + v187 = arith.constant 8 : i32; + v131 = arith.add v117, v187 : i32 #[overflow = unchecked]; + v133 = arith.add v131, v196 : i32 #[overflow = unchecked]; + v134 = hir.int_to_ptr v133 : ptr; + v135 = hir.load v134 : felt; + v195 = arith.constant 0 : i32; + v186 = arith.constant 12 : i32; + v137 = arith.add v117, v186 : i32 #[overflow = unchecked]; + v139 = arith.add v137, v195 : i32 #[overflow = unchecked]; + v140 = hir.int_to_ptr v139 : ptr; + v141 = hir.load v140 : felt; + builtin.ret v123, v129, v135, v141; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.masm index fa2da2547..7de332eee 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.masm @@ -1,13 +1,13 @@ -# mod miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1 +# mod ::"miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> (felt, felt, felt, felt) - exec.::miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1::init + exec."miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1::rust_sdk_account_get_vault_root_binding::miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1#binding + exec.::"miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1"::rust_sdk_account_get_vault_root_binding::"miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1#binding" trace.252 nop push.0 @@ -62,7 +62,7 @@ pub proc binding( nop movdn.3 swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -75,7 +75,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -86,7 +86,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1::rust_sdk_account_get_vault_root_binding +# mod ::"miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1"::rust_sdk_account_get_vault_root_binding @callconv("C") proc __wasm_call_ctors( @@ -102,6 +102,7 @@ proc rust_sdk_account_get_vault_root_binding::bindings::__link_custom_section_de nop end +@locals("2") @callconv("C") proc miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1#binding( @@ -114,36 +115,87 @@ proc miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-ro exec.::intrinsics::mem::load_sw trace.252 nop - push.48 + push.16 u32wrapping_sub + dup.0 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 - dup.1 + u32divmod.4 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114148 u32divmod.4 swap.1 trace.240 nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop exec.::intrinsics::mem::store_sw trace.252 nop trace.240 nop - exec.::miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1::rust_sdk_account_get_vault_root_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1"::rust_sdk_account_get_vault_root_binding::wit_bindgen::rt::run_ctors_once trace.252 nop - push.16 - dup.1 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1"::rust_sdk_account_get_vault_root_binding::"miden::protocol::active_account::get_vault_root" + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 u32wrapping_add + dup.0 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1::rust_sdk_account_get_vault_root_binding::miden::active_account::get_vault_root + exec.::intrinsics::mem::store_sw trace.252 nop - push.24 - dup.1 - add - u32assert - push.8 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 dup.1 swap.1 u32mod @@ -153,15 +205,14 @@ proc miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-ro swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.40 - dup.3 + push.12 + movup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -169,18 +220,32 @@ proc miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-ro assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.16 - dup.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -190,15 +255,14 @@ proc miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-ro swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.32 - dup.3 + push.8 + movup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -206,37 +270,32 @@ proc miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-ro assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.1114148 - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.32 - dup.2 - u32wrapping_add - dup.2 + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1::rust_sdk_account_get_vault_root_binding::::reverse + exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 - u32wrapping_add push.8 - dup.2 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -246,12 +305,11 @@ proc miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-ro swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.8 - dup.3 + push.4 + movup.2 add u32assert push.4 @@ -262,15 +320,32 @@ proc miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-ro assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - dup.1 - push.8 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + swap.1 + add + u32assert + push.4 dup.1 swap.1 u32mod @@ -280,11 +355,10 @@ proc miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-ro swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop swap.1 - dup.2 push.4 dup.1 swap.1 @@ -293,15 +367,20 @@ proc miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-ro assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.48 - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 u32wrapping_add push.1114144 u32divmod.4 @@ -311,8 +390,17 @@ proc miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-ro exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -354,9 +442,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop trace.240 nop - exec.::miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1::rust_sdk_account_get_vault_root_binding::__wasm_call_ctors + exec.::"miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1"::rust_sdk_account_get_vault_root_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -388,287 +492,10 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.4 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop -end - -@callconv("C") -proc miden::active_account::get_vault_root(i32) +proc miden::protocol::active_account::get_vault_root(i32) trace.240 nop - exec.::miden::active_account::get_vault_root + exec.::miden::protocol::active_account::get_vault_root trace.252 nop movup.4 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.wat index a2eaab106..cedfe56c6 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.wat @@ -12,8 +12,7 @@ (core module $main (;0;) (type (;0;) (func)) (type (;1;) (func (result i32))) - (type (;2;) (func (param i32 i32))) - (type (;3;) (func (param i32))) + (type (;2;) (func (param i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -26,43 +25,36 @@ (func $miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1#binding (;2;) (type 1) (result i32) (local i32 i32) global.get $__stack_pointer - i32.const 48 + i32.const 16 i32.sub local.tee 0 global.set $__stack_pointer - call $wit_bindgen::rt::run_ctors_once - local.get 0 - i32.const 16 - i32.add - call $miden::active_account::get_vault_root - local.get 0 - local.get 0 - i64.load offset=24 - i64.store offset=40 - local.get 0 - local.get 0 - i64.load offset=16 - i64.store offset=32 global.get $GOT.data.internal.__memory_base local.set 1 + call $wit_bindgen::rt::run_ctors_once local.get 0 - local.get 0 - i32.const 32 - i32.add - call $::reverse + call $miden::protocol::active_account::get_vault_root local.get 1 i32.const 1048584 i32.add local.tee 1 local.get 0 - i64.load offset=8 - i64.store offset=8 align=4 + f32.load + f32.store offset=12 local.get 1 local.get 0 - i64.load - i64.store align=4 + f32.load offset=4 + f32.store offset=8 + local.get 1 + local.get 0 + f32.load offset=8 + f32.store offset=4 + local.get 1 local.get 0 - i32.const 48 + f32.load offset=12 + f32.store + local.get 0 + i32.const 16 i32.add global.set $__stack_pointer local.get 1 @@ -85,69 +77,11 @@ i32.store8 end ) - (func $::reverse (;4;) (type 2) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store - ) - (func $miden::active_account::get_vault_root (;5;) (type 3) (param i32) + (func $miden::protocol::active_account::get_vault_root (;4;) (type 2) (param i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "Orust_sdk_account_get_vault_root_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "Orust_sdk_account_get_vault_root_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.hir index ecf68d20d..4490169f0 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.hir @@ -12,192 +12,198 @@ builtin.component miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk private builtin.function @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1#binding() -> felt { ^block9: - v3 = builtin.global_symbol @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/__stack_pointer : ptr - v4 = hir.bitcast v3 : ptr; - v5 = hir.load v4 : i32; - v6 = arith.constant 32 : i32; - v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; - v8 = builtin.global_symbol @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/__stack_pointer : ptr - v9 = hir.bitcast v8 : ptr; - hir.store v9, v7; + v1 = builtin.global_symbol @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v149 = arith.constant 32 : i32; + v5 = arith.sub v3, v149 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/wit_bindgen::rt::run_ctors_once() - v1 = arith.constant 0 : i32; - v12 = hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/intrinsics::felt::from_u32(v1) : felt - v198 = arith.constant 0 : i32; - v176, v177, v178, v179 = scf.while v198, v7, v12 : i32, i32, felt, i32 { - ^block38(v180: i32, v181: i32, v182: felt): - v197 = arith.constant 0 : i32; - v31 = arith.constant 16 : i32; - v15 = arith.eq v180, v31 : i1; - v16 = arith.zext v15 : u32; - v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v197 : i1; - v171 = scf.if v19 : i32 { - ^block37: - v142 = ub.poison i32 : i32; - scf.yield v142; + v148 = arith.constant 0 : i32; + hir.store_local v148 #[local = lv1]; + v141 = arith.constant 0 : felt; + hir.store_local v141 #[local = lv2]; + scf.while { + ^block12: + v11 = hir.load_local : i32 #[local = lv1]; + v179 = arith.constant 0 : i32; + v153 = arith.constant 16 : i32; + v13 = arith.eq v11, v153 : i1; + v14 = arith.zext v13 : u32; + v15 = hir.bitcast v14 : i32; + v17 = arith.neq v15, v179 : i1; + scf.if v17{ + ^block34: + scf.yield ; } else { ^block14: - v196 = arith.constant 16 : i32; - v22 = arith.add v181, v196 : i32 #[overflow = wrapping]; - v23 = arith.add v22, v180 : i32 #[overflow = wrapping]; - v25 = hir.bitcast v23 : u32; - v36 = arith.constant 4 : u32; - v27 = arith.mod v25, v36 : u32; - hir.assertz v27 #[code = 250]; - v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v182; - v29 = arith.constant 4 : i32; - v30 = arith.add v180, v29 : i32 #[overflow = wrapping]; - scf.yield v30; + v18 = hir.load_local : i32 #[local = lv0]; + v21 = hir.load_local : i32 #[local = lv1]; + v23 = hir.load_local : felt #[local = lv2]; + v178 = arith.constant 16 : i32; + v20 = arith.add v18, v178 : i32 #[overflow = wrapping]; + v22 = arith.add v20, v21 : i32 #[overflow = wrapping]; + v24 = hir.bitcast v22 : u32; + v150 = arith.constant 4 : u32; + v26 = arith.mod v24, v150 : u32; + hir.assertz v26 #[code = 250]; + v27 = hir.int_to_ptr v24 : ptr; + hir.store v27, v23; + v28 = hir.load_local : i32 #[local = lv1]; + v142 = arith.constant 4 : i32; + v30 = arith.add v28, v142 : i32 #[overflow = wrapping]; + hir.store_local v30 #[local = lv1]; + scf.yield ; }; - v143 = ub.poison felt : felt; - v173 = cf.select v19, v143, v182 : felt; - v195 = ub.poison i32 : i32; - v172 = cf.select v19, v195, v181 : i32; - v141 = arith.constant 1 : u32; - v135 = arith.constant 0 : u32; - v175 = cf.select v19, v135, v141 : u32; - v165 = arith.trunc v175 : i1; - scf.condition v165, v171, v172, v173, v181; + v164 = arith.constant 1 : u32; + v161 = arith.constant 0 : u32; + v169 = cf.select v17, v161, v164 : u32; + v165 = arith.trunc v169 : i1; + scf.condition v165; } do { - ^block39(v183: i32, v184: i32, v185: felt, v186: i32): - scf.yield v183, v184, v185; + ^block33: + scf.yield ; }; - v194 = arith.constant 16 : i32; - v32 = arith.add v179, v194 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/>::from(v179, v32) - v34 = arith.constant 12 : u32; - v33 = hir.bitcast v179 : u32; - v35 = arith.add v33, v34 : u32 #[overflow = checked]; - v193 = arith.constant 4 : u32; - v37 = arith.mod v35, v193 : u32; - hir.assertz v37 #[code = 250]; - v38 = hir.int_to_ptr v35 : ptr; - v39 = hir.load v38 : felt; - v41 = arith.constant 8 : u32; - v40 = hir.bitcast v179 : u32; - v42 = arith.add v40, v41 : u32 #[overflow = checked]; - v192 = arith.constant 4 : u32; - v44 = arith.mod v42, v192 : u32; - hir.assertz v44 #[code = 250]; - v45 = hir.int_to_ptr v42 : ptr; - v46 = hir.load v45 : felt; - v191 = arith.constant 4 : u32; - v47 = hir.bitcast v179 : u32; - v49 = arith.add v47, v191 : u32 #[overflow = checked]; - v190 = arith.constant 4 : u32; - v51 = arith.mod v49, v190 : u32; - hir.assertz v51 #[code = 250]; - v52 = hir.int_to_ptr v49 : ptr; - v53 = hir.load v52 : felt; - v54 = hir.bitcast v179 : u32; - v189 = arith.constant 4 : u32; - v56 = arith.mod v54, v189 : u32; + v31 = hir.load_local : i32 #[local = lv0]; + v177 = arith.constant 16 : i32; + v34 = arith.add v31, v177 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/>::from(v31, v34) + v35 = hir.load_local : i32 #[local = lv0]; + v146 = arith.constant 12 : u32; + v36 = hir.bitcast v35 : u32; + v38 = arith.add v36, v146 : u32 #[overflow = checked]; + v176 = arith.constant 4 : u32; + v40 = arith.mod v38, v176 : u32; + hir.assertz v40 #[code = 250]; + v41 = hir.int_to_ptr v38 : ptr; + v42 = hir.load v41 : felt; + v43 = hir.load_local : i32 #[local = lv0]; + v144 = arith.constant 8 : u32; + v44 = hir.bitcast v43 : u32; + v46 = arith.add v44, v144 : u32 #[overflow = checked]; + v175 = arith.constant 4 : u32; + v48 = arith.mod v46, v175 : u32; + hir.assertz v48 #[code = 250]; + v49 = hir.int_to_ptr v46 : ptr; + v50 = hir.load v49 : felt; + v51 = hir.load_local : i32 #[local = lv0]; + v174 = arith.constant 4 : u32; + v52 = hir.bitcast v51 : u32; + v54 = arith.add v52, v174 : u32 #[overflow = checked]; + v173 = arith.constant 4 : u32; + v56 = arith.mod v54, v173 : u32; hir.assertz v56 #[code = 250]; v57 = hir.int_to_ptr v54 : ptr; v58 = hir.load v57 : felt; - v59 = hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/miden::active_account::has_non_fungible_asset(v39, v46, v53, v58) : felt - v188 = arith.constant 0 : i32; - v61 = hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/intrinsics::felt::from_u32(v188) : felt - v62 = hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/intrinsics::felt::eq(v59, v61) : i32 - v63 = arith.constant 1 : i32; - v64 = arith.neq v62, v63 : i1; - v65 = arith.zext v64 : u32; - v66 = hir.bitcast v65 : i32; - v67 = hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/intrinsics::felt::from_u32(v66) : felt - v187 = arith.constant 32 : i32; - v69 = arith.add v179, v187 : i32 #[overflow = wrapping]; - v70 = builtin.global_symbol @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/__stack_pointer : ptr - v71 = hir.bitcast v70 : ptr; - hir.store v71, v69; - builtin.ret v67; + v59 = hir.load_local : i32 #[local = lv0]; + v60 = hir.bitcast v59 : u32; + v172 = arith.constant 4 : u32; + v62 = arith.mod v60, v172 : u32; + hir.assertz v62 #[code = 250]; + v63 = hir.int_to_ptr v60 : ptr; + v64 = hir.load v63 : felt; + v65 = hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/miden::protocol::active_account::has_non_fungible_asset(v42, v50, v58, v64) : felt + v143 = arith.constant 1 : i32; + v171 = arith.constant 0 : felt; + v68 = arith.eq v65, v171 : i1; + v69 = hir.cast v68 : i32; + v71 = arith.neq v69, v143 : i1; + v72 = arith.zext v71 : u32; + v73 = hir.bitcast v72 : i32; + v74 = hir.bitcast v73 : felt; + hir.store_local v74 #[local = lv2]; + v75 = hir.load_local : i32 #[local = lv0]; + v170 = arith.constant 32 : i32; + v77 = arith.add v75, v170 : i32 #[overflow = wrapping]; + v78 = builtin.global_symbol @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/__stack_pointer : ptr + v79 = hir.bitcast v78 : ptr; + hir.store v79, v77; + v80 = hir.load_local : felt #[local = lv2]; + builtin.ret v80; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block15: - v73 = builtin.global_symbol @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr - v74 = hir.bitcast v73 : ptr; - v75 = hir.load v74 : i32; - v76 = arith.constant 1048584 : i32; - v77 = arith.add v75, v76 : i32 #[overflow = wrapping]; - v78 = hir.bitcast v77 : u32; - v79 = hir.int_to_ptr v78 : ptr; - v80 = hir.load v79 : u8; - v72 = arith.constant 0 : i32; - v81 = arith.zext v80 : u32; - v82 = hir.bitcast v81 : i32; - v84 = arith.neq v82, v72 : i1; - scf.if v84{ + v81 = builtin.global_symbol @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v82 = hir.bitcast v81 : ptr; + v83 = hir.load v82 : i32; + v184 = arith.constant 1048584 : i32; + v85 = arith.add v83, v184 : i32 #[overflow = wrapping]; + v86 = hir.bitcast v85 : u32; + v87 = hir.int_to_ptr v86 : ptr; + v88 = hir.load v87 : u8; + v183 = arith.constant 0 : i32; + v89 = arith.zext v88 : u32; + v90 = hir.bitcast v89 : i32; + v92 = arith.neq v90, v183 : i1; + scf.if v92{ ^block17: scf.yield ; } else { ^block18: - v85 = builtin.global_symbol @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr - v86 = hir.bitcast v85 : ptr; - v87 = hir.load v86 : i32; + v93 = builtin.global_symbol @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v94 = hir.bitcast v93 : ptr; + v95 = hir.load v94 : i32; + hir.store_local v95 #[local = lv0]; hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/__wasm_call_ctors() - v200 = arith.constant 1 : u8; - v202 = arith.constant 1048584 : i32; - v89 = arith.add v87, v202 : i32 #[overflow = wrapping]; - v93 = hir.bitcast v89 : u32; - v94 = hir.int_to_ptr v93 : ptr; - hir.store v94, v200; + v96 = hir.load_local : i32 #[local = lv0]; + v182 = arith.constant 1 : u8; + v187 = arith.constant 1048584 : i32; + v98 = arith.add v96, v187 : i32 #[overflow = wrapping]; + v102 = hir.bitcast v98 : u32; + v103 = hir.int_to_ptr v102 : ptr; + hir.store v103, v182; scf.yield ; }; builtin.ret ; }; - private builtin.function @>::from(v95: i32, v96: i32) { - ^block19(v95: i32, v96: i32): - v98 = arith.constant 8 : u32; - v97 = hir.bitcast v96 : u32; - v99 = arith.add v97, v98 : u32 #[overflow = checked]; - v100 = arith.constant 4 : u32; - v101 = arith.mod v99, v100 : u32; - hir.assertz v101 #[code = 250]; - v102 = hir.int_to_ptr v99 : ptr; - v103 = hir.load v102 : i64; - v206 = arith.constant 8 : u32; - v104 = hir.bitcast v95 : u32; - v106 = arith.add v104, v206 : u32 #[overflow = checked]; - v205 = arith.constant 8 : u32; - v108 = arith.mod v106, v205 : u32; - hir.assertz v108 #[code = 250]; - v109 = hir.int_to_ptr v106 : ptr; - hir.store v109, v103; - v110 = hir.bitcast v96 : u32; - v204 = arith.constant 4 : u32; - v112 = arith.mod v110, v204 : u32; + private builtin.function @>::from(v104: i32, v105: i32) { + ^block19(v104: i32, v105: i32): + hir.store_local v104 #[local = lv0]; + hir.store_local v105 #[local = lv1]; + v106 = hir.load_local : i32 #[local = lv0]; + v107 = hir.load_local : i32 #[local = lv1]; + v189 = arith.constant 8 : u32; + v108 = hir.bitcast v107 : u32; + v110 = arith.add v108, v189 : u32 #[overflow = checked]; + v188 = arith.constant 4 : u32; + v112 = arith.mod v110, v188 : u32; hir.assertz v112 #[code = 250]; v113 = hir.int_to_ptr v110 : ptr; v114 = hir.load v113 : i64; - v115 = hir.bitcast v95 : u32; - v203 = arith.constant 8 : u32; - v117 = arith.mod v115, v203 : u32; - hir.assertz v117 #[code = 250]; - v118 = hir.int_to_ptr v115 : ptr; - hir.store v118, v114; + v197 = arith.constant 8 : u32; + v115 = hir.bitcast v106 : u32; + v117 = arith.add v115, v197 : u32 #[overflow = checked]; + v196 = arith.constant 8 : u32; + v119 = arith.mod v117, v196 : u32; + hir.assertz v119 #[code = 250]; + v120 = hir.int_to_ptr v117 : ptr; + hir.store v120, v114; + v121 = hir.load_local : i32 #[local = lv0]; + v122 = hir.load_local : i32 #[local = lv1]; + v123 = hir.bitcast v122 : u32; + v195 = arith.constant 4 : u32; + v125 = arith.mod v123, v195 : u32; + hir.assertz v125 #[code = 250]; + v126 = hir.int_to_ptr v123 : ptr; + v127 = hir.load v126 : i64; + v128 = hir.bitcast v121 : u32; + v194 = arith.constant 8 : u32; + v130 = arith.mod v128, v194 : u32; + hir.assertz v130 #[code = 250]; + v131 = hir.int_to_ptr v128 : ptr; + hir.store v131, v127; builtin.ret ; }; - private builtin.function @intrinsics::felt::eq(v119: felt, v120: felt) -> i32 { - ^block21(v119: felt, v120: felt): - v121 = arith.eq v119, v120 : i1; - v122 = hir.cast v121 : i32; - builtin.ret v122; - }; - - private builtin.function @intrinsics::felt::from_u32(v124: i32) -> felt { - ^block23(v124: i32): - v125 = hir.bitcast v124 : felt; - builtin.ret v125; - }; - - private builtin.function @miden::active_account::has_non_fungible_asset(v127: felt, v128: felt, v129: felt, v130: felt) -> felt { - ^block25(v127: felt, v128: felt, v129: felt, v130: felt): - v131 = hir.exec @miden/active_account/has_non_fungible_asset(v127, v128, v129, v130) : felt - builtin.ret v131; + private builtin.function @miden::protocol::active_account::has_non_fungible_asset(v132: felt, v133: felt, v134: felt, v135: felt) -> felt { + ^block21(v132: felt, v133: felt, v134: felt, v135: felt): + v136 = hir.exec @miden/protocol/active_account/has_non_fungible_asset(v132, v133, v134, v135) : felt + builtin.ret v136; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -212,8 +218,8 @@ builtin.component miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk }; public builtin.function @binding() -> felt { - ^block29: - v133 = hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1#binding() : felt - builtin.ret v133; + ^block26: + v138 = hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1#binding() : felt + builtin.ret v138; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.masm index d0c7bd79e..b6185a236 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.masm @@ -1,16 +1,16 @@ -# mod miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1 +# mod ::"miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> felt - exec.::miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1::init + exec."miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1::rust_sdk_account_has_non_fungible_asset_binding::miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1#binding + exec.::"miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1"::rust_sdk_account_has_non_fungible_asset_binding::"miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1#binding" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -23,7 +23,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -34,7 +34,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1::rust_sdk_account_has_non_fungible_asset_binding +# mod ::"miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1"::rust_sdk_account_has_non_fungible_asset_binding @callconv("C") proc __wasm_call_ctors( @@ -50,6 +50,7 @@ proc rust_sdk_account_has_non_fungible_asset_binding::bindings::__link_custom_se nop end +@locals("3") @callconv("C") proc miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1#binding( @@ -64,9 +65,16 @@ proc miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has- nop push.32 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -76,35 +84,74 @@ proc miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has- nop trace.240 nop - exec.::miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1::rust_sdk_account_has_non_fungible_asset_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1"::rust_sdk_account_has_non_fungible_asset_binding::wit_bindgen::rt::run_ctors_once trace.252 nop push.0 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1::rust_sdk_account_has_non_fungible_asset_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_sw trace.252 nop push.0 - movup.2 + locaddr.2 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1 while.true + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.16 - dup.2 + movup.2 eq neq dup.0 if.true - swap.1 - drop - push.3735929054 + nop else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.16 - dup.3 + movup.3 u32wrapping_add - dup.2 + movup.2 u32wrapping_add push.4 dup.1 @@ -112,8 +159,6 @@ proc miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has- u32mod u32assert assertz - dup.4 - swap.1 u32divmod.4 swap.1 trace.240 @@ -121,52 +166,64 @@ proc miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has- exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - movup.2 u32wrapping_add + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.3735929054 - dup.2 - movup.2 - swap.5 - movdn.2 - cdrop - push.3735929054 - dup.2 - dup.4 - swap.2 - swap.1 - cdrop push.1 push.0 - movup.4 + movup.2 cdrop push.1 u32and - movup.4 - swap.1 if.true - movup.3 - drop push.1 else push.0 end end - drop - drop - drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 dup.1 u32wrapping_add - dup.1 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1::rust_sdk_account_has_non_fungible_asset_binding::>::from + exec.::"miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1"::rust_sdk_account_has_non_fungible_asset_binding::>::from + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.12 - dup.1 + swap.1 add u32assert push.4 @@ -182,8 +239,16 @@ proc miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has- exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.2 + swap.1 add u32assert push.4 @@ -199,8 +264,16 @@ proc miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has- exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.3 + swap.1 add u32assert push.4 @@ -216,7 +289,14 @@ proc miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has- exec.::intrinsics::mem::load_felt trace.252 nop - dup.3 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -234,30 +314,31 @@ proc miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has- swap.2 trace.240 nop - exec.::miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1::rust_sdk_account_has_non_fungible_asset_binding::miden::active_account::has_non_fungible_asset + exec.::"miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1"::rust_sdk_account_has_non_fungible_asset_binding::"miden::protocol::active_account::has_non_fungible_asset" trace.252 nop + push.1 + push.0 + movup.2 + eq + neq + locaddr.2 push.0 - trace.240 - nop - exec.::miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1::rust_sdk_account_has_non_fungible_asset_binding::intrinsics::felt::from_u32 - trace.252 - nop swap.1 trace.240 nop - exec.::miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1::rust_sdk_account_has_non_fungible_asset_binding::intrinsics::felt::eq + exec.::intrinsics::mem::store_felt trace.252 nop - push.1 - neq + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1::rust_sdk_account_has_non_fungible_asset_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop push.32 - movup.2 u32wrapping_add push.1114144 u32divmod.4 @@ -267,8 +348,17 @@ proc miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has- exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -310,9 +400,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1"::rust_sdk_account_has_non_fungible_asset_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1::rust_sdk_account_has_non_fungible_asset_binding::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -343,13 +449,46 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("2") @callconv("C") -proc >::from( +proc >::from( i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.2 + swap.1 add u32assert push.4 @@ -367,7 +506,7 @@ proc i32 - eq -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc miden::active_account::has_non_fungible_asset( +proc miden::protocol::active_account::has_non_fungible_asset( felt, felt, felt, @@ -437,7 +581,7 @@ proc miden::active_account::has_non_fungible_asset( ) -> felt trace.240 nop - exec.::miden::active_account::has_non_fungible_asset + exec.::miden::protocol::active_account::has_non_fungible_asset trace.252 nop end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.wat index eb0315937..f963c5cdc 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.wat @@ -59,7 +59,7 @@ local.get 0 i32.const 16 i32.add - call $>::from + call $>::from local.get 0 f32.load offset=12 local.get 0 @@ -68,7 +68,7 @@ f32.load offset=4 local.get 0 f32.load - call $miden::active_account::has_non_fungible_asset + call $miden::protocol::active_account::has_non_fungible_asset i32.const 0 call $intrinsics::felt::from_u32 call $intrinsics::felt::eq @@ -100,7 +100,7 @@ i32.store8 end ) - (func $>::from (;4;) (type 2) (param i32 i32) + (func $>::from (;4;) (type 2) (param i32 i32) local.get 0 local.get 1 i64.load offset=8 align=4 @@ -116,11 +116,11 @@ (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) unreachable ) - (func $miden::active_account::has_non_fungible_asset (;7;) (type 5) (param f32 f32 f32 f32) (result f32) + (func $miden::protocol::active_account::has_non_fungible_asset (;7;) (type 5) (param f32 f32 f32 f32) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "_rust_sdk_account_has_non_fungible_asset_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "_rust_sdk_account_has_non_fungible_asset_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.hir index 75b0ef57b..df84a081a 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.hir @@ -12,154 +12,153 @@ builtin.component miden:rust-sdk-account-has-procedure-binding/rust-sdk-account- private builtin.function @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1#binding() -> felt { ^block9: - v3 = builtin.global_symbol @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/__stack_pointer : ptr - v4 = hir.bitcast v3 : ptr; - v5 = hir.load v4 : i32; - v6 = arith.constant 16 : i32; - v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; - v8 = builtin.global_symbol @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/__stack_pointer : ptr - v9 = hir.bitcast v8 : ptr; - hir.store v9, v7; + v1 = builtin.global_symbol @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v114 = arith.constant 16 : i32; + v5 = arith.sub v3, v114 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/wit_bindgen::rt::run_ctors_once() - v1 = arith.constant 0 : i32; - v12 = hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/intrinsics::felt::from_u32(v1) : felt - v169 = arith.constant 0 : i32; - v148, v149, v150, v151 = scf.while v169, v7, v12 : i32, i32, felt, i32 { - ^block36(v152: i32, v153: i32, v154: felt): - v167 = arith.constant 0 : i32; - v168 = arith.constant 16 : i32; - v15 = arith.eq v152, v168 : i1; - v16 = arith.zext v15 : u32; - v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v167 : i1; - v143 = scf.if v19 : i32 { - ^block35: - v114 = ub.poison i32 : i32; - scf.yield v114; + v113 = arith.constant 0 : i32; + hir.store_local v113 #[local = lv1]; + v107 = arith.constant 0 : felt; + hir.store_local v107 #[local = lv2]; + scf.while { + ^block12: + v11 = hir.load_local : i32 #[local = lv1]; + v141 = arith.constant 0 : i32; + v142 = arith.constant 16 : i32; + v13 = arith.eq v11, v142 : i1; + v14 = arith.zext v13 : u32; + v15 = hir.bitcast v14 : i32; + v17 = arith.neq v15, v141 : i1; + scf.if v17{ + ^block32: + scf.yield ; } else { ^block14: - v21 = arith.add v153, v152 : i32 #[overflow = wrapping]; - v23 = hir.bitcast v21 : u32; - v32 = arith.constant 4 : u32; - v25 = arith.mod v23, v32 : u32; - hir.assertz v25 #[code = 250]; - v26 = hir.int_to_ptr v23 : ptr; - hir.store v26, v154; - v27 = arith.constant 4 : i32; - v28 = arith.add v152, v27 : i32 #[overflow = wrapping]; - scf.yield v28; + v18 = hir.load_local : i32 #[local = lv0]; + v19 = hir.load_local : i32 #[local = lv1]; + v21 = hir.load_local : felt #[local = lv2]; + v20 = arith.add v18, v19 : i32 #[overflow = wrapping]; + v22 = hir.bitcast v20 : u32; + v115 = arith.constant 4 : u32; + v24 = arith.mod v22, v115 : u32; + hir.assertz v24 #[code = 250]; + v25 = hir.int_to_ptr v22 : ptr; + hir.store v25, v21; + v26 = hir.load_local : i32 #[local = lv1]; + v108 = arith.constant 4 : i32; + v28 = arith.add v26, v108 : i32 #[overflow = wrapping]; + hir.store_local v28 #[local = lv1]; + scf.yield ; }; - v115 = ub.poison felt : felt; - v145 = cf.select v19, v115, v154 : felt; - v166 = ub.poison i32 : i32; - v144 = cf.select v19, v166, v153 : i32; - v113 = arith.constant 1 : u32; - v107 = arith.constant 0 : u32; - v147 = cf.select v19, v107, v113 : u32; - v137 = arith.trunc v147 : i1; - scf.condition v137, v143, v144, v145, v153; + v128 = arith.constant 1 : u32; + v125 = arith.constant 0 : u32; + v133 = cf.select v17, v125, v128 : u32; + v129 = arith.trunc v133 : i1; + scf.condition v129; } do { - ^block37(v155: i32, v156: i32, v157: felt, v158: i32): - scf.yield v155, v156, v157; + ^block31: + scf.yield ; }; - v30 = arith.constant 12 : u32; - v29 = hir.bitcast v151 : u32; - v31 = arith.add v29, v30 : u32 #[overflow = checked]; - v165 = arith.constant 4 : u32; - v33 = arith.mod v31, v165 : u32; - hir.assertz v33 #[code = 250]; - v34 = hir.int_to_ptr v31 : ptr; - v35 = hir.load v34 : felt; - v37 = arith.constant 8 : u32; - v36 = hir.bitcast v151 : u32; - v38 = arith.add v36, v37 : u32 #[overflow = checked]; - v164 = arith.constant 4 : u32; - v40 = arith.mod v38, v164 : u32; - hir.assertz v40 #[code = 250]; - v41 = hir.int_to_ptr v38 : ptr; - v42 = hir.load v41 : felt; - v163 = arith.constant 4 : u32; - v43 = hir.bitcast v151 : u32; - v45 = arith.add v43, v163 : u32 #[overflow = checked]; - v162 = arith.constant 4 : u32; - v47 = arith.mod v45, v162 : u32; - hir.assertz v47 #[code = 250]; - v48 = hir.int_to_ptr v45 : ptr; - v49 = hir.load v48 : felt; - v50 = hir.bitcast v151 : u32; - v161 = arith.constant 4 : u32; - v52 = arith.mod v50, v161 : u32; - hir.assertz v52 #[code = 250]; - v53 = hir.int_to_ptr v50 : ptr; - v54 = hir.load v53 : felt; - v55 = hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/miden::active_account::has_procedure(v35, v42, v49, v54) : felt - v160 = arith.constant 0 : i32; - v57 = hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/intrinsics::felt::from_u32(v160) : felt - v58 = hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/intrinsics::felt::eq(v55, v57) : i32 - v59 = arith.constant 1 : i32; - v60 = arith.neq v58, v59 : i1; - v61 = arith.zext v60 : u32; - v62 = hir.bitcast v61 : i32; - v63 = hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/intrinsics::felt::from_u32(v62) : felt - v159 = arith.constant 16 : i32; - v65 = arith.add v151, v159 : i32 #[overflow = wrapping]; - v66 = builtin.global_symbol @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/__stack_pointer : ptr - v67 = hir.bitcast v66 : ptr; - hir.store v67, v65; - builtin.ret v63; + v29 = hir.load_local : i32 #[local = lv0]; + v112 = arith.constant 12 : u32; + v30 = hir.bitcast v29 : u32; + v32 = arith.add v30, v112 : u32 #[overflow = checked]; + v140 = arith.constant 4 : u32; + v34 = arith.mod v32, v140 : u32; + hir.assertz v34 #[code = 250]; + v35 = hir.int_to_ptr v32 : ptr; + v36 = hir.load v35 : felt; + v37 = hir.load_local : i32 #[local = lv0]; + v110 = arith.constant 8 : u32; + v38 = hir.bitcast v37 : u32; + v40 = arith.add v38, v110 : u32 #[overflow = checked]; + v139 = arith.constant 4 : u32; + v42 = arith.mod v40, v139 : u32; + hir.assertz v42 #[code = 250]; + v43 = hir.int_to_ptr v40 : ptr; + v44 = hir.load v43 : felt; + v45 = hir.load_local : i32 #[local = lv0]; + v138 = arith.constant 4 : u32; + v46 = hir.bitcast v45 : u32; + v48 = arith.add v46, v138 : u32 #[overflow = checked]; + v137 = arith.constant 4 : u32; + v50 = arith.mod v48, v137 : u32; + hir.assertz v50 #[code = 250]; + v51 = hir.int_to_ptr v48 : ptr; + v52 = hir.load v51 : felt; + v53 = hir.load_local : i32 #[local = lv0]; + v54 = hir.bitcast v53 : u32; + v136 = arith.constant 4 : u32; + v56 = arith.mod v54, v136 : u32; + hir.assertz v56 #[code = 250]; + v57 = hir.int_to_ptr v54 : ptr; + v58 = hir.load v57 : felt; + v59 = hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/miden::protocol::active_account::has_procedure(v36, v44, v52, v58) : felt + v109 = arith.constant 1 : i32; + v135 = arith.constant 0 : felt; + v62 = arith.eq v59, v135 : i1; + v63 = hir.cast v62 : i32; + v65 = arith.neq v63, v109 : i1; + v66 = arith.zext v65 : u32; + v67 = hir.bitcast v66 : i32; + v68 = hir.bitcast v67 : felt; + hir.store_local v68 #[local = lv2]; + v69 = hir.load_local : i32 #[local = lv0]; + v134 = arith.constant 16 : i32; + v71 = arith.add v69, v134 : i32 #[overflow = wrapping]; + v72 = builtin.global_symbol @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/__stack_pointer : ptr + v73 = hir.bitcast v72 : ptr; + hir.store v73, v71; + v74 = hir.load_local : felt #[local = lv2]; + builtin.ret v74; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block15: - v69 = builtin.global_symbol @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/GOT.data.internal.__memory_base : ptr - v70 = hir.bitcast v69 : ptr; - v71 = hir.load v70 : i32; - v72 = arith.constant 1048584 : i32; - v73 = arith.add v71, v72 : i32 #[overflow = wrapping]; - v74 = hir.bitcast v73 : u32; - v75 = hir.int_to_ptr v74 : ptr; - v76 = hir.load v75 : u8; - v68 = arith.constant 0 : i32; - v77 = arith.zext v76 : u32; - v78 = hir.bitcast v77 : i32; - v80 = arith.neq v78, v68 : i1; - scf.if v80{ + v75 = builtin.global_symbol @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/GOT.data.internal.__memory_base : ptr + v76 = hir.bitcast v75 : ptr; + v77 = hir.load v76 : i32; + v147 = arith.constant 1048584 : i32; + v79 = arith.add v77, v147 : i32 #[overflow = wrapping]; + v80 = hir.bitcast v79 : u32; + v81 = hir.int_to_ptr v80 : ptr; + v82 = hir.load v81 : u8; + v146 = arith.constant 0 : i32; + v83 = arith.zext v82 : u32; + v84 = hir.bitcast v83 : i32; + v86 = arith.neq v84, v146 : i1; + scf.if v86{ ^block17: scf.yield ; } else { ^block18: - v81 = builtin.global_symbol @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/GOT.data.internal.__memory_base : ptr - v82 = hir.bitcast v81 : ptr; - v83 = hir.load v82 : i32; + v87 = builtin.global_symbol @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/GOT.data.internal.__memory_base : ptr + v88 = hir.bitcast v87 : ptr; + v89 = hir.load v88 : i32; + hir.store_local v89 #[local = lv0]; hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/__wasm_call_ctors() - v171 = arith.constant 1 : u8; - v173 = arith.constant 1048584 : i32; - v85 = arith.add v83, v173 : i32 #[overflow = wrapping]; - v89 = hir.bitcast v85 : u32; - v90 = hir.int_to_ptr v89 : ptr; - hir.store v90, v171; + v90 = hir.load_local : i32 #[local = lv0]; + v145 = arith.constant 1 : u8; + v150 = arith.constant 1048584 : i32; + v92 = arith.add v90, v150 : i32 #[overflow = wrapping]; + v96 = hir.bitcast v92 : u32; + v97 = hir.int_to_ptr v96 : ptr; + hir.store v97, v145; scf.yield ; }; builtin.ret ; }; - private builtin.function @intrinsics::felt::eq(v91: felt, v92: felt) -> i32 { - ^block19(v91: felt, v92: felt): - v93 = arith.eq v91, v92 : i1; - v94 = hir.cast v93 : i32; - builtin.ret v94; - }; - - private builtin.function @intrinsics::felt::from_u32(v96: i32) -> felt { - ^block21(v96: i32): - v97 = hir.bitcast v96 : felt; - builtin.ret v97; - }; - - private builtin.function @miden::active_account::has_procedure(v99: felt, v100: felt, v101: felt, v102: felt) -> felt { - ^block23(v99: felt, v100: felt, v101: felt, v102: felt): - v103 = hir.exec @miden/active_account/has_procedure(v99, v100, v101, v102) : felt - builtin.ret v103; + private builtin.function @miden::protocol::active_account::has_procedure(v98: felt, v99: felt, v100: felt, v101: felt) -> felt { + ^block19(v98: felt, v99: felt, v100: felt, v101: felt): + v102 = hir.exec @miden/protocol/active_account/has_procedure(v98, v99, v100, v101) : felt + builtin.ret v102; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -174,8 +173,8 @@ builtin.component miden:rust-sdk-account-has-procedure-binding/rust-sdk-account- }; public builtin.function @binding() -> felt { - ^block27: - v105 = hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1#binding() : felt - builtin.ret v105; + ^block24: + v104 = hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1#binding() : felt + builtin.ret v104; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.masm index 4e8af43de..27f1eb7e3 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.masm @@ -1,16 +1,16 @@ -# mod miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1 +# mod ::"miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> felt - exec.::miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1::init + exec."miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1::rust_sdk_account_has_procedure_binding::miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1#binding + exec.::"miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1"::rust_sdk_account_has_procedure_binding::"miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1#binding" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -23,7 +23,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -34,7 +34,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1::rust_sdk_account_has_procedure_binding +# mod ::"miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1"::rust_sdk_account_has_procedure_binding @callconv("C") proc __wasm_call_ctors( @@ -50,6 +50,7 @@ proc rust_sdk_account_has_procedure_binding::bindings::__link_custom_section_des nop end +@locals("3") @callconv("C") proc miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1#binding( @@ -64,9 +65,16 @@ proc miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -76,33 +84,71 @@ proc miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure nop trace.240 nop - exec.::miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1::rust_sdk_account_has_procedure_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1"::rust_sdk_account_has_procedure_binding::wit_bindgen::rt::run_ctors_once trace.252 nop push.0 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1::rust_sdk_account_has_procedure_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_sw trace.252 nop push.0 - movup.2 + locaddr.2 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1 while.true + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.16 - dup.2 + movup.2 eq neq dup.0 if.true - swap.1 - drop - push.3735929054 + nop else - dup.2 - dup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.2 u32wrapping_add push.4 dup.1 @@ -110,8 +156,6 @@ proc miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure u32mod u32assert assertz - dup.4 - swap.1 u32divmod.4 swap.1 trace.240 @@ -119,43 +163,47 @@ proc miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - movup.2 u32wrapping_add + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.3735929054 - dup.2 - movup.2 - swap.5 - movdn.2 - cdrop - push.3735929054 - dup.2 - dup.4 - swap.2 - swap.1 - cdrop push.1 push.0 - movup.4 + movup.2 cdrop push.1 u32and - movup.4 - swap.1 if.true - movup.3 - drop push.1 else push.0 end end - drop - drop - drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.1 + swap.1 add u32assert push.4 @@ -171,8 +219,16 @@ proc miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.2 + swap.1 add u32assert push.4 @@ -188,8 +244,16 @@ proc miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.3 + swap.1 add u32assert push.4 @@ -205,7 +269,14 @@ proc miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure exec.::intrinsics::mem::load_felt trace.252 nop - dup.3 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -223,30 +294,31 @@ proc miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure swap.2 trace.240 nop - exec.::miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1::rust_sdk_account_has_procedure_binding::miden::active_account::has_procedure + exec.::"miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1"::rust_sdk_account_has_procedure_binding::"miden::protocol::active_account::has_procedure" trace.252 nop + push.1 + push.0 + movup.2 + eq + neq + locaddr.2 push.0 - trace.240 - nop - exec.::miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1::rust_sdk_account_has_procedure_binding::intrinsics::felt::from_u32 - trace.252 - nop swap.1 trace.240 nop - exec.::miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1::rust_sdk_account_has_procedure_binding::intrinsics::felt::eq + exec.::intrinsics::mem::store_felt trace.252 nop - push.1 - neq + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1::rust_sdk_account_has_procedure_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop push.16 - movup.2 u32wrapping_add push.1114144 u32divmod.4 @@ -256,8 +328,17 @@ proc miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -299,9 +380,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop trace.240 nop - exec.::miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1::rust_sdk_account_has_procedure_binding::__wasm_call_ctors + exec.::"miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1"::rust_sdk_account_has_procedure_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -333,20 +430,15 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc intrinsics::felt::eq(felt, felt) -> i32 - eq -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc miden::active_account::has_procedure(felt, felt, felt, felt) -> felt +proc miden::protocol::active_account::has_procedure( + felt, + felt, + felt, + felt +) -> felt trace.240 nop - exec.::miden::active_account::has_procedure + exec.::miden::protocol::active_account::has_procedure trace.252 nop end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.wat index fa55f4157..5d571d418 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.wat @@ -60,7 +60,7 @@ f32.load offset=4 local.get 0 f32.load - call $miden::active_account::has_procedure + call $miden::protocol::active_account::has_procedure i32.const 0 call $intrinsics::felt::from_u32 call $intrinsics::felt::eq @@ -98,11 +98,11 @@ (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) unreachable ) - (func $miden::active_account::has_procedure (;6;) (type 4) (param f32 f32 f32 f32) (result f32) + (func $miden::protocol::active_account::has_procedure (;6;) (type 4) (param f32 f32 f32 f32) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "Mrust_sdk_account_has_procedure_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "Mrust_sdk_account_has_procedure_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.hir index 7f28e0016..b73fbcb80 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.hir @@ -10,285 +10,209 @@ builtin.component miden:rust-sdk-account-storage-get-initial-item-binding/rust-s builtin.ret ; }; + private builtin.function @::default(v0: i32) { + ^block9(v0: i32): + hir.store_local v0 #[local = lv0]; + v3 = hir.load_local : i32 #[local = lv0]; + v187 = arith.constant 4 : u32; + v6 = hir.bitcast v3 : u32; + v8 = arith.add v6, v187 : u32 #[overflow = checked]; + v193 = arith.constant 4 : u32; + v10 = arith.mod v8, v193 : u32; + hir.assertz v10 #[code = 250]; + v188 = arith.constant -5367624396274338764 : i64; + v5 = arith.trunc v188 : felt; + v11 = hir.int_to_ptr v8 : ptr; + hir.store v11, v5; + v12 = hir.load_local : i32 #[local = lv0]; + v14 = hir.bitcast v12 : u32; + v192 = arith.constant 4 : u32; + v16 = arith.mod v14, v192 : u32; + hir.assertz v16 #[code = 250]; + v189 = arith.constant -4543582349731832257 : i64; + v2 = arith.trunc v189 : felt; + v17 = hir.int_to_ptr v14 : ptr; + hir.store v17, v2; + builtin.ret ; + }; + private builtin.function @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1#binding() -> i32 { - ^block9: - v2 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/__stack_pointer : ptr - v3 = hir.bitcast v2 : ptr; - v4 = hir.load v3 : i32; - v5 = arith.constant 48 : i32; - v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; - v7 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/__stack_pointer : ptr - v8 = hir.bitcast v7 : ptr; - hir.store v8, v6; + ^block11: + v19 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/__stack_pointer : ptr + v20 = hir.bitcast v19 : ptr; + v21 = hir.load v20 : i32; + v204 = arith.constant 32 : i32; + v23 = arith.sub v21, v204 : i32 #[overflow = wrapping]; + hir.store_local v23 #[local = lv0]; + v24 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/__stack_pointer : ptr + v25 = hir.bitcast v24 : ptr; + hir.store v25, v23; hir.exec @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/wit_bindgen::rt::run_ctors_once() - v1 = arith.constant 0 : i32; - v10 = hir.exec @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/>::from(v1) : felt - v11 = arith.constant 16 : i32; - v12 = arith.add v6, v11 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/miden::active_account::get_initial_item(v10, v12) - v14 = arith.constant 24 : u32; - v13 = hir.bitcast v6 : u32; - v15 = arith.add v13, v14 : u32 #[overflow = checked]; - v16 = arith.constant 8 : u32; - v17 = arith.mod v15, v16 : u32; - hir.assertz v17 #[code = 250]; - v18 = hir.int_to_ptr v15 : ptr; - v19 = hir.load v18 : i64; - v21 = arith.constant 40 : u32; - v20 = hir.bitcast v6 : u32; - v22 = arith.add v20, v21 : u32 #[overflow = checked]; - v245 = arith.constant 8 : u32; - v24 = arith.mod v22, v245 : u32; - hir.assertz v24 #[code = 250]; - v25 = hir.int_to_ptr v22 : ptr; - hir.store v25, v19; - v27 = arith.constant 16 : u32; - v26 = hir.bitcast v6 : u32; - v28 = arith.add v26, v27 : u32 #[overflow = checked]; - v244 = arith.constant 8 : u32; - v30 = arith.mod v28, v244 : u32; - hir.assertz v30 #[code = 250]; - v31 = hir.int_to_ptr v28 : ptr; - v32 = hir.load v31 : i64; - v34 = arith.constant 32 : u32; - v33 = hir.bitcast v6 : u32; - v35 = arith.add v33, v34 : u32 #[overflow = checked]; - v243 = arith.constant 8 : u32; - v37 = arith.mod v35, v243 : u32; - hir.assertz v37 #[code = 250]; - v38 = hir.int_to_ptr v35 : ptr; - hir.store v38, v32; - v39 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/GOT.data.internal.__memory_base : ptr - v40 = hir.bitcast v39 : ptr; - v41 = hir.load v40 : i32; - v42 = arith.constant 32 : i32; - v43 = arith.add v6, v42 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/::reverse(v6, v43) - v44 = arith.constant 1048584 : i32; - v45 = arith.add v41, v44 : i32 #[overflow = wrapping]; - v242 = arith.constant 8 : u32; - v46 = hir.bitcast v6 : u32; - v48 = arith.add v46, v242 : u32 #[overflow = checked]; - v241 = arith.constant 8 : u32; - v50 = arith.mod v48, v241 : u32; - hir.assertz v50 #[code = 250]; - v51 = hir.int_to_ptr v48 : ptr; - v52 = hir.load v51 : i64; - v240 = arith.constant 8 : u32; - v53 = hir.bitcast v45 : u32; - v55 = arith.add v53, v240 : u32 #[overflow = checked]; - v56 = arith.constant 4 : u32; - v57 = arith.mod v55, v56 : u32; + v26 = hir.load_local : i32 #[local = lv0]; + v203 = arith.constant 8 : i32; + v28 = arith.add v26, v203 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/::default(v28) + v29 = hir.load_local : i32 #[local = lv0]; + hir.exec @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/::default(v29) + v30 = hir.load_local : i32 #[local = lv0]; + v202 = arith.constant 4 : u32; + v31 = hir.bitcast v30 : u32; + v33 = arith.add v31, v202 : u32 #[overflow = checked]; + v228 = arith.constant 4 : u32; + v35 = arith.mod v33, v228 : u32; + hir.assertz v35 #[code = 250]; + v36 = hir.int_to_ptr v33 : ptr; + v37 = hir.load v36 : felt; + v38 = hir.load_local : i32 #[local = lv0]; + v39 = hir.bitcast v38 : u32; + v227 = arith.constant 4 : u32; + v41 = arith.mod v39, v227 : u32; + hir.assertz v41 #[code = 250]; + v42 = hir.int_to_ptr v39 : ptr; + v43 = hir.load v42 : felt; + v44 = hir.load_local : i32 #[local = lv0]; + v201 = arith.constant 16 : i32; + v46 = arith.add v44, v201 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/miden::protocol::active_account::get_initial_item(v37, v43, v46) + v47 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/GOT.data.internal.__memory_base : ptr + v48 = hir.bitcast v47 : ptr; + v49 = hir.load v48 : i32; + v200 = arith.constant 1048584 : i32; + v51 = arith.add v49, v200 : i32 #[overflow = wrapping]; + hir.store_local v51 #[local = lv1]; + v52 = hir.load_local : i32 #[local = lv0]; + v199 = arith.constant 16 : u32; + v53 = hir.bitcast v52 : u32; + v55 = arith.add v53, v199 : u32 #[overflow = checked]; + v226 = arith.constant 4 : u32; + v57 = arith.mod v55, v226 : u32; hir.assertz v57 #[code = 250]; - v58 = hir.int_to_ptr v55 : ptr; - hir.store v58, v52; - v59 = hir.bitcast v6 : u32; - v239 = arith.constant 8 : u32; - v61 = arith.mod v59, v239 : u32; - hir.assertz v61 #[code = 250]; - v62 = hir.int_to_ptr v59 : ptr; - v63 = hir.load v62 : i64; - v64 = hir.bitcast v45 : u32; - v238 = arith.constant 4 : u32; - v66 = arith.mod v64, v238 : u32; - hir.assertz v66 #[code = 250]; - v67 = hir.int_to_ptr v64 : ptr; - hir.store v67, v63; - v237 = arith.constant 48 : i32; - v69 = arith.add v6, v237 : i32 #[overflow = wrapping]; - v70 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/__stack_pointer : ptr - v71 = hir.bitcast v70 : ptr; - hir.store v71, v69; - builtin.ret v45; + v58 = hir.int_to_ptr v55 : ptr; + v59 = hir.load v58 : felt; + v198 = arith.constant 12 : u32; + v60 = hir.bitcast v51 : u32; + v62 = arith.add v60, v198 : u32 #[overflow = checked]; + v225 = arith.constant 4 : u32; + v64 = arith.mod v62, v225 : u32; + hir.assertz v64 #[code = 250]; + v65 = hir.int_to_ptr v62 : ptr; + hir.store v65, v59; + v66 = hir.load_local : i32 #[local = lv1]; + v67 = hir.load_local : i32 #[local = lv0]; + v197 = arith.constant 20 : u32; + v68 = hir.bitcast v67 : u32; + v70 = arith.add v68, v197 : u32 #[overflow = checked]; + v224 = arith.constant 4 : u32; + v72 = arith.mod v70, v224 : u32; + hir.assertz v72 #[code = 250]; + v73 = hir.int_to_ptr v70 : ptr; + v74 = hir.load v73 : felt; + v196 = arith.constant 8 : u32; + v75 = hir.bitcast v66 : u32; + v77 = arith.add v75, v196 : u32 #[overflow = checked]; + v223 = arith.constant 4 : u32; + v79 = arith.mod v77, v223 : u32; + hir.assertz v79 #[code = 250]; + v80 = hir.int_to_ptr v77 : ptr; + hir.store v80, v74; + v81 = hir.load_local : i32 #[local = lv1]; + v82 = hir.load_local : i32 #[local = lv0]; + v195 = arith.constant 24 : u32; + v83 = hir.bitcast v82 : u32; + v85 = arith.add v83, v195 : u32 #[overflow = checked]; + v222 = arith.constant 4 : u32; + v87 = arith.mod v85, v222 : u32; + hir.assertz v87 #[code = 250]; + v88 = hir.int_to_ptr v85 : ptr; + v89 = hir.load v88 : felt; + v221 = arith.constant 4 : u32; + v90 = hir.bitcast v81 : u32; + v92 = arith.add v90, v221 : u32 #[overflow = checked]; + v220 = arith.constant 4 : u32; + v94 = arith.mod v92, v220 : u32; + hir.assertz v94 #[code = 250]; + v95 = hir.int_to_ptr v92 : ptr; + hir.store v95, v89; + v96 = hir.load_local : i32 #[local = lv1]; + v97 = hir.load_local : i32 #[local = lv0]; + v194 = arith.constant 28 : u32; + v98 = hir.bitcast v97 : u32; + v100 = arith.add v98, v194 : u32 #[overflow = checked]; + v219 = arith.constant 4 : u32; + v102 = arith.mod v100, v219 : u32; + hir.assertz v102 #[code = 250]; + v103 = hir.int_to_ptr v100 : ptr; + v104 = hir.load v103 : felt; + v105 = hir.bitcast v96 : u32; + v218 = arith.constant 4 : u32; + v107 = arith.mod v105, v218 : u32; + hir.assertz v107 #[code = 250]; + v108 = hir.int_to_ptr v105 : ptr; + hir.store v108, v104; + v109 = hir.load_local : i32 #[local = lv0]; + v217 = arith.constant 32 : i32; + v111 = arith.add v109, v217 : i32 #[overflow = wrapping]; + v112 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/__stack_pointer : ptr + v113 = hir.bitcast v112 : ptr; + hir.store v113, v111; + v114 = hir.load_local : i32 #[local = lv1]; + builtin.ret v114; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { - ^block11: - v73 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/GOT.data.internal.__memory_base : ptr - v74 = hir.bitcast v73 : ptr; - v75 = hir.load v74 : i32; - v76 = arith.constant 1048600 : i32; - v77 = arith.add v75, v76 : i32 #[overflow = wrapping]; - v78 = hir.bitcast v77 : u32; - v79 = hir.int_to_ptr v78 : ptr; - v80 = hir.load v79 : u8; - v72 = arith.constant 0 : i32; - v81 = arith.zext v80 : u32; - v82 = hir.bitcast v81 : i32; - v84 = arith.neq v82, v72 : i1; - scf.if v84{ - ^block13: + ^block13: + v115 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/GOT.data.internal.__memory_base : ptr + v116 = hir.bitcast v115 : ptr; + v117 = hir.load v116 : i32; + v233 = arith.constant 1048600 : i32; + v119 = arith.add v117, v233 : i32 #[overflow = wrapping]; + v120 = hir.bitcast v119 : u32; + v121 = hir.int_to_ptr v120 : ptr; + v122 = hir.load v121 : u8; + v232 = arith.constant 0 : i32; + v123 = arith.zext v122 : u32; + v124 = hir.bitcast v123 : i32; + v126 = arith.neq v124, v232 : i1; + scf.if v126{ + ^block15: scf.yield ; } else { - ^block14: - v85 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/GOT.data.internal.__memory_base : ptr - v86 = hir.bitcast v85 : ptr; - v87 = hir.load v86 : i32; + ^block16: + v127 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/GOT.data.internal.__memory_base : ptr + v128 = hir.bitcast v127 : ptr; + v129 = hir.load v128 : i32; + hir.store_local v129 #[local = lv0]; hir.exec @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/__wasm_call_ctors() - v247 = arith.constant 1 : u8; - v249 = arith.constant 1048600 : i32; - v89 = arith.add v87, v249 : i32 #[overflow = wrapping]; - v93 = hir.bitcast v89 : u32; - v94 = hir.int_to_ptr v93 : ptr; - hir.store v94, v247; + v130 = hir.load_local : i32 #[local = lv0]; + v231 = arith.constant 1 : u8; + v236 = arith.constant 1048600 : i32; + v132 = arith.add v130, v236 : i32 #[overflow = wrapping]; + v136 = hir.bitcast v132 : u32; + v137 = hir.int_to_ptr v136 : ptr; + hir.store v137, v231; scf.yield ; }; builtin.ret ; }; - private builtin.function @::reverse(v95: i32, v96: i32) { - ^block15(v95: i32, v96: i32): - v99 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/__stack_pointer : ptr - v100 = hir.bitcast v99 : ptr; - v101 = hir.load v100 : i32; - v102 = arith.constant 16 : i32; - v103 = arith.sub v101, v102 : i32 #[overflow = wrapping]; - v105 = arith.constant 8 : u32; - v104 = hir.bitcast v96 : u32; - v106 = arith.add v104, v105 : u32 #[overflow = checked]; - v336 = arith.constant 8 : u32; - v108 = arith.mod v106, v336 : u32; - hir.assertz v108 #[code = 250]; - v109 = hir.int_to_ptr v106 : ptr; - v110 = hir.load v109 : i64; - v335 = arith.constant 8 : u32; - v111 = hir.bitcast v103 : u32; - v113 = arith.add v111, v335 : u32 #[overflow = checked]; - v114 = arith.constant 4 : u32; - v115 = arith.mod v113, v114 : u32; - hir.assertz v115 #[code = 250]; - v116 = hir.int_to_ptr v113 : ptr; - hir.store v116, v110; - v117 = hir.bitcast v96 : u32; - v334 = arith.constant 8 : u32; - v119 = arith.mod v117, v334 : u32; - hir.assertz v119 #[code = 250]; - v120 = hir.int_to_ptr v117 : ptr; - v121 = hir.load v120 : i64; - v122 = hir.bitcast v103 : u32; - v333 = arith.constant 4 : u32; - v124 = arith.mod v122, v333 : u32; - hir.assertz v124 #[code = 250]; - v125 = hir.int_to_ptr v122 : ptr; - hir.store v125, v121; - v126 = arith.constant 12 : i32; - v127 = arith.add v103, v126 : i32 #[overflow = wrapping]; - v97 = arith.constant 0 : i32; - v304, v305, v306, v307, v308, v309 = scf.while v97, v103, v127, v95 : i32, i32, i32, i32, i32, i32 { - ^block37(v310: i32, v311: i32, v312: i32, v313: i32): - v332 = arith.constant 0 : i32; - v130 = arith.constant 8 : i32; - v131 = arith.eq v310, v130 : i1; - v132 = arith.zext v131 : u32; - v133 = hir.bitcast v132 : i32; - v135 = arith.neq v133, v332 : i1; - v298, v299 = scf.if v135 : i32, i32 { - ^block36: - v258 = ub.poison i32 : i32; - scf.yield v258, v258; - } else { - ^block20: - v137 = arith.add v311, v310 : i32 #[overflow = wrapping]; - v138 = hir.bitcast v137 : u32; - v331 = arith.constant 4 : u32; - v140 = arith.mod v138, v331 : u32; - hir.assertz v140 #[code = 250]; - v141 = hir.int_to_ptr v138 : ptr; - v142 = hir.load v141 : felt; - v144 = hir.bitcast v312 : u32; - v330 = arith.constant 4 : u32; - v146 = arith.mod v144, v330 : u32; - hir.assertz v146 #[code = 250]; - v147 = hir.int_to_ptr v144 : ptr; - v148 = hir.load v147 : i32; - v149 = hir.bitcast v137 : u32; - v329 = arith.constant 4 : u32; - v151 = arith.mod v149, v329 : u32; - hir.assertz v151 #[code = 250]; - v152 = hir.int_to_ptr v149 : ptr; - hir.store v152, v148; - v153 = hir.bitcast v312 : u32; - v328 = arith.constant 4 : u32; - v155 = arith.mod v153, v328 : u32; - hir.assertz v155 #[code = 250]; - v156 = hir.int_to_ptr v153 : ptr; - hir.store v156, v142; - v159 = arith.constant -4 : i32; - v160 = arith.add v312, v159 : i32 #[overflow = wrapping]; - v157 = arith.constant 4 : i32; - v158 = arith.add v310, v157 : i32 #[overflow = wrapping]; - scf.yield v158, v160; - }; - v326 = ub.poison i32 : i32; - v301 = cf.select v135, v326, v313 : i32; - v327 = ub.poison i32 : i32; - v300 = cf.select v135, v327, v311 : i32; - v257 = arith.constant 1 : u32; - v250 = arith.constant 0 : u32; - v303 = cf.select v135, v250, v257 : u32; - v291 = arith.trunc v303 : i1; - scf.condition v291, v298, v300, v299, v301, v311, v313; - } do { - ^block38(v314: i32, v315: i32, v316: i32, v317: i32, v318: i32, v319: i32): - scf.yield v314, v315, v316, v317; - }; - v325 = arith.constant 8 : u32; - v162 = hir.bitcast v308 : u32; - v164 = arith.add v162, v325 : u32 #[overflow = checked]; - v324 = arith.constant 4 : u32; - v166 = arith.mod v164, v324 : u32; - hir.assertz v166 #[code = 250]; - v167 = hir.int_to_ptr v164 : ptr; - v168 = hir.load v167 : i64; - v323 = arith.constant 8 : u32; - v169 = hir.bitcast v309 : u32; - v171 = arith.add v169, v323 : u32 #[overflow = checked]; - v322 = arith.constant 8 : u32; - v173 = arith.mod v171, v322 : u32; - hir.assertz v173 #[code = 250]; - v174 = hir.int_to_ptr v171 : ptr; - hir.store v174, v168; - v175 = hir.bitcast v308 : u32; - v321 = arith.constant 4 : u32; - v177 = arith.mod v175, v321 : u32; - hir.assertz v177 #[code = 250]; - v178 = hir.int_to_ptr v175 : ptr; - v179 = hir.load v178 : i64; - v180 = hir.bitcast v309 : u32; - v320 = arith.constant 8 : u32; - v182 = arith.mod v180, v320 : u32; - hir.assertz v182 #[code = 250]; - v183 = hir.int_to_ptr v180 : ptr; - hir.store v183, v179; - builtin.ret ; - }; - - private builtin.function @>::from(v184: i32) -> felt { - ^block21(v184: i32): - v186 = arith.constant 255 : i32; - v187 = arith.band v184, v186 : i32; - v188 = hir.bitcast v187 : felt; - builtin.ret v188; - }; - - private builtin.function @miden::active_account::get_initial_item(v189: felt, v190: i32) { - ^block23(v189: felt, v190: i32): - v191, v192, v193, v194 = hir.exec @miden/active_account/get_initial_item(v189) : felt, felt, felt, felt - v195 = hir.bitcast v190 : u32; - v196 = hir.int_to_ptr v195 : ptr; - hir.store v196, v191; - v197 = arith.constant 4 : u32; - v198 = arith.add v195, v197 : u32 #[overflow = checked]; - v199 = hir.int_to_ptr v198 : ptr; - hir.store v199, v192; - v200 = arith.constant 8 : u32; - v201 = arith.add v195, v200 : u32 #[overflow = checked]; - v202 = hir.int_to_ptr v201 : ptr; - hir.store v202, v193; - v203 = arith.constant 12 : u32; - v204 = arith.add v195, v203 : u32 #[overflow = checked]; - v205 = hir.int_to_ptr v204 : ptr; - hir.store v205, v194; + private builtin.function @miden::protocol::active_account::get_initial_item(v138: felt, v139: felt, v140: i32) { + ^block17(v138: felt, v139: felt, v140: i32): + v141, v142, v143, v144 = hir.exec @miden/protocol/active_account/get_initial_item(v138, v139) : felt, felt, felt, felt + v145 = hir.bitcast v140 : u32; + v146 = hir.int_to_ptr v145 : ptr; + hir.store v146, v141; + v239 = arith.constant 4 : u32; + v148 = arith.add v145, v239 : u32 #[overflow = checked]; + v149 = hir.int_to_ptr v148 : ptr; + hir.store v149, v142; + v238 = arith.constant 8 : u32; + v151 = arith.add v145, v238 : u32 #[overflow = checked]; + v152 = hir.int_to_ptr v151 : ptr; + hir.store v152, v143; + v237 = arith.constant 12 : u32; + v154 = arith.add v145, v237 : u32 #[overflow = checked]; + v155 = hir.int_to_ptr v154 : ptr; + hir.store v155, v144; builtin.ret ; }; @@ -304,34 +228,34 @@ builtin.component miden:rust-sdk-account-storage-get-initial-item-binding/rust-s }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block27: - v206 = hir.exec @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1#binding() : i32 - v207 = arith.constant 0 : i32; - v208 = arith.add v206, v207 : i32 #[overflow = unchecked]; - v340 = arith.constant 0 : i32; - v341 = arith.constant 0 : i32; - v210 = arith.add v208, v341 : i32 #[overflow = unchecked]; - v212 = arith.add v210, v340 : i32 #[overflow = unchecked]; - v213 = hir.int_to_ptr v212 : ptr; - v214 = hir.load v213 : felt; - v339 = arith.constant 0 : i32; - v215 = arith.constant 4 : i32; - v216 = arith.add v208, v215 : i32 #[overflow = unchecked]; - v218 = arith.add v216, v339 : i32 #[overflow = unchecked]; - v219 = hir.int_to_ptr v218 : ptr; - v220 = hir.load v219 : felt; - v338 = arith.constant 0 : i32; - v221 = arith.constant 8 : i32; - v222 = arith.add v208, v221 : i32 #[overflow = unchecked]; - v224 = arith.add v222, v338 : i32 #[overflow = unchecked]; - v225 = hir.int_to_ptr v224 : ptr; - v226 = hir.load v225 : felt; - v337 = arith.constant 0 : i32; - v227 = arith.constant 12 : i32; - v228 = arith.add v208, v227 : i32 #[overflow = unchecked]; - v230 = arith.add v228, v337 : i32 #[overflow = unchecked]; - v231 = hir.int_to_ptr v230 : ptr; - v232 = hir.load v231 : felt; - builtin.ret v214, v220, v226, v232; + ^block22: + v156 = hir.exec @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1#binding() : i32 + v243 = arith.constant 0 : i32; + v158 = arith.add v156, v243 : i32 #[overflow = unchecked]; + v252 = arith.constant 0 : i32; + v253 = arith.constant 0 : i32; + v160 = arith.add v158, v253 : i32 #[overflow = unchecked]; + v162 = arith.add v160, v252 : i32 #[overflow = unchecked]; + v163 = hir.int_to_ptr v162 : ptr; + v164 = hir.load v163 : felt; + v251 = arith.constant 0 : i32; + v242 = arith.constant 4 : i32; + v166 = arith.add v158, v242 : i32 #[overflow = unchecked]; + v168 = arith.add v166, v251 : i32 #[overflow = unchecked]; + v169 = hir.int_to_ptr v168 : ptr; + v170 = hir.load v169 : felt; + v250 = arith.constant 0 : i32; + v241 = arith.constant 8 : i32; + v172 = arith.add v158, v241 : i32 #[overflow = unchecked]; + v174 = arith.add v172, v250 : i32 #[overflow = unchecked]; + v175 = hir.int_to_ptr v174 : ptr; + v176 = hir.load v175 : felt; + v249 = arith.constant 0 : i32; + v240 = arith.constant 12 : i32; + v178 = arith.add v158, v240 : i32 #[overflow = unchecked]; + v180 = arith.add v178, v249 : i32 #[overflow = unchecked]; + v181 = hir.int_to_ptr v180 : ptr; + v182 = hir.load v181 : felt; + builtin.ret v164, v170, v176, v182; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.masm index 29fe9feb2..0d9063266 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.masm @@ -1,13 +1,13 @@ -# mod miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1 +# mod ::"miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> (felt, felt, felt, felt) - exec.::miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1::init + exec."miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1::rust_sdk_account_storage_get_initial_item_binding::miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1#binding + exec.::"miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1"::rust_sdk_account_storage_get_initial_item_binding::"miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1#binding" trace.252 nop push.0 @@ -62,7 +62,7 @@ pub proc binding( nop movdn.3 swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -75,7 +75,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -86,7 +86,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1::rust_sdk_account_storage_get_initial_item_binding +# mod ::"miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1"::rust_sdk_account_storage_get_initial_item_binding @callconv("C") proc __wasm_call_ctors( @@ -102,6 +102,78 @@ proc rust_sdk_account_storage_get_initial_item_binding::bindings::__link_custom_ nop end +@locals("2") +@callconv("C") +proc ::default( + i32 +) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.3965252660 + push.3045219852 + mul.4294967296 + add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.75488831 + push.3237082093 + mul.4294967296 + add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + +@locals("2") @callconv("C") proc miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1#binding( @@ -114,11 +186,18 @@ proc miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-st exec.::intrinsics::mem::load_sw trace.252 nop - push.48 + push.32 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -128,29 +207,50 @@ proc miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-st nop trace.240 nop - exec.::miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1::rust_sdk_account_storage_get_initial_item_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1"::rust_sdk_account_storage_get_initial_item_binding::wit_bindgen::rt::run_ctors_once trace.252 nop + locaddr.0 push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1::rust_sdk_account_storage_get_initial_item_binding::>::from + exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - dup.2 + push.8 u32wrapping_add + trace.240 + nop + exec.::"miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1"::rust_sdk_account_storage_get_initial_item_binding::::default + trace.252 + nop + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1::rust_sdk_account_storage_get_initial_item_binding::miden::active_account::get_initial_item + exec.::intrinsics::mem::load_sw trace.252 nop - push.24 - dup.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1"::rust_sdk_account_storage_get_initial_item_binding::::default + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -160,15 +260,18 @@ proc miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-st swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.0 + push.0 swap.1 - push.40 - dup.3 - add - u32assert - push.8 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 dup.1 swap.1 u32mod @@ -176,18 +279,59 @@ proc miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-st assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.16 - dup.1 + u32wrapping_add + swap.2 + trace.240 + nop + exec.::"miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1"::rust_sdk_account_storage_get_initial_item_binding::"miden::protocol::active_account::get_initial_item" + trace.252 + nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -197,15 +341,14 @@ proc miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-st swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.32 - dup.3 + push.12 + movup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -213,37 +356,49 @@ proc miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-st assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.1114148 - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.32 - dup.2 - u32wrapping_add - dup.2 + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1::rust_sdk_account_storage_get_initial_item_binding::::reverse + exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 - u32wrapping_add - push.8 - dup.2 + push.20 + swap.1 add u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.8 + movup.2 + add + u32assert + push.4 dup.1 swap.1 u32mod @@ -253,12 +408,27 @@ proc miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-st swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.24 swap.1 - push.8 - dup.3 add u32assert push.4 @@ -269,15 +439,49 @@ proc miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-st assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop + push.4 + movup.2 + add + u32assert + push.4 dup.1 - push.8 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.28 + swap.1 + add + u32assert + push.4 dup.1 swap.1 u32mod @@ -287,11 +491,10 @@ proc miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-st swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop swap.1 - dup.2 push.4 dup.1 swap.1 @@ -300,15 +503,20 @@ proc miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-st assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.48 - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 u32wrapping_add push.1114144 u32divmod.4 @@ -318,8 +526,17 @@ proc miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-st exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -361,9 +578,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1"::rust_sdk_account_storage_get_initial_item_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1::rust_sdk_account_storage_get_initial_item_binding::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -395,295 +628,10 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.4 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop -end - -@callconv("C") -proc >::from( - i32 -) -> felt - push.255 - u32and -end - -@callconv("C") -proc miden::active_account::get_initial_item(felt, i32) +proc miden::protocol::active_account::get_initial_item(felt, felt, i32) trace.240 nop - exec.::miden::active_account::get_initial_item + exec.::miden::protocol::active_account::get_initial_item trace.252 nop movup.4 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.wat index d40af96d1..a9a195171 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.wat @@ -11,10 +11,10 @@ (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) (core module $main (;0;) (type (;0;) (func)) - (type (;1;) (func (result i32))) - (type (;2;) (func (param i32 i32))) - (type (;3;) (func (param i32) (result f32))) - (type (;4;) (func (param f32 i32))) + (type (;1;) (func (param i32))) + (type (;2;) (func (result i32))) + (type (;3;) (func (param i64) (result f32))) + (type (;4;) (func (param f32 f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -24,53 +24,67 @@ (elem (;0;) (i32.const 1) func $rust_sdk_account_storage_get_initial_item_binding::bindings::__link_custom_section_describing_imports) (func $__wasm_call_ctors (;0;) (type 0)) (func $rust_sdk_account_storage_get_initial_item_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) - (func $miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1#binding (;2;) (type 1) (result i32) + (func $::default (;2;) (type 1) (param i32) + (local f32) + i64.const -4543582349731832257 + call $intrinsics::felt::from_u64_unchecked + local.set 1 + local.get 0 + i64.const -5367624396274338764 + call $intrinsics::felt::from_u64_unchecked + f32.store offset=4 + local.get 0 + local.get 1 + f32.store + ) + (func $miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1#binding (;3;) (type 2) (result i32) (local i32 i32) global.get $__stack_pointer - i32.const 48 + i32.const 32 i32.sub local.tee 0 global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once - i32.const 0 - call $>::from local.get 0 - i32.const 16 + i32.const 8 i32.add - call $miden::active_account::get_initial_item + call $::default local.get 0 + call $::default local.get 0 - i64.load offset=24 - i64.store offset=40 + f32.load offset=4 local.get 0 + f32.load local.get 0 - i64.load offset=16 - i64.store offset=32 - global.get $GOT.data.internal.__memory_base - local.set 1 - local.get 0 - local.get 0 - i32.const 32 + i32.const 16 i32.add - call $::reverse - local.get 1 + call $miden::protocol::active_account::get_initial_item + global.get $GOT.data.internal.__memory_base i32.const 1048584 i32.add local.tee 1 local.get 0 - i64.load offset=8 - i64.store offset=8 align=4 + f32.load offset=16 + f32.store offset=12 + local.get 1 + local.get 0 + f32.load offset=20 + f32.store offset=8 local.get 1 local.get 0 - i64.load - i64.store align=4 + f32.load offset=24 + f32.store offset=4 + local.get 1 + local.get 0 + f32.load offset=28 + f32.store local.get 0 - i32.const 48 + i32.const 32 i32.add global.set $__stack_pointer local.get 1 ) - (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (func $wit_bindgen::rt::run_ctors_once (;4;) (type 0) (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base @@ -88,75 +102,14 @@ i32.store8 end ) - (func $::reverse (;4;) (type 2) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store - ) - (func $>::from (;5;) (type 3) (param i32) (result f32) - local.get 0 - i32.const 255 - i32.and - f32.reinterpret_i32 + (func $intrinsics::felt::from_u64_unchecked (;5;) (type 3) (param i64) (result f32) + unreachable ) - (func $miden::active_account::get_initial_item (;6;) (type 4) (param f32 i32) + (func $miden::protocol::active_account::get_initial_item (;6;) (type 4) (param f32 f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "crust_sdk_account_storage_get_initial_item_binding\01\0b0.0.1\03\01\01\00\00\00\00") + (@custom "rodata,miden_account" (after data) "crust_sdk_account_storage_get_initial_item_binding\01\0b0.0.1\03\01\01\00Pmiden::component::miden_rust_sdk_account_storage_get_initial_item_binding::value\00\01\15test value\00\09word\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.hir index 25f9dd841..48703494d 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.hir @@ -10,366 +10,298 @@ builtin.component miden:rust-sdk-account-storage-get-initial-map-item-binding/ru builtin.ret ; }; + private builtin.function @::default(v0: i32) { + ^block9(v0: i32): + hir.store_local v0 #[local = lv0]; + v3 = hir.load_local : i32 #[local = lv0]; + v250 = arith.constant 4 : u32; + v6 = hir.bitcast v3 : u32; + v8 = arith.add v6, v250 : u32 #[overflow = checked]; + v256 = arith.constant 4 : u32; + v10 = arith.mod v8, v256 : u32; + hir.assertz v10 #[code = 250]; + v251 = arith.constant -8911505773112514939 : i64; + v5 = arith.trunc v251 : felt; + v11 = hir.int_to_ptr v8 : ptr; + hir.store v11, v5; + v12 = hir.load_local : i32 #[local = lv0]; + v14 = hir.bitcast v12 : u32; + v255 = arith.constant 4 : u32; + v16 = arith.mod v14, v255 : u32; + hir.assertz v16 #[code = 250]; + v252 = arith.constant 2764190884472685073 : i64; + v2 = arith.trunc v252 : felt; + v17 = hir.int_to_ptr v14 : ptr; + hir.store v17, v2; + builtin.ret ; + }; + private builtin.function @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding() -> i32 { - ^block9: - v3 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/__stack_pointer : ptr - v4 = hir.bitcast v3 : ptr; - v5 = hir.load v4 : i32; - v6 = arith.constant 48 : i32; - v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; - v8 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/__stack_pointer : ptr - v9 = hir.bitcast v8 : ptr; - hir.store v9, v7; + ^block11: + v19 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/__stack_pointer : ptr + v20 = hir.bitcast v19 : ptr; + v21 = hir.load v20 : i32; + v271 = arith.constant 32 : i32; + v23 = arith.sub v21, v271 : i32 #[overflow = wrapping]; + hir.store_local v23 #[local = lv0]; + v24 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/__stack_pointer : ptr + v25 = hir.bitcast v24 : ptr; + hir.store v25, v23; hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/wit_bindgen::rt::run_ctors_once() - v1 = arith.constant 0 : i32; - v12 = hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/intrinsics::felt::from_u32(v1) : felt - v368 = arith.constant 0 : i32; - v336, v337, v338, v339 = scf.while v368, v7, v12 : i32, i32, felt, i32 { - ^block42(v340: i32, v341: i32, v342: felt): - v367 = arith.constant 0 : i32; - v61 = arith.constant 16 : i32; - v15 = arith.eq v340, v61 : i1; - v16 = arith.zext v15 : u32; - v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v367 : i1; - v331 = scf.if v19 : i32 { - ^block41: - v302 = ub.poison i32 : i32; - scf.yield v302; + v26 = hir.load_local : i32 #[local = lv0]; + v270 = arith.constant 8 : i32; + v28 = arith.add v26, v270 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/::default(v28) + v269 = arith.constant 0 : i32; + hir.store_local v269 #[local = lv1]; + v258 = arith.constant 0 : felt; + hir.store_local v258 #[local = lv2]; + scf.while { + ^block14: + v32 = hir.load_local : i32 #[local = lv1]; + v329 = arith.constant 0 : i32; + v275 = arith.constant 16 : i32; + v34 = arith.eq v32, v275 : i1; + v35 = arith.zext v34 : u32; + v36 = hir.bitcast v35 : i32; + v38 = arith.neq v36, v329 : i1; + scf.if v38{ + ^block34: + scf.yield ; } else { - ^block14: - v92 = arith.constant 32 : i32; - v22 = arith.add v341, v92 : i32 #[overflow = wrapping]; - v23 = arith.add v22, v340 : i32 #[overflow = wrapping]; - v25 = hir.bitcast v23 : u32; - v34 = arith.constant 4 : u32; - v27 = arith.mod v25, v34 : u32; - hir.assertz v27 #[code = 250]; - v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v342; - v29 = arith.constant 4 : i32; - v30 = arith.add v340, v29 : i32 #[overflow = wrapping]; - scf.yield v30; + ^block16: + v39 = hir.load_local : i32 #[local = lv0]; + v42 = hir.load_local : i32 #[local = lv1]; + v44 = hir.load_local : felt #[local = lv2]; + v328 = arith.constant 16 : i32; + v41 = arith.add v39, v328 : i32 #[overflow = wrapping]; + v43 = arith.add v41, v42 : i32 #[overflow = wrapping]; + v45 = hir.bitcast v43 : u32; + v272 = arith.constant 4 : u32; + v47 = arith.mod v45, v272 : u32; + hir.assertz v47 #[code = 250]; + v48 = hir.int_to_ptr v45 : ptr; + hir.store v48, v44; + v49 = hir.load_local : i32 #[local = lv1]; + v259 = arith.constant 4 : i32; + v51 = arith.add v49, v259 : i32 #[overflow = wrapping]; + hir.store_local v51 #[local = lv1]; + scf.yield ; }; - v303 = ub.poison felt : felt; - v333 = cf.select v19, v303, v342 : felt; - v366 = ub.poison i32 : i32; - v332 = cf.select v19, v366, v341 : i32; - v301 = arith.constant 1 : u32; - v295 = arith.constant 0 : u32; - v335 = cf.select v19, v295, v301 : u32; - v325 = arith.trunc v335 : i1; - scf.condition v325, v331, v332, v333, v341; + v300 = arith.constant 1 : u32; + v297 = arith.constant 0 : u32; + v305 = cf.select v38, v297, v300 : u32; + v301 = arith.trunc v305 : i1; + scf.condition v301; } do { - ^block43(v343: i32, v344: i32, v345: felt, v346: i32): - scf.yield v343, v344, v345; + ^block33: + scf.yield ; }; - v32 = arith.constant 44 : u32; - v31 = hir.bitcast v339 : u32; - v33 = arith.add v31, v32 : u32 #[overflow = checked]; - v365 = arith.constant 4 : u32; - v35 = arith.mod v33, v365 : u32; - hir.assertz v35 #[code = 250]; - v36 = hir.int_to_ptr v33 : ptr; - v37 = hir.load v36 : felt; - v39 = arith.constant 40 : u32; - v38 = hir.bitcast v339 : u32; - v40 = arith.add v38, v39 : u32 #[overflow = checked]; - v364 = arith.constant 4 : u32; - v42 = arith.mod v40, v364 : u32; - hir.assertz v42 #[code = 250]; - v43 = hir.int_to_ptr v40 : ptr; - v44 = hir.load v43 : felt; - v46 = arith.constant 36 : u32; - v45 = hir.bitcast v339 : u32; - v47 = arith.add v45, v46 : u32 #[overflow = checked]; - v363 = arith.constant 4 : u32; - v49 = arith.mod v47, v363 : u32; - hir.assertz v49 #[code = 250]; - v50 = hir.int_to_ptr v47 : ptr; - v51 = hir.load v50 : felt; - v53 = arith.constant 32 : u32; - v52 = hir.bitcast v339 : u32; - v54 = arith.add v52, v53 : u32 #[overflow = checked]; - v362 = arith.constant 4 : u32; - v56 = arith.mod v54, v362 : u32; - hir.assertz v56 #[code = 250]; - v57 = hir.int_to_ptr v54 : ptr; - v58 = hir.load v57 : felt; - v361 = arith.constant 0 : i32; - v60 = hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/>::from(v361) : felt - v360 = arith.constant 16 : i32; - v62 = arith.add v339, v360 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/miden::active_account::get_initial_map_item(v60, v37, v44, v51, v58, v62) - v64 = arith.constant 24 : u32; - v63 = hir.bitcast v339 : u32; - v65 = arith.add v63, v64 : u32 #[overflow = checked]; - v66 = arith.constant 8 : u32; - v67 = arith.mod v65, v66 : u32; - hir.assertz v67 #[code = 250]; - v68 = hir.int_to_ptr v65 : ptr; - v69 = hir.load v68 : i64; - v359 = arith.constant 40 : u32; - v70 = hir.bitcast v339 : u32; - v72 = arith.add v70, v359 : u32 #[overflow = checked]; - v358 = arith.constant 8 : u32; - v74 = arith.mod v72, v358 : u32; - hir.assertz v74 #[code = 250]; - v75 = hir.int_to_ptr v72 : ptr; - hir.store v75, v69; - v77 = arith.constant 16 : u32; - v76 = hir.bitcast v339 : u32; - v78 = arith.add v76, v77 : u32 #[overflow = checked]; - v357 = arith.constant 8 : u32; - v80 = arith.mod v78, v357 : u32; - hir.assertz v80 #[code = 250]; - v81 = hir.int_to_ptr v78 : ptr; - v82 = hir.load v81 : i64; - v356 = arith.constant 32 : u32; - v83 = hir.bitcast v339 : u32; - v85 = arith.add v83, v356 : u32 #[overflow = checked]; - v355 = arith.constant 8 : u32; - v87 = arith.mod v85, v355 : u32; - hir.assertz v87 #[code = 250]; - v88 = hir.int_to_ptr v85 : ptr; - hir.store v88, v82; - v89 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/GOT.data.internal.__memory_base : ptr - v90 = hir.bitcast v89 : ptr; - v91 = hir.load v90 : i32; - v354 = arith.constant 32 : i32; - v93 = arith.add v339, v354 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/::reverse(v339, v93) - v94 = arith.constant 1048584 : i32; - v95 = arith.add v91, v94 : i32 #[overflow = wrapping]; - v353 = arith.constant 8 : u32; - v96 = hir.bitcast v339 : u32; - v98 = arith.add v96, v353 : u32 #[overflow = checked]; - v352 = arith.constant 8 : u32; - v100 = arith.mod v98, v352 : u32; - hir.assertz v100 #[code = 250]; - v101 = hir.int_to_ptr v98 : ptr; - v102 = hir.load v101 : i64; - v351 = arith.constant 8 : u32; - v103 = hir.bitcast v95 : u32; - v105 = arith.add v103, v351 : u32 #[overflow = checked]; - v350 = arith.constant 4 : u32; - v107 = arith.mod v105, v350 : u32; - hir.assertz v107 #[code = 250]; - v108 = hir.int_to_ptr v105 : ptr; - hir.store v108, v102; - v109 = hir.bitcast v339 : u32; - v349 = arith.constant 8 : u32; - v111 = arith.mod v109, v349 : u32; - hir.assertz v111 #[code = 250]; - v112 = hir.int_to_ptr v109 : ptr; - v113 = hir.load v112 : i64; - v114 = hir.bitcast v95 : u32; - v348 = arith.constant 4 : u32; - v116 = arith.mod v114, v348 : u32; + v52 = hir.load_local : i32 #[local = lv0]; + v268 = arith.constant 28 : u32; + v53 = hir.bitcast v52 : u32; + v55 = arith.add v53, v268 : u32 #[overflow = checked]; + v327 = arith.constant 4 : u32; + v57 = arith.mod v55, v327 : u32; + hir.assertz v57 #[code = 250]; + v58 = hir.int_to_ptr v55 : ptr; + v59 = hir.load v58 : felt; + hir.store_local v59 #[local = lv2]; + v60 = hir.load_local : i32 #[local = lv0]; + v266 = arith.constant 24 : u32; + v61 = hir.bitcast v60 : u32; + v63 = arith.add v61, v266 : u32 #[overflow = checked]; + v326 = arith.constant 4 : u32; + v65 = arith.mod v63, v326 : u32; + hir.assertz v65 #[code = 250]; + v66 = hir.int_to_ptr v63 : ptr; + v67 = hir.load v66 : felt; + hir.store_local v67 #[local = lv3]; + v68 = hir.load_local : i32 #[local = lv0]; + v265 = arith.constant 20 : u32; + v69 = hir.bitcast v68 : u32; + v71 = arith.add v69, v265 : u32 #[overflow = checked]; + v325 = arith.constant 4 : u32; + v73 = arith.mod v71, v325 : u32; + hir.assertz v73 #[code = 250]; + v74 = hir.int_to_ptr v71 : ptr; + v75 = hir.load v74 : felt; + hir.store_local v75 #[local = lv4]; + v76 = hir.load_local : i32 #[local = lv0]; + v264 = arith.constant 16 : u32; + v77 = hir.bitcast v76 : u32; + v79 = arith.add v77, v264 : u32 #[overflow = checked]; + v324 = arith.constant 4 : u32; + v81 = arith.mod v79, v324 : u32; + hir.assertz v81 #[code = 250]; + v82 = hir.int_to_ptr v79 : ptr; + v83 = hir.load v82 : felt; + hir.store_local v83 #[local = lv5]; + v84 = hir.load_local : i32 #[local = lv0]; + hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/::default(v84) + v85 = hir.load_local : i32 #[local = lv0]; + v323 = arith.constant 4 : u32; + v86 = hir.bitcast v85 : u32; + v88 = arith.add v86, v323 : u32 #[overflow = checked]; + v322 = arith.constant 4 : u32; + v90 = arith.mod v88, v322 : u32; + hir.assertz v90 #[code = 250]; + v91 = hir.int_to_ptr v88 : ptr; + v92 = hir.load v91 : felt; + v93 = hir.load_local : i32 #[local = lv0]; + v94 = hir.bitcast v93 : u32; + v321 = arith.constant 4 : u32; + v96 = arith.mod v94, v321 : u32; + hir.assertz v96 #[code = 250]; + v97 = hir.int_to_ptr v94 : ptr; + v98 = hir.load v97 : felt; + v99 = hir.load_local : felt #[local = lv2]; + v100 = hir.load_local : felt #[local = lv3]; + v101 = hir.load_local : felt #[local = lv4]; + v102 = hir.load_local : felt #[local = lv5]; + v103 = hir.load_local : i32 #[local = lv0]; + v320 = arith.constant 16 : i32; + v105 = arith.add v103, v320 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/miden::protocol::active_account::get_initial_map_item(v92, v98, v99, v100, v101, v102, v105) + v106 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/GOT.data.internal.__memory_base : ptr + v107 = hir.bitcast v106 : ptr; + v108 = hir.load v107 : i32; + v262 = arith.constant 1048584 : i32; + v110 = arith.add v108, v262 : i32 #[overflow = wrapping]; + hir.store_local v110 #[local = lv1]; + v111 = hir.load_local : i32 #[local = lv0]; + v319 = arith.constant 16 : u32; + v112 = hir.bitcast v111 : u32; + v114 = arith.add v112, v319 : u32 #[overflow = checked]; + v318 = arith.constant 4 : u32; + v116 = arith.mod v114, v318 : u32; hir.assertz v116 #[code = 250]; - v117 = hir.int_to_ptr v114 : ptr; - hir.store v117, v113; - v347 = arith.constant 48 : i32; - v119 = arith.add v339, v347 : i32 #[overflow = wrapping]; - v120 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/__stack_pointer : ptr - v121 = hir.bitcast v120 : ptr; - hir.store v121, v119; - builtin.ret v95; + v117 = hir.int_to_ptr v114 : ptr; + v118 = hir.load v117 : felt; + v261 = arith.constant 12 : u32; + v119 = hir.bitcast v110 : u32; + v121 = arith.add v119, v261 : u32 #[overflow = checked]; + v317 = arith.constant 4 : u32; + v123 = arith.mod v121, v317 : u32; + hir.assertz v123 #[code = 250]; + v124 = hir.int_to_ptr v121 : ptr; + hir.store v124, v118; + v125 = hir.load_local : i32 #[local = lv1]; + v126 = hir.load_local : i32 #[local = lv0]; + v316 = arith.constant 20 : u32; + v127 = hir.bitcast v126 : u32; + v129 = arith.add v127, v316 : u32 #[overflow = checked]; + v315 = arith.constant 4 : u32; + v131 = arith.mod v129, v315 : u32; + hir.assertz v131 #[code = 250]; + v132 = hir.int_to_ptr v129 : ptr; + v133 = hir.load v132 : felt; + v260 = arith.constant 8 : u32; + v134 = hir.bitcast v125 : u32; + v136 = arith.add v134, v260 : u32 #[overflow = checked]; + v314 = arith.constant 4 : u32; + v138 = arith.mod v136, v314 : u32; + hir.assertz v138 #[code = 250]; + v139 = hir.int_to_ptr v136 : ptr; + hir.store v139, v133; + v140 = hir.load_local : i32 #[local = lv1]; + v141 = hir.load_local : i32 #[local = lv0]; + v313 = arith.constant 24 : u32; + v142 = hir.bitcast v141 : u32; + v144 = arith.add v142, v313 : u32 #[overflow = checked]; + v312 = arith.constant 4 : u32; + v146 = arith.mod v144, v312 : u32; + hir.assertz v146 #[code = 250]; + v147 = hir.int_to_ptr v144 : ptr; + v148 = hir.load v147 : felt; + v311 = arith.constant 4 : u32; + v149 = hir.bitcast v140 : u32; + v151 = arith.add v149, v311 : u32 #[overflow = checked]; + v310 = arith.constant 4 : u32; + v153 = arith.mod v151, v310 : u32; + hir.assertz v153 #[code = 250]; + v154 = hir.int_to_ptr v151 : ptr; + hir.store v154, v148; + v155 = hir.load_local : i32 #[local = lv1]; + v156 = hir.load_local : i32 #[local = lv0]; + v309 = arith.constant 28 : u32; + v157 = hir.bitcast v156 : u32; + v159 = arith.add v157, v309 : u32 #[overflow = checked]; + v308 = arith.constant 4 : u32; + v161 = arith.mod v159, v308 : u32; + hir.assertz v161 #[code = 250]; + v162 = hir.int_to_ptr v159 : ptr; + v163 = hir.load v162 : felt; + v164 = hir.bitcast v155 : u32; + v307 = arith.constant 4 : u32; + v166 = arith.mod v164, v307 : u32; + hir.assertz v166 #[code = 250]; + v167 = hir.int_to_ptr v164 : ptr; + hir.store v167, v163; + v168 = hir.load_local : i32 #[local = lv0]; + v306 = arith.constant 32 : i32; + v170 = arith.add v168, v306 : i32 #[overflow = wrapping]; + v171 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/__stack_pointer : ptr + v172 = hir.bitcast v171 : ptr; + hir.store v172, v170; + v173 = hir.load_local : i32 #[local = lv1]; + builtin.ret v173; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { - ^block15: - v123 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/GOT.data.internal.__memory_base : ptr - v124 = hir.bitcast v123 : ptr; - v125 = hir.load v124 : i32; - v126 = arith.constant 1048600 : i32; - v127 = arith.add v125, v126 : i32 #[overflow = wrapping]; - v128 = hir.bitcast v127 : u32; - v129 = hir.int_to_ptr v128 : ptr; - v130 = hir.load v129 : u8; - v122 = arith.constant 0 : i32; - v131 = arith.zext v130 : u32; - v132 = hir.bitcast v131 : i32; - v134 = arith.neq v132, v122 : i1; - scf.if v134{ - ^block17: + ^block17: + v174 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/GOT.data.internal.__memory_base : ptr + v175 = hir.bitcast v174 : ptr; + v176 = hir.load v175 : i32; + v334 = arith.constant 1048600 : i32; + v178 = arith.add v176, v334 : i32 #[overflow = wrapping]; + v179 = hir.bitcast v178 : u32; + v180 = hir.int_to_ptr v179 : ptr; + v181 = hir.load v180 : u8; + v333 = arith.constant 0 : i32; + v182 = arith.zext v181 : u32; + v183 = hir.bitcast v182 : i32; + v185 = arith.neq v183, v333 : i1; + scf.if v185{ + ^block19: scf.yield ; } else { - ^block18: - v135 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/GOT.data.internal.__memory_base : ptr - v136 = hir.bitcast v135 : ptr; - v137 = hir.load v136 : i32; + ^block20: + v186 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/GOT.data.internal.__memory_base : ptr + v187 = hir.bitcast v186 : ptr; + v188 = hir.load v187 : i32; + hir.store_local v188 #[local = lv0]; hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/__wasm_call_ctors() - v370 = arith.constant 1 : u8; - v372 = arith.constant 1048600 : i32; - v139 = arith.add v137, v372 : i32 #[overflow = wrapping]; - v143 = hir.bitcast v139 : u32; - v144 = hir.int_to_ptr v143 : ptr; - hir.store v144, v370; + v189 = hir.load_local : i32 #[local = lv0]; + v332 = arith.constant 1 : u8; + v337 = arith.constant 1048600 : i32; + v191 = arith.add v189, v337 : i32 #[overflow = wrapping]; + v195 = hir.bitcast v191 : u32; + v196 = hir.int_to_ptr v195 : ptr; + hir.store v196, v332; scf.yield ; }; builtin.ret ; }; - private builtin.function @::reverse(v145: i32, v146: i32) { - ^block19(v145: i32, v146: i32): - v149 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/__stack_pointer : ptr - v150 = hir.bitcast v149 : ptr; - v151 = hir.load v150 : i32; - v152 = arith.constant 16 : i32; - v153 = arith.sub v151, v152 : i32 #[overflow = wrapping]; - v155 = arith.constant 8 : u32; - v154 = hir.bitcast v146 : u32; - v156 = arith.add v154, v155 : u32 #[overflow = checked]; - v459 = arith.constant 8 : u32; - v158 = arith.mod v156, v459 : u32; - hir.assertz v158 #[code = 250]; - v159 = hir.int_to_ptr v156 : ptr; - v160 = hir.load v159 : i64; - v458 = arith.constant 8 : u32; - v161 = hir.bitcast v153 : u32; - v163 = arith.add v161, v458 : u32 #[overflow = checked]; - v164 = arith.constant 4 : u32; - v165 = arith.mod v163, v164 : u32; - hir.assertz v165 #[code = 250]; - v166 = hir.int_to_ptr v163 : ptr; - hir.store v166, v160; - v167 = hir.bitcast v146 : u32; - v457 = arith.constant 8 : u32; - v169 = arith.mod v167, v457 : u32; - hir.assertz v169 #[code = 250]; - v170 = hir.int_to_ptr v167 : ptr; - v171 = hir.load v170 : i64; - v172 = hir.bitcast v153 : u32; - v456 = arith.constant 4 : u32; - v174 = arith.mod v172, v456 : u32; - hir.assertz v174 #[code = 250]; - v175 = hir.int_to_ptr v172 : ptr; - hir.store v175, v171; - v176 = arith.constant 12 : i32; - v177 = arith.add v153, v176 : i32 #[overflow = wrapping]; - v147 = arith.constant 0 : i32; - v427, v428, v429, v430, v431, v432 = scf.while v147, v153, v177, v145 : i32, i32, i32, i32, i32, i32 { - ^block52(v433: i32, v434: i32, v435: i32, v436: i32): - v455 = arith.constant 0 : i32; - v180 = arith.constant 8 : i32; - v181 = arith.eq v433, v180 : i1; - v182 = arith.zext v181 : u32; - v183 = hir.bitcast v182 : i32; - v185 = arith.neq v183, v455 : i1; - v421, v422 = scf.if v185 : i32, i32 { - ^block51: - v381 = ub.poison i32 : i32; - scf.yield v381, v381; - } else { - ^block24: - v187 = arith.add v434, v433 : i32 #[overflow = wrapping]; - v188 = hir.bitcast v187 : u32; - v454 = arith.constant 4 : u32; - v190 = arith.mod v188, v454 : u32; - hir.assertz v190 #[code = 250]; - v191 = hir.int_to_ptr v188 : ptr; - v192 = hir.load v191 : felt; - v194 = hir.bitcast v435 : u32; - v453 = arith.constant 4 : u32; - v196 = arith.mod v194, v453 : u32; - hir.assertz v196 #[code = 250]; - v197 = hir.int_to_ptr v194 : ptr; - v198 = hir.load v197 : i32; - v199 = hir.bitcast v187 : u32; - v452 = arith.constant 4 : u32; - v201 = arith.mod v199, v452 : u32; - hir.assertz v201 #[code = 250]; - v202 = hir.int_to_ptr v199 : ptr; - hir.store v202, v198; - v203 = hir.bitcast v435 : u32; - v451 = arith.constant 4 : u32; - v205 = arith.mod v203, v451 : u32; - hir.assertz v205 #[code = 250]; - v206 = hir.int_to_ptr v203 : ptr; - hir.store v206, v192; - v209 = arith.constant -4 : i32; - v210 = arith.add v435, v209 : i32 #[overflow = wrapping]; - v207 = arith.constant 4 : i32; - v208 = arith.add v433, v207 : i32 #[overflow = wrapping]; - scf.yield v208, v210; - }; - v449 = ub.poison i32 : i32; - v424 = cf.select v185, v449, v436 : i32; - v450 = ub.poison i32 : i32; - v423 = cf.select v185, v450, v434 : i32; - v380 = arith.constant 1 : u32; - v373 = arith.constant 0 : u32; - v426 = cf.select v185, v373, v380 : u32; - v414 = arith.trunc v426 : i1; - scf.condition v414, v421, v423, v422, v424, v434, v436; - } do { - ^block53(v437: i32, v438: i32, v439: i32, v440: i32, v441: i32, v442: i32): - scf.yield v437, v438, v439, v440; - }; - v448 = arith.constant 8 : u32; - v212 = hir.bitcast v431 : u32; - v214 = arith.add v212, v448 : u32 #[overflow = checked]; - v447 = arith.constant 4 : u32; - v216 = arith.mod v214, v447 : u32; - hir.assertz v216 #[code = 250]; - v217 = hir.int_to_ptr v214 : ptr; - v218 = hir.load v217 : i64; - v446 = arith.constant 8 : u32; - v219 = hir.bitcast v432 : u32; - v221 = arith.add v219, v446 : u32 #[overflow = checked]; - v445 = arith.constant 8 : u32; - v223 = arith.mod v221, v445 : u32; - hir.assertz v223 #[code = 250]; - v224 = hir.int_to_ptr v221 : ptr; - hir.store v224, v218; - v225 = hir.bitcast v431 : u32; - v444 = arith.constant 4 : u32; - v227 = arith.mod v225, v444 : u32; - hir.assertz v227 #[code = 250]; - v228 = hir.int_to_ptr v225 : ptr; - v229 = hir.load v228 : i64; - v230 = hir.bitcast v432 : u32; - v443 = arith.constant 8 : u32; - v232 = arith.mod v230, v443 : u32; - hir.assertz v232 #[code = 250]; - v233 = hir.int_to_ptr v230 : ptr; - hir.store v233, v229; - builtin.ret ; - }; - - private builtin.function @>::from(v234: i32) -> felt { - ^block25(v234: i32): - v236 = arith.constant 255 : i32; - v237 = arith.band v234, v236 : i32; - v238 = hir.bitcast v237 : felt; - builtin.ret v238; - }; - - private builtin.function @intrinsics::felt::from_u32(v239: i32) -> felt { - ^block27(v239: i32): - v240 = hir.bitcast v239 : felt; - builtin.ret v240; - }; - - private builtin.function @miden::active_account::get_initial_map_item(v242: felt, v243: felt, v244: felt, v245: felt, v246: felt, v247: i32) { - ^block29(v242: felt, v243: felt, v244: felt, v245: felt, v246: felt, v247: i32): - v248, v249, v250, v251 = hir.exec @miden/active_account/get_initial_map_item(v242, v243, v244, v245, v246) : felt, felt, felt, felt - v252 = hir.bitcast v247 : u32; - v253 = hir.int_to_ptr v252 : ptr; - hir.store v253, v248; - v254 = arith.constant 4 : u32; - v255 = arith.add v252, v254 : u32 #[overflow = checked]; - v256 = hir.int_to_ptr v255 : ptr; - hir.store v256, v249; - v257 = arith.constant 8 : u32; - v258 = arith.add v252, v257 : u32 #[overflow = checked]; - v259 = hir.int_to_ptr v258 : ptr; - hir.store v259, v250; - v260 = arith.constant 12 : u32; - v261 = arith.add v252, v260 : u32 #[overflow = checked]; - v262 = hir.int_to_ptr v261 : ptr; - hir.store v262, v251; + private builtin.function @miden::protocol::active_account::get_initial_map_item(v197: felt, v198: felt, v199: felt, v200: felt, v201: felt, v202: felt, v203: i32) { + ^block21(v197: felt, v198: felt, v199: felt, v200: felt, v201: felt, v202: felt, v203: i32): + v204, v205, v206, v207 = hir.exec @miden/protocol/active_account/get_initial_map_item(v197, v198, v199, v200, v201, v202) : felt, felt, felt, felt + v208 = hir.bitcast v203 : u32; + v209 = hir.int_to_ptr v208 : ptr; + hir.store v209, v204; + v340 = arith.constant 4 : u32; + v211 = arith.add v208, v340 : u32 #[overflow = checked]; + v212 = hir.int_to_ptr v211 : ptr; + hir.store v212, v205; + v339 = arith.constant 8 : u32; + v214 = arith.add v208, v339 : u32 #[overflow = checked]; + v215 = hir.int_to_ptr v214 : ptr; + hir.store v215, v206; + v338 = arith.constant 12 : u32; + v217 = arith.add v208, v338 : u32 #[overflow = checked]; + v218 = hir.int_to_ptr v217 : ptr; + hir.store v218, v207; builtin.ret ; }; @@ -385,34 +317,34 @@ builtin.component miden:rust-sdk-account-storage-get-initial-map-item-binding/ru }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block33: - v263 = hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding() : i32 - v264 = arith.constant 0 : i32; - v265 = arith.add v263, v264 : i32 #[overflow = unchecked]; - v463 = arith.constant 0 : i32; - v464 = arith.constant 0 : i32; - v267 = arith.add v265, v464 : i32 #[overflow = unchecked]; - v269 = arith.add v267, v463 : i32 #[overflow = unchecked]; - v270 = hir.int_to_ptr v269 : ptr; - v271 = hir.load v270 : felt; - v462 = arith.constant 0 : i32; - v272 = arith.constant 4 : i32; - v273 = arith.add v265, v272 : i32 #[overflow = unchecked]; - v275 = arith.add v273, v462 : i32 #[overflow = unchecked]; - v276 = hir.int_to_ptr v275 : ptr; - v277 = hir.load v276 : felt; - v461 = arith.constant 0 : i32; - v278 = arith.constant 8 : i32; - v279 = arith.add v265, v278 : i32 #[overflow = unchecked]; - v281 = arith.add v279, v461 : i32 #[overflow = unchecked]; - v282 = hir.int_to_ptr v281 : ptr; - v283 = hir.load v282 : felt; - v460 = arith.constant 0 : i32; - v284 = arith.constant 12 : i32; - v285 = arith.add v265, v284 : i32 #[overflow = unchecked]; - v287 = arith.add v285, v460 : i32 #[overflow = unchecked]; - v288 = hir.int_to_ptr v287 : ptr; - v289 = hir.load v288 : felt; - builtin.ret v271, v277, v283, v289; + ^block26: + v219 = hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding() : i32 + v344 = arith.constant 0 : i32; + v221 = arith.add v219, v344 : i32 #[overflow = unchecked]; + v353 = arith.constant 0 : i32; + v354 = arith.constant 0 : i32; + v223 = arith.add v221, v354 : i32 #[overflow = unchecked]; + v225 = arith.add v223, v353 : i32 #[overflow = unchecked]; + v226 = hir.int_to_ptr v225 : ptr; + v227 = hir.load v226 : felt; + v352 = arith.constant 0 : i32; + v343 = arith.constant 4 : i32; + v229 = arith.add v221, v343 : i32 #[overflow = unchecked]; + v231 = arith.add v229, v352 : i32 #[overflow = unchecked]; + v232 = hir.int_to_ptr v231 : ptr; + v233 = hir.load v232 : felt; + v351 = arith.constant 0 : i32; + v342 = arith.constant 8 : i32; + v235 = arith.add v221, v342 : i32 #[overflow = unchecked]; + v237 = arith.add v235, v351 : i32 #[overflow = unchecked]; + v238 = hir.int_to_ptr v237 : ptr; + v239 = hir.load v238 : felt; + v350 = arith.constant 0 : i32; + v341 = arith.constant 12 : i32; + v241 = arith.add v221, v341 : i32 #[overflow = unchecked]; + v243 = arith.add v241, v350 : i32 #[overflow = unchecked]; + v244 = hir.int_to_ptr v243 : ptr; + v245 = hir.load v244 : felt; + builtin.ret v227, v233, v239, v245; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.masm index adbc69a68..980fd9503 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.masm @@ -1,13 +1,13 @@ -# mod miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1 +# mod ::"miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> (felt, felt, felt, felt) - exec.::miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1::init + exec."miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1::rust_sdk_account_storage_get_initial_map_item_binding::miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding + exec.::"miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1"::rust_sdk_account_storage_get_initial_map_item_binding::"miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding" trace.252 nop push.0 @@ -62,7 +62,7 @@ pub proc binding( nop movdn.3 swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -75,7 +75,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -86,7 +86,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1::rust_sdk_account_storage_get_initial_map_item_binding +# mod ::"miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1"::rust_sdk_account_storage_get_initial_map_item_binding @callconv("C") proc __wasm_call_ctors( @@ -102,6 +102,78 @@ proc rust_sdk_account_storage_get_initial_map_item_binding::bindings::__link_cus nop end +@locals("2") +@callconv("C") +proc ::default( + i32 +) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.3955828357 + push.2220095670 + mul.4294967296 + add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.3495821841 + push.643588342 + mul.4294967296 + add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + +@locals("6") @callconv("C") proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding( @@ -114,11 +186,18 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun exec.::intrinsics::mem::load_sw trace.252 nop - push.48 + push.32 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -128,35 +207,89 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun nop trace.240 nop - exec.::miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1::rust_sdk_account_storage_get_initial_map_item_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1"::rust_sdk_account_storage_get_initial_map_item_binding::wit_bindgen::rt::run_ctors_once trace.252 nop + locaddr.0 push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1::rust_sdk_account_storage_get_initial_map_item_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + u32wrapping_add + trace.240 + nop + exec.::"miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1"::rust_sdk_account_storage_get_initial_map_item_binding::::default trace.252 nop push.0 - movup.2 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + locaddr.2 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1 while.true + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.16 - dup.2 + movup.2 eq neq dup.0 if.true - swap.1 - drop - push.3735929054 + nop else - push.32 - dup.3 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.16 + movup.3 u32wrapping_add - dup.2 + movup.2 u32wrapping_add push.4 dup.1 @@ -164,8 +297,6 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun u32mod u32assert assertz - dup.4 - swap.1 u32divmod.4 swap.1 trace.240 @@ -173,60 +304,47 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - movup.2 u32wrapping_add + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.3735929054 - dup.2 - movup.2 - swap.5 - movdn.2 - cdrop - push.3735929054 - dup.2 - dup.4 - swap.2 - swap.1 - cdrop push.1 push.0 - movup.4 + movup.2 cdrop push.1 u32and - movup.4 - swap.1 if.true - movup.3 - drop push.1 else push.0 end end - drop - drop - drop - push.44 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::load_sw trace.252 nop - push.40 - dup.2 + push.28 + swap.1 add u32assert push.4 @@ -242,25 +360,24 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun exec.::intrinsics::mem::load_felt trace.252 nop - push.36 - dup.3 - add - u32assert - push.4 - dup.1 + locaddr.2 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::load_sw trace.252 nop - push.32 - dup.4 + push.24 + swap.1 add u32assert push.4 @@ -276,30 +393,27 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.3 push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1::rust_sdk_account_storage_get_initial_map_item_binding::>::from + exec.::intrinsics::mem::store_felt trace.252 nop - push.16 - dup.6 - u32wrapping_add - movup.2 - swap.4 - movdn.2 - swap.5 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1::rust_sdk_account_storage_get_initial_map_item_binding::miden::active_account::get_initial_map_item + exec.::intrinsics::mem::load_sw trace.252 nop - push.24 - dup.1 + push.20 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -309,52 +423,30 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.4 + push.0 swap.1 - push.40 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.16 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + push.16 swap.1 - push.32 - dup.3 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -362,37 +454,45 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop - push.1114148 - u32divmod.4 + locaddr.5 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::store_felt trace.252 nop - push.32 - dup.2 - u32wrapping_add - dup.2 + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1::rust_sdk_account_storage_get_initial_map_item_binding::::reverse + exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 - u32wrapping_add - push.8 - dup.2 + trace.240 + nop + exec.::"miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1"::rust_sdk_account_storage_get_initial_map_item_binding::::default + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -402,14 +502,17 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.0 + push.0 swap.1 - push.8 - dup.3 - add - u32assert + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -418,61 +521,65 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop - dup.1 - push.8 - dup.1 + locaddr.2 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.3 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.4 + push.0 swap.1 - dup.2 - push.4 - dup.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.5 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.0 + push.0 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.48 - movup.2 + push.16 u32wrapping_add - push.1114144 - u32divmod.4 + movup.2 + swap.4 + movdn.2 + swap.1 + swap.5 swap.1 + swap.6 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::"miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1"::rust_sdk_account_storage_get_initial_map_item_binding::"miden::protocol::active_account::get_initial_map_item" trace.252 nop -end - -@callconv("C") -proc wit_bindgen::rt::run_ctors_once( - -) push.1114148 u32divmod.4 swap.1 @@ -481,75 +588,19 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048600 + push.1048584 u32wrapping_add - u32divmod.4 - swap.1 - swap.1 - dup.1 - mem_load - swap.1 - push.8 - u32wrapping_mul - u32shr - swap.1 - drop - push.255 - u32and + dup.0 + locaddr.1 push.0 swap.1 - neq - if.true - nop - else - push.1114148 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - trace.240 - nop - exec.::miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1::rust_sdk_account_storage_get_initial_map_item_binding::__wasm_call_ctors - trace.252 - nop - push.1 - push.1048600 - movup.2 - u32wrapping_add - u32divmod.4 - swap.1 - dup.0 - mem_load - dup.2 - push.8 - u32wrapping_mul - push.255 - swap.1 - u32shl - u32not - swap.1 - u32and - movup.3 - movup.3 - push.8 - u32wrapping_mul - u32shl - u32or - swap.1 - mem_store - end -end - -@callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 swap.1 trace.240 nop @@ -557,12 +608,10 @@ proc ::reverse( trace.252 nop push.16 - u32wrapping_sub - push.8 - dup.3 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -572,12 +621,11 @@ proc ::reverse( swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.8 - dup.3 + push.12 + movup.2 add u32assert push.4 @@ -588,15 +636,32 @@ proc ::reverse( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - movup.2 - push.8 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.20 + swap.1 + add + u32assert + push.4 dup.1 swap.1 u32mod @@ -606,11 +671,13 @@ proc ::reverse( swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - dup.2 + push.8 + movup.2 + add + u32assert push.4 dup.1 swap.1 @@ -619,140 +686,29 @@ proc ::reverse( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - push.12 - dup.1 - u32wrapping_add + locaddr.1 push.0 - movup.2 swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.8 - dup.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.24 + swap.1 add u32assert push.4 @@ -765,15 +721,14 @@ proc ::reverse( swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.8 - dup.4 + push.4 + movup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -781,13 +736,31 @@ proc ::reverse( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.28 + swap.1 + add + u32assert push.4 dup.1 swap.1 @@ -798,12 +771,11 @@ proc ::reverse( swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop swap.1 - movup.2 - push.8 + push.4 dup.1 swap.1 u32mod @@ -811,30 +783,133 @@ proc ::reverse( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop end +@locals("1") @callconv("C") -proc >::from( - i32 -) -> felt - push.255 - u32and -end +proc wit_bindgen::rt::run_ctors_once( -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1"::rust_sdk_account_storage_get_initial_map_item_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1 + push.1048600 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end end @callconv("C") -proc miden::active_account::get_initial_map_item( +proc miden::protocol::active_account::get_initial_map_item( + felt, felt, felt, felt, @@ -844,7 +919,7 @@ proc miden::active_account::get_initial_map_item( ) trace.240 nop - exec.::miden::active_account::get_initial_map_item + exec.::miden::protocol::active_account::get_initial_map_item trace.252 nop movup.4 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.wat index 4814ce159..81155ba61 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.wat @@ -11,10 +11,11 @@ (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) (core module $main (;0;) (type (;0;) (func)) - (type (;1;) (func (result i32))) - (type (;2;) (func (param i32 i32))) + (type (;1;) (func (param i32))) + (type (;2;) (func (result i32))) (type (;3;) (func (param i32) (result f32))) - (type (;4;) (func (param f32 f32 f32 f32 f32 i32))) + (type (;4;) (func (param i64) (result f32))) + (type (;5;) (func (param f32 f32 f32 f32 f32 f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -24,14 +25,31 @@ (elem (;0;) (i32.const 1) func $rust_sdk_account_storage_get_initial_map_item_binding::bindings::__link_custom_section_describing_imports) (func $__wasm_call_ctors (;0;) (type 0)) (func $rust_sdk_account_storage_get_initial_map_item_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) - (func $miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding (;2;) (type 1) (result i32) + (func $::default (;2;) (type 1) (param i32) + (local f32) + i64.const 2764190884472685073 + call $intrinsics::felt::from_u64_unchecked + local.set 1 + local.get 0 + i64.const -8911505773112514939 + call $intrinsics::felt::from_u64_unchecked + f32.store offset=4 + local.get 0 + local.get 1 + f32.store + ) + (func $miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding (;3;) (type 2) (result i32) (local i32 i32 f32 f32 f32 f32) global.get $__stack_pointer - i32.const 48 + i32.const 32 i32.sub local.tee 0 global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once + local.get 0 + i32.const 8 + i32.add + call $::default i32.const 0 local.set 1 i32.const 0 @@ -44,7 +62,7 @@ i32.eq br_if 1 (;@1;) local.get 0 - i32.const 32 + i32.const 16 i32.add local.get 1 i32.add @@ -58,19 +76,23 @@ end end local.get 0 - f32.load offset=44 + f32.load offset=28 local.set 2 local.get 0 - f32.load offset=40 + f32.load offset=24 local.set 3 local.get 0 - f32.load offset=36 + f32.load offset=20 local.set 4 local.get 0 - f32.load offset=32 + f32.load offset=16 local.set 5 - i32.const 0 - call $>::from + local.get 0 + call $::default + local.get 0 + f32.load offset=4 + local.get 0 + f32.load local.get 2 local.get 3 local.get 4 @@ -78,40 +100,33 @@ local.get 0 i32.const 16 i32.add - call $miden::active_account::get_initial_map_item - local.get 0 - local.get 0 - i64.load offset=24 - i64.store offset=40 - local.get 0 - local.get 0 - i64.load offset=16 - i64.store offset=32 + call $miden::protocol::active_account::get_initial_map_item global.get $GOT.data.internal.__memory_base - local.set 1 - local.get 0 - local.get 0 - i32.const 32 - i32.add - call $::reverse - local.get 1 i32.const 1048584 i32.add local.tee 1 local.get 0 - i64.load offset=8 - i64.store offset=8 align=4 + f32.load offset=16 + f32.store offset=12 + local.get 1 + local.get 0 + f32.load offset=20 + f32.store offset=8 + local.get 1 + local.get 0 + f32.load offset=24 + f32.store offset=4 local.get 1 local.get 0 - i64.load - i64.store align=4 + f32.load offset=28 + f32.store local.get 0 - i32.const 48 + i32.const 32 i32.add global.set $__stack_pointer local.get 1 ) - (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (func $wit_bindgen::rt::run_ctors_once (;4;) (type 0) (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base @@ -129,78 +144,17 @@ i32.store8 end ) - (func $::reverse (;4;) (type 2) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store - ) - (func $>::from (;5;) (type 3) (param i32) (result f32) - local.get 0 - i32.const 255 - i32.and - f32.reinterpret_i32 + (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + unreachable ) - (func $intrinsics::felt::from_u32 (;6;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;6;) (type 4) (param i64) (result f32) unreachable ) - (func $miden::active_account::get_initial_map_item (;7;) (type 4) (param f32 f32 f32 f32 f32 i32) + (func $miden::protocol::active_account::get_initial_map_item (;7;) (type 5) (param f32 f32 f32 f32 f32 f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "krust_sdk_account_storage_get_initial_map_item_binding\01\0b0.0.1\03\01\01") + (@custom "rodata,miden_account" (after data) "krust_sdk_account_storage_get_initial_map_item_binding\01\0b0.0.1\03\01\01\00Rmiden::component::miden_rust_sdk_account_storage_get_initial_map_item_binding::map\01\01\11test map\00\00\09word\00\00\09word\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.hir index 69b64926d..8be2e498e 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.hir @@ -12,21 +12,24 @@ builtin.component miden:base/transaction-script@1.0.0 { private builtin.function @miden:base/transaction-script@1.0.0#run(v0: felt, v1: felt, v2: felt, v3: felt) { ^block9(v0: felt, v1: felt, v2: felt, v3: felt): - v5 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/__stack_pointer : ptr - v6 = hir.bitcast v5 : ptr; - v7 = hir.load v6 : i32; - v8 = arith.constant 16 : i32; - v9 = arith.sub v7, v8 : i32 #[overflow = wrapping]; - v10 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/__stack_pointer : ptr - v11 = hir.bitcast v10 : ptr; - hir.store v11, v9; + v4 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/__stack_pointer : ptr + v5 = hir.bitcast v4 : ptr; + v6 = hir.load v5 : i32; + v106 = arith.constant 16 : i32; + v8 = arith.sub v6, v106 : i32 #[overflow = wrapping]; + hir.store_local v8 #[local = lv4]; + v9 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/__stack_pointer : ptr + v10 = hir.bitcast v9 : ptr; + hir.store v10, v8; hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/wit_bindgen::rt::run_ctors_once() - hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/miden_base_sys::bindings::tx::get_block_commitment(v9) - v187 = arith.constant 16 : i32; - v13 = arith.add v9, v187 : i32 #[overflow = wrapping]; - v14 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/__stack_pointer : ptr - v15 = hir.bitcast v14 : ptr; - hir.store v15, v13; + v11 = hir.load_local : i32 #[local = lv4]; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/miden_base_sys::bindings::tx::get_block_commitment(v11) + v12 = hir.load_local : i32 #[local = lv4]; + v108 = arith.constant 16 : i32; + v14 = arith.add v12, v108 : i32 #[overflow = wrapping]; + v15 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/__stack_pointer : ptr + v16 = hir.bitcast v15 : ptr; + hir.store v16, v14; builtin.ret ; }; @@ -35,15 +38,15 @@ builtin.component miden:base/transaction-script@1.0.0 { v17 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/GOT.data.internal.__memory_base : ptr v18 = hir.bitcast v17 : ptr; v19 = hir.load v18 : i32; - v20 = arith.constant 1048584 : i32; - v21 = arith.add v19, v20 : i32 #[overflow = wrapping]; + v113 = arith.constant 1048584 : i32; + v21 = arith.add v19, v113 : i32 #[overflow = wrapping]; v22 = hir.bitcast v21 : u32; v23 = hir.int_to_ptr v22 : ptr; v24 = hir.load v23 : u8; - v16 = arith.constant 0 : i32; + v112 = arith.constant 0 : i32; v25 = arith.zext v24 : u32; v26 = hir.bitcast v25 : i32; - v28 = arith.neq v26, v16 : i1; + v28 = arith.neq v26, v112 : i1; scf.if v28{ ^block13: scf.yield ; @@ -52,215 +55,97 @@ builtin.component miden:base/transaction-script@1.0.0 { v29 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/GOT.data.internal.__memory_base : ptr v30 = hir.bitcast v29 : ptr; v31 = hir.load v30 : i32; + hir.store_local v31 #[local = lv0]; hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/__wasm_call_ctors() - v189 = arith.constant 1 : u8; - v191 = arith.constant 1048584 : i32; - v33 = arith.add v31, v191 : i32 #[overflow = wrapping]; - v37 = hir.bitcast v33 : u32; - v38 = hir.int_to_ptr v37 : ptr; - hir.store v38, v189; + v32 = hir.load_local : i32 #[local = lv0]; + v111 = arith.constant 1 : u8; + v116 = arith.constant 1048584 : i32; + v34 = arith.add v32, v116 : i32 #[overflow = wrapping]; + v38 = hir.bitcast v34 : u32; + v39 = hir.int_to_ptr v38 : ptr; + hir.store v39, v111; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::tx::get_block_commitment(v39: i32) { - ^block15(v39: i32): + private builtin.function @miden_base_sys::bindings::tx::get_block_commitment(v40: i32) { + ^block15(v40: i32): + hir.store_local v40 #[local = lv0]; v41 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/__stack_pointer : ptr v42 = hir.bitcast v41 : ptr; v43 = hir.load v42 : i32; - v44 = arith.constant 32 : i32; - v45 = arith.sub v43, v44 : i32 #[overflow = wrapping]; + v124 = arith.constant 16 : i32; + v45 = arith.sub v43, v124 : i32 #[overflow = wrapping]; + hir.store_local v45 #[local = lv1]; v46 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/__stack_pointer : ptr v47 = hir.bitcast v46 : ptr; hir.store v47, v45; - hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/miden::tx::get_block_commitment(v45) - v49 = arith.constant 8 : u32; - v48 = hir.bitcast v45 : u32; - v50 = arith.add v48, v49 : u32 #[overflow = checked]; - v196 = arith.constant 8 : u32; - v52 = arith.mod v50, v196 : u32; - hir.assertz v52 #[code = 250]; - v53 = hir.int_to_ptr v50 : ptr; - v54 = hir.load v53 : i64; - v56 = arith.constant 24 : u32; - v55 = hir.bitcast v45 : u32; - v57 = arith.add v55, v56 : u32 #[overflow = checked]; - v195 = arith.constant 8 : u32; - v59 = arith.mod v57, v195 : u32; - hir.assertz v59 #[code = 250]; - v60 = hir.int_to_ptr v57 : ptr; - hir.store v60, v54; - v61 = hir.bitcast v45 : u32; - v194 = arith.constant 8 : u32; - v63 = arith.mod v61, v194 : u32; + v48 = hir.load_local : i32 #[local = lv1]; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/miden::protocol::tx::get_block_commitment(v48) + v49 = hir.load_local : i32 #[local = lv0]; + v50 = hir.load_local : i32 #[local = lv1]; + v51 = hir.bitcast v50 : u32; + v123 = arith.constant 8 : u32; + v53 = arith.mod v51, v123 : u32; + hir.assertz v53 #[code = 250]; + v54 = hir.int_to_ptr v51 : ptr; + v55 = hir.load v54 : i64; + v120, v121 = arith.split v55 : felt, felt; + v136 = arith.constant 8 : u32; + v59 = hir.bitcast v49 : u32; + v61 = arith.add v59, v136 : u32 #[overflow = checked]; + v135 = arith.constant 8 : u32; + v63 = arith.mod v61, v135 : u32; hir.assertz v63 #[code = 250]; + v122 = arith.join v121, v120 : i64; v64 = hir.int_to_ptr v61 : ptr; - v65 = hir.load v64 : i64; - v67 = arith.constant 16 : u32; - v66 = hir.bitcast v45 : u32; - v68 = arith.add v66, v67 : u32 #[overflow = checked]; - v193 = arith.constant 8 : u32; - v70 = arith.mod v68, v193 : u32; - hir.assertz v70 #[code = 250]; - v71 = hir.int_to_ptr v68 : ptr; - hir.store v71, v65; - v72 = arith.constant 16 : i32; - v73 = arith.add v45, v72 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/::reverse(v39, v73) - v192 = arith.constant 32 : i32; - v75 = arith.add v45, v192 : i32 #[overflow = wrapping]; - v76 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/__stack_pointer : ptr - v77 = hir.bitcast v76 : ptr; - hir.store v77, v75; + hir.store v64, v122; + v65 = hir.load_local : i32 #[local = lv0]; + v66 = hir.load_local : i32 #[local = lv1]; + v134 = arith.constant 8 : u32; + v67 = hir.bitcast v66 : u32; + v69 = arith.add v67, v134 : u32 #[overflow = checked]; + v133 = arith.constant 8 : u32; + v71 = arith.mod v69, v133 : u32; + hir.assertz v71 #[code = 250]; + v72 = hir.int_to_ptr v69 : ptr; + v73 = hir.load v72 : i64; + v117, v118 = arith.split v73 : felt, felt; + v77 = hir.bitcast v65 : u32; + v132 = arith.constant 8 : u32; + v79 = arith.mod v77, v132 : u32; + hir.assertz v79 #[code = 250]; + v119 = arith.join v118, v117 : i64; + v80 = hir.int_to_ptr v77 : ptr; + hir.store v80, v119; + v81 = hir.load_local : i32 #[local = lv1]; + v131 = arith.constant 16 : i32; + v83 = arith.add v81, v131 : i32 #[overflow = wrapping]; + v84 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/__stack_pointer : ptr + v85 = hir.bitcast v84 : ptr; + hir.store v85, v83; builtin.ret ; }; - private builtin.function @::reverse(v78: i32, v79: i32) { - ^block17(v78: i32, v79: i32): - v82 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/__stack_pointer : ptr - v83 = hir.bitcast v82 : ptr; - v84 = hir.load v83 : i32; - v85 = arith.constant 16 : i32; - v86 = arith.sub v84, v85 : i32 #[overflow = wrapping]; - v88 = arith.constant 8 : u32; - v87 = hir.bitcast v79 : u32; - v89 = arith.add v87, v88 : u32 #[overflow = checked]; - v283 = arith.constant 8 : u32; - v91 = arith.mod v89, v283 : u32; - hir.assertz v91 #[code = 250]; - v92 = hir.int_to_ptr v89 : ptr; - v93 = hir.load v92 : i64; - v282 = arith.constant 8 : u32; - v94 = hir.bitcast v86 : u32; - v96 = arith.add v94, v282 : u32 #[overflow = checked]; - v97 = arith.constant 4 : u32; - v98 = arith.mod v96, v97 : u32; - hir.assertz v98 #[code = 250]; - v99 = hir.int_to_ptr v96 : ptr; - hir.store v99, v93; - v100 = hir.bitcast v79 : u32; - v281 = arith.constant 8 : u32; - v102 = arith.mod v100, v281 : u32; - hir.assertz v102 #[code = 250]; - v103 = hir.int_to_ptr v100 : ptr; - v104 = hir.load v103 : i64; - v105 = hir.bitcast v86 : u32; - v280 = arith.constant 4 : u32; - v107 = arith.mod v105, v280 : u32; - hir.assertz v107 #[code = 250]; - v108 = hir.int_to_ptr v105 : ptr; - hir.store v108, v104; - v109 = arith.constant 12 : i32; - v110 = arith.add v86, v109 : i32 #[overflow = wrapping]; - v80 = arith.constant 0 : i32; - v251, v252, v253, v254, v255, v256 = scf.while v80, v86, v110, v78 : i32, i32, i32, i32, i32, i32 { - ^block37(v257: i32, v258: i32, v259: i32, v260: i32): - v279 = arith.constant 0 : i32; - v113 = arith.constant 8 : i32; - v114 = arith.eq v257, v113 : i1; - v115 = arith.zext v114 : u32; - v116 = hir.bitcast v115 : i32; - v118 = arith.neq v116, v279 : i1; - v245, v246 = scf.if v118 : i32, i32 { - ^block36: - v205 = ub.poison i32 : i32; - scf.yield v205, v205; - } else { - ^block22: - v120 = arith.add v258, v257 : i32 #[overflow = wrapping]; - v121 = hir.bitcast v120 : u32; - v278 = arith.constant 4 : u32; - v123 = arith.mod v121, v278 : u32; - hir.assertz v123 #[code = 250]; - v124 = hir.int_to_ptr v121 : ptr; - v125 = hir.load v124 : felt; - v127 = hir.bitcast v259 : u32; - v277 = arith.constant 4 : u32; - v129 = arith.mod v127, v277 : u32; - hir.assertz v129 #[code = 250]; - v130 = hir.int_to_ptr v127 : ptr; - v131 = hir.load v130 : i32; - v132 = hir.bitcast v120 : u32; - v276 = arith.constant 4 : u32; - v134 = arith.mod v132, v276 : u32; - hir.assertz v134 #[code = 250]; - v135 = hir.int_to_ptr v132 : ptr; - hir.store v135, v131; - v136 = hir.bitcast v259 : u32; - v275 = arith.constant 4 : u32; - v138 = arith.mod v136, v275 : u32; - hir.assertz v138 #[code = 250]; - v139 = hir.int_to_ptr v136 : ptr; - hir.store v139, v125; - v142 = arith.constant -4 : i32; - v143 = arith.add v259, v142 : i32 #[overflow = wrapping]; - v140 = arith.constant 4 : i32; - v141 = arith.add v257, v140 : i32 #[overflow = wrapping]; - scf.yield v141, v143; - }; - v273 = ub.poison i32 : i32; - v248 = cf.select v118, v273, v260 : i32; - v274 = ub.poison i32 : i32; - v247 = cf.select v118, v274, v258 : i32; - v204 = arith.constant 1 : u32; - v197 = arith.constant 0 : u32; - v250 = cf.select v118, v197, v204 : u32; - v238 = arith.trunc v250 : i1; - scf.condition v238, v245, v247, v246, v248, v258, v260; - } do { - ^block38(v261: i32, v262: i32, v263: i32, v264: i32, v265: i32, v266: i32): - scf.yield v261, v262, v263, v264; - }; - v272 = arith.constant 8 : u32; - v145 = hir.bitcast v255 : u32; - v147 = arith.add v145, v272 : u32 #[overflow = checked]; - v271 = arith.constant 4 : u32; - v149 = arith.mod v147, v271 : u32; - hir.assertz v149 #[code = 250]; - v150 = hir.int_to_ptr v147 : ptr; - v151 = hir.load v150 : i64; - v270 = arith.constant 8 : u32; - v152 = hir.bitcast v256 : u32; - v154 = arith.add v152, v270 : u32 #[overflow = checked]; - v269 = arith.constant 8 : u32; - v156 = arith.mod v154, v269 : u32; - hir.assertz v156 #[code = 250]; - v157 = hir.int_to_ptr v154 : ptr; - hir.store v157, v151; - v158 = hir.bitcast v255 : u32; - v268 = arith.constant 4 : u32; - v160 = arith.mod v158, v268 : u32; - hir.assertz v160 #[code = 250]; - v161 = hir.int_to_ptr v158 : ptr; - v162 = hir.load v161 : i64; - v163 = hir.bitcast v256 : u32; - v267 = arith.constant 8 : u32; - v165 = arith.mod v163, v267 : u32; - hir.assertz v165 #[code = 250]; - v166 = hir.int_to_ptr v163 : ptr; - hir.store v166, v162; - builtin.ret ; - }; - - private builtin.function @miden::tx::get_block_commitment(v167: i32) { - ^block23(v167: i32): - v168, v169, v170, v171 = hir.exec @miden/tx/get_block_commitment() : felt, felt, felt, felt - v172 = hir.bitcast v167 : u32; - v173 = hir.int_to_ptr v172 : ptr; - hir.store v173, v168; - v174 = arith.constant 4 : u32; - v175 = arith.add v172, v174 : u32 #[overflow = checked]; - v176 = hir.int_to_ptr v175 : ptr; - hir.store v176, v169; - v177 = arith.constant 8 : u32; - v178 = arith.add v172, v177 : u32 #[overflow = checked]; - v179 = hir.int_to_ptr v178 : ptr; - hir.store v179, v170; - v180 = arith.constant 12 : u32; - v181 = arith.add v172, v180 : u32 #[overflow = checked]; - v182 = hir.int_to_ptr v181 : ptr; - hir.store v182, v171; + private builtin.function @miden::protocol::tx::get_block_commitment(v86: i32) { + ^block17(v86: i32): + v87, v88, v89, v90 = hir.exec @miden/protocol/tx/get_block_commitment() : felt, felt, felt, felt + v91 = hir.bitcast v86 : u32; + v92 = hir.int_to_ptr v91 : ptr; + hir.store v92, v87; + v139 = arith.constant 4 : u32; + v94 = arith.add v91, v139 : u32 #[overflow = checked]; + v95 = hir.int_to_ptr v94 : ptr; + hir.store v95, v88; + v138 = arith.constant 8 : u32; + v97 = arith.add v91, v138 : u32 #[overflow = checked]; + v98 = hir.int_to_ptr v97 : ptr; + hir.store v98, v89; + v137 = arith.constant 12 : u32; + v100 = arith.add v91, v137 : u32 #[overflow = checked]; + v101 = hir.int_to_ptr v100 : ptr; + hir.store v101, v90; builtin.ret ; }; @@ -275,9 +160,9 @@ builtin.component miden:base/transaction-script@1.0.0 { builtin.segment @1048576 = 0x0000000100000001; }; - public builtin.function @run(v183: felt, v184: felt, v185: felt, v186: felt) { - ^block27(v183: felt, v184: felt, v185: felt, v186: felt): - hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/miden:base/transaction-script@1.0.0#run(v183, v184, v185, v186) + public builtin.function @run(v102: felt, v103: felt, v104: felt, v105: felt) { + ^block22(v102: felt, v103: felt, v104: felt, v105: felt): + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/miden:base/transaction-script@1.0.0#run(v102, v103, v104, v105) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.masm index c26d9cf25..ac0010102 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.masm @@ -1,14 +1,14 @@ -# mod miden:base/transaction-script@1.0.0 +# mod ::"miden:base/transaction-script@1.0.0" @callconv("canon-lift") pub proc run(felt, felt, felt, felt) - exec.::miden:base/transaction-script@1.0.0::init + exec."miden:base/transaction-script@1.0.0"::init trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_commitment_binding::miden:base/transaction-script@1.0.0#run + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_block_commitment_binding::"miden:base/transaction-script@1.0.0#run" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -21,7 +21,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -32,7 +32,7 @@ proc init mem_store.278537 end -# mod miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_commitment_binding +# mod ::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_block_commitment_binding @callconv("C") proc __wasm_call_ctors( @@ -48,6 +48,7 @@ proc rust_sdk_account_tx_get_block_commitment_binding::bindings::__link_custom_s nop end +@locals("5") @callconv("C") proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) drop @@ -64,9 +65,16 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.4 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -76,13 +84,28 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) nop trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_commitment_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_block_commitment_binding::wit_bindgen::rt::run_ctors_once trace.252 nop - dup.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_block_commitment_binding::miden_base_sys::bindings::tx::get_block_commitment + trace.252 + nop + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_commitment_binding::miden_base_sys::bindings::tx::get_block_commitment + exec.::intrinsics::mem::load_sw trace.252 nop push.16 @@ -97,6 +120,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -138,9 +162,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_commitment_binding::__wasm_call_ctors + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_block_commitment_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -171,147 +211,75 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("2") @callconv("C") proc miden_base_sys::bindings::tx::get_block_commitment( i32 ) - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::store_sw trace.252 nop - push.32 - u32wrapping_sub push.1114144 - dup.1 - swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop + push.16 + u32wrapping_sub dup.0 - trace.240 - nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_commitment_binding::miden::tx::get_block_commitment - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.24 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop - dup.0 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.1114144 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 swap.1 - push.16 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - dup.1 - u32wrapping_add - movup.2 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_commitment_binding::::reverse + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_block_commitment_binding::"miden::protocol::tx::get_block_commitment" trace.252 nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop -end - -@callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert push.8 dup.1 swap.1 @@ -327,15 +295,17 @@ proc ::reverse( nop swap.1 push.8 - dup.3 + movup.3 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -345,167 +315,27 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.1 + push.0 swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop push.8 - dup.1 + swap.1 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod @@ -519,16 +349,15 @@ proc ::reverse( trace.252 nop swap.1 - push.8 - dup.4 - add - u32assert + movup.2 push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -538,43 +367,31 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop - swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.16 + u32wrapping_add + push.1114144 u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop end @callconv("C") -proc miden::tx::get_block_commitment(i32) +proc miden::protocol::tx::get_block_commitment(i32) trace.240 nop - exec.::miden::tx::get_block_commitment + exec.::miden::protocol::tx::get_block_commitment trace.252 nop movup.4 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.wat index 8ff0e6246..1007e1f72 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.wat @@ -13,7 +13,6 @@ (type (;0;) (func)) (type (;1;) (func (param f32 f32 f32 f32))) (type (;2;) (func (param i32))) - (type (;3;) (func (param i32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -59,89 +58,30 @@ (func $miden_base_sys::bindings::tx::get_block_commitment (;4;) (type 2) (param i32) (local i32) global.get $__stack_pointer - i32.const 32 + i32.const 16 i32.sub local.tee 1 global.set $__stack_pointer local.get 1 - call $miden::tx::get_block_commitment - local.get 1 - local.get 1 - i64.load offset=8 - i64.store offset=24 - local.get 1 + call $miden::protocol::tx::get_block_commitment + local.get 0 local.get 1 i64.load - i64.store offset=16 + i64.const 32 + i64.rotl + i64.store offset=8 local.get 0 local.get 1 - i32.const 16 - i32.add - call $::reverse - local.get 1 - i32.const 32 - i32.add - global.set $__stack_pointer - ) - (func $::reverse (;5;) (type 3) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 + i64.const 32 + i64.rotl + i64.store local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 + i32.const 16 i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store + global.set $__stack_pointer ) - (func $miden::tx::get_block_commitment (;6;) (type 2) (param i32) + (func $miden::protocol::tx::get_block_commitment (;5;) (type 2) (param i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.hir index 039af3aaa..94d745b58 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.hir @@ -19,33 +19,35 @@ builtin.component miden:base/transaction-script@1.0.0 { private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v6 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_number_binding/GOT.data.internal.__memory_base : ptr - v7 = hir.bitcast v6 : ptr; - v8 = hir.load v7 : i32; - v9 = arith.constant 1048584 : i32; - v10 = arith.add v8, v9 : i32 #[overflow = wrapping]; - v11 = hir.bitcast v10 : u32; - v12 = hir.int_to_ptr v11 : ptr; - v13 = hir.load v12 : u8; - v5 = arith.constant 0 : i32; - v14 = arith.zext v13 : u32; - v15 = hir.bitcast v14 : i32; - v17 = arith.neq v15, v5 : i1; - scf.if v17{ + v5 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_number_binding/GOT.data.internal.__memory_base : ptr + v6 = hir.bitcast v5 : ptr; + v7 = hir.load v6 : i32; + v40 = arith.constant 1048584 : i32; + v9 = arith.add v7, v40 : i32 #[overflow = wrapping]; + v10 = hir.bitcast v9 : u32; + v11 = hir.int_to_ptr v10 : ptr; + v12 = hir.load v11 : u8; + v39 = arith.constant 0 : i32; + v13 = arith.zext v12 : u32; + v14 = hir.bitcast v13 : i32; + v16 = arith.neq v14, v39 : i1; + scf.if v16{ ^block13: scf.yield ; } else { ^block14: - v18 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_number_binding/GOT.data.internal.__memory_base : ptr - v19 = hir.bitcast v18 : ptr; - v20 = hir.load v19 : i32; + v17 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_number_binding/GOT.data.internal.__memory_base : ptr + v18 = hir.bitcast v17 : ptr; + v19 = hir.load v18 : i32; + hir.store_local v19 #[local = lv0]; hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_number_binding/__wasm_call_ctors() - v37 = arith.constant 1 : u8; - v39 = arith.constant 1048584 : i32; - v22 = arith.add v20, v39 : i32 #[overflow = wrapping]; + v20 = hir.load_local : i32 #[local = lv0]; + v38 = arith.constant 1 : u8; + v43 = arith.constant 1048584 : i32; + v22 = arith.add v20, v43 : i32 #[overflow = wrapping]; v26 = hir.bitcast v22 : u32; v27 = hir.int_to_ptr v26 : ptr; - hir.store v27, v37; + hir.store v27, v38; scf.yield ; }; builtin.ret ; @@ -53,13 +55,13 @@ builtin.component miden:base/transaction-script@1.0.0 { private builtin.function @miden_base_sys::bindings::tx::get_block_number() -> felt { ^block15: - v29 = hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_number_binding/miden::tx::get_block_number() : felt + v29 = hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_number_binding/miden::protocol::tx::get_block_number() : felt builtin.ret v29; }; - private builtin.function @miden::tx::get_block_number() -> felt { + private builtin.function @miden::protocol::tx::get_block_number() -> felt { ^block17: - v30 = hir.exec @miden/tx/get_block_number() : felt + v30 = hir.exec @miden/protocol/tx/get_block_number() : felt builtin.ret v30; }; @@ -75,7 +77,7 @@ builtin.component miden:base/transaction-script@1.0.0 { }; public builtin.function @run(v32: felt, v33: felt, v34: felt, v35: felt) { - ^block21(v32: felt, v33: felt, v34: felt, v35: felt): + ^block22(v32: felt, v33: felt, v34: felt, v35: felt): hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_number_binding/miden:base/transaction-script@1.0.0#run(v32, v33, v34, v35) builtin.ret ; }; diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.masm index 31e2bba78..8e50e46d9 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.masm @@ -1,14 +1,14 @@ -# mod miden:base/transaction-script@1.0.0 +# mod ::"miden:base/transaction-script@1.0.0" @callconv("canon-lift") pub proc run(felt, felt, felt, felt) - exec.::miden:base/transaction-script@1.0.0::init + exec."miden:base/transaction-script@1.0.0"::init trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_number_binding::miden:base/transaction-script@1.0.0#run + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_block_number_binding::"miden:base/transaction-script@1.0.0#run" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -21,7 +21,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -32,7 +32,7 @@ proc init mem_store.278537 end -# mod miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_number_binding +# mod ::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_block_number_binding @callconv("C") proc __wasm_call_ctors( @@ -48,6 +48,7 @@ proc rust_sdk_account_tx_get_block_number_binding::bindings::__link_custom_secti nop end +@locals("4") @callconv("C") proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) drop @@ -56,17 +57,18 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) drop trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_number_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_block_number_binding::wit_bindgen::rt::run_ctors_once trace.252 nop trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_number_binding::miden_base_sys::bindings::tx::get_block_number + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_block_number_binding::miden_base_sys::bindings::tx::get_block_number trace.252 nop drop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -108,9 +110,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_number_binding::__wasm_call_ctors + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_block_number_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -147,18 +165,18 @@ proc miden_base_sys::bindings::tx::get_block_number( ) -> felt trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_number_binding::miden::tx::get_block_number + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_block_number_binding::"miden::protocol::tx::get_block_number" trace.252 nop end @callconv("C") -proc miden::tx::get_block_number( +proc miden::protocol::tx::get_block_number( ) -> felt trace.240 nop - exec.::miden::tx::get_block_number + exec.::miden::protocol::tx::get_block_number trace.252 nop end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.wat index 434eebee1..0b82801cf 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.wat @@ -46,9 +46,9 @@ end ) (func $miden_base_sys::bindings::tx::get_block_number (;4;) (type 2) (result f32) - call $miden::tx::get_block_number + call $miden::protocol::tx::get_block_number ) - (func $miden::tx::get_block_number (;5;) (type 2) (result f32) + (func $miden::protocol::tx::get_block_number (;5;) (type 2) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.hir index f3bd546d6..02b3f87d3 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.hir @@ -19,33 +19,35 @@ builtin.component miden:base/transaction-script@1.0.0 { private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v6 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_timestamp_binding/GOT.data.internal.__memory_base : ptr - v7 = hir.bitcast v6 : ptr; - v8 = hir.load v7 : i32; - v9 = arith.constant 1048584 : i32; - v10 = arith.add v8, v9 : i32 #[overflow = wrapping]; - v11 = hir.bitcast v10 : u32; - v12 = hir.int_to_ptr v11 : ptr; - v13 = hir.load v12 : u8; - v5 = arith.constant 0 : i32; - v14 = arith.zext v13 : u32; - v15 = hir.bitcast v14 : i32; - v17 = arith.neq v15, v5 : i1; - scf.if v17{ + v5 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_timestamp_binding/GOT.data.internal.__memory_base : ptr + v6 = hir.bitcast v5 : ptr; + v7 = hir.load v6 : i32; + v40 = arith.constant 1048584 : i32; + v9 = arith.add v7, v40 : i32 #[overflow = wrapping]; + v10 = hir.bitcast v9 : u32; + v11 = hir.int_to_ptr v10 : ptr; + v12 = hir.load v11 : u8; + v39 = arith.constant 0 : i32; + v13 = arith.zext v12 : u32; + v14 = hir.bitcast v13 : i32; + v16 = arith.neq v14, v39 : i1; + scf.if v16{ ^block13: scf.yield ; } else { ^block14: - v18 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_timestamp_binding/GOT.data.internal.__memory_base : ptr - v19 = hir.bitcast v18 : ptr; - v20 = hir.load v19 : i32; + v17 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_timestamp_binding/GOT.data.internal.__memory_base : ptr + v18 = hir.bitcast v17 : ptr; + v19 = hir.load v18 : i32; + hir.store_local v19 #[local = lv0]; hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_timestamp_binding/__wasm_call_ctors() - v37 = arith.constant 1 : u8; - v39 = arith.constant 1048584 : i32; - v22 = arith.add v20, v39 : i32 #[overflow = wrapping]; + v20 = hir.load_local : i32 #[local = lv0]; + v38 = arith.constant 1 : u8; + v43 = arith.constant 1048584 : i32; + v22 = arith.add v20, v43 : i32 #[overflow = wrapping]; v26 = hir.bitcast v22 : u32; v27 = hir.int_to_ptr v26 : ptr; - hir.store v27, v37; + hir.store v27, v38; scf.yield ; }; builtin.ret ; @@ -53,13 +55,13 @@ builtin.component miden:base/transaction-script@1.0.0 { private builtin.function @miden_base_sys::bindings::tx::get_block_timestamp() -> felt { ^block15: - v29 = hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_timestamp_binding/miden::tx::get_block_timestamp() : felt + v29 = hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_timestamp_binding/miden::protocol::tx::get_block_timestamp() : felt builtin.ret v29; }; - private builtin.function @miden::tx::get_block_timestamp() -> felt { + private builtin.function @miden::protocol::tx::get_block_timestamp() -> felt { ^block17: - v30 = hir.exec @miden/tx/get_block_timestamp() : felt + v30 = hir.exec @miden/protocol/tx/get_block_timestamp() : felt builtin.ret v30; }; @@ -75,7 +77,7 @@ builtin.component miden:base/transaction-script@1.0.0 { }; public builtin.function @run(v32: felt, v33: felt, v34: felt, v35: felt) { - ^block21(v32: felt, v33: felt, v34: felt, v35: felt): + ^block22(v32: felt, v33: felt, v34: felt, v35: felt): hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_timestamp_binding/miden:base/transaction-script@1.0.0#run(v32, v33, v34, v35) builtin.ret ; }; diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.masm index 8a6ca578f..38ffabd1c 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.masm @@ -1,14 +1,14 @@ -# mod miden:base/transaction-script@1.0.0 +# mod ::"miden:base/transaction-script@1.0.0" @callconv("canon-lift") pub proc run(felt, felt, felt, felt) - exec.::miden:base/transaction-script@1.0.0::init + exec."miden:base/transaction-script@1.0.0"::init trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_timestamp_binding::miden:base/transaction-script@1.0.0#run + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_block_timestamp_binding::"miden:base/transaction-script@1.0.0#run" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -21,7 +21,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -32,7 +32,7 @@ proc init mem_store.278537 end -# mod miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_timestamp_binding +# mod ::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_block_timestamp_binding @callconv("C") proc __wasm_call_ctors( @@ -48,6 +48,7 @@ proc rust_sdk_account_tx_get_block_timestamp_binding::bindings::__link_custom_se nop end +@locals("4") @callconv("C") proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) drop @@ -56,17 +57,18 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) drop trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_timestamp_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_block_timestamp_binding::wit_bindgen::rt::run_ctors_once trace.252 nop trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_timestamp_binding::miden_base_sys::bindings::tx::get_block_timestamp + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_block_timestamp_binding::miden_base_sys::bindings::tx::get_block_timestamp trace.252 nop drop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -108,9 +110,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_timestamp_binding::__wasm_call_ctors + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_block_timestamp_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -147,18 +165,18 @@ proc miden_base_sys::bindings::tx::get_block_timestamp( ) -> felt trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_timestamp_binding::miden::tx::get_block_timestamp + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_block_timestamp_binding::"miden::protocol::tx::get_block_timestamp" trace.252 nop end @callconv("C") -proc miden::tx::get_block_timestamp( +proc miden::protocol::tx::get_block_timestamp( ) -> felt trace.240 nop - exec.::miden::tx::get_block_timestamp + exec.::miden::protocol::tx::get_block_timestamp trace.252 nop end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.wat index 5a516a14c..d4064577a 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.wat @@ -46,9 +46,9 @@ end ) (func $miden_base_sys::bindings::tx::get_block_timestamp (;4;) (type 2) (result f32) - call $miden::tx::get_block_timestamp + call $miden::protocol::tx::get_block_timestamp ) - (func $miden::tx::get_block_timestamp (;5;) (type 2) (result f32) + (func $miden::protocol::tx::get_block_timestamp (;5;) (type 2) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.hir index ea8af3c25..a38864e60 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.hir @@ -19,33 +19,35 @@ builtin.component miden:base/transaction-script@1.0.0 { private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v6 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_expiration_block_delta_binding/GOT.data.internal.__memory_base : ptr - v7 = hir.bitcast v6 : ptr; - v8 = hir.load v7 : i32; - v9 = arith.constant 1048584 : i32; - v10 = arith.add v8, v9 : i32 #[overflow = wrapping]; - v11 = hir.bitcast v10 : u32; - v12 = hir.int_to_ptr v11 : ptr; - v13 = hir.load v12 : u8; - v5 = arith.constant 0 : i32; - v14 = arith.zext v13 : u32; - v15 = hir.bitcast v14 : i32; - v17 = arith.neq v15, v5 : i1; - scf.if v17{ + v5 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_expiration_block_delta_binding/GOT.data.internal.__memory_base : ptr + v6 = hir.bitcast v5 : ptr; + v7 = hir.load v6 : i32; + v40 = arith.constant 1048584 : i32; + v9 = arith.add v7, v40 : i32 #[overflow = wrapping]; + v10 = hir.bitcast v9 : u32; + v11 = hir.int_to_ptr v10 : ptr; + v12 = hir.load v11 : u8; + v39 = arith.constant 0 : i32; + v13 = arith.zext v12 : u32; + v14 = hir.bitcast v13 : i32; + v16 = arith.neq v14, v39 : i1; + scf.if v16{ ^block13: scf.yield ; } else { ^block14: - v18 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_expiration_block_delta_binding/GOT.data.internal.__memory_base : ptr - v19 = hir.bitcast v18 : ptr; - v20 = hir.load v19 : i32; + v17 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_expiration_block_delta_binding/GOT.data.internal.__memory_base : ptr + v18 = hir.bitcast v17 : ptr; + v19 = hir.load v18 : i32; + hir.store_local v19 #[local = lv0]; hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_expiration_block_delta_binding/__wasm_call_ctors() - v37 = arith.constant 1 : u8; - v39 = arith.constant 1048584 : i32; - v22 = arith.add v20, v39 : i32 #[overflow = wrapping]; + v20 = hir.load_local : i32 #[local = lv0]; + v38 = arith.constant 1 : u8; + v43 = arith.constant 1048584 : i32; + v22 = arith.add v20, v43 : i32 #[overflow = wrapping]; v26 = hir.bitcast v22 : u32; v27 = hir.int_to_ptr v26 : ptr; - hir.store v27, v37; + hir.store v27, v38; scf.yield ; }; builtin.ret ; @@ -53,13 +55,13 @@ builtin.component miden:base/transaction-script@1.0.0 { private builtin.function @miden_base_sys::bindings::tx::get_expiration_block_delta() -> felt { ^block15: - v29 = hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_expiration_block_delta_binding/miden::tx::get_expiration_block_delta() : felt + v29 = hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_expiration_block_delta_binding/miden::protocol::tx::get_expiration_block_delta() : felt builtin.ret v29; }; - private builtin.function @miden::tx::get_expiration_block_delta() -> felt { + private builtin.function @miden::protocol::tx::get_expiration_block_delta() -> felt { ^block17: - v30 = hir.exec @miden/tx/get_expiration_block_delta() : felt + v30 = hir.exec @miden/protocol/tx/get_expiration_block_delta() : felt builtin.ret v30; }; @@ -75,7 +77,7 @@ builtin.component miden:base/transaction-script@1.0.0 { }; public builtin.function @run(v32: felt, v33: felt, v34: felt, v35: felt) { - ^block21(v32: felt, v33: felt, v34: felt, v35: felt): + ^block22(v32: felt, v33: felt, v34: felt, v35: felt): hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_expiration_block_delta_binding/miden:base/transaction-script@1.0.0#run(v32, v33, v34, v35) builtin.ret ; }; diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.masm index f3adcf86d..486e33873 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.masm @@ -1,14 +1,14 @@ -# mod miden:base/transaction-script@1.0.0 +# mod ::"miden:base/transaction-script@1.0.0" @callconv("canon-lift") pub proc run(felt, felt, felt, felt) - exec.::miden:base/transaction-script@1.0.0::init + exec."miden:base/transaction-script@1.0.0"::init trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_expiration_block_delta_binding::miden:base/transaction-script@1.0.0#run + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_expiration_block_delta_binding::"miden:base/transaction-script@1.0.0#run" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -21,7 +21,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -32,7 +32,7 @@ proc init mem_store.278537 end -# mod miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_expiration_block_delta_binding +# mod ::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_expiration_block_delta_binding @callconv("C") proc __wasm_call_ctors( @@ -48,6 +48,7 @@ proc rust_sdk_account_tx_get_expiration_block_delta_binding::bindings::__link_cu nop end +@locals("4") @callconv("C") proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) drop @@ -56,17 +57,18 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) drop trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_expiration_block_delta_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_expiration_block_delta_binding::wit_bindgen::rt::run_ctors_once trace.252 nop trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_expiration_block_delta_binding::miden_base_sys::bindings::tx::get_expiration_block_delta + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_expiration_block_delta_binding::miden_base_sys::bindings::tx::get_expiration_block_delta trace.252 nop drop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -108,9 +110,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_expiration_block_delta_binding::__wasm_call_ctors + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_expiration_block_delta_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -147,18 +165,18 @@ proc miden_base_sys::bindings::tx::get_expiration_block_delta( ) -> felt trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_expiration_block_delta_binding::miden::tx::get_expiration_block_delta + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_expiration_block_delta_binding::"miden::protocol::tx::get_expiration_block_delta" trace.252 nop end @callconv("C") -proc miden::tx::get_expiration_block_delta( +proc miden::protocol::tx::get_expiration_block_delta( ) -> felt trace.240 nop - exec.::miden::tx::get_expiration_block_delta + exec.::miden::protocol::tx::get_expiration_block_delta trace.252 nop end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.wat index 583e87c04..da95ee1c5 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.wat @@ -46,9 +46,9 @@ end ) (func $miden_base_sys::bindings::tx::get_expiration_block_delta (;4;) (type 2) (result f32) - call $miden::tx::get_expiration_block_delta + call $miden::protocol::tx::get_expiration_block_delta ) - (func $miden::tx::get_expiration_block_delta (;5;) (type 2) (result f32) + (func $miden::protocol::tx::get_expiration_block_delta (;5;) (type 2) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.hir index ea14cf714..3c3dd6778 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.hir @@ -12,21 +12,24 @@ builtin.component miden:base/transaction-script@1.0.0 { private builtin.function @miden:base/transaction-script@1.0.0#run(v0: felt, v1: felt, v2: felt, v3: felt) { ^block9(v0: felt, v1: felt, v2: felt, v3: felt): - v5 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/__stack_pointer : ptr - v6 = hir.bitcast v5 : ptr; - v7 = hir.load v6 : i32; - v8 = arith.constant 16 : i32; - v9 = arith.sub v7, v8 : i32 #[overflow = wrapping]; - v10 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/__stack_pointer : ptr - v11 = hir.bitcast v10 : ptr; - hir.store v11, v9; + v4 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/__stack_pointer : ptr + v5 = hir.bitcast v4 : ptr; + v6 = hir.load v5 : i32; + v106 = arith.constant 16 : i32; + v8 = arith.sub v6, v106 : i32 #[overflow = wrapping]; + hir.store_local v8 #[local = lv4]; + v9 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/__stack_pointer : ptr + v10 = hir.bitcast v9 : ptr; + hir.store v10, v8; hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/wit_bindgen::rt::run_ctors_once() - hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/miden_base_sys::bindings::tx::get_input_notes_commitment(v9) - v187 = arith.constant 16 : i32; - v13 = arith.add v9, v187 : i32 #[overflow = wrapping]; - v14 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/__stack_pointer : ptr - v15 = hir.bitcast v14 : ptr; - hir.store v15, v13; + v11 = hir.load_local : i32 #[local = lv4]; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/miden_base_sys::bindings::tx::get_input_notes_commitment(v11) + v12 = hir.load_local : i32 #[local = lv4]; + v108 = arith.constant 16 : i32; + v14 = arith.add v12, v108 : i32 #[overflow = wrapping]; + v15 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/__stack_pointer : ptr + v16 = hir.bitcast v15 : ptr; + hir.store v16, v14; builtin.ret ; }; @@ -35,15 +38,15 @@ builtin.component miden:base/transaction-script@1.0.0 { v17 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/GOT.data.internal.__memory_base : ptr v18 = hir.bitcast v17 : ptr; v19 = hir.load v18 : i32; - v20 = arith.constant 1048584 : i32; - v21 = arith.add v19, v20 : i32 #[overflow = wrapping]; + v113 = arith.constant 1048584 : i32; + v21 = arith.add v19, v113 : i32 #[overflow = wrapping]; v22 = hir.bitcast v21 : u32; v23 = hir.int_to_ptr v22 : ptr; v24 = hir.load v23 : u8; - v16 = arith.constant 0 : i32; + v112 = arith.constant 0 : i32; v25 = arith.zext v24 : u32; v26 = hir.bitcast v25 : i32; - v28 = arith.neq v26, v16 : i1; + v28 = arith.neq v26, v112 : i1; scf.if v28{ ^block13: scf.yield ; @@ -52,215 +55,97 @@ builtin.component miden:base/transaction-script@1.0.0 { v29 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/GOT.data.internal.__memory_base : ptr v30 = hir.bitcast v29 : ptr; v31 = hir.load v30 : i32; + hir.store_local v31 #[local = lv0]; hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/__wasm_call_ctors() - v189 = arith.constant 1 : u8; - v191 = arith.constant 1048584 : i32; - v33 = arith.add v31, v191 : i32 #[overflow = wrapping]; - v37 = hir.bitcast v33 : u32; - v38 = hir.int_to_ptr v37 : ptr; - hir.store v38, v189; + v32 = hir.load_local : i32 #[local = lv0]; + v111 = arith.constant 1 : u8; + v116 = arith.constant 1048584 : i32; + v34 = arith.add v32, v116 : i32 #[overflow = wrapping]; + v38 = hir.bitcast v34 : u32; + v39 = hir.int_to_ptr v38 : ptr; + hir.store v39, v111; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::tx::get_input_notes_commitment(v39: i32) { - ^block15(v39: i32): + private builtin.function @miden_base_sys::bindings::tx::get_input_notes_commitment(v40: i32) { + ^block15(v40: i32): + hir.store_local v40 #[local = lv0]; v41 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/__stack_pointer : ptr v42 = hir.bitcast v41 : ptr; v43 = hir.load v42 : i32; - v44 = arith.constant 32 : i32; - v45 = arith.sub v43, v44 : i32 #[overflow = wrapping]; + v124 = arith.constant 16 : i32; + v45 = arith.sub v43, v124 : i32 #[overflow = wrapping]; + hir.store_local v45 #[local = lv1]; v46 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/__stack_pointer : ptr v47 = hir.bitcast v46 : ptr; hir.store v47, v45; - hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/miden::tx::get_input_notes_commitment(v45) - v49 = arith.constant 8 : u32; - v48 = hir.bitcast v45 : u32; - v50 = arith.add v48, v49 : u32 #[overflow = checked]; - v196 = arith.constant 8 : u32; - v52 = arith.mod v50, v196 : u32; - hir.assertz v52 #[code = 250]; - v53 = hir.int_to_ptr v50 : ptr; - v54 = hir.load v53 : i64; - v56 = arith.constant 24 : u32; - v55 = hir.bitcast v45 : u32; - v57 = arith.add v55, v56 : u32 #[overflow = checked]; - v195 = arith.constant 8 : u32; - v59 = arith.mod v57, v195 : u32; - hir.assertz v59 #[code = 250]; - v60 = hir.int_to_ptr v57 : ptr; - hir.store v60, v54; - v61 = hir.bitcast v45 : u32; - v194 = arith.constant 8 : u32; - v63 = arith.mod v61, v194 : u32; + v48 = hir.load_local : i32 #[local = lv1]; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/miden::protocol::tx::get_input_notes_commitment(v48) + v49 = hir.load_local : i32 #[local = lv0]; + v50 = hir.load_local : i32 #[local = lv1]; + v51 = hir.bitcast v50 : u32; + v123 = arith.constant 8 : u32; + v53 = arith.mod v51, v123 : u32; + hir.assertz v53 #[code = 250]; + v54 = hir.int_to_ptr v51 : ptr; + v55 = hir.load v54 : i64; + v120, v121 = arith.split v55 : felt, felt; + v136 = arith.constant 8 : u32; + v59 = hir.bitcast v49 : u32; + v61 = arith.add v59, v136 : u32 #[overflow = checked]; + v135 = arith.constant 8 : u32; + v63 = arith.mod v61, v135 : u32; hir.assertz v63 #[code = 250]; + v122 = arith.join v121, v120 : i64; v64 = hir.int_to_ptr v61 : ptr; - v65 = hir.load v64 : i64; - v67 = arith.constant 16 : u32; - v66 = hir.bitcast v45 : u32; - v68 = arith.add v66, v67 : u32 #[overflow = checked]; - v193 = arith.constant 8 : u32; - v70 = arith.mod v68, v193 : u32; - hir.assertz v70 #[code = 250]; - v71 = hir.int_to_ptr v68 : ptr; - hir.store v71, v65; - v72 = arith.constant 16 : i32; - v73 = arith.add v45, v72 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/::reverse(v39, v73) - v192 = arith.constant 32 : i32; - v75 = arith.add v45, v192 : i32 #[overflow = wrapping]; - v76 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/__stack_pointer : ptr - v77 = hir.bitcast v76 : ptr; - hir.store v77, v75; + hir.store v64, v122; + v65 = hir.load_local : i32 #[local = lv0]; + v66 = hir.load_local : i32 #[local = lv1]; + v134 = arith.constant 8 : u32; + v67 = hir.bitcast v66 : u32; + v69 = arith.add v67, v134 : u32 #[overflow = checked]; + v133 = arith.constant 8 : u32; + v71 = arith.mod v69, v133 : u32; + hir.assertz v71 #[code = 250]; + v72 = hir.int_to_ptr v69 : ptr; + v73 = hir.load v72 : i64; + v117, v118 = arith.split v73 : felt, felt; + v77 = hir.bitcast v65 : u32; + v132 = arith.constant 8 : u32; + v79 = arith.mod v77, v132 : u32; + hir.assertz v79 #[code = 250]; + v119 = arith.join v118, v117 : i64; + v80 = hir.int_to_ptr v77 : ptr; + hir.store v80, v119; + v81 = hir.load_local : i32 #[local = lv1]; + v131 = arith.constant 16 : i32; + v83 = arith.add v81, v131 : i32 #[overflow = wrapping]; + v84 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/__stack_pointer : ptr + v85 = hir.bitcast v84 : ptr; + hir.store v85, v83; builtin.ret ; }; - private builtin.function @::reverse(v78: i32, v79: i32) { - ^block17(v78: i32, v79: i32): - v82 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/__stack_pointer : ptr - v83 = hir.bitcast v82 : ptr; - v84 = hir.load v83 : i32; - v85 = arith.constant 16 : i32; - v86 = arith.sub v84, v85 : i32 #[overflow = wrapping]; - v88 = arith.constant 8 : u32; - v87 = hir.bitcast v79 : u32; - v89 = arith.add v87, v88 : u32 #[overflow = checked]; - v283 = arith.constant 8 : u32; - v91 = arith.mod v89, v283 : u32; - hir.assertz v91 #[code = 250]; - v92 = hir.int_to_ptr v89 : ptr; - v93 = hir.load v92 : i64; - v282 = arith.constant 8 : u32; - v94 = hir.bitcast v86 : u32; - v96 = arith.add v94, v282 : u32 #[overflow = checked]; - v97 = arith.constant 4 : u32; - v98 = arith.mod v96, v97 : u32; - hir.assertz v98 #[code = 250]; - v99 = hir.int_to_ptr v96 : ptr; - hir.store v99, v93; - v100 = hir.bitcast v79 : u32; - v281 = arith.constant 8 : u32; - v102 = arith.mod v100, v281 : u32; - hir.assertz v102 #[code = 250]; - v103 = hir.int_to_ptr v100 : ptr; - v104 = hir.load v103 : i64; - v105 = hir.bitcast v86 : u32; - v280 = arith.constant 4 : u32; - v107 = arith.mod v105, v280 : u32; - hir.assertz v107 #[code = 250]; - v108 = hir.int_to_ptr v105 : ptr; - hir.store v108, v104; - v109 = arith.constant 12 : i32; - v110 = arith.add v86, v109 : i32 #[overflow = wrapping]; - v80 = arith.constant 0 : i32; - v251, v252, v253, v254, v255, v256 = scf.while v80, v86, v110, v78 : i32, i32, i32, i32, i32, i32 { - ^block37(v257: i32, v258: i32, v259: i32, v260: i32): - v279 = arith.constant 0 : i32; - v113 = arith.constant 8 : i32; - v114 = arith.eq v257, v113 : i1; - v115 = arith.zext v114 : u32; - v116 = hir.bitcast v115 : i32; - v118 = arith.neq v116, v279 : i1; - v245, v246 = scf.if v118 : i32, i32 { - ^block36: - v205 = ub.poison i32 : i32; - scf.yield v205, v205; - } else { - ^block22: - v120 = arith.add v258, v257 : i32 #[overflow = wrapping]; - v121 = hir.bitcast v120 : u32; - v278 = arith.constant 4 : u32; - v123 = arith.mod v121, v278 : u32; - hir.assertz v123 #[code = 250]; - v124 = hir.int_to_ptr v121 : ptr; - v125 = hir.load v124 : felt; - v127 = hir.bitcast v259 : u32; - v277 = arith.constant 4 : u32; - v129 = arith.mod v127, v277 : u32; - hir.assertz v129 #[code = 250]; - v130 = hir.int_to_ptr v127 : ptr; - v131 = hir.load v130 : i32; - v132 = hir.bitcast v120 : u32; - v276 = arith.constant 4 : u32; - v134 = arith.mod v132, v276 : u32; - hir.assertz v134 #[code = 250]; - v135 = hir.int_to_ptr v132 : ptr; - hir.store v135, v131; - v136 = hir.bitcast v259 : u32; - v275 = arith.constant 4 : u32; - v138 = arith.mod v136, v275 : u32; - hir.assertz v138 #[code = 250]; - v139 = hir.int_to_ptr v136 : ptr; - hir.store v139, v125; - v142 = arith.constant -4 : i32; - v143 = arith.add v259, v142 : i32 #[overflow = wrapping]; - v140 = arith.constant 4 : i32; - v141 = arith.add v257, v140 : i32 #[overflow = wrapping]; - scf.yield v141, v143; - }; - v273 = ub.poison i32 : i32; - v248 = cf.select v118, v273, v260 : i32; - v274 = ub.poison i32 : i32; - v247 = cf.select v118, v274, v258 : i32; - v204 = arith.constant 1 : u32; - v197 = arith.constant 0 : u32; - v250 = cf.select v118, v197, v204 : u32; - v238 = arith.trunc v250 : i1; - scf.condition v238, v245, v247, v246, v248, v258, v260; - } do { - ^block38(v261: i32, v262: i32, v263: i32, v264: i32, v265: i32, v266: i32): - scf.yield v261, v262, v263, v264; - }; - v272 = arith.constant 8 : u32; - v145 = hir.bitcast v255 : u32; - v147 = arith.add v145, v272 : u32 #[overflow = checked]; - v271 = arith.constant 4 : u32; - v149 = arith.mod v147, v271 : u32; - hir.assertz v149 #[code = 250]; - v150 = hir.int_to_ptr v147 : ptr; - v151 = hir.load v150 : i64; - v270 = arith.constant 8 : u32; - v152 = hir.bitcast v256 : u32; - v154 = arith.add v152, v270 : u32 #[overflow = checked]; - v269 = arith.constant 8 : u32; - v156 = arith.mod v154, v269 : u32; - hir.assertz v156 #[code = 250]; - v157 = hir.int_to_ptr v154 : ptr; - hir.store v157, v151; - v158 = hir.bitcast v255 : u32; - v268 = arith.constant 4 : u32; - v160 = arith.mod v158, v268 : u32; - hir.assertz v160 #[code = 250]; - v161 = hir.int_to_ptr v158 : ptr; - v162 = hir.load v161 : i64; - v163 = hir.bitcast v256 : u32; - v267 = arith.constant 8 : u32; - v165 = arith.mod v163, v267 : u32; - hir.assertz v165 #[code = 250]; - v166 = hir.int_to_ptr v163 : ptr; - hir.store v166, v162; - builtin.ret ; - }; - - private builtin.function @miden::tx::get_input_notes_commitment(v167: i32) { - ^block23(v167: i32): - v168, v169, v170, v171 = hir.exec @miden/tx/get_input_notes_commitment() : felt, felt, felt, felt - v172 = hir.bitcast v167 : u32; - v173 = hir.int_to_ptr v172 : ptr; - hir.store v173, v168; - v174 = arith.constant 4 : u32; - v175 = arith.add v172, v174 : u32 #[overflow = checked]; - v176 = hir.int_to_ptr v175 : ptr; - hir.store v176, v169; - v177 = arith.constant 8 : u32; - v178 = arith.add v172, v177 : u32 #[overflow = checked]; - v179 = hir.int_to_ptr v178 : ptr; - hir.store v179, v170; - v180 = arith.constant 12 : u32; - v181 = arith.add v172, v180 : u32 #[overflow = checked]; - v182 = hir.int_to_ptr v181 : ptr; - hir.store v182, v171; + private builtin.function @miden::protocol::tx::get_input_notes_commitment(v86: i32) { + ^block17(v86: i32): + v87, v88, v89, v90 = hir.exec @miden/protocol/tx/get_input_notes_commitment() : felt, felt, felt, felt + v91 = hir.bitcast v86 : u32; + v92 = hir.int_to_ptr v91 : ptr; + hir.store v92, v87; + v139 = arith.constant 4 : u32; + v94 = arith.add v91, v139 : u32 #[overflow = checked]; + v95 = hir.int_to_ptr v94 : ptr; + hir.store v95, v88; + v138 = arith.constant 8 : u32; + v97 = arith.add v91, v138 : u32 #[overflow = checked]; + v98 = hir.int_to_ptr v97 : ptr; + hir.store v98, v89; + v137 = arith.constant 12 : u32; + v100 = arith.add v91, v137 : u32 #[overflow = checked]; + v101 = hir.int_to_ptr v100 : ptr; + hir.store v101, v90; builtin.ret ; }; @@ -275,9 +160,9 @@ builtin.component miden:base/transaction-script@1.0.0 { builtin.segment @1048576 = 0x0000000100000001; }; - public builtin.function @run(v183: felt, v184: felt, v185: felt, v186: felt) { - ^block27(v183: felt, v184: felt, v185: felt, v186: felt): - hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/miden:base/transaction-script@1.0.0#run(v183, v184, v185, v186) + public builtin.function @run(v102: felt, v103: felt, v104: felt, v105: felt) { + ^block22(v102: felt, v103: felt, v104: felt, v105: felt): + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/miden:base/transaction-script@1.0.0#run(v102, v103, v104, v105) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.masm index 5fd5a04ae..08eaf4b56 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.masm @@ -1,14 +1,14 @@ -# mod miden:base/transaction-script@1.0.0 +# mod ::"miden:base/transaction-script@1.0.0" @callconv("canon-lift") pub proc run(felt, felt, felt, felt) - exec.::miden:base/transaction-script@1.0.0::init + exec."miden:base/transaction-script@1.0.0"::init trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_input_notes_commitment_binding::miden:base/transaction-script@1.0.0#run + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_input_notes_commitment_binding::"miden:base/transaction-script@1.0.0#run" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -21,7 +21,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -32,7 +32,7 @@ proc init mem_store.278537 end -# mod miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_input_notes_commitment_binding +# mod ::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_input_notes_commitment_binding @callconv("C") proc __wasm_call_ctors( @@ -48,6 +48,7 @@ proc rust_sdk_account_tx_get_input_notes_commitment_binding::bindings::__link_cu nop end +@locals("5") @callconv("C") proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) drop @@ -64,9 +65,16 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.4 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -76,13 +84,28 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) nop trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_input_notes_commitment_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_input_notes_commitment_binding::wit_bindgen::rt::run_ctors_once trace.252 nop - dup.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_input_notes_commitment_binding::miden_base_sys::bindings::tx::get_input_notes_commitment + trace.252 + nop + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_input_notes_commitment_binding::miden_base_sys::bindings::tx::get_input_notes_commitment + exec.::intrinsics::mem::load_sw trace.252 nop push.16 @@ -97,6 +120,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -138,9 +162,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_input_notes_commitment_binding::__wasm_call_ctors + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_input_notes_commitment_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -171,147 +211,75 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("2") @callconv("C") proc miden_base_sys::bindings::tx::get_input_notes_commitment( i32 ) - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::store_sw trace.252 nop - push.32 - u32wrapping_sub push.1114144 - dup.1 - swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop + push.16 + u32wrapping_sub dup.0 - trace.240 - nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_input_notes_commitment_binding::miden::tx::get_input_notes_commitment - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.24 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop - dup.0 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.1114144 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 swap.1 - push.16 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - dup.1 - u32wrapping_add - movup.2 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_input_notes_commitment_binding::::reverse + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_input_notes_commitment_binding::"miden::protocol::tx::get_input_notes_commitment" trace.252 nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop -end - -@callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert push.8 dup.1 swap.1 @@ -327,15 +295,17 @@ proc ::reverse( nop swap.1 push.8 - dup.3 + movup.3 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -345,167 +315,27 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.1 + push.0 swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop push.8 - dup.1 + swap.1 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod @@ -519,16 +349,15 @@ proc ::reverse( trace.252 nop swap.1 - push.8 - dup.4 - add - u32assert + movup.2 push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -538,43 +367,31 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop - swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.16 + u32wrapping_add + push.1114144 u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop end @callconv("C") -proc miden::tx::get_input_notes_commitment(i32) +proc miden::protocol::tx::get_input_notes_commitment(i32) trace.240 nop - exec.::miden::tx::get_input_notes_commitment + exec.::miden::protocol::tx::get_input_notes_commitment trace.252 nop movup.4 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.wat index 827c2eba1..8ad054d0b 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.wat @@ -13,7 +13,6 @@ (type (;0;) (func)) (type (;1;) (func (param f32 f32 f32 f32))) (type (;2;) (func (param i32))) - (type (;3;) (func (param i32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -59,89 +58,30 @@ (func $miden_base_sys::bindings::tx::get_input_notes_commitment (;4;) (type 2) (param i32) (local i32) global.get $__stack_pointer - i32.const 32 + i32.const 16 i32.sub local.tee 1 global.set $__stack_pointer local.get 1 - call $miden::tx::get_input_notes_commitment - local.get 1 - local.get 1 - i64.load offset=8 - i64.store offset=24 - local.get 1 + call $miden::protocol::tx::get_input_notes_commitment + local.get 0 local.get 1 i64.load - i64.store offset=16 + i64.const 32 + i64.rotl + i64.store offset=8 local.get 0 local.get 1 - i32.const 16 - i32.add - call $::reverse - local.get 1 - i32.const 32 - i32.add - global.set $__stack_pointer - ) - (func $::reverse (;5;) (type 3) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 + i64.const 32 + i64.rotl + i64.store local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 + i32.const 16 i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store + global.set $__stack_pointer ) - (func $miden::tx::get_input_notes_commitment (;6;) (type 2) (param i32) + (func $miden::protocol::tx::get_input_notes_commitment (;5;) (type 2) (param i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.hir index 6c49a6ec8..8fa2f7e86 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.hir @@ -19,33 +19,35 @@ builtin.component miden:base/transaction-script@1.0.0 { private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v6 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_input_notes_binding/GOT.data.internal.__memory_base : ptr - v7 = hir.bitcast v6 : ptr; - v8 = hir.load v7 : i32; - v9 = arith.constant 1048584 : i32; - v10 = arith.add v8, v9 : i32 #[overflow = wrapping]; - v11 = hir.bitcast v10 : u32; - v12 = hir.int_to_ptr v11 : ptr; - v13 = hir.load v12 : u8; - v5 = arith.constant 0 : i32; - v14 = arith.zext v13 : u32; - v15 = hir.bitcast v14 : i32; - v17 = arith.neq v15, v5 : i1; - scf.if v17{ + v5 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_input_notes_binding/GOT.data.internal.__memory_base : ptr + v6 = hir.bitcast v5 : ptr; + v7 = hir.load v6 : i32; + v40 = arith.constant 1048584 : i32; + v9 = arith.add v7, v40 : i32 #[overflow = wrapping]; + v10 = hir.bitcast v9 : u32; + v11 = hir.int_to_ptr v10 : ptr; + v12 = hir.load v11 : u8; + v39 = arith.constant 0 : i32; + v13 = arith.zext v12 : u32; + v14 = hir.bitcast v13 : i32; + v16 = arith.neq v14, v39 : i1; + scf.if v16{ ^block13: scf.yield ; } else { ^block14: - v18 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_input_notes_binding/GOT.data.internal.__memory_base : ptr - v19 = hir.bitcast v18 : ptr; - v20 = hir.load v19 : i32; + v17 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_input_notes_binding/GOT.data.internal.__memory_base : ptr + v18 = hir.bitcast v17 : ptr; + v19 = hir.load v18 : i32; + hir.store_local v19 #[local = lv0]; hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_input_notes_binding/__wasm_call_ctors() - v37 = arith.constant 1 : u8; - v39 = arith.constant 1048584 : i32; - v22 = arith.add v20, v39 : i32 #[overflow = wrapping]; + v20 = hir.load_local : i32 #[local = lv0]; + v38 = arith.constant 1 : u8; + v43 = arith.constant 1048584 : i32; + v22 = arith.add v20, v43 : i32 #[overflow = wrapping]; v26 = hir.bitcast v22 : u32; v27 = hir.int_to_ptr v26 : ptr; - hir.store v27, v37; + hir.store v27, v38; scf.yield ; }; builtin.ret ; @@ -53,13 +55,13 @@ builtin.component miden:base/transaction-script@1.0.0 { private builtin.function @miden_base_sys::bindings::tx::get_num_input_notes() -> felt { ^block15: - v29 = hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_input_notes_binding/miden::tx::get_num_input_notes() : felt + v29 = hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_input_notes_binding/miden::protocol::tx::get_num_input_notes() : felt builtin.ret v29; }; - private builtin.function @miden::tx::get_num_input_notes() -> felt { + private builtin.function @miden::protocol::tx::get_num_input_notes() -> felt { ^block17: - v30 = hir.exec @miden/tx/get_num_input_notes() : felt + v30 = hir.exec @miden/protocol/tx/get_num_input_notes() : felt builtin.ret v30; }; @@ -75,7 +77,7 @@ builtin.component miden:base/transaction-script@1.0.0 { }; public builtin.function @run(v32: felt, v33: felt, v34: felt, v35: felt) { - ^block21(v32: felt, v33: felt, v34: felt, v35: felt): + ^block22(v32: felt, v33: felt, v34: felt, v35: felt): hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_input_notes_binding/miden:base/transaction-script@1.0.0#run(v32, v33, v34, v35) builtin.ret ; }; diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.masm index 60c8227e3..29e86496c 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.masm @@ -1,14 +1,14 @@ -# mod miden:base/transaction-script@1.0.0 +# mod ::"miden:base/transaction-script@1.0.0" @callconv("canon-lift") pub proc run(felt, felt, felt, felt) - exec.::miden:base/transaction-script@1.0.0::init + exec."miden:base/transaction-script@1.0.0"::init trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_num_input_notes_binding::miden:base/transaction-script@1.0.0#run + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_num_input_notes_binding::"miden:base/transaction-script@1.0.0#run" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -21,7 +21,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -32,7 +32,7 @@ proc init mem_store.278537 end -# mod miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_num_input_notes_binding +# mod ::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_num_input_notes_binding @callconv("C") proc __wasm_call_ctors( @@ -48,6 +48,7 @@ proc rust_sdk_account_tx_get_num_input_notes_binding::bindings::__link_custom_se nop end +@locals("4") @callconv("C") proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) drop @@ -56,17 +57,18 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) drop trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_num_input_notes_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_num_input_notes_binding::wit_bindgen::rt::run_ctors_once trace.252 nop trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_num_input_notes_binding::miden_base_sys::bindings::tx::get_num_input_notes + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_num_input_notes_binding::miden_base_sys::bindings::tx::get_num_input_notes trace.252 nop drop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -108,9 +110,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_num_input_notes_binding::__wasm_call_ctors + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_num_input_notes_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -147,18 +165,18 @@ proc miden_base_sys::bindings::tx::get_num_input_notes( ) -> felt trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_num_input_notes_binding::miden::tx::get_num_input_notes + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_num_input_notes_binding::"miden::protocol::tx::get_num_input_notes" trace.252 nop end @callconv("C") -proc miden::tx::get_num_input_notes( +proc miden::protocol::tx::get_num_input_notes( ) -> felt trace.240 nop - exec.::miden::tx::get_num_input_notes + exec.::miden::protocol::tx::get_num_input_notes trace.252 nop end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.wat index 51490aa8a..d76280bfc 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.wat @@ -46,9 +46,9 @@ end ) (func $miden_base_sys::bindings::tx::get_num_input_notes (;4;) (type 2) (result f32) - call $miden::tx::get_num_input_notes + call $miden::protocol::tx::get_num_input_notes ) - (func $miden::tx::get_num_input_notes (;5;) (type 2) (result f32) + (func $miden::protocol::tx::get_num_input_notes (;5;) (type 2) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.hir index 703ce084f..805915e35 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.hir @@ -19,33 +19,35 @@ builtin.component miden:base/transaction-script@1.0.0 { private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v6 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_output_notes_binding/GOT.data.internal.__memory_base : ptr - v7 = hir.bitcast v6 : ptr; - v8 = hir.load v7 : i32; - v9 = arith.constant 1048584 : i32; - v10 = arith.add v8, v9 : i32 #[overflow = wrapping]; - v11 = hir.bitcast v10 : u32; - v12 = hir.int_to_ptr v11 : ptr; - v13 = hir.load v12 : u8; - v5 = arith.constant 0 : i32; - v14 = arith.zext v13 : u32; - v15 = hir.bitcast v14 : i32; - v17 = arith.neq v15, v5 : i1; - scf.if v17{ + v5 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_output_notes_binding/GOT.data.internal.__memory_base : ptr + v6 = hir.bitcast v5 : ptr; + v7 = hir.load v6 : i32; + v40 = arith.constant 1048584 : i32; + v9 = arith.add v7, v40 : i32 #[overflow = wrapping]; + v10 = hir.bitcast v9 : u32; + v11 = hir.int_to_ptr v10 : ptr; + v12 = hir.load v11 : u8; + v39 = arith.constant 0 : i32; + v13 = arith.zext v12 : u32; + v14 = hir.bitcast v13 : i32; + v16 = arith.neq v14, v39 : i1; + scf.if v16{ ^block13: scf.yield ; } else { ^block14: - v18 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_output_notes_binding/GOT.data.internal.__memory_base : ptr - v19 = hir.bitcast v18 : ptr; - v20 = hir.load v19 : i32; + v17 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_output_notes_binding/GOT.data.internal.__memory_base : ptr + v18 = hir.bitcast v17 : ptr; + v19 = hir.load v18 : i32; + hir.store_local v19 #[local = lv0]; hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_output_notes_binding/__wasm_call_ctors() - v37 = arith.constant 1 : u8; - v39 = arith.constant 1048584 : i32; - v22 = arith.add v20, v39 : i32 #[overflow = wrapping]; + v20 = hir.load_local : i32 #[local = lv0]; + v38 = arith.constant 1 : u8; + v43 = arith.constant 1048584 : i32; + v22 = arith.add v20, v43 : i32 #[overflow = wrapping]; v26 = hir.bitcast v22 : u32; v27 = hir.int_to_ptr v26 : ptr; - hir.store v27, v37; + hir.store v27, v38; scf.yield ; }; builtin.ret ; @@ -53,13 +55,13 @@ builtin.component miden:base/transaction-script@1.0.0 { private builtin.function @miden_base_sys::bindings::tx::get_num_output_notes() -> felt { ^block15: - v29 = hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_output_notes_binding/miden::tx::get_num_output_notes() : felt + v29 = hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_output_notes_binding/miden::protocol::tx::get_num_output_notes() : felt builtin.ret v29; }; - private builtin.function @miden::tx::get_num_output_notes() -> felt { + private builtin.function @miden::protocol::tx::get_num_output_notes() -> felt { ^block17: - v30 = hir.exec @miden/tx/get_num_output_notes() : felt + v30 = hir.exec @miden/protocol/tx/get_num_output_notes() : felt builtin.ret v30; }; @@ -75,7 +77,7 @@ builtin.component miden:base/transaction-script@1.0.0 { }; public builtin.function @run(v32: felt, v33: felt, v34: felt, v35: felt) { - ^block21(v32: felt, v33: felt, v34: felt, v35: felt): + ^block22(v32: felt, v33: felt, v34: felt, v35: felt): hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_output_notes_binding/miden:base/transaction-script@1.0.0#run(v32, v33, v34, v35) builtin.ret ; }; diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.masm index cd52d0afd..ae1ed8e02 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.masm @@ -1,14 +1,14 @@ -# mod miden:base/transaction-script@1.0.0 +# mod ::"miden:base/transaction-script@1.0.0" @callconv("canon-lift") pub proc run(felt, felt, felt, felt) - exec.::miden:base/transaction-script@1.0.0::init + exec."miden:base/transaction-script@1.0.0"::init trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_num_output_notes_binding::miden:base/transaction-script@1.0.0#run + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_num_output_notes_binding::"miden:base/transaction-script@1.0.0#run" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -21,7 +21,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -32,7 +32,7 @@ proc init mem_store.278537 end -# mod miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_num_output_notes_binding +# mod ::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_num_output_notes_binding @callconv("C") proc __wasm_call_ctors( @@ -48,6 +48,7 @@ proc rust_sdk_account_tx_get_num_output_notes_binding::bindings::__link_custom_s nop end +@locals("4") @callconv("C") proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) drop @@ -56,17 +57,18 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) drop trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_num_output_notes_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_num_output_notes_binding::wit_bindgen::rt::run_ctors_once trace.252 nop trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_num_output_notes_binding::miden_base_sys::bindings::tx::get_num_output_notes + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_num_output_notes_binding::miden_base_sys::bindings::tx::get_num_output_notes trace.252 nop drop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -108,9 +110,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_num_output_notes_binding::__wasm_call_ctors + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_num_output_notes_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -147,18 +165,18 @@ proc miden_base_sys::bindings::tx::get_num_output_notes( ) -> felt trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_num_output_notes_binding::miden::tx::get_num_output_notes + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_num_output_notes_binding::"miden::protocol::tx::get_num_output_notes" trace.252 nop end @callconv("C") -proc miden::tx::get_num_output_notes( +proc miden::protocol::tx::get_num_output_notes( ) -> felt trace.240 nop - exec.::miden::tx::get_num_output_notes + exec.::miden::protocol::tx::get_num_output_notes trace.252 nop end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.wat index 943ea3ff8..e15b3541f 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.wat @@ -46,9 +46,9 @@ end ) (func $miden_base_sys::bindings::tx::get_num_output_notes (;4;) (type 2) (result f32) - call $miden::tx::get_num_output_notes + call $miden::protocol::tx::get_num_output_notes ) - (func $miden::tx::get_num_output_notes (;5;) (type 2) (result f32) + (func $miden::protocol::tx::get_num_output_notes (;5;) (type 2) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.hir index 80d5aedf9..ea5fc5809 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.hir @@ -12,21 +12,24 @@ builtin.component miden:base/transaction-script@1.0.0 { private builtin.function @miden:base/transaction-script@1.0.0#run(v0: felt, v1: felt, v2: felt, v3: felt) { ^block9(v0: felt, v1: felt, v2: felt, v3: felt): - v5 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/__stack_pointer : ptr - v6 = hir.bitcast v5 : ptr; - v7 = hir.load v6 : i32; - v8 = arith.constant 16 : i32; - v9 = arith.sub v7, v8 : i32 #[overflow = wrapping]; - v10 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/__stack_pointer : ptr - v11 = hir.bitcast v10 : ptr; - hir.store v11, v9; + v4 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/__stack_pointer : ptr + v5 = hir.bitcast v4 : ptr; + v6 = hir.load v5 : i32; + v106 = arith.constant 16 : i32; + v8 = arith.sub v6, v106 : i32 #[overflow = wrapping]; + hir.store_local v8 #[local = lv4]; + v9 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/__stack_pointer : ptr + v10 = hir.bitcast v9 : ptr; + hir.store v10, v8; hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/wit_bindgen::rt::run_ctors_once() - hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/miden_base_sys::bindings::tx::get_output_notes_commitment(v9) - v187 = arith.constant 16 : i32; - v13 = arith.add v9, v187 : i32 #[overflow = wrapping]; - v14 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/__stack_pointer : ptr - v15 = hir.bitcast v14 : ptr; - hir.store v15, v13; + v11 = hir.load_local : i32 #[local = lv4]; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/miden_base_sys::bindings::tx::get_output_notes_commitment(v11) + v12 = hir.load_local : i32 #[local = lv4]; + v108 = arith.constant 16 : i32; + v14 = arith.add v12, v108 : i32 #[overflow = wrapping]; + v15 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/__stack_pointer : ptr + v16 = hir.bitcast v15 : ptr; + hir.store v16, v14; builtin.ret ; }; @@ -35,15 +38,15 @@ builtin.component miden:base/transaction-script@1.0.0 { v17 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/GOT.data.internal.__memory_base : ptr v18 = hir.bitcast v17 : ptr; v19 = hir.load v18 : i32; - v20 = arith.constant 1048584 : i32; - v21 = arith.add v19, v20 : i32 #[overflow = wrapping]; + v113 = arith.constant 1048584 : i32; + v21 = arith.add v19, v113 : i32 #[overflow = wrapping]; v22 = hir.bitcast v21 : u32; v23 = hir.int_to_ptr v22 : ptr; v24 = hir.load v23 : u8; - v16 = arith.constant 0 : i32; + v112 = arith.constant 0 : i32; v25 = arith.zext v24 : u32; v26 = hir.bitcast v25 : i32; - v28 = arith.neq v26, v16 : i1; + v28 = arith.neq v26, v112 : i1; scf.if v28{ ^block13: scf.yield ; @@ -52,215 +55,97 @@ builtin.component miden:base/transaction-script@1.0.0 { v29 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/GOT.data.internal.__memory_base : ptr v30 = hir.bitcast v29 : ptr; v31 = hir.load v30 : i32; + hir.store_local v31 #[local = lv0]; hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/__wasm_call_ctors() - v189 = arith.constant 1 : u8; - v191 = arith.constant 1048584 : i32; - v33 = arith.add v31, v191 : i32 #[overflow = wrapping]; - v37 = hir.bitcast v33 : u32; - v38 = hir.int_to_ptr v37 : ptr; - hir.store v38, v189; + v32 = hir.load_local : i32 #[local = lv0]; + v111 = arith.constant 1 : u8; + v116 = arith.constant 1048584 : i32; + v34 = arith.add v32, v116 : i32 #[overflow = wrapping]; + v38 = hir.bitcast v34 : u32; + v39 = hir.int_to_ptr v38 : ptr; + hir.store v39, v111; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::tx::get_output_notes_commitment(v39: i32) { - ^block15(v39: i32): + private builtin.function @miden_base_sys::bindings::tx::get_output_notes_commitment(v40: i32) { + ^block15(v40: i32): + hir.store_local v40 #[local = lv0]; v41 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/__stack_pointer : ptr v42 = hir.bitcast v41 : ptr; v43 = hir.load v42 : i32; - v44 = arith.constant 32 : i32; - v45 = arith.sub v43, v44 : i32 #[overflow = wrapping]; + v124 = arith.constant 16 : i32; + v45 = arith.sub v43, v124 : i32 #[overflow = wrapping]; + hir.store_local v45 #[local = lv1]; v46 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/__stack_pointer : ptr v47 = hir.bitcast v46 : ptr; hir.store v47, v45; - hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/miden::tx::get_output_notes_commitment(v45) - v49 = arith.constant 8 : u32; - v48 = hir.bitcast v45 : u32; - v50 = arith.add v48, v49 : u32 #[overflow = checked]; - v196 = arith.constant 8 : u32; - v52 = arith.mod v50, v196 : u32; - hir.assertz v52 #[code = 250]; - v53 = hir.int_to_ptr v50 : ptr; - v54 = hir.load v53 : i64; - v56 = arith.constant 24 : u32; - v55 = hir.bitcast v45 : u32; - v57 = arith.add v55, v56 : u32 #[overflow = checked]; - v195 = arith.constant 8 : u32; - v59 = arith.mod v57, v195 : u32; - hir.assertz v59 #[code = 250]; - v60 = hir.int_to_ptr v57 : ptr; - hir.store v60, v54; - v61 = hir.bitcast v45 : u32; - v194 = arith.constant 8 : u32; - v63 = arith.mod v61, v194 : u32; + v48 = hir.load_local : i32 #[local = lv1]; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/miden::protocol::tx::get_output_notes_commitment(v48) + v49 = hir.load_local : i32 #[local = lv0]; + v50 = hir.load_local : i32 #[local = lv1]; + v51 = hir.bitcast v50 : u32; + v123 = arith.constant 8 : u32; + v53 = arith.mod v51, v123 : u32; + hir.assertz v53 #[code = 250]; + v54 = hir.int_to_ptr v51 : ptr; + v55 = hir.load v54 : i64; + v120, v121 = arith.split v55 : felt, felt; + v136 = arith.constant 8 : u32; + v59 = hir.bitcast v49 : u32; + v61 = arith.add v59, v136 : u32 #[overflow = checked]; + v135 = arith.constant 8 : u32; + v63 = arith.mod v61, v135 : u32; hir.assertz v63 #[code = 250]; + v122 = arith.join v121, v120 : i64; v64 = hir.int_to_ptr v61 : ptr; - v65 = hir.load v64 : i64; - v67 = arith.constant 16 : u32; - v66 = hir.bitcast v45 : u32; - v68 = arith.add v66, v67 : u32 #[overflow = checked]; - v193 = arith.constant 8 : u32; - v70 = arith.mod v68, v193 : u32; - hir.assertz v70 #[code = 250]; - v71 = hir.int_to_ptr v68 : ptr; - hir.store v71, v65; - v72 = arith.constant 16 : i32; - v73 = arith.add v45, v72 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/::reverse(v39, v73) - v192 = arith.constant 32 : i32; - v75 = arith.add v45, v192 : i32 #[overflow = wrapping]; - v76 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/__stack_pointer : ptr - v77 = hir.bitcast v76 : ptr; - hir.store v77, v75; + hir.store v64, v122; + v65 = hir.load_local : i32 #[local = lv0]; + v66 = hir.load_local : i32 #[local = lv1]; + v134 = arith.constant 8 : u32; + v67 = hir.bitcast v66 : u32; + v69 = arith.add v67, v134 : u32 #[overflow = checked]; + v133 = arith.constant 8 : u32; + v71 = arith.mod v69, v133 : u32; + hir.assertz v71 #[code = 250]; + v72 = hir.int_to_ptr v69 : ptr; + v73 = hir.load v72 : i64; + v117, v118 = arith.split v73 : felt, felt; + v77 = hir.bitcast v65 : u32; + v132 = arith.constant 8 : u32; + v79 = arith.mod v77, v132 : u32; + hir.assertz v79 #[code = 250]; + v119 = arith.join v118, v117 : i64; + v80 = hir.int_to_ptr v77 : ptr; + hir.store v80, v119; + v81 = hir.load_local : i32 #[local = lv1]; + v131 = arith.constant 16 : i32; + v83 = arith.add v81, v131 : i32 #[overflow = wrapping]; + v84 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/__stack_pointer : ptr + v85 = hir.bitcast v84 : ptr; + hir.store v85, v83; builtin.ret ; }; - private builtin.function @::reverse(v78: i32, v79: i32) { - ^block17(v78: i32, v79: i32): - v82 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/__stack_pointer : ptr - v83 = hir.bitcast v82 : ptr; - v84 = hir.load v83 : i32; - v85 = arith.constant 16 : i32; - v86 = arith.sub v84, v85 : i32 #[overflow = wrapping]; - v88 = arith.constant 8 : u32; - v87 = hir.bitcast v79 : u32; - v89 = arith.add v87, v88 : u32 #[overflow = checked]; - v283 = arith.constant 8 : u32; - v91 = arith.mod v89, v283 : u32; - hir.assertz v91 #[code = 250]; - v92 = hir.int_to_ptr v89 : ptr; - v93 = hir.load v92 : i64; - v282 = arith.constant 8 : u32; - v94 = hir.bitcast v86 : u32; - v96 = arith.add v94, v282 : u32 #[overflow = checked]; - v97 = arith.constant 4 : u32; - v98 = arith.mod v96, v97 : u32; - hir.assertz v98 #[code = 250]; - v99 = hir.int_to_ptr v96 : ptr; - hir.store v99, v93; - v100 = hir.bitcast v79 : u32; - v281 = arith.constant 8 : u32; - v102 = arith.mod v100, v281 : u32; - hir.assertz v102 #[code = 250]; - v103 = hir.int_to_ptr v100 : ptr; - v104 = hir.load v103 : i64; - v105 = hir.bitcast v86 : u32; - v280 = arith.constant 4 : u32; - v107 = arith.mod v105, v280 : u32; - hir.assertz v107 #[code = 250]; - v108 = hir.int_to_ptr v105 : ptr; - hir.store v108, v104; - v109 = arith.constant 12 : i32; - v110 = arith.add v86, v109 : i32 #[overflow = wrapping]; - v80 = arith.constant 0 : i32; - v251, v252, v253, v254, v255, v256 = scf.while v80, v86, v110, v78 : i32, i32, i32, i32, i32, i32 { - ^block37(v257: i32, v258: i32, v259: i32, v260: i32): - v279 = arith.constant 0 : i32; - v113 = arith.constant 8 : i32; - v114 = arith.eq v257, v113 : i1; - v115 = arith.zext v114 : u32; - v116 = hir.bitcast v115 : i32; - v118 = arith.neq v116, v279 : i1; - v245, v246 = scf.if v118 : i32, i32 { - ^block36: - v205 = ub.poison i32 : i32; - scf.yield v205, v205; - } else { - ^block22: - v120 = arith.add v258, v257 : i32 #[overflow = wrapping]; - v121 = hir.bitcast v120 : u32; - v278 = arith.constant 4 : u32; - v123 = arith.mod v121, v278 : u32; - hir.assertz v123 #[code = 250]; - v124 = hir.int_to_ptr v121 : ptr; - v125 = hir.load v124 : felt; - v127 = hir.bitcast v259 : u32; - v277 = arith.constant 4 : u32; - v129 = arith.mod v127, v277 : u32; - hir.assertz v129 #[code = 250]; - v130 = hir.int_to_ptr v127 : ptr; - v131 = hir.load v130 : i32; - v132 = hir.bitcast v120 : u32; - v276 = arith.constant 4 : u32; - v134 = arith.mod v132, v276 : u32; - hir.assertz v134 #[code = 250]; - v135 = hir.int_to_ptr v132 : ptr; - hir.store v135, v131; - v136 = hir.bitcast v259 : u32; - v275 = arith.constant 4 : u32; - v138 = arith.mod v136, v275 : u32; - hir.assertz v138 #[code = 250]; - v139 = hir.int_to_ptr v136 : ptr; - hir.store v139, v125; - v142 = arith.constant -4 : i32; - v143 = arith.add v259, v142 : i32 #[overflow = wrapping]; - v140 = arith.constant 4 : i32; - v141 = arith.add v257, v140 : i32 #[overflow = wrapping]; - scf.yield v141, v143; - }; - v273 = ub.poison i32 : i32; - v248 = cf.select v118, v273, v260 : i32; - v274 = ub.poison i32 : i32; - v247 = cf.select v118, v274, v258 : i32; - v204 = arith.constant 1 : u32; - v197 = arith.constant 0 : u32; - v250 = cf.select v118, v197, v204 : u32; - v238 = arith.trunc v250 : i1; - scf.condition v238, v245, v247, v246, v248, v258, v260; - } do { - ^block38(v261: i32, v262: i32, v263: i32, v264: i32, v265: i32, v266: i32): - scf.yield v261, v262, v263, v264; - }; - v272 = arith.constant 8 : u32; - v145 = hir.bitcast v255 : u32; - v147 = arith.add v145, v272 : u32 #[overflow = checked]; - v271 = arith.constant 4 : u32; - v149 = arith.mod v147, v271 : u32; - hir.assertz v149 #[code = 250]; - v150 = hir.int_to_ptr v147 : ptr; - v151 = hir.load v150 : i64; - v270 = arith.constant 8 : u32; - v152 = hir.bitcast v256 : u32; - v154 = arith.add v152, v270 : u32 #[overflow = checked]; - v269 = arith.constant 8 : u32; - v156 = arith.mod v154, v269 : u32; - hir.assertz v156 #[code = 250]; - v157 = hir.int_to_ptr v154 : ptr; - hir.store v157, v151; - v158 = hir.bitcast v255 : u32; - v268 = arith.constant 4 : u32; - v160 = arith.mod v158, v268 : u32; - hir.assertz v160 #[code = 250]; - v161 = hir.int_to_ptr v158 : ptr; - v162 = hir.load v161 : i64; - v163 = hir.bitcast v256 : u32; - v267 = arith.constant 8 : u32; - v165 = arith.mod v163, v267 : u32; - hir.assertz v165 #[code = 250]; - v166 = hir.int_to_ptr v163 : ptr; - hir.store v166, v162; - builtin.ret ; - }; - - private builtin.function @miden::tx::get_output_notes_commitment(v167: i32) { - ^block23(v167: i32): - v168, v169, v170, v171 = hir.exec @miden/tx/get_output_notes_commitment() : felt, felt, felt, felt - v172 = hir.bitcast v167 : u32; - v173 = hir.int_to_ptr v172 : ptr; - hir.store v173, v168; - v174 = arith.constant 4 : u32; - v175 = arith.add v172, v174 : u32 #[overflow = checked]; - v176 = hir.int_to_ptr v175 : ptr; - hir.store v176, v169; - v177 = arith.constant 8 : u32; - v178 = arith.add v172, v177 : u32 #[overflow = checked]; - v179 = hir.int_to_ptr v178 : ptr; - hir.store v179, v170; - v180 = arith.constant 12 : u32; - v181 = arith.add v172, v180 : u32 #[overflow = checked]; - v182 = hir.int_to_ptr v181 : ptr; - hir.store v182, v171; + private builtin.function @miden::protocol::tx::get_output_notes_commitment(v86: i32) { + ^block17(v86: i32): + v87, v88, v89, v90 = hir.exec @miden/protocol/tx/get_output_notes_commitment() : felt, felt, felt, felt + v91 = hir.bitcast v86 : u32; + v92 = hir.int_to_ptr v91 : ptr; + hir.store v92, v87; + v139 = arith.constant 4 : u32; + v94 = arith.add v91, v139 : u32 #[overflow = checked]; + v95 = hir.int_to_ptr v94 : ptr; + hir.store v95, v88; + v138 = arith.constant 8 : u32; + v97 = arith.add v91, v138 : u32 #[overflow = checked]; + v98 = hir.int_to_ptr v97 : ptr; + hir.store v98, v89; + v137 = arith.constant 12 : u32; + v100 = arith.add v91, v137 : u32 #[overflow = checked]; + v101 = hir.int_to_ptr v100 : ptr; + hir.store v101, v90; builtin.ret ; }; @@ -275,9 +160,9 @@ builtin.component miden:base/transaction-script@1.0.0 { builtin.segment @1048576 = 0x0000000100000001; }; - public builtin.function @run(v183: felt, v184: felt, v185: felt, v186: felt) { - ^block27(v183: felt, v184: felt, v185: felt, v186: felt): - hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/miden:base/transaction-script@1.0.0#run(v183, v184, v185, v186) + public builtin.function @run(v102: felt, v103: felt, v104: felt, v105: felt) { + ^block22(v102: felt, v103: felt, v104: felt, v105: felt): + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/miden:base/transaction-script@1.0.0#run(v102, v103, v104, v105) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.masm index 365eeae7a..21d6ee9d8 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.masm @@ -1,14 +1,14 @@ -# mod miden:base/transaction-script@1.0.0 +# mod ::"miden:base/transaction-script@1.0.0" @callconv("canon-lift") pub proc run(felt, felt, felt, felt) - exec.::miden:base/transaction-script@1.0.0::init + exec."miden:base/transaction-script@1.0.0"::init trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_output_notes_commitment_binding::miden:base/transaction-script@1.0.0#run + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_output_notes_commitment_binding::"miden:base/transaction-script@1.0.0#run" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -21,7 +21,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -32,7 +32,7 @@ proc init mem_store.278537 end -# mod miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_output_notes_commitment_binding +# mod ::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_output_notes_commitment_binding @callconv("C") proc __wasm_call_ctors( @@ -48,6 +48,7 @@ proc rust_sdk_account_tx_get_output_notes_commitment_binding::bindings::__link_c nop end +@locals("5") @callconv("C") proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) drop @@ -64,9 +65,16 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.4 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -76,13 +84,28 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) nop trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_output_notes_commitment_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_output_notes_commitment_binding::wit_bindgen::rt::run_ctors_once trace.252 nop - dup.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_output_notes_commitment_binding::miden_base_sys::bindings::tx::get_output_notes_commitment + trace.252 + nop + locaddr.4 + push.0 + swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_output_notes_commitment_binding::miden_base_sys::bindings::tx::get_output_notes_commitment + exec.::intrinsics::mem::load_sw trace.252 nop push.16 @@ -97,6 +120,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -138,9 +162,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_output_notes_commitment_binding::__wasm_call_ctors + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_output_notes_commitment_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -171,147 +211,75 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("2") @callconv("C") proc miden_base_sys::bindings::tx::get_output_notes_commitment( i32 ) - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::store_sw trace.252 nop - push.32 - u32wrapping_sub push.1114144 - dup.1 - swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop + push.16 + u32wrapping_sub dup.0 - trace.240 - nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_output_notes_commitment_binding::miden::tx::get_output_notes_commitment - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.24 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop - dup.0 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.1114144 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 swap.1 - push.16 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - dup.1 - u32wrapping_add - movup.2 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_output_notes_commitment_binding::::reverse + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_get_output_notes_commitment_binding::"miden::protocol::tx::get_output_notes_commitment" trace.252 nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop -end - -@callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert push.8 dup.1 swap.1 @@ -327,15 +295,17 @@ proc ::reverse( nop swap.1 push.8 - dup.3 + movup.3 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -345,167 +315,27 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.1 + push.0 swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop push.8 - dup.1 + swap.1 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod @@ -519,16 +349,15 @@ proc ::reverse( trace.252 nop swap.1 - push.8 - dup.4 - add - u32assert + movup.2 push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -538,43 +367,31 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop - swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.16 + u32wrapping_add + push.1114144 u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop end @callconv("C") -proc miden::tx::get_output_notes_commitment(i32) +proc miden::protocol::tx::get_output_notes_commitment(i32) trace.240 nop - exec.::miden::tx::get_output_notes_commitment + exec.::miden::protocol::tx::get_output_notes_commitment trace.252 nop movup.4 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.wat index 6b475738c..cd184b74f 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.wat @@ -13,7 +13,6 @@ (type (;0;) (func)) (type (;1;) (func (param f32 f32 f32 f32))) (type (;2;) (func (param i32))) - (type (;3;) (func (param i32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -59,89 +58,30 @@ (func $miden_base_sys::bindings::tx::get_output_notes_commitment (;4;) (type 2) (param i32) (local i32) global.get $__stack_pointer - i32.const 32 + i32.const 16 i32.sub local.tee 1 global.set $__stack_pointer local.get 1 - call $miden::tx::get_output_notes_commitment - local.get 1 - local.get 1 - i64.load offset=8 - i64.store offset=24 - local.get 1 + call $miden::protocol::tx::get_output_notes_commitment + local.get 0 local.get 1 i64.load - i64.store offset=16 + i64.const 32 + i64.rotl + i64.store offset=8 local.get 0 local.get 1 - i32.const 16 - i32.add - call $::reverse - local.get 1 - i32.const 32 - i32.add - global.set $__stack_pointer - ) - (func $::reverse (;5;) (type 3) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 + i64.const 32 + i64.rotl + i64.store local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 + i32.const 16 i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store + global.set $__stack_pointer ) - (func $miden::tx::get_output_notes_commitment (;6;) (type 2) (param i32) + (func $miden::protocol::tx::get_output_notes_commitment (;5;) (type 2) (param i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.hir index 7c688ec32..8ea5c52b1 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.hir @@ -13,41 +13,42 @@ builtin.component miden:base/transaction-script@1.0.0 { private builtin.function @miden:base/transaction-script@1.0.0#run(v0: felt, v1: felt, v2: felt, v3: felt) { ^block9(v0: felt, v1: felt, v2: felt, v3: felt): hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/wit_bindgen::rt::run_ctors_once() - v4 = arith.constant 42 : i32; - v5 = hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/intrinsics::felt::from_u32(v4) : felt - hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/miden_base_sys::bindings::tx::update_expiration_block_delta(v5) + v37 = arith.constant 42 : felt; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/miden_base_sys::bindings::tx::update_expiration_block_delta(v37) builtin.ret ; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v7 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/GOT.data.internal.__memory_base : ptr - v8 = hir.bitcast v7 : ptr; - v9 = hir.load v8 : i32; - v10 = arith.constant 1048584 : i32; - v11 = arith.add v9, v10 : i32 #[overflow = wrapping]; - v12 = hir.bitcast v11 : u32; - v13 = hir.int_to_ptr v12 : ptr; - v14 = hir.load v13 : u8; - v6 = arith.constant 0 : i32; - v15 = arith.zext v14 : u32; - v16 = hir.bitcast v15 : i32; - v18 = arith.neq v16, v6 : i1; - scf.if v18{ + v6 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/GOT.data.internal.__memory_base : ptr + v7 = hir.bitcast v6 : ptr; + v8 = hir.load v7 : i32; + v42 = arith.constant 1048584 : i32; + v10 = arith.add v8, v42 : i32 #[overflow = wrapping]; + v11 = hir.bitcast v10 : u32; + v12 = hir.int_to_ptr v11 : ptr; + v13 = hir.load v12 : u8; + v41 = arith.constant 0 : i32; + v14 = arith.zext v13 : u32; + v15 = hir.bitcast v14 : i32; + v17 = arith.neq v15, v41 : i1; + scf.if v17{ ^block13: scf.yield ; } else { ^block14: - v19 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/GOT.data.internal.__memory_base : ptr - v20 = hir.bitcast v19 : ptr; - v21 = hir.load v20 : i32; + v18 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/GOT.data.internal.__memory_base : ptr + v19 = hir.bitcast v18 : ptr; + v20 = hir.load v19 : i32; + hir.store_local v20 #[local = lv0]; hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/__wasm_call_ctors() - v39 = arith.constant 1 : u8; - v41 = arith.constant 1048584 : i32; - v23 = arith.add v21, v41 : i32 #[overflow = wrapping]; + v21 = hir.load_local : i32 #[local = lv0]; + v40 = arith.constant 1 : u8; + v45 = arith.constant 1048584 : i32; + v23 = arith.add v21, v45 : i32 #[overflow = wrapping]; v27 = hir.bitcast v23 : u32; v28 = hir.int_to_ptr v27 : ptr; - hir.store v28, v39; + hir.store v28, v40; scf.yield ; }; builtin.ret ; @@ -55,19 +56,13 @@ builtin.component miden:base/transaction-script@1.0.0 { private builtin.function @miden_base_sys::bindings::tx::update_expiration_block_delta(v29: felt) { ^block15(v29: felt): - hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/miden::tx::update_expiration_block_delta(v29) + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/miden::protocol::tx::update_expiration_block_delta(v29) builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v30: i32) -> felt { - ^block17(v30: i32): - v31 = hir.bitcast v30 : felt; - builtin.ret v31; - }; - - private builtin.function @miden::tx::update_expiration_block_delta(v33: felt) { - ^block19(v33: felt): - hir.exec @miden/tx/update_expiration_block_delta(v33) + private builtin.function @miden::protocol::tx::update_expiration_block_delta(v31: felt) { + ^block17(v31: felt): + hir.exec @miden/protocol/tx/update_expiration_block_delta(v31) builtin.ret ; }; @@ -82,9 +77,9 @@ builtin.component miden:base/transaction-script@1.0.0 { builtin.segment @1048576 = 0x0000000100000001; }; - public builtin.function @run(v34: felt, v35: felt, v36: felt, v37: felt) { - ^block23(v34: felt, v35: felt, v36: felt, v37: felt): - hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/miden:base/transaction-script@1.0.0#run(v34, v35, v36, v37) + public builtin.function @run(v32: felt, v33: felt, v34: felt, v35: felt) { + ^block22(v32: felt, v33: felt, v34: felt, v35: felt): + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/miden:base/transaction-script@1.0.0#run(v32, v33, v34, v35) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.masm index 5a3935001..a668807d7 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.masm @@ -1,14 +1,14 @@ -# mod miden:base/transaction-script@1.0.0 +# mod ::"miden:base/transaction-script@1.0.0" @callconv("canon-lift") pub proc run(felt, felt, felt, felt) - exec.::miden:base/transaction-script@1.0.0::init + exec."miden:base/transaction-script@1.0.0"::init trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_update_expiration_block_delta_binding::miden:base/transaction-script@1.0.0#run + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_update_expiration_block_delta_binding::"miden:base/transaction-script@1.0.0#run" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -21,7 +21,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -32,7 +32,7 @@ proc init mem_store.278537 end -# mod miden:base/transaction-script@1.0.0::rust_sdk_account_tx_update_expiration_block_delta_binding +# mod ::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_update_expiration_block_delta_binding @callconv("C") proc __wasm_call_ctors( @@ -48,6 +48,7 @@ proc rust_sdk_account_tx_update_expiration_block_delta_binding::bindings::__link nop end +@locals("4") @callconv("C") proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) drop @@ -56,22 +57,18 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) drop trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_update_expiration_block_delta_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_update_expiration_block_delta_binding::wit_bindgen::rt::run_ctors_once trace.252 nop push.42 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_update_expiration_block_delta_binding::intrinsics::felt::from_u32 - trace.252 - nop - trace.240 - nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_update_expiration_block_delta_binding::miden_base_sys::bindings::tx::update_expiration_block_delta + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_update_expiration_block_delta_binding::miden_base_sys::bindings::tx::update_expiration_block_delta trace.252 nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -113,9 +110,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_update_expiration_block_delta_binding::__wasm_call_ctors + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_update_expiration_block_delta_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -146,27 +159,23 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("1") @callconv("C") proc miden_base_sys::bindings::tx::update_expiration_block_delta( felt ) trace.240 nop - exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_update_expiration_block_delta_binding::miden::tx::update_expiration_block_delta + exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_update_expiration_block_delta_binding::"miden::protocol::tx::update_expiration_block_delta" trace.252 nop end @callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc miden::tx::update_expiration_block_delta(felt) +proc miden::protocol::tx::update_expiration_block_delta(felt) trace.240 nop - exec.::miden::tx::update_expiration_block_delta + exec.::miden::protocol::tx::update_expiration_block_delta trace.252 nop end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.wat index 39aab6d37..2371c1fe5 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.wat @@ -49,12 +49,12 @@ ) (func $miden_base_sys::bindings::tx::update_expiration_block_delta (;4;) (type 2) (param f32) local.get 0 - call $miden::tx::update_expiration_block_delta + call $miden::protocol::tx::update_expiration_block_delta ) (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) unreachable ) - (func $miden::tx::update_expiration_block_delta (;6;) (type 2) (param f32) + (func $miden::protocol::tx::update_expiration_block_delta (;6;) (type 2) (param f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.hir index 5f725a4d0..f54742a08 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.hir @@ -12,154 +12,153 @@ builtin.component miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-a private builtin.function @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1#binding() -> felt { ^block9: - v3 = builtin.global_symbol @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/__stack_pointer : ptr - v4 = hir.bitcast v3 : ptr; - v5 = hir.load v4 : i32; - v6 = arith.constant 16 : i32; - v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; - v8 = builtin.global_symbol @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/__stack_pointer : ptr - v9 = hir.bitcast v8 : ptr; - hir.store v9, v7; + v1 = builtin.global_symbol @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v114 = arith.constant 16 : i32; + v5 = arith.sub v3, v114 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/wit_bindgen::rt::run_ctors_once() - v1 = arith.constant 0 : i32; - v12 = hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/intrinsics::felt::from_u32(v1) : felt - v169 = arith.constant 0 : i32; - v148, v149, v150, v151 = scf.while v169, v7, v12 : i32, i32, felt, i32 { - ^block36(v152: i32, v153: i32, v154: felt): - v167 = arith.constant 0 : i32; - v168 = arith.constant 16 : i32; - v15 = arith.eq v152, v168 : i1; - v16 = arith.zext v15 : u32; - v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v167 : i1; - v143 = scf.if v19 : i32 { - ^block35: - v114 = ub.poison i32 : i32; - scf.yield v114; + v113 = arith.constant 0 : i32; + hir.store_local v113 #[local = lv1]; + v107 = arith.constant 0 : felt; + hir.store_local v107 #[local = lv2]; + scf.while { + ^block12: + v11 = hir.load_local : i32 #[local = lv1]; + v141 = arith.constant 0 : i32; + v142 = arith.constant 16 : i32; + v13 = arith.eq v11, v142 : i1; + v14 = arith.zext v13 : u32; + v15 = hir.bitcast v14 : i32; + v17 = arith.neq v15, v141 : i1; + scf.if v17{ + ^block32: + scf.yield ; } else { ^block14: - v21 = arith.add v153, v152 : i32 #[overflow = wrapping]; - v23 = hir.bitcast v21 : u32; - v32 = arith.constant 4 : u32; - v25 = arith.mod v23, v32 : u32; - hir.assertz v25 #[code = 250]; - v26 = hir.int_to_ptr v23 : ptr; - hir.store v26, v154; - v27 = arith.constant 4 : i32; - v28 = arith.add v152, v27 : i32 #[overflow = wrapping]; - scf.yield v28; + v18 = hir.load_local : i32 #[local = lv0]; + v19 = hir.load_local : i32 #[local = lv1]; + v21 = hir.load_local : felt #[local = lv2]; + v20 = arith.add v18, v19 : i32 #[overflow = wrapping]; + v22 = hir.bitcast v20 : u32; + v115 = arith.constant 4 : u32; + v24 = arith.mod v22, v115 : u32; + hir.assertz v24 #[code = 250]; + v25 = hir.int_to_ptr v22 : ptr; + hir.store v25, v21; + v26 = hir.load_local : i32 #[local = lv1]; + v108 = arith.constant 4 : i32; + v28 = arith.add v26, v108 : i32 #[overflow = wrapping]; + hir.store_local v28 #[local = lv1]; + scf.yield ; }; - v115 = ub.poison felt : felt; - v145 = cf.select v19, v115, v154 : felt; - v166 = ub.poison i32 : i32; - v144 = cf.select v19, v166, v153 : i32; - v113 = arith.constant 1 : u32; - v107 = arith.constant 0 : u32; - v147 = cf.select v19, v107, v113 : u32; - v137 = arith.trunc v147 : i1; - scf.condition v137, v143, v144, v145, v153; + v128 = arith.constant 1 : u32; + v125 = arith.constant 0 : u32; + v133 = cf.select v17, v125, v128 : u32; + v129 = arith.trunc v133 : i1; + scf.condition v129; } do { - ^block37(v155: i32, v156: i32, v157: felt, v158: i32): - scf.yield v155, v156, v157; + ^block31: + scf.yield ; }; - v30 = arith.constant 12 : u32; - v29 = hir.bitcast v151 : u32; - v31 = arith.add v29, v30 : u32 #[overflow = checked]; - v165 = arith.constant 4 : u32; - v33 = arith.mod v31, v165 : u32; - hir.assertz v33 #[code = 250]; - v34 = hir.int_to_ptr v31 : ptr; - v35 = hir.load v34 : felt; - v37 = arith.constant 8 : u32; - v36 = hir.bitcast v151 : u32; - v38 = arith.add v36, v37 : u32 #[overflow = checked]; - v164 = arith.constant 4 : u32; - v40 = arith.mod v38, v164 : u32; - hir.assertz v40 #[code = 250]; - v41 = hir.int_to_ptr v38 : ptr; - v42 = hir.load v41 : felt; - v163 = arith.constant 4 : u32; - v43 = hir.bitcast v151 : u32; - v45 = arith.add v43, v163 : u32 #[overflow = checked]; - v162 = arith.constant 4 : u32; - v47 = arith.mod v45, v162 : u32; - hir.assertz v47 #[code = 250]; - v48 = hir.int_to_ptr v45 : ptr; - v49 = hir.load v48 : felt; - v50 = hir.bitcast v151 : u32; - v161 = arith.constant 4 : u32; - v52 = arith.mod v50, v161 : u32; - hir.assertz v52 #[code = 250]; - v53 = hir.int_to_ptr v50 : ptr; - v54 = hir.load v53 : felt; - v55 = hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/miden::native_account::was_procedure_called(v35, v42, v49, v54) : felt - v160 = arith.constant 0 : i32; - v57 = hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/intrinsics::felt::from_u32(v160) : felt - v58 = hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/intrinsics::felt::eq(v55, v57) : i32 - v59 = arith.constant 1 : i32; - v60 = arith.neq v58, v59 : i1; - v61 = arith.zext v60 : u32; - v62 = hir.bitcast v61 : i32; - v63 = hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/intrinsics::felt::from_u32(v62) : felt - v159 = arith.constant 16 : i32; - v65 = arith.add v151, v159 : i32 #[overflow = wrapping]; - v66 = builtin.global_symbol @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/__stack_pointer : ptr - v67 = hir.bitcast v66 : ptr; - hir.store v67, v65; - builtin.ret v63; + v29 = hir.load_local : i32 #[local = lv0]; + v112 = arith.constant 12 : u32; + v30 = hir.bitcast v29 : u32; + v32 = arith.add v30, v112 : u32 #[overflow = checked]; + v140 = arith.constant 4 : u32; + v34 = arith.mod v32, v140 : u32; + hir.assertz v34 #[code = 250]; + v35 = hir.int_to_ptr v32 : ptr; + v36 = hir.load v35 : felt; + v37 = hir.load_local : i32 #[local = lv0]; + v110 = arith.constant 8 : u32; + v38 = hir.bitcast v37 : u32; + v40 = arith.add v38, v110 : u32 #[overflow = checked]; + v139 = arith.constant 4 : u32; + v42 = arith.mod v40, v139 : u32; + hir.assertz v42 #[code = 250]; + v43 = hir.int_to_ptr v40 : ptr; + v44 = hir.load v43 : felt; + v45 = hir.load_local : i32 #[local = lv0]; + v138 = arith.constant 4 : u32; + v46 = hir.bitcast v45 : u32; + v48 = arith.add v46, v138 : u32 #[overflow = checked]; + v137 = arith.constant 4 : u32; + v50 = arith.mod v48, v137 : u32; + hir.assertz v50 #[code = 250]; + v51 = hir.int_to_ptr v48 : ptr; + v52 = hir.load v51 : felt; + v53 = hir.load_local : i32 #[local = lv0]; + v54 = hir.bitcast v53 : u32; + v136 = arith.constant 4 : u32; + v56 = arith.mod v54, v136 : u32; + hir.assertz v56 #[code = 250]; + v57 = hir.int_to_ptr v54 : ptr; + v58 = hir.load v57 : felt; + v59 = hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/miden::protocol::native_account::was_procedure_called(v36, v44, v52, v58) : felt + v109 = arith.constant 1 : i32; + v135 = arith.constant 0 : felt; + v62 = arith.eq v59, v135 : i1; + v63 = hir.cast v62 : i32; + v65 = arith.neq v63, v109 : i1; + v66 = arith.zext v65 : u32; + v67 = hir.bitcast v66 : i32; + v68 = hir.bitcast v67 : felt; + hir.store_local v68 #[local = lv2]; + v69 = hir.load_local : i32 #[local = lv0]; + v134 = arith.constant 16 : i32; + v71 = arith.add v69, v134 : i32 #[overflow = wrapping]; + v72 = builtin.global_symbol @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/__stack_pointer : ptr + v73 = hir.bitcast v72 : ptr; + hir.store v73, v71; + v74 = hir.load_local : felt #[local = lv2]; + builtin.ret v74; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block15: - v69 = builtin.global_symbol @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/GOT.data.internal.__memory_base : ptr - v70 = hir.bitcast v69 : ptr; - v71 = hir.load v70 : i32; - v72 = arith.constant 1048584 : i32; - v73 = arith.add v71, v72 : i32 #[overflow = wrapping]; - v74 = hir.bitcast v73 : u32; - v75 = hir.int_to_ptr v74 : ptr; - v76 = hir.load v75 : u8; - v68 = arith.constant 0 : i32; - v77 = arith.zext v76 : u32; - v78 = hir.bitcast v77 : i32; - v80 = arith.neq v78, v68 : i1; - scf.if v80{ + v75 = builtin.global_symbol @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/GOT.data.internal.__memory_base : ptr + v76 = hir.bitcast v75 : ptr; + v77 = hir.load v76 : i32; + v147 = arith.constant 1048584 : i32; + v79 = arith.add v77, v147 : i32 #[overflow = wrapping]; + v80 = hir.bitcast v79 : u32; + v81 = hir.int_to_ptr v80 : ptr; + v82 = hir.load v81 : u8; + v146 = arith.constant 0 : i32; + v83 = arith.zext v82 : u32; + v84 = hir.bitcast v83 : i32; + v86 = arith.neq v84, v146 : i1; + scf.if v86{ ^block17: scf.yield ; } else { ^block18: - v81 = builtin.global_symbol @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/GOT.data.internal.__memory_base : ptr - v82 = hir.bitcast v81 : ptr; - v83 = hir.load v82 : i32; + v87 = builtin.global_symbol @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/GOT.data.internal.__memory_base : ptr + v88 = hir.bitcast v87 : ptr; + v89 = hir.load v88 : i32; + hir.store_local v89 #[local = lv0]; hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/__wasm_call_ctors() - v171 = arith.constant 1 : u8; - v173 = arith.constant 1048584 : i32; - v85 = arith.add v83, v173 : i32 #[overflow = wrapping]; - v89 = hir.bitcast v85 : u32; - v90 = hir.int_to_ptr v89 : ptr; - hir.store v90, v171; + v90 = hir.load_local : i32 #[local = lv0]; + v145 = arith.constant 1 : u8; + v150 = arith.constant 1048584 : i32; + v92 = arith.add v90, v150 : i32 #[overflow = wrapping]; + v96 = hir.bitcast v92 : u32; + v97 = hir.int_to_ptr v96 : ptr; + hir.store v97, v145; scf.yield ; }; builtin.ret ; }; - private builtin.function @intrinsics::felt::eq(v91: felt, v92: felt) -> i32 { - ^block19(v91: felt, v92: felt): - v93 = arith.eq v91, v92 : i1; - v94 = hir.cast v93 : i32; - builtin.ret v94; - }; - - private builtin.function @intrinsics::felt::from_u32(v96: i32) -> felt { - ^block21(v96: i32): - v97 = hir.bitcast v96 : felt; - builtin.ret v97; - }; - - private builtin.function @miden::native_account::was_procedure_called(v99: felt, v100: felt, v101: felt, v102: felt) -> felt { - ^block23(v99: felt, v100: felt, v101: felt, v102: felt): - v103 = hir.exec @miden/native_account/was_procedure_called(v99, v100, v101, v102) : felt - builtin.ret v103; + private builtin.function @miden::protocol::native_account::was_procedure_called(v98: felt, v99: felt, v100: felt, v101: felt) -> felt { + ^block19(v98: felt, v99: felt, v100: felt, v101: felt): + v102 = hir.exec @miden/protocol/native_account/was_procedure_called(v98, v99, v100, v101) : felt + builtin.ret v102; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -174,8 +173,8 @@ builtin.component miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-a }; public builtin.function @binding() -> felt { - ^block27: - v105 = hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1#binding() : felt - builtin.ret v105; + ^block24: + v104 = hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1#binding() : felt + builtin.ret v104; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.masm index 2774306af..d02453948 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.masm @@ -1,16 +1,16 @@ -# mod miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1 +# mod ::"miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> felt - exec.::miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1::init + exec."miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1::rust_sdk_account_was_procedure_called_binding::miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1#binding + exec.::"miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1"::rust_sdk_account_was_procedure_called_binding::"miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1#binding" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -23,7 +23,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -34,7 +34,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1::rust_sdk_account_was_procedure_called_binding +# mod ::"miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1"::rust_sdk_account_was_procedure_called_binding @callconv("C") proc __wasm_call_ctors( @@ -50,6 +50,7 @@ proc rust_sdk_account_was_procedure_called_binding::bindings::__link_custom_sect nop end +@locals("3") @callconv("C") proc miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1#binding( @@ -64,9 +65,16 @@ proc miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-pr nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -76,33 +84,71 @@ proc miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-pr nop trace.240 nop - exec.::miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1::rust_sdk_account_was_procedure_called_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1"::rust_sdk_account_was_procedure_called_binding::wit_bindgen::rt::run_ctors_once trace.252 nop push.0 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1::rust_sdk_account_was_procedure_called_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_sw trace.252 nop push.0 - movup.2 + locaddr.2 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1 while.true + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.16 - dup.2 + movup.2 eq neq dup.0 if.true - swap.1 - drop - push.3735929054 + nop else - dup.2 - dup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.2 u32wrapping_add push.4 dup.1 @@ -110,8 +156,6 @@ proc miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-pr u32mod u32assert assertz - dup.4 - swap.1 u32divmod.4 swap.1 trace.240 @@ -119,43 +163,47 @@ proc miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-pr exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - movup.2 u32wrapping_add + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.3735929054 - dup.2 - movup.2 - swap.5 - movdn.2 - cdrop - push.3735929054 - dup.2 - dup.4 - swap.2 - swap.1 - cdrop push.1 push.0 - movup.4 + movup.2 cdrop push.1 u32and - movup.4 - swap.1 if.true - movup.3 - drop push.1 else push.0 end end - drop - drop - drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.1 + swap.1 add u32assert push.4 @@ -171,8 +219,16 @@ proc miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-pr exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.2 + swap.1 add u32assert push.4 @@ -188,8 +244,16 @@ proc miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-pr exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.3 + swap.1 add u32assert push.4 @@ -205,7 +269,14 @@ proc miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-pr exec.::intrinsics::mem::load_felt trace.252 nop - dup.3 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -223,30 +294,31 @@ proc miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-pr swap.2 trace.240 nop - exec.::miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1::rust_sdk_account_was_procedure_called_binding::miden::native_account::was_procedure_called + exec.::"miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1"::rust_sdk_account_was_procedure_called_binding::"miden::protocol::native_account::was_procedure_called" trace.252 nop + push.1 + push.0 + movup.2 + eq + neq + locaddr.2 push.0 - trace.240 - nop - exec.::miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1::rust_sdk_account_was_procedure_called_binding::intrinsics::felt::from_u32 - trace.252 - nop swap.1 trace.240 nop - exec.::miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1::rust_sdk_account_was_procedure_called_binding::intrinsics::felt::eq + exec.::intrinsics::mem::store_felt trace.252 nop - push.1 - neq + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1::rust_sdk_account_was_procedure_called_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop push.16 - movup.2 u32wrapping_add push.1114144 u32divmod.4 @@ -256,8 +328,17 @@ proc miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-pr exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -299,9 +380,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop trace.240 nop - exec.::miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1::rust_sdk_account_was_procedure_called_binding::__wasm_call_ctors + exec.::"miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1"::rust_sdk_account_was_procedure_called_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -333,20 +430,15 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc intrinsics::felt::eq(felt, felt) -> i32 - eq -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc miden::native_account::was_procedure_called(felt, felt, felt, felt) -> felt +proc miden::protocol::native_account::was_procedure_called( + felt, + felt, + felt, + felt +) -> felt trace.240 nop - exec.::miden::native_account::was_procedure_called + exec.::miden::protocol::native_account::was_procedure_called trace.252 nop end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.wat index 03940a791..7f829e874 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.wat @@ -60,7 +60,7 @@ f32.load offset=4 local.get 0 f32.load - call $miden::native_account::was_procedure_called + call $miden::protocol::native_account::was_procedure_called i32.const 0 call $intrinsics::felt::from_u32 call $intrinsics::felt::eq @@ -98,11 +98,11 @@ (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) unreachable ) - (func $miden::native_account::was_procedure_called (;6;) (type 4) (param f32 f32 f32 f32) (result f32) + (func $miden::protocol::native_account::was_procedure_called (;6;) (type 4) (param f32 f32 f32 f32) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "[rust_sdk_account_was_procedure_called_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "[rust_sdk_account_was_procedure_called_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.hir index 6ce5b8478..ddfb548c6 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.hir @@ -10,57 +10,66 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no v3 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/GOT.data.internal.__memory_base : ptr v4 = hir.bitcast v3 : ptr; v5 = hir.load v4 : i32; - v6 = arith.constant 1048584 : i32; - v7 = arith.add v5, v6 : i32 #[overflow = wrapping]; - v8 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::alloc(v7, v1, v0) : i32 - builtin.ret v8; + v745 = arith.constant 1048584 : i32; + v7 = arith.add v5, v745 : i32 #[overflow = wrapping]; + v10 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::alloc(v7, v1, v0) : i32 + builtin.ret v10; }; - private builtin.function @__rustc::__rust_dealloc(v9: i32, v10: i32, v11: i32) { - ^block9(v9: i32, v10: i32, v11: i32): + private builtin.function @__rustc::__rust_dealloc(v11: i32, v12: i32, v13: i32) { + ^block9(v11: i32, v12: i32, v13: i32): builtin.ret ; }; - private builtin.function @__rustc::__rust_alloc_zeroed(v12: i32, v13: i32) -> i32 { - ^block11(v12: i32, v13: i32): - v15 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/GOT.data.internal.__memory_base : ptr - v16 = hir.bitcast v15 : ptr; - v17 = hir.load v16 : i32; - v18 = arith.constant 1048584 : i32; - v19 = arith.add v17, v18 : i32 #[overflow = wrapping]; - v20 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::alloc(v19, v13, v12) : i32 - v656 = arith.constant 0 : i32; - v21 = arith.constant 0 : i32; - v22 = arith.eq v20, v21 : i1; - v23 = arith.zext v22 : u32; - v24 = hir.bitcast v23 : i32; - v26 = arith.neq v24, v656 : i1; - scf.if v26{ - ^block13: + private builtin.function @__rustc::__rust_alloc_zeroed(v14: i32, v15: i32) -> i32 { + ^block11(v14: i32, v15: i32): + hir.store_local v14 #[local = lv0]; + hir.store_local v15 #[local = lv1]; + v17 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/GOT.data.internal.__memory_base : ptr + v18 = hir.bitcast v17 : ptr; + v19 = hir.load v18 : i32; + v22 = hir.load_local : i32 #[local = lv1]; + v23 = hir.load_local : i32 #[local = lv0]; + v749 = arith.constant 1048584 : i32; + v21 = arith.add v19, v749 : i32 #[overflow = wrapping]; + v24 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::alloc(v21, v22, v23) : i32 + hir.store_local v24 #[local = lv1]; + v757 = arith.constant 0 : i32; + v752 = arith.constant 0 : i32; + v26 = arith.eq v24, v752 : i1; + v27 = arith.zext v26 : u32; + v28 = hir.bitcast v27 : i32; + v30 = arith.neq v28, v757 : i1; + scf.if v30{ + ^block91: scf.yield ; } else { ^block14: - v654 = arith.constant 0 : i32; - v655 = arith.constant 0 : i32; - v28 = arith.eq v12, v655 : i1; - v29 = arith.zext v28 : u32; - v30 = hir.bitcast v29 : i32; - v32 = arith.neq v30, v654 : i1; - scf.if v32{ - ^block94: + v31 = hir.load_local : i32 #[local = lv0]; + v755 = arith.constant 0 : i32; + v756 = arith.constant 0 : i32; + v33 = arith.eq v31, v756 : i1; + v34 = arith.zext v33 : u32; + v35 = hir.bitcast v34 : i32; + v37 = arith.neq v35, v755 : i1; + scf.if v37{ + ^block90: scf.yield ; } else { ^block15: - v648 = arith.constant 0 : u8; - v35 = hir.bitcast v12 : u32; - v36 = hir.bitcast v20 : u32; - v37 = hir.int_to_ptr v36 : ptr; - hir.mem_set v37, v35, v648; + v38 = hir.load_local : i32 #[local = lv1]; + v40 = hir.load_local : i32 #[local = lv0]; + v747 = arith.constant 0 : u8; + v42 = hir.bitcast v40 : u32; + v43 = hir.bitcast v38 : u32; + v44 = hir.int_to_ptr v43 : ptr; + hir.mem_set v44, v42, v747; scf.yield ; }; scf.yield ; }; - builtin.ret v20; + v45 = hir.load_local : i32 #[local = lv1]; + builtin.ret v45; }; private builtin.function @rust_sdk_input_note_get_assets_binding::bindings::__link_custom_section_describing_imports() { @@ -70,39 +79,45 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no private builtin.function @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1#binding() -> felt { ^block18: - v42 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v43 = hir.bitcast v42 : ptr; - v44 = hir.load v43 : i32; - v45 = arith.constant 16 : i32; - v46 = arith.sub v44, v45 : i32 #[overflow = wrapping]; v47 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr v48 = hir.bitcast v47 : ptr; - hir.store v48, v46; + v49 = hir.load v48 : i32; + v763 = arith.constant 16 : i32; + v51 = arith.sub v49, v763 : i32 #[overflow = wrapping]; + hir.store_local v51 #[local = lv0]; + v52 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v53 = hir.bitcast v52 : ptr; + hir.store v53, v51; hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/wit_bindgen::rt::run_ctors_once() - v40 = arith.constant 0 : i32; - v52 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/intrinsics::felt::from_u32(v40) : felt - v49 = arith.constant 4 : i32; - v50 = arith.add v46, v49 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/miden_base_sys::bindings::input_note::get_assets(v50, v52) - v54 = arith.constant 12 : u32; - v53 = hir.bitcast v46 : u32; - v55 = arith.add v53, v54 : u32 #[overflow = checked]; - v56 = arith.constant 4 : u32; - v57 = arith.mod v55, v56 : u32; - hir.assertz v57 #[code = 250]; - v58 = hir.int_to_ptr v55 : ptr; - v59 = hir.load v58 : i32; - v60 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/intrinsics::felt::from_u32(v59) : felt - v658 = arith.constant 16 : i32; - v659 = arith.constant 4 : i32; - v62 = arith.add v46, v659 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::deallocate(v62, v658, v658) - v657 = arith.constant 16 : i32; - v66 = arith.add v46, v657 : i32 #[overflow = wrapping]; - v67 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v68 = hir.bitcast v67 : ptr; - hir.store v68, v66; - builtin.ret v60; + v54 = hir.load_local : i32 #[local = lv0]; + v759 = arith.constant 0 : felt; + v762 = arith.constant 4 : i32; + v56 = arith.add v54, v762 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/miden_base_sys::bindings::input_note::get_assets(v56, v759) + v59 = hir.load_local : i32 #[local = lv0]; + v761 = arith.constant 12 : u32; + v60 = hir.bitcast v59 : u32; + v62 = arith.add v60, v761 : u32 #[overflow = checked]; + v760 = arith.constant 4 : u32; + v64 = arith.mod v62, v760 : u32; + hir.assertz v64 #[code = 250]; + v65 = hir.int_to_ptr v62 : ptr; + v66 = hir.load v65 : i32; + v67 = hir.bitcast v66 : felt; + hir.store_local v67 #[local = lv1]; + v68 = hir.load_local : i32 #[local = lv0]; + v768 = arith.constant 16 : i32; + v769 = arith.constant 4 : i32; + v70 = arith.add v68, v769 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::deallocate(v70, v768, v768) + v73 = hir.load_local : i32 #[local = lv0]; + v767 = arith.constant 16 : i32; + v75 = arith.add v73, v767 : i32 #[overflow = wrapping]; + v76 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v77 = hir.bitcast v76 : ptr; + hir.store v77, v75; + v78 = hir.load_local : felt #[local = lv1]; + builtin.ret v78; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { @@ -112,820 +127,969 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block22: - v70 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/GOT.data.internal.__memory_base : ptr - v71 = hir.bitcast v70 : ptr; - v72 = hir.load v71 : i32; - v73 = arith.constant 1048588 : i32; - v74 = arith.add v72, v73 : i32 #[overflow = wrapping]; - v75 = hir.bitcast v74 : u32; - v76 = hir.int_to_ptr v75 : ptr; - v77 = hir.load v76 : u8; - v69 = arith.constant 0 : i32; - v78 = arith.zext v77 : u32; - v79 = hir.bitcast v78 : i32; - v81 = arith.neq v79, v69 : i1; - scf.if v81{ + v79 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/GOT.data.internal.__memory_base : ptr + v80 = hir.bitcast v79 : ptr; + v81 = hir.load v80 : i32; + v774 = arith.constant 1048588 : i32; + v83 = arith.add v81, v774 : i32 #[overflow = wrapping]; + v84 = hir.bitcast v83 : u32; + v85 = hir.int_to_ptr v84 : ptr; + v86 = hir.load v85 : u8; + v773 = arith.constant 0 : i32; + v87 = arith.zext v86 : u32; + v88 = hir.bitcast v87 : i32; + v90 = arith.neq v88, v773 : i1; + scf.if v90{ ^block24: scf.yield ; } else { ^block25: - v82 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/GOT.data.internal.__memory_base : ptr - v83 = hir.bitcast v82 : ptr; - v84 = hir.load v83 : i32; + v91 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/GOT.data.internal.__memory_base : ptr + v92 = hir.bitcast v91 : ptr; + v93 = hir.load v92 : i32; + hir.store_local v93 #[local = lv0]; hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__wasm_call_ctors() - v661 = arith.constant 1 : u8; - v663 = arith.constant 1048588 : i32; - v86 = arith.add v84, v663 : i32 #[overflow = wrapping]; - v90 = hir.bitcast v86 : u32; - v91 = hir.int_to_ptr v90 : ptr; - hir.store v91, v661; + v94 = hir.load_local : i32 #[local = lv0]; + v772 = arith.constant 1 : u8; + v777 = arith.constant 1048588 : i32; + v96 = arith.add v94, v777 : i32 #[overflow = wrapping]; + v100 = hir.bitcast v96 : u32; + v101 = hir.int_to_ptr v100 : ptr; + hir.store v101, v772; scf.yield ; }; builtin.ret ; }; - private builtin.function @::alloc(v92: i32, v93: i32, v94: i32) -> i32 { - ^block26(v92: i32, v93: i32, v94: i32): - v97 = arith.constant 16 : i32; - v96 = arith.constant 0 : i32; - v665 = arith.constant 16 : u32; - v99 = hir.bitcast v93 : u32; - v101 = arith.gt v99, v665 : i1; - v102 = arith.zext v101 : u32; - v103 = hir.bitcast v102 : i32; - v105 = arith.neq v103, v96 : i1; - v106 = cf.select v105, v93, v97 : i32; - v705 = arith.constant 0 : i32; - v107 = arith.constant -1 : i32; - v108 = arith.add v106, v107 : i32 #[overflow = wrapping]; - v109 = arith.band v106, v108 : i32; - v111 = arith.neq v109, v705 : i1; - v674, v675 = scf.if v111 : i32, u32 { - ^block100: - v666 = arith.constant 0 : u32; - v670 = ub.poison i32 : i32; - scf.yield v670, v666; + private builtin.function @::alloc(v102: i32, v103: i32, v104: i32) -> i32 { + ^block26(v102: i32, v103: i32, v104: i32): + hir.store_local v102 #[local = lv0]; + hir.store_local v103 #[local = lv1]; + hir.store_local v104 #[local = lv2]; + v106 = hir.load_local : i32 #[local = lv1]; + v785 = arith.constant 16 : i32; + v784 = arith.constant 0 : i32; + v780 = arith.constant 16 : u32; + v110 = hir.bitcast v106 : u32; + v112 = arith.gt v110, v780 : i1; + v113 = arith.zext v112 : u32; + v114 = hir.bitcast v113 : i32; + v116 = arith.neq v114, v784 : i1; + v117 = cf.select v116, v106, v785 : i32; + hir.store_local v117 #[local = lv3]; + v118 = hir.load_local : i32 #[local = lv3]; + v828 = arith.constant 0 : i32; + v783 = arith.constant -1 : i32; + v120 = arith.add v118, v783 : i32 #[overflow = wrapping]; + v121 = arith.band v117, v120 : i32; + v123 = arith.neq v121, v828 : i1; + v806, v807 = scf.if v123 : i32, u32 { + ^block98: + v798 = arith.constant 0 : u32; + v802 = ub.poison i32 : i32; + scf.yield v802, v798; } else { ^block29: - v113 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::max(v93, v106) : i32 - v704 = arith.constant 0 : i32; - v112 = arith.constant -2147483648 : i32; - v114 = arith.sub v112, v113 : i32 #[overflow = wrapping]; - v116 = hir.bitcast v114 : u32; - v115 = hir.bitcast v94 : u32; - v117 = arith.gt v115, v116 : i1; - v118 = arith.zext v117 : u32; - v119 = hir.bitcast v118 : i32; - v121 = arith.neq v119, v704 : i1; - v689 = scf.if v121 : i32 { - ^block99: - v703 = ub.poison i32 : i32; - scf.yield v703; + v124 = hir.load_local : i32 #[local = lv2]; + v126 = hir.load_local : i32 #[local = lv1]; + v127 = hir.load_local : i32 #[local = lv3]; + v128 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::max(v126, v127) : i32 + hir.store_local v128 #[local = lv1]; + v827 = arith.constant 0 : i32; + v782 = arith.constant -2147483648 : i32; + v129 = arith.sub v782, v128 : i32 #[overflow = wrapping]; + v131 = hir.bitcast v129 : u32; + v130 = hir.bitcast v124 : u32; + v132 = arith.gt v130, v131 : i1; + v133 = arith.zext v132 : u32; + v134 = hir.bitcast v133 : i32; + v136 = arith.neq v134, v827 : i1; + v812 = scf.if v136 : i32 { + ^block97: + v826 = ub.poison i32 : i32; + scf.yield v826; } else { ^block30: - v701 = arith.constant 0 : i32; - v127 = arith.sub v701, v113 : i32 #[overflow = wrapping]; - v702 = arith.constant -1 : i32; - v123 = arith.add v94, v113 : i32 #[overflow = wrapping]; - v125 = arith.add v123, v702 : i32 #[overflow = wrapping]; - v128 = arith.band v125, v127 : i32; - v129 = hir.bitcast v92 : u32; - v130 = arith.constant 4 : u32; - v131 = arith.mod v129, v130 : u32; - hir.assertz v131 #[code = 250]; - v132 = hir.int_to_ptr v129 : ptr; - v133 = hir.load v132 : i32; - v700 = arith.constant 0 : i32; - v135 = arith.neq v133, v700 : i1; - scf.if v135{ - ^block98: + v825 = arith.constant 0 : i32; + hir.store_local v825 #[local = lv3]; + v138 = hir.load_local : i32 #[local = lv2]; + v139 = hir.load_local : i32 #[local = lv1]; + v823 = arith.constant 0 : i32; + v145 = arith.sub v823, v139 : i32 #[overflow = wrapping]; + v824 = arith.constant -1 : i32; + v140 = arith.add v138, v139 : i32 #[overflow = wrapping]; + v142 = arith.add v140, v824 : i32 #[overflow = wrapping]; + v146 = arith.band v142, v145 : i32; + hir.store_local v146 #[local = lv2]; + v147 = hir.load_local : i32 #[local = lv0]; + v148 = hir.bitcast v147 : u32; + v781 = arith.constant 4 : u32; + v150 = arith.mod v148, v781 : u32; + hir.assertz v150 #[code = 250]; + v151 = hir.int_to_ptr v148 : ptr; + v152 = hir.load v151 : i32; + v822 = arith.constant 0 : i32; + v154 = arith.neq v152, v822 : i1; + scf.if v154{ + ^block96: scf.yield ; } else { ^block32: - v136 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/intrinsics::mem::heap_base() : i32 - v137 = hir.mem_size : u32; - v143 = hir.bitcast v92 : u32; - v699 = arith.constant 4 : u32; - v145 = arith.mod v143, v699 : u32; - hir.assertz v145 #[code = 250]; - v698 = arith.constant 16 : u32; - v138 = hir.bitcast v137 : i32; - v141 = arith.shl v138, v698 : i32; - v142 = arith.add v136, v141 : i32 #[overflow = wrapping]; - v146 = hir.int_to_ptr v143 : ptr; - hir.store v146, v142; + v155 = hir.load_local : i32 #[local = lv0]; + v156 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/intrinsics::mem::heap_base() : i32 + v157 = hir.mem_size : u32; + v163 = hir.bitcast v155 : u32; + v821 = arith.constant 4 : u32; + v165 = arith.mod v163, v821 : u32; + hir.assertz v165 #[code = 250]; + v820 = arith.constant 16 : u32; + v158 = hir.bitcast v157 : i32; + v161 = arith.shl v158, v820 : i32; + v162 = arith.add v156, v161 : i32 #[overflow = wrapping]; + v166 = hir.int_to_ptr v163 : ptr; + hir.store v166, v162; scf.yield ; }; - v149 = hir.bitcast v92 : u32; - v697 = arith.constant 4 : u32; - v151 = arith.mod v149, v697 : u32; - hir.assertz v151 #[code = 250]; - v152 = hir.int_to_ptr v149 : ptr; - v153 = hir.load v152 : i32; - v695 = arith.constant 0 : i32; - v696 = arith.constant -1 : i32; - v155 = arith.bxor v153, v696 : i32; - v157 = hir.bitcast v155 : u32; - v156 = hir.bitcast v128 : u32; - v158 = arith.gt v156, v157 : i1; - v159 = arith.zext v158 : u32; - v160 = hir.bitcast v159 : i32; - v162 = arith.neq v160, v695 : i1; - v688 = scf.if v162 : i32 { - ^block33: - v694 = arith.constant 0 : i32; - scf.yield v694; + v167 = hir.load_local : i32 #[local = lv2]; + v168 = hir.load_local : i32 #[local = lv0]; + v169 = hir.bitcast v168 : u32; + v819 = arith.constant 4 : u32; + v171 = arith.mod v169, v819 : u32; + hir.assertz v171 #[code = 250]; + v172 = hir.int_to_ptr v169 : ptr; + v173 = hir.load v172 : i32; + hir.store_local v173 #[local = lv4]; + v817 = arith.constant 0 : i32; + v818 = arith.constant -1 : i32; + v175 = arith.bxor v173, v818 : i32; + v177 = hir.bitcast v175 : u32; + v176 = hir.bitcast v167 : u32; + v178 = arith.gt v176, v177 : i1; + v179 = arith.zext v178 : u32; + v180 = hir.bitcast v179 : i32; + v182 = arith.neq v180, v817 : i1; + scf.if v182{ + ^block95: + scf.yield ; } else { ^block34: - v164 = hir.bitcast v92 : u32; - v693 = arith.constant 4 : u32; - v166 = arith.mod v164, v693 : u32; - hir.assertz v166 #[code = 250]; - v163 = arith.add v153, v128 : i32 #[overflow = wrapping]; - v167 = hir.int_to_ptr v164 : ptr; - hir.store v167, v163; - v169 = arith.add v153, v113 : i32 #[overflow = wrapping]; - scf.yield v169; + v183 = hir.load_local : i32 #[local = lv0]; + v184 = hir.load_local : i32 #[local = lv4]; + v185 = hir.load_local : i32 #[local = lv2]; + v187 = hir.bitcast v183 : u32; + v816 = arith.constant 4 : u32; + v189 = arith.mod v187, v816 : u32; + hir.assertz v189 #[code = 250]; + v186 = arith.add v184, v185 : i32 #[overflow = wrapping]; + v190 = hir.int_to_ptr v187 : ptr; + hir.store v190, v186; + v191 = hir.load_local : i32 #[local = lv4]; + v192 = hir.load_local : i32 #[local = lv1]; + v193 = arith.add v191, v192 : i32 #[overflow = wrapping]; + hir.store_local v193 #[local = lv3]; + scf.yield ; }; - scf.yield v688; + v194 = hir.load_local : i32 #[local = lv3]; + scf.yield v194; }; - v671 = arith.constant 1 : u32; - v692 = arith.constant 0 : u32; - v690 = cf.select v121, v692, v671 : u32; - scf.yield v689, v690; + v803 = arith.constant 1 : u32; + v815 = arith.constant 0 : u32; + v813 = cf.select v136, v815, v803 : u32; + scf.yield v812, v813; }; - v691 = arith.constant 0 : u32; - v687 = arith.eq v675, v691 : i1; - cf.cond_br v687 ^block28, ^block102(v674); + v814 = arith.constant 0 : u32; + v811 = arith.eq v807, v814 : i1; + cf.cond_br v811 ^block28, ^block100(v806); ^block28: ub.unreachable ; - ^block102(v667: i32): - builtin.ret v667; + ^block100(v799: i32): + builtin.ret v799; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { ^block35: - v172 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v172; + v195 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v195; }; - private builtin.function @>::with_capacity(v174: i32) { - ^block39(v174: i32): - v177 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v178 = hir.bitcast v177 : ptr; - v179 = hir.load v178 : i32; - v180 = arith.constant 16 : i32; - v181 = arith.sub v179, v180 : i32 #[overflow = wrapping]; - v182 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v183 = hir.bitcast v182 : ptr; - hir.store v183, v181; - v710 = arith.constant 16 : i32; - v184 = arith.constant 8 : i32; - v185 = arith.add v181, v184 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::with_capacity_in(v185, v710, v710) - v189 = arith.constant 8 : u32; - v188 = hir.bitcast v181 : u32; - v190 = arith.add v188, v189 : u32 #[overflow = checked]; - v709 = arith.constant 8 : u32; - v192 = arith.mod v190, v709 : u32; - hir.assertz v192 #[code = 250]; - v193 = hir.int_to_ptr v190 : ptr; - v194 = hir.load v193 : i64; - v708 = arith.constant 8 : u32; - v196 = hir.bitcast v174 : u32; - v198 = arith.add v196, v708 : u32 #[overflow = checked]; - v199 = arith.constant 4 : u32; - v200 = arith.mod v198, v199 : u32; - hir.assertz v200 #[code = 250]; - v175 = arith.constant 0 : i32; - v201 = hir.int_to_ptr v198 : ptr; - hir.store v201, v175; - v202 = hir.bitcast v174 : u32; - v707 = arith.constant 4 : u32; - v204 = arith.mod v202, v707 : u32; - hir.assertz v204 #[code = 250]; - v205 = hir.int_to_ptr v202 : ptr; - hir.store v205, v194; - v706 = arith.constant 16 : i32; - v207 = arith.add v181, v706 : i32 #[overflow = wrapping]; - v208 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v209 = hir.bitcast v208 : ptr; - hir.store v209, v207; + private builtin.function @>::with_capacity(v197: i32) { + ^block39(v197: i32): + hir.store_local v197 #[local = lv0]; + v198 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v199 = hir.bitcast v198 : ptr; + v200 = hir.load v199 : i32; + v834 = arith.constant 16 : i32; + v202 = arith.sub v200, v834 : i32 #[overflow = wrapping]; + hir.store_local v202 #[local = lv1]; + v203 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v204 = hir.bitcast v203 : ptr; + hir.store v204, v202; + v205 = hir.load_local : i32 #[local = lv1]; + v844 = arith.constant 16 : i32; + v832 = arith.constant 256 : i32; + v833 = arith.constant 8 : i32; + v207 = arith.add v205, v833 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::with_capacity_in(v207, v832, v844, v844) + v211 = hir.load_local : i32 #[local = lv1]; + v831 = arith.constant 8 : u32; + v212 = hir.bitcast v211 : u32; + v214 = arith.add v212, v831 : u32 #[overflow = checked]; + v843 = arith.constant 8 : u32; + v216 = arith.mod v214, v843 : u32; + hir.assertz v216 #[code = 250]; + v217 = hir.int_to_ptr v214 : ptr; + v218 = hir.load v217 : i64; + v219 = hir.load_local : i32 #[local = lv0]; + v842 = arith.constant 8 : u32; + v221 = hir.bitcast v219 : u32; + v223 = arith.add v221, v842 : u32 #[overflow = checked]; + v829 = arith.constant 4 : u32; + v225 = arith.mod v223, v829 : u32; + hir.assertz v225 #[code = 250]; + v830 = arith.constant 0 : i32; + v226 = hir.int_to_ptr v223 : ptr; + hir.store v226, v830; + v227 = hir.load_local : i32 #[local = lv0]; + v229 = hir.bitcast v227 : u32; + v841 = arith.constant 4 : u32; + v231 = arith.mod v229, v841 : u32; + hir.assertz v231 #[code = 250]; + v232 = hir.int_to_ptr v229 : ptr; + hir.store v232, v218; + v233 = hir.load_local : i32 #[local = lv1]; + v840 = arith.constant 16 : i32; + v235 = arith.add v233, v840 : i32 #[overflow = wrapping]; + v236 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v237 = hir.bitcast v236 : ptr; + hir.store v237, v235; builtin.ret ; }; - private builtin.function @::with_capacity_in(v210: i32, v211: i32, v212: i32) { - ^block41(v210: i32, v211: i32, v212: i32): - v214 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v215 = hir.bitcast v214 : ptr; - v216 = hir.load v215 : i32; - v217 = arith.constant 16 : i32; - v218 = arith.sub v216, v217 : i32 #[overflow = wrapping]; - v219 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v220 = hir.bitcast v219 : ptr; - hir.store v220, v218; - v213 = arith.constant 0 : i32; - v223 = arith.constant 256 : i32; - v221 = arith.constant 4 : i32; - v222 = arith.add v218, v221 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::try_allocate_in(v222, v223, v213, v211, v212) - v226 = arith.constant 8 : u32; - v225 = hir.bitcast v218 : u32; - v227 = arith.add v225, v226 : u32 #[overflow = checked]; - v228 = arith.constant 4 : u32; - v229 = arith.mod v227, v228 : u32; - hir.assertz v229 #[code = 250]; - v230 = hir.int_to_ptr v227 : ptr; - v231 = hir.load v230 : i32; - v721 = arith.constant 4 : u32; - v232 = hir.bitcast v218 : u32; - v234 = arith.add v232, v721 : u32 #[overflow = checked]; - v720 = arith.constant 4 : u32; - v236 = arith.mod v234, v720 : u32; - hir.assertz v236 #[code = 250]; - v237 = hir.int_to_ptr v234 : ptr; - v238 = hir.load v237 : i32; - v719 = arith.constant 0 : i32; - v239 = arith.constant 1 : i32; - v240 = arith.neq v238, v239 : i1; - v241 = arith.zext v240 : u32; - v242 = hir.bitcast v241 : i32; - v244 = arith.neq v242, v719 : i1; - cf.cond_br v244 ^block43, ^block44; + private builtin.function @::with_capacity_in(v238: i32, v239: i32, v240: i32, v241: i32) { + ^block41(v238: i32, v239: i32, v240: i32, v241: i32): + hir.store_local v238 #[local = lv0]; + hir.store_local v241 #[local = lv3]; + v242 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v243 = hir.bitcast v242 : ptr; + v244 = hir.load v243 : i32; + v851 = arith.constant 16 : i32; + v246 = arith.sub v244, v851 : i32 #[overflow = wrapping]; + hir.store_local v246 #[local = lv4]; + v247 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v248 = hir.bitcast v247 : ptr; + hir.store v248, v246; + v249 = hir.load_local : i32 #[local = lv4]; + v255 = hir.load_local : i32 #[local = lv3]; + v849 = arith.constant 0 : i32; + v850 = arith.constant 4 : i32; + v251 = arith.add v249, v850 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::try_allocate_in(v251, v239, v849, v240, v255) + v256 = hir.load_local : i32 #[local = lv4]; + v848 = arith.constant 8 : u32; + v257 = hir.bitcast v256 : u32; + v259 = arith.add v257, v848 : u32 #[overflow = checked]; + v847 = arith.constant 4 : u32; + v261 = arith.mod v259, v847 : u32; + hir.assertz v261 #[code = 250]; + v262 = hir.int_to_ptr v259 : ptr; + v263 = hir.load v262 : i32; + hir.store_local v263 #[local = lv3]; + v264 = hir.load_local : i32 #[local = lv4]; + v872 = arith.constant 4 : u32; + v265 = hir.bitcast v264 : u32; + v267 = arith.add v265, v872 : u32 #[overflow = checked]; + v871 = arith.constant 4 : u32; + v269 = arith.mod v267, v871 : u32; + hir.assertz v269 #[code = 250]; + v270 = hir.int_to_ptr v267 : ptr; + v271 = hir.load v270 : i32; + v870 = arith.constant 0 : i32; + v846 = arith.constant 1 : i32; + v273 = arith.neq v271, v846 : i1; + v274 = arith.zext v273 : u32; + v275 = hir.bitcast v274 : i32; + v277 = arith.neq v275, v870 : i1; + cf.cond_br v277 ^block43, ^block44; ^block43: - v253 = arith.constant 12 : u32; - v252 = hir.bitcast v218 : u32; - v254 = arith.add v252, v253 : u32 #[overflow = checked]; - v718 = arith.constant 4 : u32; - v256 = arith.mod v254, v718 : u32; - hir.assertz v256 #[code = 250]; - v257 = hir.int_to_ptr v254 : ptr; - v258 = hir.load v257 : i32; - v717 = arith.constant 4 : u32; - v259 = hir.bitcast v210 : u32; - v261 = arith.add v259, v717 : u32 #[overflow = checked]; - v716 = arith.constant 4 : u32; - v263 = arith.mod v261, v716 : u32; - hir.assertz v263 #[code = 250]; - v264 = hir.int_to_ptr v261 : ptr; - hir.store v264, v258; - v265 = hir.bitcast v210 : u32; - v715 = arith.constant 4 : u32; - v267 = arith.mod v265, v715 : u32; - hir.assertz v267 #[code = 250]; - v268 = hir.int_to_ptr v265 : ptr; - hir.store v268, v231; - v714 = arith.constant 16 : i32; - v270 = arith.add v218, v714 : i32 #[overflow = wrapping]; - v271 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v272 = hir.bitcast v271 : ptr; - hir.store v272, v270; + v287 = hir.load_local : i32 #[local = lv0]; + v288 = hir.load_local : i32 #[local = lv4]; + v845 = arith.constant 12 : u32; + v289 = hir.bitcast v288 : u32; + v291 = arith.add v289, v845 : u32 #[overflow = checked]; + v869 = arith.constant 4 : u32; + v293 = arith.mod v291, v869 : u32; + hir.assertz v293 #[code = 250]; + v294 = hir.int_to_ptr v291 : ptr; + v295 = hir.load v294 : i32; + v868 = arith.constant 4 : u32; + v296 = hir.bitcast v287 : u32; + v298 = arith.add v296, v868 : u32 #[overflow = checked]; + v867 = arith.constant 4 : u32; + v300 = arith.mod v298, v867 : u32; + hir.assertz v300 #[code = 250]; + v301 = hir.int_to_ptr v298 : ptr; + hir.store v301, v295; + v302 = hir.load_local : i32 #[local = lv0]; + v303 = hir.load_local : i32 #[local = lv3]; + v304 = hir.bitcast v302 : u32; + v866 = arith.constant 4 : u32; + v306 = arith.mod v304, v866 : u32; + hir.assertz v306 #[code = 250]; + v307 = hir.int_to_ptr v304 : ptr; + hir.store v307, v303; + v308 = hir.load_local : i32 #[local = lv4]; + v865 = arith.constant 16 : i32; + v310 = arith.add v308, v865 : i32 #[overflow = wrapping]; + v311 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v312 = hir.bitcast v311 : ptr; + hir.store v312, v310; builtin.ret ; ^block44: - v713 = arith.constant 12 : u32; - v245 = hir.bitcast v218 : u32; - v247 = arith.add v245, v713 : u32 #[overflow = checked]; - v712 = arith.constant 4 : u32; - v249 = arith.mod v247, v712 : u32; - hir.assertz v249 #[code = 250]; - v250 = hir.int_to_ptr v247 : ptr; - v251 = hir.load v250 : i32; - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/alloc::raw_vec::handle_error(v231, v251) + v278 = hir.load_local : i32 #[local = lv3]; + v279 = hir.load_local : i32 #[local = lv4]; + v864 = arith.constant 12 : u32; + v280 = hir.bitcast v279 : u32; + v282 = arith.add v280, v864 : u32 #[overflow = checked]; + v863 = arith.constant 4 : u32; + v284 = arith.mod v282, v863 : u32; + hir.assertz v284 #[code = 250]; + v285 = hir.int_to_ptr v282 : ptr; + v286 = hir.load v285 : i32; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/alloc::raw_vec::handle_error(v278, v286) ub.unreachable ; }; - private builtin.function @miden_base_sys::bindings::input_note::get_assets(v273: i32, v274: felt) { - ^block45(v273: i32, v274: felt): - v276 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v277 = hir.bitcast v276 : ptr; - v278 = hir.load v277 : i32; - v279 = arith.constant 16 : i32; - v280 = arith.sub v278, v279 : i32 #[overflow = wrapping]; - v281 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v282 = hir.bitcast v281 : ptr; - hir.store v282, v280; - v283 = arith.constant 4 : i32; - v284 = arith.add v280, v283 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/>::with_capacity(v284) - v288 = arith.constant 8 : u32; - v287 = hir.bitcast v280 : u32; - v289 = arith.add v287, v288 : u32 #[overflow = checked]; - v290 = arith.constant 4 : u32; - v291 = arith.mod v289, v290 : u32; - hir.assertz v291 #[code = 250]; - v292 = hir.int_to_ptr v289 : ptr; - v293 = hir.load v292 : i32; - v722 = arith.constant 2 : u32; - v295 = hir.bitcast v293 : u32; - v297 = arith.shr v295, v722 : u32; - v298 = hir.bitcast v297 : i32; - v299 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/miden::input_note::get_assets(v298, v274) : i32 - v285 = arith.constant 8 : i32; - v286 = arith.add v273, v285 : i32 #[overflow = wrapping]; - v300 = hir.bitcast v286 : u32; - v727 = arith.constant 4 : u32; - v302 = arith.mod v300, v727 : u32; - hir.assertz v302 #[code = 250]; - v303 = hir.int_to_ptr v300 : ptr; - hir.store v303, v299; - v726 = arith.constant 4 : u32; - v304 = hir.bitcast v280 : u32; - v306 = arith.add v304, v726 : u32 #[overflow = checked]; - v725 = arith.constant 4 : u32; - v308 = arith.mod v306, v725 : u32; - hir.assertz v308 #[code = 250]; - v309 = hir.int_to_ptr v306 : ptr; - v310 = hir.load v309 : i64; - v311 = hir.bitcast v273 : u32; - v724 = arith.constant 4 : u32; - v313 = arith.mod v311, v724 : u32; - hir.assertz v313 #[code = 250]; - v314 = hir.int_to_ptr v311 : ptr; - hir.store v314, v310; - v723 = arith.constant 16 : i32; - v316 = arith.add v280, v723 : i32 #[overflow = wrapping]; - v317 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v318 = hir.bitcast v317 : ptr; - hir.store v318, v316; + private builtin.function @miden_base_sys::bindings::input_note::get_assets(v313: i32, v314: felt) { + ^block45(v313: i32, v314: felt): + hir.store_local v313 #[local = lv0]; + hir.store_local v314 #[local = lv1]; + v315 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v316 = hir.bitcast v315 : ptr; + v317 = hir.load v316 : i32; + v879 = arith.constant 16 : i32; + v319 = arith.sub v317, v879 : i32 #[overflow = wrapping]; + hir.store_local v319 #[local = lv2]; + v320 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v321 = hir.bitcast v320 : ptr; + hir.store v321, v319; + v322 = hir.load_local : i32 #[local = lv2]; + v878 = arith.constant 4 : i32; + v324 = arith.add v322, v878 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/>::with_capacity(v324) + v325 = hir.load_local : i32 #[local = lv0]; + v328 = hir.load_local : i32 #[local = lv2]; + v876 = arith.constant 8 : u32; + v329 = hir.bitcast v328 : u32; + v331 = arith.add v329, v876 : u32 #[overflow = checked]; + v875 = arith.constant 4 : u32; + v333 = arith.mod v331, v875 : u32; + hir.assertz v333 #[code = 250]; + v334 = hir.int_to_ptr v331 : ptr; + v335 = hir.load v334 : i32; + v341 = hir.load_local : felt #[local = lv1]; + v874 = arith.constant 2 : u32; + v337 = hir.bitcast v335 : u32; + v339 = arith.shr v337, v874 : u32; + v340 = hir.bitcast v339 : i32; + v342 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/miden::protocol::input_note::get_assets(v340, v341) : i32 + v877 = arith.constant 8 : i32; + v327 = arith.add v325, v877 : i32 #[overflow = wrapping]; + v343 = hir.bitcast v327 : u32; + v889 = arith.constant 4 : u32; + v345 = arith.mod v343, v889 : u32; + hir.assertz v345 #[code = 250]; + v346 = hir.int_to_ptr v343 : ptr; + hir.store v346, v342; + v347 = hir.load_local : i32 #[local = lv0]; + v348 = hir.load_local : i32 #[local = lv2]; + v888 = arith.constant 4 : u32; + v349 = hir.bitcast v348 : u32; + v351 = arith.add v349, v888 : u32 #[overflow = checked]; + v887 = arith.constant 4 : u32; + v353 = arith.mod v351, v887 : u32; + hir.assertz v353 #[code = 250]; + v354 = hir.int_to_ptr v351 : ptr; + v355 = hir.load v354 : i64; + v356 = hir.bitcast v347 : u32; + v886 = arith.constant 4 : u32; + v358 = arith.mod v356, v886 : u32; + hir.assertz v358 #[code = 250]; + v359 = hir.int_to_ptr v356 : ptr; + hir.store v359, v355; + v360 = hir.load_local : i32 #[local = lv2]; + v885 = arith.constant 16 : i32; + v362 = arith.add v360, v885 : i32 #[overflow = wrapping]; + v363 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v364 = hir.bitcast v363 : ptr; + hir.store v364, v362; builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v319: i32) -> felt { - ^block47(v319: i32): - v320 = hir.bitcast v319 : felt; - builtin.ret v320; - }; - - private builtin.function @::alloc_impl(v322: i32, v323: i32, v324: i32, v325: i32) { - ^block49(v322: i32, v323: i32, v324: i32, v325: i32): - v743 = arith.constant 0 : i32; - v326 = arith.constant 0 : i32; - v327 = arith.eq v324, v326 : i1; - v328 = arith.zext v327 : u32; - v329 = hir.bitcast v328 : i32; - v331 = arith.neq v329, v743 : i1; - v739 = scf.if v331 : i32 { - ^block108: - scf.yield v323; + private builtin.function @::alloc_impl(v365: i32, v366: i32, v367: i32, v368: i32) { + ^block47(v365: i32, v366: i32, v367: i32, v368: i32): + hir.store_local v365 #[local = lv0]; + hir.store_local v366 #[local = lv1]; + hir.store_local v367 #[local = lv2]; + hir.store_local v368 #[local = lv3]; + v369 = hir.load_local : i32 #[local = lv2]; + v900 = arith.constant 0 : i32; + v895 = arith.constant 0 : i32; + v371 = arith.eq v369, v895 : i1; + v372 = arith.zext v371 : u32; + v373 = hir.bitcast v372 : i32; + v375 = arith.neq v373, v900 : i1; + scf.if v375{ + ^block105: + scf.yield ; } else { - ^block52: + ^block50: hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v742 = arith.constant 0 : i32; - v333 = arith.neq v325, v742 : i1; - v738 = scf.if v333 : i32 { - ^block53: - v335 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__rustc::__rust_alloc_zeroed(v324, v323) : i32 - scf.yield v335; + v376 = hir.load_local : i32 #[local = lv3]; + v899 = arith.constant 0 : i32; + v378 = arith.neq v376, v899 : i1; + scf.if v378{ + ^block51: + v382 = hir.load_local : i32 #[local = lv2]; + v383 = hir.load_local : i32 #[local = lv1]; + v384 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__rustc::__rust_alloc_zeroed(v382, v383) : i32 + hir.store_local v384 #[local = lv1]; + scf.yield ; } else { - ^block54: - v334 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__rustc::__rust_alloc(v324, v323) : i32 - scf.yield v334; + ^block52: + v379 = hir.load_local : i32 #[local = lv2]; + v380 = hir.load_local : i32 #[local = lv1]; + v381 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__rustc::__rust_alloc(v379, v380) : i32 + hir.store_local v381 #[local = lv1]; + scf.yield ; }; - scf.yield v738; + scf.yield ; }; - v339 = arith.constant 4 : u32; - v338 = hir.bitcast v322 : u32; - v340 = arith.add v338, v339 : u32 #[overflow = checked]; - v741 = arith.constant 4 : u32; - v342 = arith.mod v340, v741 : u32; - hir.assertz v342 #[code = 250]; - v343 = hir.int_to_ptr v340 : ptr; - hir.store v343, v324; - v345 = hir.bitcast v322 : u32; - v740 = arith.constant 4 : u32; - v347 = arith.mod v345, v740 : u32; - hir.assertz v347 #[code = 250]; - v348 = hir.int_to_ptr v345 : ptr; - hir.store v348, v739; + v385 = hir.load_local : i32 #[local = lv0]; + v386 = hir.load_local : i32 #[local = lv2]; + v890 = arith.constant 4 : u32; + v387 = hir.bitcast v385 : u32; + v389 = arith.add v387, v890 : u32 #[overflow = checked]; + v898 = arith.constant 4 : u32; + v391 = arith.mod v389, v898 : u32; + hir.assertz v391 #[code = 250]; + v392 = hir.int_to_ptr v389 : ptr; + hir.store v392, v386; + v393 = hir.load_local : i32 #[local = lv0]; + v394 = hir.load_local : i32 #[local = lv1]; + v395 = hir.bitcast v393 : u32; + v897 = arith.constant 4 : u32; + v397 = arith.mod v395, v897 : u32; + hir.assertz v397 #[code = 250]; + v398 = hir.int_to_ptr v395 : ptr; + hir.store v398, v394; builtin.ret ; }; - private builtin.function @::deallocate(v349: i32, v350: i32, v351: i32) { - ^block55(v349: i32, v350: i32, v351: i32): - v353 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v354 = hir.bitcast v353 : ptr; - v355 = hir.load v354 : i32; - v356 = arith.constant 16 : i32; - v357 = arith.sub v355, v356 : i32 #[overflow = wrapping]; - v358 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v359 = hir.bitcast v358 : ptr; - hir.store v359, v357; - v360 = arith.constant 4 : i32; - v361 = arith.add v357, v360 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::current_memory(v361, v349, v350, v351) - v363 = arith.constant 8 : u32; - v362 = hir.bitcast v357 : u32; - v364 = arith.add v362, v363 : u32 #[overflow = checked]; - v365 = arith.constant 4 : u32; - v366 = arith.mod v364, v365 : u32; - hir.assertz v366 #[code = 250]; - v367 = hir.int_to_ptr v364 : ptr; - v368 = hir.load v367 : i32; - v750 = arith.constant 0 : i32; - v352 = arith.constant 0 : i32; - v370 = arith.eq v368, v352 : i1; - v371 = arith.zext v370 : u32; - v372 = hir.bitcast v371 : i32; - v374 = arith.neq v372, v750 : i1; - scf.if v374{ - ^block111: + private builtin.function @::deallocate(v399: i32, v400: i32, v401: i32) { + ^block53(v399: i32, v400: i32, v401: i32): + hir.store_local v401 #[local = lv2]; + v402 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v403 = hir.bitcast v402 : ptr; + v404 = hir.load v403 : i32; + v906 = arith.constant 16 : i32; + v406 = arith.sub v404, v906 : i32 #[overflow = wrapping]; + hir.store_local v406 #[local = lv3]; + v407 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v408 = hir.bitcast v407 : ptr; + hir.store v408, v406; + v409 = hir.load_local : i32 #[local = lv3]; + v414 = hir.load_local : i32 #[local = lv2]; + v905 = arith.constant 4 : i32; + v411 = arith.add v409, v905 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::current_memory(v411, v399, v400, v414) + v415 = hir.load_local : i32 #[local = lv3]; + v904 = arith.constant 8 : u32; + v416 = hir.bitcast v415 : u32; + v418 = arith.add v416, v904 : u32 #[overflow = checked]; + v903 = arith.constant 4 : u32; + v420 = arith.mod v418, v903 : u32; + hir.assertz v420 #[code = 250]; + v421 = hir.int_to_ptr v418 : ptr; + v422 = hir.load v421 : i32; + hir.store_local v422 #[local = lv2]; + v917 = arith.constant 0 : i32; + v911 = arith.constant 0 : i32; + v424 = arith.eq v422, v911 : i1; + v425 = arith.zext v424 : u32; + v426 = hir.bitcast v425 : i32; + v428 = arith.neq v426, v917 : i1; + scf.if v428{ + ^block108: scf.yield ; } else { - ^block58: - v749 = arith.constant 4 : u32; - v375 = hir.bitcast v357 : u32; - v377 = arith.add v375, v749 : u32 #[overflow = checked]; - v748 = arith.constant 4 : u32; - v379 = arith.mod v377, v748 : u32; - hir.assertz v379 #[code = 250]; - v380 = hir.int_to_ptr v377 : ptr; - v381 = hir.load v380 : i32; - v383 = arith.constant 12 : u32; - v382 = hir.bitcast v357 : u32; - v384 = arith.add v382, v383 : u32 #[overflow = checked]; - v747 = arith.constant 4 : u32; - v386 = arith.mod v384, v747 : u32; - hir.assertz v386 #[code = 250]; - v387 = hir.int_to_ptr v384 : ptr; - v388 = hir.load v387 : i32; - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::deallocate(v381, v368, v388) + ^block56: + v429 = hir.load_local : i32 #[local = lv3]; + v916 = arith.constant 4 : u32; + v430 = hir.bitcast v429 : u32; + v432 = arith.add v430, v916 : u32 #[overflow = checked]; + v915 = arith.constant 4 : u32; + v434 = arith.mod v432, v915 : u32; + hir.assertz v434 #[code = 250]; + v435 = hir.int_to_ptr v432 : ptr; + v436 = hir.load v435 : i32; + v437 = hir.load_local : i32 #[local = lv2]; + v438 = hir.load_local : i32 #[local = lv3]; + v901 = arith.constant 12 : u32; + v439 = hir.bitcast v438 : u32; + v441 = arith.add v439, v901 : u32 #[overflow = checked]; + v914 = arith.constant 4 : u32; + v443 = arith.mod v441, v914 : u32; + hir.assertz v443 #[code = 250]; + v444 = hir.int_to_ptr v441 : ptr; + v445 = hir.load v444 : i32; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::deallocate(v436, v437, v445) scf.yield ; }; - v746 = arith.constant 16 : i32; - v391 = arith.add v357, v746 : i32 #[overflow = wrapping]; - v392 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v393 = hir.bitcast v392 : ptr; - hir.store v393, v391; + v446 = hir.load_local : i32 #[local = lv3]; + v913 = arith.constant 16 : i32; + v448 = arith.add v446, v913 : i32 #[overflow = wrapping]; + v449 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v450 = hir.bitcast v449 : ptr; + hir.store v450, v448; builtin.ret ; }; - private builtin.function @::current_memory(v394: i32, v395: i32, v396: i32, v397: i32) { - ^block59(v394: i32, v395: i32, v396: i32, v397: i32): - v776 = arith.constant 0 : i32; - v398 = arith.constant 0 : i32; - v402 = arith.eq v397, v398 : i1; - v403 = arith.zext v402 : u32; - v404 = hir.bitcast v403 : i32; - v406 = arith.neq v404, v776 : i1; - v763, v764 = scf.if v406 : i32, i32 { - ^block114: - v775 = arith.constant 0 : i32; - v400 = arith.constant 4 : i32; - scf.yield v400, v775; + private builtin.function @::current_memory(v451: i32, v452: i32, v453: i32, v454: i32) { + ^block57(v451: i32, v452: i32, v453: i32, v454: i32): + hir.store_local v451 #[local = lv0]; + hir.store_local v452 #[local = lv1]; + hir.store_local v453 #[local = lv2]; + hir.store_local v454 #[local = lv3]; + v921 = arith.constant 0 : i32; + hir.store_local v921 #[local = lv4]; + v920 = arith.constant 4 : i32; + hir.store_local v920 #[local = lv5]; + v457 = hir.load_local : i32 #[local = lv3]; + v941 = arith.constant 0 : i32; + v942 = arith.constant 0 : i32; + v459 = arith.eq v457, v942 : i1; + v460 = arith.zext v459 : u32; + v461 = hir.bitcast v460 : i32; + v463 = arith.neq v461, v941 : i1; + scf.if v463{ + ^block111: + scf.yield ; } else { - ^block62: - v407 = hir.bitcast v395 : u32; - v442 = arith.constant 4 : u32; - v409 = arith.mod v407, v442 : u32; - hir.assertz v409 #[code = 250]; - v410 = hir.int_to_ptr v407 : ptr; - v411 = hir.load v410 : i32; - v773 = arith.constant 0 : i32; - v774 = arith.constant 0 : i32; - v413 = arith.eq v411, v774 : i1; - v414 = arith.zext v413 : u32; - v415 = hir.bitcast v414 : i32; - v417 = arith.neq v415, v773 : i1; - v761 = scf.if v417 : i32 { - ^block113: - v772 = arith.constant 0 : i32; - scf.yield v772; + ^block60: + v464 = hir.load_local : i32 #[local = lv1]; + v465 = hir.bitcast v464 : u32; + v929 = arith.constant 4 : u32; + v467 = arith.mod v465, v929 : u32; + hir.assertz v467 #[code = 250]; + v468 = hir.int_to_ptr v465 : ptr; + v469 = hir.load v468 : i32; + hir.store_local v469 #[local = lv6]; + v939 = arith.constant 0 : i32; + v940 = arith.constant 0 : i32; + v471 = arith.eq v469, v940 : i1; + v472 = arith.zext v471 : u32; + v473 = hir.bitcast v472 : i32; + v475 = arith.neq v473, v939 : i1; + scf.if v475{ + ^block110: + scf.yield ; } else { - ^block63: - v771 = arith.constant 4 : u32; - v418 = hir.bitcast v394 : u32; - v420 = arith.add v418, v771 : u32 #[overflow = checked]; - v770 = arith.constant 4 : u32; - v422 = arith.mod v420, v770 : u32; - hir.assertz v422 #[code = 250]; - v423 = hir.int_to_ptr v420 : ptr; - hir.store v423, v396; - v769 = arith.constant 4 : u32; - v424 = hir.bitcast v395 : u32; - v426 = arith.add v424, v769 : u32 #[overflow = checked]; - v768 = arith.constant 4 : u32; - v428 = arith.mod v426, v768 : u32; - hir.assertz v428 #[code = 250]; - v429 = hir.int_to_ptr v426 : ptr; - v430 = hir.load v429 : i32; - v431 = hir.bitcast v394 : u32; - v767 = arith.constant 4 : u32; - v433 = arith.mod v431, v767 : u32; - hir.assertz v433 #[code = 250]; - v434 = hir.int_to_ptr v431 : ptr; - hir.store v434, v430; - v435 = arith.mul v411, v397 : i32 #[overflow = wrapping]; - scf.yield v435; + ^block61: + v476 = hir.load_local : i32 #[local = lv0]; + v477 = hir.load_local : i32 #[local = lv2]; + v938 = arith.constant 4 : u32; + v478 = hir.bitcast v476 : u32; + v480 = arith.add v478, v938 : u32 #[overflow = checked]; + v937 = arith.constant 4 : u32; + v482 = arith.mod v480, v937 : u32; + hir.assertz v482 #[code = 250]; + v483 = hir.int_to_ptr v480 : ptr; + hir.store v483, v477; + v484 = hir.load_local : i32 #[local = lv0]; + v485 = hir.load_local : i32 #[local = lv1]; + v936 = arith.constant 4 : u32; + v486 = hir.bitcast v485 : u32; + v488 = arith.add v486, v936 : u32 #[overflow = checked]; + v935 = arith.constant 4 : u32; + v490 = arith.mod v488, v935 : u32; + hir.assertz v490 #[code = 250]; + v491 = hir.int_to_ptr v488 : ptr; + v492 = hir.load v491 : i32; + v493 = hir.bitcast v484 : u32; + v934 = arith.constant 4 : u32; + v495 = arith.mod v493, v934 : u32; + hir.assertz v495 #[code = 250]; + v496 = hir.int_to_ptr v493 : ptr; + hir.store v496, v492; + v497 = hir.load_local : i32 #[local = lv6]; + v498 = hir.load_local : i32 #[local = lv3]; + v499 = arith.mul v497, v498 : i32 #[overflow = wrapping]; + hir.store_local v499 #[local = lv4]; + v918 = arith.constant 8 : i32; + hir.store_local v918 #[local = lv5]; + scf.yield ; }; - v436 = arith.constant 8 : i32; - v766 = arith.constant 4 : i32; - v762 = cf.select v417, v766, v436 : i32; - scf.yield v762, v761; + scf.yield ; }; - v439 = arith.add v394, v763 : i32 #[overflow = wrapping]; - v441 = hir.bitcast v439 : u32; - v765 = arith.constant 4 : u32; - v443 = arith.mod v441, v765 : u32; - hir.assertz v443 #[code = 250]; - v444 = hir.int_to_ptr v441 : ptr; - hir.store v444, v764; + v501 = hir.load_local : i32 #[local = lv0]; + v502 = hir.load_local : i32 #[local = lv5]; + v504 = hir.load_local : i32 #[local = lv4]; + v503 = arith.add v501, v502 : i32 #[overflow = wrapping]; + v505 = hir.bitcast v503 : u32; + v933 = arith.constant 4 : u32; + v507 = arith.mod v505, v933 : u32; + hir.assertz v507 #[code = 250]; + v508 = hir.int_to_ptr v505 : ptr; + hir.store v508, v504; builtin.ret ; }; - private builtin.function @::deallocate(v445: i32, v446: i32, v447: i32) { - ^block64(v445: i32, v446: i32, v447: i32): - v778 = arith.constant 0 : i32; - v448 = arith.constant 0 : i32; - v449 = arith.eq v447, v448 : i1; - v450 = arith.zext v449 : u32; - v451 = hir.bitcast v450 : i32; - v453 = arith.neq v451, v778 : i1; - scf.if v453{ - ^block66: + private builtin.function @::deallocate(v509: i32, v510: i32, v511: i32) { + ^block62(v509: i32, v510: i32, v511: i32): + hir.store_local v509 #[local = lv0]; + hir.store_local v510 #[local = lv1]; + hir.store_local v511 #[local = lv2]; + v512 = hir.load_local : i32 #[local = lv2]; + v946 = arith.constant 0 : i32; + v944 = arith.constant 0 : i32; + v514 = arith.eq v512, v944 : i1; + v515 = arith.zext v514 : u32; + v516 = hir.bitcast v515 : i32; + v518 = arith.neq v516, v946 : i1; + scf.if v518{ + ^block64: scf.yield ; } else { - ^block67: - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__rustc::__rust_dealloc(v445, v447, v446) + ^block65: + v519 = hir.load_local : i32 #[local = lv0]; + v520 = hir.load_local : i32 #[local = lv2]; + v521 = hir.load_local : i32 #[local = lv1]; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__rustc::__rust_dealloc(v519, v520, v521) scf.yield ; }; builtin.ret ; }; - private builtin.function @::allocate(v454: i32, v455: i32, v456: i32) { - ^block68(v454: i32, v455: i32, v456: i32): - v458 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v459 = hir.bitcast v458 : ptr; - v460 = hir.load v459 : i32; - v461 = arith.constant 16 : i32; - v462 = arith.sub v460, v461 : i32 #[overflow = wrapping]; - v463 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v464 = hir.bitcast v463 : ptr; - hir.store v464, v462; - v457 = arith.constant 0 : i32; - v465 = arith.constant 8 : i32; - v466 = arith.add v462, v465 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::alloc_impl(v466, v455, v456, v457) - v469 = arith.constant 12 : u32; - v468 = hir.bitcast v462 : u32; - v470 = arith.add v468, v469 : u32 #[overflow = checked]; - v471 = arith.constant 4 : u32; - v472 = arith.mod v470, v471 : u32; - hir.assertz v472 #[code = 250]; - v473 = hir.int_to_ptr v470 : ptr; - v474 = hir.load v473 : i32; - v476 = arith.constant 8 : u32; - v475 = hir.bitcast v462 : u32; - v477 = arith.add v475, v476 : u32 #[overflow = checked]; - v783 = arith.constant 4 : u32; - v479 = arith.mod v477, v783 : u32; - hir.assertz v479 #[code = 250]; - v480 = hir.int_to_ptr v477 : ptr; - v481 = hir.load v480 : i32; - v482 = hir.bitcast v454 : u32; - v782 = arith.constant 4 : u32; - v484 = arith.mod v482, v782 : u32; - hir.assertz v484 #[code = 250]; - v485 = hir.int_to_ptr v482 : ptr; - hir.store v485, v481; - v781 = arith.constant 4 : u32; - v486 = hir.bitcast v454 : u32; - v488 = arith.add v486, v781 : u32 #[overflow = checked]; - v780 = arith.constant 4 : u32; - v490 = arith.mod v488, v780 : u32; - hir.assertz v490 #[code = 250]; - v491 = hir.int_to_ptr v488 : ptr; - hir.store v491, v474; - v779 = arith.constant 16 : i32; - v493 = arith.add v462, v779 : i32 #[overflow = wrapping]; - v494 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v495 = hir.bitcast v494 : ptr; - hir.store v495, v493; + private builtin.function @::allocate(v522: i32, v523: i32, v524: i32) { + ^block66(v522: i32, v523: i32, v524: i32): + hir.store_local v522 #[local = lv0]; + hir.store_local v524 #[local = lv2]; + v525 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v526 = hir.bitcast v525 : ptr; + v527 = hir.load v526 : i32; + v952 = arith.constant 16 : i32; + v529 = arith.sub v527, v952 : i32 #[overflow = wrapping]; + hir.store_local v529 #[local = lv3]; + v530 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v531 = hir.bitcast v530 : ptr; + hir.store v531, v529; + v532 = hir.load_local : i32 #[local = lv3]; + v536 = hir.load_local : i32 #[local = lv2]; + v950 = arith.constant 0 : i32; + v951 = arith.constant 8 : i32; + v534 = arith.add v532, v951 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::alloc_impl(v534, v523, v536, v950) + v538 = hir.load_local : i32 #[local = lv3]; + v949 = arith.constant 12 : u32; + v539 = hir.bitcast v538 : u32; + v541 = arith.add v539, v949 : u32 #[overflow = checked]; + v948 = arith.constant 4 : u32; + v543 = arith.mod v541, v948 : u32; + hir.assertz v543 #[code = 250]; + v544 = hir.int_to_ptr v541 : ptr; + v545 = hir.load v544 : i32; + hir.store_local v545 #[local = lv2]; + v546 = hir.load_local : i32 #[local = lv0]; + v547 = hir.load_local : i32 #[local = lv3]; + v947 = arith.constant 8 : u32; + v548 = hir.bitcast v547 : u32; + v550 = arith.add v548, v947 : u32 #[overflow = checked]; + v962 = arith.constant 4 : u32; + v552 = arith.mod v550, v962 : u32; + hir.assertz v552 #[code = 250]; + v553 = hir.int_to_ptr v550 : ptr; + v554 = hir.load v553 : i32; + v555 = hir.bitcast v546 : u32; + v961 = arith.constant 4 : u32; + v557 = arith.mod v555, v961 : u32; + hir.assertz v557 #[code = 250]; + v558 = hir.int_to_ptr v555 : ptr; + hir.store v558, v554; + v559 = hir.load_local : i32 #[local = lv0]; + v560 = hir.load_local : i32 #[local = lv2]; + v960 = arith.constant 4 : u32; + v561 = hir.bitcast v559 : u32; + v563 = arith.add v561, v960 : u32 #[overflow = checked]; + v959 = arith.constant 4 : u32; + v565 = arith.mod v563, v959 : u32; + hir.assertz v565 #[code = 250]; + v566 = hir.int_to_ptr v563 : ptr; + hir.store v566, v560; + v567 = hir.load_local : i32 #[local = lv3]; + v958 = arith.constant 16 : i32; + v569 = arith.add v567, v958 : i32 #[overflow = wrapping]; + v570 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v571 = hir.bitcast v570 : ptr; + hir.store v571, v569; builtin.ret ; }; - private builtin.function @::try_allocate_in(v496: i32, v497: i32, v498: i32, v499: i32, v500: i32) { - ^block70(v496: i32, v497: i32, v498: i32, v499: i32, v500: i32): - v503 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v504 = hir.bitcast v503 : ptr; - v505 = hir.load v504 : i32; - v506 = arith.constant 16 : i32; - v507 = arith.sub v505, v506 : i32 #[overflow = wrapping]; - v508 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v509 = hir.bitcast v508 : ptr; - hir.store v509, v507; - v519 = hir.bitcast v497 : u32; - v520 = arith.zext v519 : u64; - v521 = hir.bitcast v520 : i64; - v501 = arith.constant 0 : i32; - v514 = arith.sub v501, v499 : i32 #[overflow = wrapping]; - v511 = arith.constant -1 : i32; - v510 = arith.add v499, v500 : i32 #[overflow = wrapping]; - v512 = arith.add v510, v511 : i32 #[overflow = wrapping]; - v515 = arith.band v512, v514 : i32; - v516 = hir.bitcast v515 : u32; - v517 = arith.zext v516 : u64; - v518 = hir.bitcast v517 : i64; - v522 = arith.mul v518, v521 : i64 #[overflow = wrapping]; - v886 = arith.constant 0 : i32; - v523 = arith.constant 32 : i64; - v525 = hir.cast v523 : u32; - v524 = hir.bitcast v522 : u64; - v526 = arith.shr v524, v525 : u64; - v527 = hir.bitcast v526 : i64; - v528 = arith.trunc v527 : i32; - v530 = arith.neq v528, v886 : i1; - v799, v800, v801, v802, v803, v804 = scf.if v530 : i32, i32, i32, i32, i32, u32 { - ^block118: - v784 = arith.constant 0 : u32; - v791 = ub.poison i32 : i32; - scf.yield v496, v507, v791, v791, v791, v784; + private builtin.function @::try_allocate_in(v572: i32, v573: i32, v574: i32, v575: i32, v576: i32) { + ^block68(v572: i32, v573: i32, v574: i32, v575: i32, v576: i32): + hir.store_local v572 #[local = lv0]; + hir.store_local v573 #[local = lv1]; + hir.store_local v574 #[local = lv2]; + hir.store_local v575 #[local = lv3]; + hir.store_local v576 #[local = lv4]; + v577 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v578 = hir.bitcast v577 : ptr; + v579 = hir.load v578 : i32; + v971 = arith.constant 16 : i32; + v581 = arith.sub v579, v971 : i32 #[overflow = wrapping]; + hir.store_local v581 #[local = lv5]; + v582 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v583 = hir.bitcast v582 : ptr; + hir.store v583, v581; + v584 = hir.load_local : i32 #[local = lv3]; + v585 = hir.load_local : i32 #[local = lv4]; + v596 = hir.load_local : i32 #[local = lv1]; + v597 = hir.bitcast v596 : u32; + v598 = arith.zext v597 : u64; + v599 = hir.bitcast v598 : i64; + v969 = arith.constant 0 : i32; + v591 = arith.sub v969, v584 : i32 #[overflow = wrapping]; + v970 = arith.constant -1 : i32; + v586 = arith.add v584, v585 : i32 #[overflow = wrapping]; + v588 = arith.add v586, v970 : i32 #[overflow = wrapping]; + v592 = arith.band v588, v591 : i32; + v593 = hir.bitcast v592 : u32; + v594 = arith.zext v593 : u64; + v595 = hir.bitcast v594 : i64; + v600 = arith.mul v595, v599 : i64 #[overflow = wrapping]; + hir.store_local v600 #[local = lv6]; + v1039 = arith.constant 0 : i32; + v968 = arith.constant 32 : i64; + v603 = hir.cast v968 : u32; + v602 = hir.bitcast v600 : u64; + v604 = arith.shr v602, v603 : u64; + v605 = hir.bitcast v604 : i64; + v606 = arith.trunc v605 : i32; + v608 = arith.neq v606, v1039 : i1; + v1004 = scf.if v608 : u32 { + ^block115: + v1000 = arith.constant 0 : u32; + scf.yield v1000; } else { - ^block75: - v531 = arith.trunc v522 : i32; - v885 = arith.constant 0 : i32; - v532 = arith.constant -2147483648 : i32; - v533 = arith.sub v532, v499 : i32 #[overflow = wrapping]; - v535 = hir.bitcast v533 : u32; - v534 = hir.bitcast v531 : u32; - v536 = arith.lte v534, v535 : i1; - v537 = arith.zext v536 : u32; - v538 = hir.bitcast v537 : i32; - v540 = arith.neq v538, v885 : i1; - v847 = scf.if v540 : i32 { - ^block73: - v884 = arith.constant 0 : i32; - v551 = arith.neq v531, v884 : i1; - v846 = scf.if v551 : i32 { - ^block77: - v883 = arith.constant 0 : i32; - v567 = arith.neq v498, v883 : i1; - v845 = scf.if v567 : i32 { - ^block80: - v549 = arith.constant 1 : i32; - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::alloc_impl(v507, v499, v531, v549) - v578 = hir.bitcast v507 : u32; - v619 = arith.constant 4 : u32; - v580 = arith.mod v578, v619 : u32; - hir.assertz v580 #[code = 250]; - v581 = hir.int_to_ptr v578 : ptr; - v582 = hir.load v581 : i32; - scf.yield v582; + ^block73: + v609 = hir.load_local : i64 #[local = lv6]; + v610 = arith.trunc v609 : i32; + hir.store_local v610 #[local = lv4]; + v612 = hir.load_local : i32 #[local = lv3]; + v1038 = arith.constant 0 : i32; + v965 = arith.constant -2147483648 : i32; + v613 = arith.sub v965, v612 : i32 #[overflow = wrapping]; + v615 = hir.bitcast v613 : u32; + v614 = hir.bitcast v610 : u32; + v616 = arith.lte v614, v615 : i1; + v617 = arith.zext v616 : u32; + v618 = hir.bitcast v617 : i32; + v620 = arith.neq v618, v1038 : i1; + scf.if v620{ + ^block71: + v630 = hir.load_local : i32 #[local = lv4]; + v1037 = arith.constant 0 : i32; + v632 = arith.neq v630, v1037 : i1; + scf.if v632{ + ^block75: + v650 = hir.load_local : i32 #[local = lv2]; + v1036 = arith.constant 0 : i32; + v652 = arith.neq v650, v1036 : i1; + scf.if v652{ + ^block78: + v666 = hir.load_local : i32 #[local = lv5]; + v667 = hir.load_local : i32 #[local = lv3]; + v668 = hir.load_local : i32 #[local = lv4]; + v985 = arith.constant 1 : i32; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::alloc_impl(v666, v667, v668, v985) + v670 = hir.load_local : i32 #[local = lv5]; + v671 = hir.bitcast v670 : u32; + v984 = arith.constant 4 : u32; + v673 = arith.mod v671, v984 : u32; + hir.assertz v673 #[code = 250]; + v674 = hir.int_to_ptr v671 : ptr; + v675 = hir.load v674 : i32; + hir.store_local v675 #[local = lv2]; + scf.yield ; } else { - ^block81: - v568 = arith.constant 8 : i32; - v569 = arith.add v507, v568 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::allocate(v569, v499, v531) - v553 = arith.constant 8 : u32; - v570 = hir.bitcast v507 : u32; - v572 = arith.add v570, v553 : u32 #[overflow = checked]; - v882 = arith.constant 4 : u32; - v574 = arith.mod v572, v882 : u32; - hir.assertz v574 #[code = 250]; - v575 = hir.int_to_ptr v572 : ptr; - v576 = hir.load v575 : i32; - scf.yield v576; + ^block79: + v653 = hir.load_local : i32 #[local = lv5]; + v656 = hir.load_local : i32 #[local = lv3]; + v657 = hir.load_local : i32 #[local = lv4]; + v963 = arith.constant 8 : i32; + v655 = arith.add v653, v963 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::allocate(v655, v656, v657) + v658 = hir.load_local : i32 #[local = lv5]; + v983 = arith.constant 8 : u32; + v659 = hir.bitcast v658 : u32; + v661 = arith.add v659, v983 : u32 #[overflow = checked]; + v1035 = arith.constant 4 : u32; + v663 = arith.mod v661, v1035 : u32; + hir.assertz v663 #[code = 250]; + v664 = hir.int_to_ptr v661 : ptr; + v665 = hir.load v664 : i32; + hir.store_local v665 #[local = lv2]; + scf.yield ; }; - v881 = arith.constant 0 : i32; - v585 = arith.neq v845, v881 : i1; - scf.if v585{ - ^block82: - v880 = arith.constant 8 : u32; - v602 = hir.bitcast v496 : u32; - v604 = arith.add v602, v880 : u32 #[overflow = checked]; - v879 = arith.constant 4 : u32; - v606 = arith.mod v604, v879 : u32; - hir.assertz v606 #[code = 250]; - v607 = hir.int_to_ptr v604 : ptr; - hir.store v607, v845; - v878 = arith.constant 4 : u32; - v609 = hir.bitcast v496 : u32; - v611 = arith.add v609, v878 : u32 #[overflow = checked]; - v877 = arith.constant 4 : u32; - v613 = arith.mod v611, v877 : u32; - hir.assertz v613 #[code = 250]; - v614 = hir.int_to_ptr v611 : ptr; - hir.store v614, v497; + v676 = hir.load_local : i32 #[local = lv2]; + v1034 = arith.constant 0 : i32; + v678 = arith.neq v676, v1034 : i1; + scf.if v678{ + ^block80: + v696 = hir.load_local : i32 #[local = lv0]; + v697 = hir.load_local : i32 #[local = lv2]; + v1033 = arith.constant 8 : u32; + v698 = hir.bitcast v696 : u32; + v700 = arith.add v698, v1033 : u32 #[overflow = checked]; + v1032 = arith.constant 4 : u32; + v702 = arith.mod v700, v1032 : u32; + hir.assertz v702 #[code = 250]; + v703 = hir.int_to_ptr v700 : ptr; + hir.store v703, v697; + v704 = hir.load_local : i32 #[local = lv0]; + v705 = hir.load_local : i32 #[local = lv1]; + v1031 = arith.constant 4 : u32; + v706 = hir.bitcast v704 : u32; + v708 = arith.add v706, v1031 : u32 #[overflow = checked]; + v1030 = arith.constant 4 : u32; + v710 = arith.mod v708, v1030 : u32; + hir.assertz v710 #[code = 250]; + v711 = hir.int_to_ptr v708 : ptr; + hir.store v711, v705; + v1029 = arith.constant 0 : i32; + hir.store_local v1029 #[local = lv3]; scf.yield ; } else { - ^block83: - v876 = arith.constant 8 : u32; - v588 = hir.bitcast v496 : u32; - v590 = arith.add v588, v876 : u32 #[overflow = checked]; - v875 = arith.constant 4 : u32; - v592 = arith.mod v590, v875 : u32; - hir.assertz v592 #[code = 250]; - v593 = hir.int_to_ptr v590 : ptr; - hir.store v593, v531; - v874 = arith.constant 4 : u32; - v595 = hir.bitcast v496 : u32; - v597 = arith.add v595, v874 : u32 #[overflow = checked]; - v873 = arith.constant 4 : u32; - v599 = arith.mod v597, v873 : u32; - hir.assertz v599 #[code = 250]; - v600 = hir.int_to_ptr v597 : ptr; - hir.store v600, v499; + ^block81: + v679 = hir.load_local : i32 #[local = lv0]; + v680 = hir.load_local : i32 #[local = lv4]; + v1028 = arith.constant 8 : u32; + v681 = hir.bitcast v679 : u32; + v683 = arith.add v681, v1028 : u32 #[overflow = checked]; + v1027 = arith.constant 4 : u32; + v685 = arith.mod v683, v1027 : u32; + hir.assertz v685 #[code = 250]; + v686 = hir.int_to_ptr v683 : ptr; + hir.store v686, v680; + v687 = hir.load_local : i32 #[local = lv0]; + v688 = hir.load_local : i32 #[local = lv3]; + v1026 = arith.constant 4 : u32; + v689 = hir.bitcast v687 : u32; + v691 = arith.add v689, v1026 : u32 #[overflow = checked]; + v1025 = arith.constant 4 : u32; + v693 = arith.mod v691, v1025 : u32; + hir.assertz v693 #[code = 250]; + v694 = hir.int_to_ptr v691 : ptr; + hir.store v694, v688; + v1024 = arith.constant 1 : i32; + hir.store_local v1024 #[local = lv3]; scf.yield ; }; - v871 = arith.constant 1 : i32; - v872 = arith.constant 0 : i32; - v844 = cf.select v585, v872, v871 : i32; - scf.yield v844; + scf.yield ; } else { - ^block78: - v870 = arith.constant 8 : u32; - v552 = hir.bitcast v496 : u32; - v554 = arith.add v552, v870 : u32 #[overflow = checked]; - v869 = arith.constant 4 : u32; - v556 = arith.mod v554, v869 : u32; - hir.assertz v556 #[code = 250]; - v557 = hir.int_to_ptr v554 : ptr; - hir.store v557, v499; - v868 = arith.constant 4 : u32; - v560 = hir.bitcast v496 : u32; - v562 = arith.add v560, v868 : u32 #[overflow = checked]; - v867 = arith.constant 4 : u32; - v564 = arith.mod v562, v867 : u32; - hir.assertz v564 #[code = 250]; - v866 = arith.constant 0 : i32; - v565 = hir.int_to_ptr v562 : ptr; - hir.store v565, v866; - v865 = arith.constant 0 : i32; - scf.yield v865; + ^block76: + v633 = hir.load_local : i32 #[local = lv0]; + v634 = hir.load_local : i32 #[local = lv3]; + v1023 = arith.constant 8 : u32; + v635 = hir.bitcast v633 : u32; + v637 = arith.add v635, v1023 : u32 #[overflow = checked]; + v1022 = arith.constant 4 : u32; + v639 = arith.mod v637, v1022 : u32; + hir.assertz v639 #[code = 250]; + v640 = hir.int_to_ptr v637 : ptr; + hir.store v640, v634; + v1021 = arith.constant 0 : i32; + hir.store_local v1021 #[local = lv3]; + v642 = hir.load_local : i32 #[local = lv0]; + v1020 = arith.constant 4 : u32; + v644 = hir.bitcast v642 : u32; + v646 = arith.add v644, v1020 : u32 #[overflow = checked]; + v1019 = arith.constant 4 : u32; + v648 = arith.mod v646, v1019 : u32; + hir.assertz v648 #[code = 250]; + v1018 = arith.constant 0 : i32; + v649 = hir.int_to_ptr v646 : ptr; + hir.store v649, v1018; + scf.yield ; }; - scf.yield v846; + scf.yield ; } else { - ^block76: - v864 = ub.poison i32 : i32; - scf.yield v864; + ^block74: + scf.yield ; }; - v859 = arith.constant 0 : u32; - v792 = arith.constant 1 : u32; - v852 = cf.select v540, v792, v859 : u32; - v860 = ub.poison i32 : i32; - v851 = cf.select v540, v507, v860 : i32; - v861 = ub.poison i32 : i32; - v850 = cf.select v540, v496, v861 : i32; - v862 = ub.poison i32 : i32; - v849 = cf.select v540, v862, v507 : i32; - v863 = ub.poison i32 : i32; - v848 = cf.select v540, v863, v496 : i32; - scf.yield v848, v849, v850, v847, v851, v852; + v1017 = arith.constant 0 : u32; + v1002 = arith.constant 1 : u32; + v1010 = cf.select v620, v1002, v1017 : u32; + scf.yield v1010; }; - v805, v806, v807 = scf.index_switch v804 : i32, i32, i32 + scf.index_switch v1004 case 0 { - ^block74: - v858 = arith.constant 4 : u32; - v543 = hir.bitcast v799 : u32; - v545 = arith.add v543, v858 : u32 #[overflow = checked]; - v857 = arith.constant 4 : u32; - v547 = arith.mod v545, v857 : u32; - hir.assertz v547 #[code = 250]; - v856 = arith.constant 0 : i32; - v548 = hir.int_to_ptr v545 : ptr; - hir.store v548, v856; - v855 = arith.constant 1 : i32; - scf.yield v799, v855, v800; + ^block72: + v621 = hir.load_local : i32 #[local = lv0]; + v1016 = arith.constant 4 : u32; + v623 = hir.bitcast v621 : u32; + v625 = arith.add v623, v1016 : u32 #[overflow = checked]; + v1015 = arith.constant 4 : u32; + v627 = arith.mod v625, v1015 : u32; + hir.assertz v627 #[code = 250]; + v1014 = arith.constant 0 : i32; + v628 = hir.int_to_ptr v625 : ptr; + hir.store v628, v1014; + v1013 = arith.constant 1 : i32; + hir.store_local v1013 #[local = lv3]; + scf.yield ; } default { - ^block122: - scf.yield v801, v802, v803; + ^block119: + scf.yield ; }; - v618 = hir.bitcast v805 : u32; - v854 = arith.constant 4 : u32; - v620 = arith.mod v618, v854 : u32; - hir.assertz v620 #[code = 250]; - v621 = hir.int_to_ptr v618 : ptr; - hir.store v621, v806; - v853 = arith.constant 16 : i32; - v626 = arith.add v807, v853 : i32 #[overflow = wrapping]; - v627 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v628 = hir.bitcast v627 : ptr; - hir.store v628, v626; + v713 = hir.load_local : i32 #[local = lv0]; + v714 = hir.load_local : i32 #[local = lv3]; + v715 = hir.bitcast v713 : u32; + v1012 = arith.constant 4 : u32; + v717 = arith.mod v715, v1012 : u32; + hir.assertz v717 #[code = 250]; + v718 = hir.int_to_ptr v715 : ptr; + hir.store v718, v714; + v719 = hir.load_local : i32 #[local = lv5]; + v1011 = arith.constant 16 : i32; + v721 = arith.add v719, v1011 : i32 #[overflow = wrapping]; + v722 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v723 = hir.bitcast v722 : ptr; + hir.store v723, v721; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v629: i32, v630: i32) { - ^block84(v629: i32, v630: i32): + private builtin.function @alloc::raw_vec::handle_error(v724: i32, v725: i32) { + ^block82(v724: i32, v725: i32): ub.unreachable ; }; - private builtin.function @::max(v631: i32, v632: i32) -> i32 { - ^block86(v631: i32, v632: i32): - v639 = arith.constant 0 : i32; - v635 = hir.bitcast v632 : u32; - v634 = hir.bitcast v631 : u32; - v636 = arith.gt v634, v635 : i1; - v637 = arith.zext v636 : u32; - v638 = hir.bitcast v637 : i32; - v640 = arith.neq v638, v639 : i1; - v641 = cf.select v640, v631, v632 : i32; - builtin.ret v641; + private builtin.function @::max(v726: i32, v727: i32) -> i32 { + ^block84(v726: i32, v727: i32): + v1040 = arith.constant 0 : i32; + v734 = hir.bitcast v727 : u32; + v733 = hir.bitcast v726 : u32; + v735 = arith.gt v733, v734 : i1; + v736 = arith.zext v735 : u32; + v737 = hir.bitcast v736 : i32; + v739 = arith.neq v737, v1040 : i1; + v740 = cf.select v739, v726, v727 : i32; + builtin.ret v740; }; - private builtin.function @miden::input_note::get_assets(v642: i32, v643: felt) -> i32 { - ^block88(v642: i32, v643: felt): - v644, v645 = hir.exec @miden/input_note/get_assets(v642, v643) : i32, i32 - builtin.ret v644; + private builtin.function @miden::protocol::input_note::get_assets(v741: i32, v742: felt) -> i32 { + ^block86(v741: i32, v742: felt): + ub.unreachable ; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -940,8 +1104,8 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no }; public builtin.function @binding() -> felt { - ^block92: - v647 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1#binding() : felt - builtin.ret v647; + ^block88: + v744 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1#binding() : felt + builtin.ret v744; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.masm index 472f7f025..3f22aba94 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.masm @@ -1,16 +1,16 @@ -# mod miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1 +# mod ::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> felt - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::init + exec."miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1#binding + exec.::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::rust_sdk_input_note_get_assets_binding::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1#binding" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -23,7 +23,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -34,7 +34,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding +# mod ::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::rust_sdk_input_note_get_assets_binding @callconv("C") proc __wasm_call_ctors( @@ -43,6 +43,7 @@ proc __wasm_call_ctors( nop end +@locals("2") @callconv("C") proc __rustc::__rust_alloc(i32, i32) -> i32 push.1114148 @@ -59,11 +60,12 @@ proc __rustc::__rust_alloc(i32, i32) -> i32 swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::::alloc + exec.::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::rust_sdk_input_note_get_assets_binding::::alloc trace.252 nop end +@locals("3") @callconv("C") proc __rustc::__rust_dealloc(i32, i32, i32) drop @@ -71,8 +73,25 @@ proc __rustc::__rust_dealloc(i32, i32, i32) drop end +@locals("2") @callconv("C") proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114148 u32divmod.4 swap.1 @@ -81,38 +100,84 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.1048584 + movup.3 u32wrapping_add - dup.1 - swap.2 - swap.3 + movup.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::rust_sdk_input_note_get_assets_binding::::alloc + trace.252 + nop + dup.0 + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::::alloc + exec.::intrinsics::mem::store_sw trace.252 nop push.0 push.0 - dup.2 + movup.2 eq neq if.true - swap.1 - drop + nop else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.0 - dup.3 + movup.2 eq neq if.true - swap.1 - drop + nop else + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 + swap.1 movup.2 - dup.2 push.0 dup.2 push.0 @@ -154,6 +219,14 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 dropw end end + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end @callconv("C") @@ -163,6 +236,7 @@ proc rust_sdk_input_note_get_assets_binding::bindings::__link_custom_section_des nop end +@locals("2") @callconv("C") proc miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1#binding( @@ -177,9 +251,16 @@ proc miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -189,25 +270,36 @@ proc miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets nop trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::rust_sdk_input_note_get_assets_binding::wit_bindgen::rt::run_ctors_once trace.252 nop + locaddr.0 push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop + push.0 push.4 - dup.2 + movup.2 u32wrapping_add trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::miden_base_sys::bindings::input_note::get_assets + exec.::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::rust_sdk_input_note_get_assets_binding::miden_base_sys::bindings::input_note::get_assets + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.12 - dup.1 + swap.1 add u32assert push.4 @@ -223,25 +315,43 @@ proc miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop push.16 push.4 - dup.3 + movup.2 u32wrapping_add dup.1 swap.2 swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::::deallocate + exec.::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::rust_sdk_input_note_get_assets_binding::::deallocate + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.16 - movup.2 u32wrapping_add push.1114144 u32divmod.4 @@ -251,6 +361,14 @@ proc miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop end @callconv("C") @@ -260,6 +378,7 @@ proc __rustc::__rust_no_alloc_shim_is_unstable_v2( nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -301,9 +420,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::rust_sdk_input_note_get_assets_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -334,95 +469,221 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("5") @callconv("C") proc ::alloc( i32, i32, i32 ) -> i32 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 push.0 push.16 - dup.4 + dup.3 swap.1 u32gt neq - dup.3 + movup.2 swap.1 cdrop + dup.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.4294967295 - dup.2 + movup.2 u32wrapping_add - dup.2 + movup.2 u32and neq if.true - dropw push.0 push.3735929054 else - movup.2 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::::max + exec.::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::rust_sdk_input_note_get_assets_binding::::max + trace.252 + nop + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw trace.252 nop push.0 push.2147483648 - dup.2 + movup.2 u32wrapping_sub - dup.4 + movup.2 swap.1 u32gt neq dup.0 if.true - movdn.3 - drop - drop - drop push.3735929054 else push.0 - dup.2 - u32wrapping_sub - push.4294967295 - movup.5 - dup.4 - u32wrapping_add - u32wrapping_add - u32and - dup.3 - push.4 - dup.1 + locaddr.3 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.1 push.0 - neq - if.true - nop - else - trace.240 - nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::intrinsics::mem::heap_base - trace.252 - nop - trace.240 - nop + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + dup.1 + u32wrapping_sub + push.4294967295 + movup.3 + movup.3 + u32wrapping_add + u32wrapping_add + u32and + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + neq + if.true + nop + else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::rust_sdk_input_note_get_assets_binding::"intrinsics::mem::heap_base" + trace.252 + nop + trace.240 + nop exec.::intrinsics::mem::memory_size trace.252 nop - dup.5 + movup.2 push.4 dup.1 swap.1 @@ -444,7 +705,22 @@ proc ::alloc( trace.252 nop end - dup.3 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -458,31 +734,58 @@ proc ::alloc( exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 push.4294967295 - dup.2 + movup.2 u32xor - dup.3 + movup.2 swap.1 u32gt neq if.true - drop - drop - movdn.2 - drop - drop - push.0 + nop else - movup.4 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 push.4 dup.1 swap.1 u32mod u32assert assertz - movup.2 - dup.2 + movdn.2 u32wrapping_add swap.1 u32divmod.4 @@ -492,9 +795,40 @@ proc ::alloc( exec.::intrinsics::mem::store_sw trace.252 nop - movup.2 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop u32wrapping_add + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end push.1 push.0 @@ -525,10 +859,19 @@ proc intrinsics::mem::heap_base( nop end +@locals("4") @callconv("C") proc >::with_capacity( i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -539,9 +882,16 @@ proc >::with_capacity( nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.1 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -549,20 +899,38 @@ proc >::with_capacity( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 + push.256 push.8 - dup.2 + movup.3 u32wrapping_add - dup.1 + dup.2 + swap.3 swap.2 swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::::with_capacity_in + exec.::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::rust_sdk_input_note_get_assets_binding::::with_capacity_in + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.1 + swap.1 add u32assert push.8 @@ -579,8 +947,16 @@ proc >::with_capacity( trace.252 nop swap.1 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.4 + swap.1 add u32assert push.4 @@ -598,7 +974,14 @@ proc >::with_capacity( exec.::intrinsics::mem::store_sw trace.252 nop - movup.3 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -614,6 +997,14 @@ proc >::with_capacity( exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114144 @@ -626,12 +1017,31 @@ proc >::with_capacity( nop end +@locals("5") @callconv("C") proc ::with_capacity_in( + i32, i32, i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -642,60 +1052,105 @@ proc ::with_capacity_in( nop push.16 u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 + dup.0 + locaddr.4 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::store_sw trace.252 nop - push.0 - push.256 - push.4 - dup.3 - u32wrapping_add - movup.4 - swap.6 - movdn.4 - movup.3 - swap.5 - movdn.3 + push.1114144 + u32divmod.4 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::::try_allocate_in + exec.::intrinsics::mem::store_sw trace.252 nop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.4 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.4 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.4 + movup.3 + u32wrapping_add + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::rust_sdk_input_note_get_assets_binding::::try_allocate_in + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 swap.1 trace.240 nop @@ -708,8 +1163,24 @@ proc ::with_capacity_in( neq neq if.true + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.2 + swap.1 add u32assert push.4 @@ -726,7 +1197,7 @@ proc ::with_capacity_in( trace.252 nop push.4 - dup.4 + movup.2 add u32assert push.4 @@ -742,7 +1213,23 @@ proc ::with_capacity_in( exec.::intrinsics::mem::store_sw trace.252 nop - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 push.4 dup.1 swap.1 @@ -756,6 +1243,14 @@ proc ::with_capacity_in( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114144 @@ -767,10 +1262,24 @@ proc ::with_capacity_in( trace.252 nop else - movup.2 - drop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - movup.2 + swap.1 add u32assert push.4 @@ -789,7 +1298,7 @@ proc ::with_capacity_in( swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::alloc::raw_vec::handle_error + exec.::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::rust_sdk_input_note_get_assets_binding::alloc::raw_vec::handle_error trace.252 nop push.0 @@ -797,11 +1306,28 @@ proc ::with_capacity_in( end end +@locals("3") @callconv("C") proc miden_base_sys::bindings::input_note::get_assets( i32, felt ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -812,9 +1338,16 @@ proc miden_base_sys::bindings::input_note::get_assets( nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.2 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -822,16 +1355,39 @@ proc miden_base_sys::bindings::input_note::get_assets( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 u32wrapping_add trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::>::with_capacity + exec.::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::rust_sdk_input_note_get_assets_binding::>::with_capacity + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.1 + swap.1 add u32assert push.4 @@ -847,19 +1403,25 @@ proc miden_base_sys::bindings::input_note::get_assets( exec.::intrinsics::mem::load_sw trace.252 nop - push.2 + locaddr.1 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.2 + movup.2 swap.1 u32shr - movup.3 - swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::miden::input_note::get_assets + exec.::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::rust_sdk_input_note_get_assets_binding::"miden::protocol::input_note::get_assets" trace.252 nop push.8 - dup.3 + movup.2 u32wrapping_add push.4 dup.1 @@ -874,8 +1436,24 @@ proc miden_base_sys::bindings::input_note::get_assets( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + swap.1 add u32assert push.4 @@ -892,7 +1470,7 @@ proc miden_base_sys::bindings::input_note::get_assets( trace.252 nop swap.1 - movup.3 + movup.2 push.4 dup.1 swap.1 @@ -908,6 +1486,14 @@ proc miden_base_sys::bindings::input_note::get_assets( exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114144 @@ -920,11 +1506,7 @@ proc miden_base_sys::bindings::input_note::get_assets( nop end -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - +@locals("4") @callconv("C") proc ::alloc_impl( i32, @@ -932,44 +1514,151 @@ proc ::alloc_impl( i32, i32 ) + locaddr.0 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 push.0 - dup.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 eq neq if.true - movup.3 - drop - swap.1 + nop else trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::__rustc::__rust_no_alloc_shim_is_unstable_v2 + exec.::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::rust_sdk_input_note_get_assets_binding::__rustc::__rust_no_alloc_shim_is_unstable_v2 trace.252 nop + locaddr.3 push.0 - movup.4 - neq + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + neq if.true + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::rust_sdk_input_note_get_assets_binding::__rustc::__rust_alloc_zeroed + trace.252 + nop + locaddr.1 + push.0 swap.1 - dup.2 trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::__rustc::__rust_alloc_zeroed + exec.::intrinsics::mem::store_sw trace.252 nop else + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop swap.1 - dup.2 trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::__rustc::__rust_alloc + exec.::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::rust_sdk_input_note_get_assets_binding::__rustc::__rust_alloc + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw trace.252 nop end end + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.2 + movup.2 add u32assert push.4 @@ -978,8 +1667,6 @@ proc ::alloc_impl( u32mod u32assert assertz - movup.3 - swap.1 u32divmod.4 swap.1 trace.240 @@ -987,6 +1674,22 @@ proc ::alloc_impl( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop swap.1 push.4 dup.1 @@ -1003,12 +1706,22 @@ proc ::alloc_impl( nop end +@locals("4") @callconv("C") proc ::deallocate( i32, i32, i32 ) + movup.2 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -1019,9 +1732,16 @@ proc ::deallocate( nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.3 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1029,21 +1749,44 @@ proc ::deallocate( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + movup.2 u32wrapping_add swap.1 - swap.4 swap.3 swap.2 swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::::current_memory + exec.::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::rust_sdk_input_note_get_assets_binding::"::current_memory" + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.1 + swap.1 add u32assert push.4 @@ -1059,16 +1802,33 @@ proc ::deallocate( exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.2 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 - dup.2 + push.0 + movup.2 eq neq if.true - drop + nop else + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.2 + swap.1 add u32assert push.4 @@ -1084,8 +1844,24 @@ proc ::deallocate( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.3 + swap.1 add u32assert push.4 @@ -1101,13 +1877,21 @@ proc ::deallocate( exec.::intrinsics::mem::load_sw trace.252 nop - movdn.2 + swap.2 trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::::deallocate + exec.::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::rust_sdk_input_note_get_assets_binding::"::deallocate" trace.252 nop end + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114144 @@ -1120,6 +1904,7 @@ proc ::deallocate( nop end +@locals("7") @callconv("C") proc ::current_memory( i32, @@ -1127,20 +1912,80 @@ proc ::current_memory( i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.0 - dup.5 + movup.2 eq neq if.true - movdn.3 - drop - drop - drop - push.0 - push.4 + nop else - dup.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -1154,25 +1999,41 @@ proc ::current_memory( exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 push.0 - dup.2 + movup.2 eq neq - dup.0 if.true + nop + else + locaddr.0 + push.0 swap.1 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 push.0 - else + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.3 + movup.2 add u32assert push.4 @@ -1181,8 +2042,6 @@ proc ::current_memory( u32mod u32assert assertz - movup.5 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1190,8 +2049,24 @@ proc ::current_memory( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - movup.4 + swap.1 add u32assert push.4 @@ -1207,7 +2082,7 @@ proc ::current_memory( exec.::intrinsics::mem::load_sw trace.252 nop - dup.3 + swap.1 push.4 dup.1 swap.1 @@ -1221,21 +2096,71 @@ proc ::current_memory( exec.::intrinsics::mem::store_sw trace.252 nop - swap.3 + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop trace.240 nop exec.::intrinsics::i32::wrapping_mul trace.252 nop - movup.2 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + locaddr.5 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.8 - push.4 - movup.3 - cdrop end - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movdn.2 u32wrapping_add push.4 dup.1 @@ -1252,38 +2177,110 @@ proc ::current_memory( nop end +@locals("3") @callconv("C") proc ::deallocate( i32, i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 push.0 - dup.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 eq neq if.true - drop - drop - drop + nop else - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::__rustc::__rust_dealloc + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.2 + trace.240 + nop + exec.::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::rust_sdk_input_note_get_assets_binding::__rustc::__rust_dealloc trace.252 nop end end +@locals("4") @callconv("C") proc ::allocate( i32, i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + swap.1 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -1294,9 +2291,16 @@ proc ::allocate( nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.3 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1304,24 +2308,44 @@ proc ::allocate( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.8 - dup.2 + movup.3 u32wrapping_add - movup.2 - swap.5 - movdn.2 swap.1 swap.3 - swap.4 swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::::alloc_impl + exec.::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::rust_sdk_input_note_get_assets_binding::"::alloc_impl" + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.12 - dup.2 + swap.1 add u32assert push.4 @@ -1337,8 +2361,32 @@ proc ::allocate( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.3 + swap.1 add u32assert push.4 @@ -1354,7 +2402,7 @@ proc ::allocate( exec.::intrinsics::mem::load_sw trace.252 nop - dup.2 + swap.1 push.4 dup.1 swap.1 @@ -1368,6 +2416,22 @@ proc ::allocate( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 movup.2 add @@ -1385,6 +2449,14 @@ proc ::allocate( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114144 @@ -1397,6 +2469,7 @@ proc ::allocate( nop end +@locals("8") @callconv("C") proc ::try_allocate_in( i32, @@ -1405,6 +2478,46 @@ proc ::try_allocate_in( i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -1415,9 +2528,16 @@ proc ::try_allocate_in( nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.5 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1425,14 +2545,37 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop - dup.2 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.0 - dup.7 + dup.4 u32wrapping_sub push.4294967295 - movup.9 - dup.9 + movup.5 + movup.5 u32wrapping_add u32wrapping_add u32and @@ -1442,6 +2585,18 @@ proc ::try_allocate_in( exec.::intrinsics::i64::wrapping_mul trace.252 nop + dup.1 + dup.1 + locaddr.6 + push.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop push.0 push.32 push.0 @@ -1455,64 +2610,118 @@ proc ::try_allocate_in( push.4294967295 u32lte assert - dup.3 - dup.3 + movup.3 + movup.3 movup.2 trace.240 nop - exec.::std::math::u64::shr + exec.::miden::core::math::u64::shr trace.252 nop drop neq if.true - drop - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop push.0 - push.3735929054 - dup.0 - dup.1 - swap.4 - swap.1 - swap.3 - swap.5 else + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 drop + dup.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.2147483648 - dup.7 + movup.2 u32wrapping_sub - dup.2 + movup.2 swap.1 u32lte neq dup.0 if.true + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 - dup.2 neq if.true + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 - movup.6 neq if.true + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.1 - dup.3 - dup.7 - dup.4 + movdn.3 swap.2 trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::::alloc_impl + exec.::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::rust_sdk_input_note_get_assets_binding::"::alloc_impl" + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop - dup.2 push.4 dup.1 swap.1 @@ -1526,20 +2735,59 @@ proc ::try_allocate_in( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop else + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.3 + movup.3 u32wrapping_add - dup.6 - dup.3 - swap.2 + movup.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1"::rust_sdk_input_note_get_assets_binding::"::allocate" + trace.252 + nop + locaddr.5 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::::allocate + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.3 + swap.1 add u32assert push.4 @@ -1555,18 +2803,44 @@ proc ::try_allocate_in( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 - dup.1 neq - dup.0 if.true - movup.7 - movup.4 - drop - drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.5 + movup.2 add u32assert push.4 @@ -1575,8 +2849,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1584,8 +2856,24 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.4 + movup.2 add u32assert push.4 @@ -1594,8 +2882,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.5 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1603,13 +2889,34 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + push.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop else - movup.6 - movup.2 - drop - drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.5 + movup.2 add u32assert push.4 @@ -1618,8 +2925,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.3 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1627,8 +2932,24 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.4 + movup.2 add u32assert push.4 @@ -1637,8 +2958,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.5 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1646,22 +2965,35 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + push.1 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.1 - push.0 - movup.2 - cdrop else - movup.2 - swap.5 - movdn.2 - swap.4 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 swap.1 - drop - drop - drop + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.1 + movup.2 add u32assert push.4 @@ -1670,8 +3002,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.4 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1679,8 +3009,25 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + push.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + swap.1 add u32assert push.4 @@ -1698,68 +3045,27 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop - push.0 - swap.1 - swap.3 - swap.2 - swap.1 end else - swap.1 - drop - movup.3 - drop - movup.3 - drop - movup.3 - drop - push.3735929054 + nop end push.0 push.1 - dup.3 - cdrop - push.3735929054 - dup.3 - dup.5 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.7 - swap.1 - cdrop - push.3735929054 - dup.5 - movup.2 - swap.7 - movdn.2 - cdrop - push.3735929054 movup.2 - swap.7 - movdn.2 - swap.1 - swap.5 cdrop - swap.1 - swap.5 - swap.4 - swap.2 - swap.3 - swap.1 end - movup.5 eq.0 if.true - movup.2 - drop - movup.2 - drop - movup.2 - drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + swap.1 add u32assert push.4 @@ -1778,11 +3084,34 @@ proc ::try_allocate_in( trace.252 nop push.1 + locaddr.3 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop else - drop - drop + nop end + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 push.4 dup.1 swap.1 @@ -1796,6 +3125,14 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114144 @@ -1808,6 +3145,7 @@ proc ::try_allocate_in( nop end +@locals("2") @callconv("C") proc alloc::raw_vec::handle_error(i32, i32) drop @@ -1816,6 +3154,7 @@ proc alloc::raw_vec::handle_error(i32, i32) assert end +@locals("2") @callconv("C") proc ::max( i32, @@ -1830,14 +3169,12 @@ proc ::max( cdrop end +@locals("2") @callconv("C") -proc miden::input_note::get_assets(i32, felt) -> i32 - trace.240 - nop - exec.::miden::input_note::get_assets - trace.252 - nop - swap.1 +proc miden::protocol::input_note::get_assets(i32, felt) -> i32 + drop drop + push.0 + assert end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.wat index cdbae458c..4fe7cc077 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.wat @@ -14,9 +14,9 @@ (type (;4;) (func (param i32 i32 i32) (result i32))) (type (;5;) (func (result i32))) (type (;6;) (func (param i32))) - (type (;7;) (func (param i32 f32))) - (type (;8;) (func (param i32) (result f32))) - (type (;9;) (func (param i32 i32 i32 i32))) + (type (;7;) (func (param i32 i32 i32 i32))) + (type (;8;) (func (param i32 f32))) + (type (;9;) (func (param i32) (result f32))) (type (;10;) (func (param i32 i32 i32 i32 i32))) (type (;11;) (func (param i32 i32))) (type (;12;) (func (param i32 f32) (result i32))) @@ -195,6 +195,7 @@ local.get 1 i32.const 8 i32.add + i32.const 256 i32.const 16 i32.const 16 call $::with_capacity_in @@ -212,49 +213,49 @@ i32.add global.set $__stack_pointer ) - (func $::with_capacity_in (;11;) (type 2) (param i32 i32 i32) + (func $::with_capacity_in (;11;) (type 7) (param i32 i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 i32.sub - local.tee 3 + local.tee 4 global.set $__stack_pointer - local.get 3 + local.get 4 i32.const 4 i32.add - i32.const 256 - i32.const 0 local.get 1 + i32.const 0 local.get 2 - call $::try_allocate_in local.get 3 + call $::try_allocate_in + local.get 4 i32.load offset=8 - local.set 2 + local.set 3 block ;; label = @1 - local.get 3 + local.get 4 i32.load offset=4 i32.const 1 i32.ne br_if 0 (;@1;) - local.get 2 local.get 3 + local.get 4 i32.load offset=12 call $alloc::raw_vec::handle_error unreachable end local.get 0 - local.get 3 + local.get 4 i32.load offset=12 i32.store offset=4 local.get 0 - local.get 2 - i32.store local.get 3 + i32.store + local.get 4 i32.const 16 i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::input_note::get_assets (;12;) (type 7) (param i32 f32) + (func $miden_base_sys::bindings::input_note::get_assets (;12;) (type 8) (param i32 f32) (local i32) global.get $__stack_pointer i32.const 16 @@ -273,7 +274,7 @@ i32.const 2 i32.shr_u local.get 1 - call $miden::input_note::get_assets + call $miden::protocol::input_note::get_assets i32.store local.get 0 local.get 2 @@ -284,10 +285,10 @@ i32.add global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;13;) (type 8) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;13;) (type 9) (param i32) (result f32) unreachable ) - (func $::alloc_impl (;14;) (type 9) (param i32 i32 i32 i32) + (func $::alloc_impl (;14;) (type 7) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -346,7 +347,7 @@ i32.add global.set $__stack_pointer ) - (func $::current_memory (;16;) (type 9) (param i32 i32 i32 i32) + (func $::current_memory (;16;) (type 7) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -543,11 +544,11 @@ i32.gt_u select ) - (func $miden::input_note::get_assets (;22;) (type 12) (param i32 f32) (result i32) + (func $miden::protocol::input_note::get_assets (;22;) (type 12) (param i32 f32) (result i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "Mrust_sdk_input_note_get_assets_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "Mrust_sdk_input_note_get_assets_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.hir index 5eb18c37c..be04250d5 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.hir @@ -12,292 +12,185 @@ builtin.component miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-inp private builtin.function @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1#binding() -> felt { ^block9: - v3 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__stack_pointer : ptr - v4 = hir.bitcast v3 : ptr; - v5 = hir.load v4 : i32; - v6 = arith.constant 32 : i32; - v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; - v8 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__stack_pointer : ptr - v9 = hir.bitcast v8 : ptr; - hir.store v9, v7; + v1 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v142 = arith.constant 32 : i32; + v5 = arith.sub v3, v142 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; hir.exec @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/wit_bindgen::rt::run_ctors_once() - v1 = arith.constant 0 : i32; - v11 = hir.exec @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/intrinsics::felt::from_u32(v1) : felt - hir.exec @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/miden_base_sys::bindings::input_note::get_assets_info(v7, v11) - v13 = arith.constant 16 : u32; - v12 = hir.bitcast v7 : u32; - v14 = arith.add v12, v13 : u32 #[overflow = checked]; - v15 = arith.constant 4 : u32; - v16 = arith.mod v14, v15 : u32; + v8 = hir.load_local : i32 #[local = lv0]; + v139 = arith.constant 0 : felt; + hir.exec @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/miden_base_sys::bindings::input_note::get_assets_info(v8, v139) + v11 = hir.load_local : i32 #[local = lv0]; + v141 = arith.constant 16 : u32; + v12 = hir.bitcast v11 : u32; + v14 = arith.add v12, v141 : u32 #[overflow = checked]; + v140 = arith.constant 4 : u32; + v16 = arith.mod v14, v140 : u32; hir.assertz v16 #[code = 250]; v17 = hir.int_to_ptr v14 : ptr; v18 = hir.load v17 : felt; - v213 = arith.constant 32 : i32; - v20 = arith.add v7, v213 : i32 #[overflow = wrapping]; - v21 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__stack_pointer : ptr - v22 = hir.bitcast v21 : ptr; - hir.store v22, v20; + v19 = hir.load_local : i32 #[local = lv0]; + v144 = arith.constant 32 : i32; + v21 = arith.add v19, v144 : i32 #[overflow = wrapping]; + v22 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__stack_pointer : ptr + v23 = hir.bitcast v22 : ptr; + hir.store v23, v21; builtin.ret v18; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v24 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/GOT.data.internal.__memory_base : ptr - v25 = hir.bitcast v24 : ptr; - v26 = hir.load v25 : i32; - v27 = arith.constant 1048584 : i32; - v28 = arith.add v26, v27 : i32 #[overflow = wrapping]; - v29 = hir.bitcast v28 : u32; - v30 = hir.int_to_ptr v29 : ptr; - v31 = hir.load v30 : u8; - v23 = arith.constant 0 : i32; - v32 = arith.zext v31 : u32; - v33 = hir.bitcast v32 : i32; - v35 = arith.neq v33, v23 : i1; - scf.if v35{ + v25 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/GOT.data.internal.__memory_base : ptr + v26 = hir.bitcast v25 : ptr; + v27 = hir.load v26 : i32; + v149 = arith.constant 1048584 : i32; + v29 = arith.add v27, v149 : i32 #[overflow = wrapping]; + v30 = hir.bitcast v29 : u32; + v31 = hir.int_to_ptr v30 : ptr; + v32 = hir.load v31 : u8; + v148 = arith.constant 0 : i32; + v33 = arith.zext v32 : u32; + v34 = hir.bitcast v33 : i32; + v36 = arith.neq v34, v148 : i1; + scf.if v36{ ^block13: scf.yield ; } else { ^block14: - v36 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/GOT.data.internal.__memory_base : ptr - v37 = hir.bitcast v36 : ptr; - v38 = hir.load v37 : i32; + v37 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/GOT.data.internal.__memory_base : ptr + v38 = hir.bitcast v37 : ptr; + v39 = hir.load v38 : i32; + hir.store_local v39 #[local = lv0]; hir.exec @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__wasm_call_ctors() - v215 = arith.constant 1 : u8; - v217 = arith.constant 1048584 : i32; - v40 = arith.add v38, v217 : i32 #[overflow = wrapping]; - v44 = hir.bitcast v40 : u32; - v45 = hir.int_to_ptr v44 : ptr; - hir.store v45, v215; + v40 = hir.load_local : i32 #[local = lv0]; + v147 = arith.constant 1 : u8; + v152 = arith.constant 1048584 : i32; + v42 = arith.add v40, v152 : i32 #[overflow = wrapping]; + v46 = hir.bitcast v42 : u32; + v47 = hir.int_to_ptr v46 : ptr; + hir.store v47, v147; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::input_note::get_assets_info(v46: i32, v47: felt) { - ^block15(v46: i32, v47: felt): - v49 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__stack_pointer : ptr - v50 = hir.bitcast v49 : ptr; - v51 = hir.load v50 : i32; - v52 = arith.constant 48 : i32; - v53 = arith.sub v51, v52 : i32 #[overflow = wrapping]; - v54 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__stack_pointer : ptr - v55 = hir.bitcast v54 : ptr; - hir.store v55, v53; - hir.exec @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/miden::input_note::get_assets_info(v47, v53) - v57 = arith.constant 8 : u32; - v56 = hir.bitcast v53 : u32; - v58 = arith.add v56, v57 : u32 #[overflow = checked]; - v224 = arith.constant 8 : u32; - v60 = arith.mod v58, v224 : u32; - hir.assertz v60 #[code = 250]; - v61 = hir.int_to_ptr v58 : ptr; - v62 = hir.load v61 : i64; - v64 = arith.constant 40 : u32; - v63 = hir.bitcast v53 : u32; - v65 = arith.add v63, v64 : u32 #[overflow = checked]; - v223 = arith.constant 8 : u32; - v67 = arith.mod v65, v223 : u32; - hir.assertz v67 #[code = 250]; - v68 = hir.int_to_ptr v65 : ptr; - hir.store v68, v62; - v69 = hir.bitcast v53 : u32; - v222 = arith.constant 8 : u32; - v71 = arith.mod v69, v222 : u32; - hir.assertz v71 #[code = 250]; - v72 = hir.int_to_ptr v69 : ptr; - v73 = hir.load v72 : i64; - v75 = arith.constant 32 : u32; - v74 = hir.bitcast v53 : u32; - v76 = arith.add v74, v75 : u32 #[overflow = checked]; - v221 = arith.constant 8 : u32; - v78 = arith.mod v76, v221 : u32; + private builtin.function @miden_base_sys::bindings::input_note::get_assets_info(v48: i32, v49: felt) { + ^block15(v48: i32, v49: felt): + hir.store_local v48 #[local = lv0]; + v50 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__stack_pointer : ptr + v51 = hir.bitcast v50 : ptr; + v52 = hir.load v51 : i32; + v157 = arith.constant 32 : i32; + v54 = arith.sub v52, v157 : i32 #[overflow = wrapping]; + hir.store_local v54 #[local = lv2]; + v55 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__stack_pointer : ptr + v56 = hir.bitcast v55 : ptr; + hir.store v56, v54; + v58 = hir.load_local : i32 #[local = lv2]; + hir.exec @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/miden::protocol::input_note::get_assets_info(v49, v58) + v59 = hir.load_local : i32 #[local = lv0]; + v60 = hir.load_local : i32 #[local = lv2]; + v156 = arith.constant 16 : u32; + v61 = hir.bitcast v60 : u32; + v63 = arith.add v61, v156 : u32 #[overflow = checked]; + v155 = arith.constant 4 : u32; + v65 = arith.mod v63, v155 : u32; + hir.assertz v65 #[code = 250]; + v66 = hir.int_to_ptr v63 : ptr; + v67 = hir.load v66 : felt; + v187 = arith.constant 16 : u32; + v68 = hir.bitcast v59 : u32; + v70 = arith.add v68, v187 : u32 #[overflow = checked]; + v186 = arith.constant 4 : u32; + v72 = arith.mod v70, v186 : u32; + hir.assertz v72 #[code = 250]; + v73 = hir.int_to_ptr v70 : ptr; + hir.store v73, v67; + v74 = hir.load_local : i32 #[local = lv0]; + v75 = hir.load_local : i32 #[local = lv2]; + v76 = hir.bitcast v75 : u32; + v185 = arith.constant 4 : u32; + v78 = arith.mod v76, v185 : u32; hir.assertz v78 #[code = 250]; - v79 = hir.int_to_ptr v76 : ptr; - hir.store v79, v73; - v81 = arith.constant 16 : u32; - v80 = hir.bitcast v53 : u32; - v82 = arith.add v80, v81 : u32 #[overflow = checked]; - v83 = arith.constant 4 : u32; - v84 = arith.mod v82, v83 : u32; - hir.assertz v84 #[code = 250]; - v85 = hir.int_to_ptr v82 : ptr; - v86 = hir.load v85 : felt; - v87 = arith.constant 32 : i32; - v88 = arith.add v53, v87 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/::reverse(v46, v88) - v220 = arith.constant 16 : u32; - v89 = hir.bitcast v46 : u32; - v91 = arith.add v89, v220 : u32 #[overflow = checked]; - v219 = arith.constant 4 : u32; - v93 = arith.mod v91, v219 : u32; + v79 = hir.int_to_ptr v76 : ptr; + v80 = hir.load v79 : felt; + v154 = arith.constant 12 : u32; + v81 = hir.bitcast v74 : u32; + v83 = arith.add v81, v154 : u32 #[overflow = checked]; + v184 = arith.constant 4 : u32; + v85 = arith.mod v83, v184 : u32; + hir.assertz v85 #[code = 250]; + v86 = hir.int_to_ptr v83 : ptr; + hir.store v86, v80; + v87 = hir.load_local : i32 #[local = lv0]; + v88 = hir.load_local : i32 #[local = lv2]; + v183 = arith.constant 4 : u32; + v89 = hir.bitcast v88 : u32; + v91 = arith.add v89, v183 : u32 #[overflow = checked]; + v182 = arith.constant 4 : u32; + v93 = arith.mod v91, v182 : u32; hir.assertz v93 #[code = 250]; v94 = hir.int_to_ptr v91 : ptr; - hir.store v94, v86; - v218 = arith.constant 48 : i32; - v96 = arith.add v53, v218 : i32 #[overflow = wrapping]; - v97 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__stack_pointer : ptr - v98 = hir.bitcast v97 : ptr; - hir.store v98, v96; - builtin.ret ; - }; - - private builtin.function @::reverse(v99: i32, v100: i32) { - ^block17(v99: i32, v100: i32): - v103 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__stack_pointer : ptr - v104 = hir.bitcast v103 : ptr; - v105 = hir.load v104 : i32; - v106 = arith.constant 16 : i32; - v107 = arith.sub v105, v106 : i32 #[overflow = wrapping]; - v109 = arith.constant 8 : u32; - v108 = hir.bitcast v100 : u32; - v110 = arith.add v108, v109 : u32 #[overflow = checked]; - v311 = arith.constant 8 : u32; - v112 = arith.mod v110, v311 : u32; - hir.assertz v112 #[code = 250]; - v113 = hir.int_to_ptr v110 : ptr; - v114 = hir.load v113 : i64; - v310 = arith.constant 8 : u32; - v115 = hir.bitcast v107 : u32; - v117 = arith.add v115, v310 : u32 #[overflow = checked]; - v118 = arith.constant 4 : u32; - v119 = arith.mod v117, v118 : u32; - hir.assertz v119 #[code = 250]; - v120 = hir.int_to_ptr v117 : ptr; - hir.store v120, v114; - v121 = hir.bitcast v100 : u32; - v309 = arith.constant 8 : u32; - v123 = arith.mod v121, v309 : u32; + v95 = hir.load v94 : felt; + v153 = arith.constant 8 : u32; + v96 = hir.bitcast v87 : u32; + v98 = arith.add v96, v153 : u32 #[overflow = checked]; + v181 = arith.constant 4 : u32; + v100 = arith.mod v98, v181 : u32; + hir.assertz v100 #[code = 250]; + v101 = hir.int_to_ptr v98 : ptr; + hir.store v101, v95; + v102 = hir.load_local : i32 #[local = lv0]; + v103 = hir.load_local : i32 #[local = lv2]; + v180 = arith.constant 8 : u32; + v104 = hir.bitcast v103 : u32; + v106 = arith.add v104, v180 : u32 #[overflow = checked]; + v179 = arith.constant 4 : u32; + v108 = arith.mod v106, v179 : u32; + hir.assertz v108 #[code = 250]; + v109 = hir.int_to_ptr v106 : ptr; + v110 = hir.load v109 : felt; + v178 = arith.constant 4 : u32; + v111 = hir.bitcast v102 : u32; + v113 = arith.add v111, v178 : u32 #[overflow = checked]; + v177 = arith.constant 4 : u32; + v115 = arith.mod v113, v177 : u32; + hir.assertz v115 #[code = 250]; + v116 = hir.int_to_ptr v113 : ptr; + hir.store v116, v110; + v117 = hir.load_local : i32 #[local = lv0]; + v118 = hir.load_local : i32 #[local = lv2]; + v176 = arith.constant 12 : u32; + v119 = hir.bitcast v118 : u32; + v121 = arith.add v119, v176 : u32 #[overflow = checked]; + v175 = arith.constant 4 : u32; + v123 = arith.mod v121, v175 : u32; hir.assertz v123 #[code = 250]; - v124 = hir.int_to_ptr v121 : ptr; - v125 = hir.load v124 : i64; - v126 = hir.bitcast v107 : u32; - v308 = arith.constant 4 : u32; - v128 = arith.mod v126, v308 : u32; + v124 = hir.int_to_ptr v121 : ptr; + v125 = hir.load v124 : felt; + v126 = hir.bitcast v117 : u32; + v174 = arith.constant 4 : u32; + v128 = arith.mod v126, v174 : u32; hir.assertz v128 #[code = 250]; - v129 = hir.int_to_ptr v126 : ptr; + v129 = hir.int_to_ptr v126 : ptr; hir.store v129, v125; - v130 = arith.constant 12 : i32; - v131 = arith.add v107, v130 : i32 #[overflow = wrapping]; - v101 = arith.constant 0 : i32; - v279, v280, v281, v282, v283, v284 = scf.while v101, v107, v131, v99 : i32, i32, i32, i32, i32, i32 { - ^block39(v285: i32, v286: i32, v287: i32, v288: i32): - v307 = arith.constant 0 : i32; - v134 = arith.constant 8 : i32; - v135 = arith.eq v285, v134 : i1; - v136 = arith.zext v135 : u32; - v137 = hir.bitcast v136 : i32; - v139 = arith.neq v137, v307 : i1; - v273, v274 = scf.if v139 : i32, i32 { - ^block38: - v233 = ub.poison i32 : i32; - scf.yield v233, v233; - } else { - ^block22: - v141 = arith.add v286, v285 : i32 #[overflow = wrapping]; - v142 = hir.bitcast v141 : u32; - v306 = arith.constant 4 : u32; - v144 = arith.mod v142, v306 : u32; - hir.assertz v144 #[code = 250]; - v145 = hir.int_to_ptr v142 : ptr; - v146 = hir.load v145 : felt; - v148 = hir.bitcast v287 : u32; - v305 = arith.constant 4 : u32; - v150 = arith.mod v148, v305 : u32; - hir.assertz v150 #[code = 250]; - v151 = hir.int_to_ptr v148 : ptr; - v152 = hir.load v151 : i32; - v153 = hir.bitcast v141 : u32; - v304 = arith.constant 4 : u32; - v155 = arith.mod v153, v304 : u32; - hir.assertz v155 #[code = 250]; - v156 = hir.int_to_ptr v153 : ptr; - hir.store v156, v152; - v157 = hir.bitcast v287 : u32; - v303 = arith.constant 4 : u32; - v159 = arith.mod v157, v303 : u32; - hir.assertz v159 #[code = 250]; - v160 = hir.int_to_ptr v157 : ptr; - hir.store v160, v146; - v163 = arith.constant -4 : i32; - v164 = arith.add v287, v163 : i32 #[overflow = wrapping]; - v161 = arith.constant 4 : i32; - v162 = arith.add v285, v161 : i32 #[overflow = wrapping]; - scf.yield v162, v164; - }; - v301 = ub.poison i32 : i32; - v276 = cf.select v139, v301, v288 : i32; - v302 = ub.poison i32 : i32; - v275 = cf.select v139, v302, v286 : i32; - v232 = arith.constant 1 : u32; - v225 = arith.constant 0 : u32; - v278 = cf.select v139, v225, v232 : u32; - v266 = arith.trunc v278 : i1; - scf.condition v266, v273, v275, v274, v276, v286, v288; - } do { - ^block40(v289: i32, v290: i32, v291: i32, v292: i32, v293: i32, v294: i32): - scf.yield v289, v290, v291, v292; - }; - v300 = arith.constant 8 : u32; - v166 = hir.bitcast v283 : u32; - v168 = arith.add v166, v300 : u32 #[overflow = checked]; - v299 = arith.constant 4 : u32; - v170 = arith.mod v168, v299 : u32; - hir.assertz v170 #[code = 250]; - v171 = hir.int_to_ptr v168 : ptr; - v172 = hir.load v171 : i64; - v298 = arith.constant 8 : u32; - v173 = hir.bitcast v284 : u32; - v175 = arith.add v173, v298 : u32 #[overflow = checked]; - v297 = arith.constant 8 : u32; - v177 = arith.mod v175, v297 : u32; - hir.assertz v177 #[code = 250]; - v178 = hir.int_to_ptr v175 : ptr; - hir.store v178, v172; - v179 = hir.bitcast v283 : u32; - v296 = arith.constant 4 : u32; - v181 = arith.mod v179, v296 : u32; - hir.assertz v181 #[code = 250]; - v182 = hir.int_to_ptr v179 : ptr; - v183 = hir.load v182 : i64; - v184 = hir.bitcast v284 : u32; - v295 = arith.constant 8 : u32; - v186 = arith.mod v184, v295 : u32; - hir.assertz v186 #[code = 250]; - v187 = hir.int_to_ptr v184 : ptr; - hir.store v187, v183; + v130 = hir.load_local : i32 #[local = lv2]; + v173 = arith.constant 32 : i32; + v132 = arith.add v130, v173 : i32 #[overflow = wrapping]; + v133 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__stack_pointer : ptr + v134 = hir.bitcast v133 : ptr; + hir.store v134, v132; builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v188: i32) -> felt { - ^block23(v188: i32): - v189 = hir.bitcast v188 : felt; - builtin.ret v189; - }; - - private builtin.function @miden::input_note::get_assets_info(v191: felt, v192: i32) { - ^block25(v191: felt, v192: i32): - v193, v194, v195, v196, v197 = hir.exec @miden/input_note/get_assets_info(v191) : felt, felt, felt, felt, felt - v198 = hir.bitcast v192 : u32; - v199 = hir.int_to_ptr v198 : ptr; - hir.store v199, v193; - v200 = arith.constant 4 : u32; - v201 = arith.add v198, v200 : u32 #[overflow = checked]; - v202 = hir.int_to_ptr v201 : ptr; - hir.store v202, v194; - v203 = arith.constant 8 : u32; - v204 = arith.add v198, v203 : u32 #[overflow = checked]; - v205 = hir.int_to_ptr v204 : ptr; - hir.store v205, v195; - v206 = arith.constant 12 : u32; - v207 = arith.add v198, v206 : u32 #[overflow = checked]; - v208 = hir.int_to_ptr v207 : ptr; - hir.store v208, v196; - v209 = arith.constant 16 : u32; - v210 = arith.add v198, v209 : u32 #[overflow = checked]; - v211 = hir.int_to_ptr v210 : ptr; - hir.store v211, v197; - builtin.ret ; + private builtin.function @miden::protocol::input_note::get_assets_info(v135: felt, v136: i32) { + ^block17(v135: felt, v136: i32): + ub.unreachable ; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -312,8 +205,8 @@ builtin.component miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-inp }; public builtin.function @binding() -> felt { - ^block29: - v212 = hir.exec @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1#binding() : felt - builtin.ret v212; + ^block19: + v137 = hir.exec @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1#binding() : felt + builtin.ret v137; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.masm index 86428a52d..b1cfdf59e 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.masm @@ -1,16 +1,16 @@ -# mod miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1 +# mod ::"miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> felt - exec.::miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1::init + exec."miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1::rust_sdk_input_note_get_assets_info_binding::miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1#binding + exec.::"miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1"::rust_sdk_input_note_get_assets_info_binding::"miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1#binding" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -23,7 +23,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -34,7 +34,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1::rust_sdk_input_note_get_assets_info_binding +# mod ::"miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1"::rust_sdk_input_note_get_assets_info_binding @callconv("C") proc __wasm_call_ctors( @@ -50,6 +50,7 @@ proc rust_sdk_input_note_get_assets_info_binding::bindings::__link_custom_sectio nop end +@locals("2") @callconv("C") proc miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1#binding( @@ -64,9 +65,16 @@ proc miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-a nop push.32 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -76,23 +84,34 @@ proc miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-a nop trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1::rust_sdk_input_note_get_assets_info_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1"::rust_sdk_input_note_get_assets_info_binding::wit_bindgen::rt::run_ctors_once trace.252 nop + locaddr.0 push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1::rust_sdk_input_note_get_assets_info_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop - dup.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1::rust_sdk_input_note_get_assets_info_binding::miden_base_sys::bindings::input_note::get_assets_info + exec.::"miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1"::rust_sdk_input_note_get_assets_info_binding::miden_base_sys::bindings::input_note::get_assets_info + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.16 - dup.1 + swap.1 add u32assert push.4 @@ -108,8 +127,15 @@ proc miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-a exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.32 - movup.2 u32wrapping_add push.1114144 u32divmod.4 @@ -121,6 +147,7 @@ proc miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-a nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -162,9 +189,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1::rust_sdk_input_note_get_assets_info_binding::__wasm_call_ctors + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1"::rust_sdk_input_note_get_assets_info_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -195,111 +238,79 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("3") @callconv("C") proc miden_base_sys::bindings::input_note::get_assets_info( i32, felt ) - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::store_sw trace.252 nop - push.48 - u32wrapping_sub push.1114144 - dup.1 - swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop + push.32 + u32wrapping_sub dup.0 - movup.3 + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1::rust_sdk_input_note_get_assets_info_binding::miden::input_note::get_assets_info + exec.::intrinsics::mem::store_sw trace.252 nop - push.8 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.1114144 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.2 + push.0 swap.1 - push.40 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - dup.0 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::"miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1"::rust_sdk_input_note_get_assets_info_binding::"miden::protocol::input_note::get_assets_info" trace.252 nop + locaddr.0 + push.0 swap.1 - push.32 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop push.16 - dup.1 + swap.1 add u32assert push.4 @@ -315,17 +326,8 @@ proc miden_base_sys::bindings::input_note::get_assets_info( exec.::intrinsics::mem::load_felt trace.252 nop - push.32 - dup.2 - u32wrapping_add - dup.3 - trace.240 - nop - exec.::miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1::rust_sdk_input_note_get_assets_info_binding::::reverse - trace.252 - nop push.16 - movup.3 + movup.2 add u32assert push.4 @@ -341,38 +343,23 @@ proc miden_base_sys::bindings::input_note::get_assets_info( exec.::intrinsics::mem::store_felt trace.252 nop - push.48 - u32wrapping_add - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop -end - -@callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -382,12 +369,11 @@ proc ::reverse( swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.8 - dup.3 + push.12 + movup.2 add u32assert push.4 @@ -398,29 +384,31 @@ proc ::reverse( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - movup.2 - push.8 - dup.1 + locaddr.0 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + push.4 swap.1 - dup.2 + add + u32assert push.4 dup.1 swap.1 @@ -429,140 +417,13 @@ proc ::reverse( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop push.8 - dup.1 + movup.2 add u32assert push.4 @@ -575,29 +436,29 @@ proc ::reverse( swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.0 + push.0 swap.1 - push.8 - dup.4 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop + push.8 + swap.1 + add + u32assert push.4 dup.1 swap.1 @@ -608,12 +469,14 @@ proc ::reverse( swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 + push.4 movup.2 - push.8 + add + u32assert + push.4 dup.1 swap.1 u32mod @@ -621,57 +484,51 @@ proc ::reverse( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc miden::input_note::get_assets_info(felt, i32) + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden::input_note::get_assets_info + exec.::intrinsics::mem::load_sw trace.252 nop - movup.5 - dup.0 - movup.2 - swap.1 - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_sw trace.252 nop - push.4 - dup.1 + push.12 + swap.1 add u32assert - movup.2 + push.4 + dup.1 swap.1 + u32mod + u32assert + assertz u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_felt trace.252 nop - push.8 + swap.1 + push.4 dup.1 - add - u32assert - movup.2 swap.1 + u32mod + u32assert + assertz u32divmod.4 swap.1 trace.240 @@ -679,28 +536,32 @@ proc miden::input_note::get_assets_info(felt, i32) exec.::intrinsics::mem::store_felt trace.252 nop - push.12 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - add - u32assert + push.32 + u32wrapping_add + push.1114144 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::store_sw trace.252 nop end +@locals("2") +@callconv("C") +proc miden::protocol::input_note::get_assets_info(felt, i32) + drop + drop + push.0 + assert +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.wat index ae7ede13c..2078de91e 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.wat @@ -10,9 +10,8 @@ (type (;0;) (func)) (type (;1;) (func (result f32))) (type (;2;) (func (param i32 f32))) - (type (;3;) (func (param i32 i32))) - (type (;4;) (func (param i32) (result f32))) - (type (;5;) (func (param f32 i32))) + (type (;3;) (func (param i32) (result f32))) + (type (;4;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -64,103 +63,46 @@ (func $miden_base_sys::bindings::input_note::get_assets_info (;4;) (type 2) (param i32 f32) (local i32) global.get $__stack_pointer - i32.const 48 + i32.const 32 i32.sub local.tee 2 global.set $__stack_pointer local.get 1 local.get 2 - call $miden::input_note::get_assets_info - local.get 2 - local.get 2 - i64.load offset=8 - i64.store offset=40 - local.get 2 - local.get 2 - i64.load - i64.store offset=32 + call $miden::protocol::input_note::get_assets_info + local.get 0 local.get 2 f32.load offset=16 - local.set 1 + f32.store offset=16 local.get 0 local.get 2 - i32.const 32 - i32.add - call $::reverse + f32.load + f32.store offset=12 local.get 0 - local.get 1 - f32.store offset=16 local.get 2 - i32.const 48 - i32.add - global.set $__stack_pointer - ) - (func $::reverse (;5;) (type 3) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end + f32.load offset=4 + f32.store offset=8 local.get 0 local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 + f32.load offset=8 + f32.store offset=4 local.get 0 local.get 2 - i64.load align=4 - i64.store + f32.load offset=12 + f32.store + local.get 2 + i32.const 32 + i32.add + global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) unreachable ) - (func $miden::input_note::get_assets_info (;7;) (type 5) (param f32 i32) + (func $miden::protocol::input_note::get_assets_info (;6;) (type 4) (param f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "Wrust_sdk_input_note_get_assets_info_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "Wrust_sdk_input_note_get_assets_info_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.hir index bfa3f2b1a..4407ddf69 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.hir @@ -12,292 +12,185 @@ builtin.component miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-inp private builtin.function @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1#binding() -> felt { ^block9: - v3 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__stack_pointer : ptr - v4 = hir.bitcast v3 : ptr; - v5 = hir.load v4 : i32; - v6 = arith.constant 32 : i32; - v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; - v8 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__stack_pointer : ptr - v9 = hir.bitcast v8 : ptr; - hir.store v9, v7; + v1 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v142 = arith.constant 32 : i32; + v5 = arith.sub v3, v142 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; hir.exec @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/wit_bindgen::rt::run_ctors_once() - v1 = arith.constant 0 : i32; - v11 = hir.exec @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/intrinsics::felt::from_u32(v1) : felt - hir.exec @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/miden_base_sys::bindings::input_note::get_inputs_info(v7, v11) - v13 = arith.constant 16 : u32; - v12 = hir.bitcast v7 : u32; - v14 = arith.add v12, v13 : u32 #[overflow = checked]; - v15 = arith.constant 4 : u32; - v16 = arith.mod v14, v15 : u32; + v8 = hir.load_local : i32 #[local = lv0]; + v139 = arith.constant 0 : felt; + hir.exec @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/miden_base_sys::bindings::input_note::get_inputs_info(v8, v139) + v11 = hir.load_local : i32 #[local = lv0]; + v141 = arith.constant 16 : u32; + v12 = hir.bitcast v11 : u32; + v14 = arith.add v12, v141 : u32 #[overflow = checked]; + v140 = arith.constant 4 : u32; + v16 = arith.mod v14, v140 : u32; hir.assertz v16 #[code = 250]; v17 = hir.int_to_ptr v14 : ptr; v18 = hir.load v17 : felt; - v213 = arith.constant 32 : i32; - v20 = arith.add v7, v213 : i32 #[overflow = wrapping]; - v21 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__stack_pointer : ptr - v22 = hir.bitcast v21 : ptr; - hir.store v22, v20; + v19 = hir.load_local : i32 #[local = lv0]; + v144 = arith.constant 32 : i32; + v21 = arith.add v19, v144 : i32 #[overflow = wrapping]; + v22 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__stack_pointer : ptr + v23 = hir.bitcast v22 : ptr; + hir.store v23, v21; builtin.ret v18; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v24 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/GOT.data.internal.__memory_base : ptr - v25 = hir.bitcast v24 : ptr; - v26 = hir.load v25 : i32; - v27 = arith.constant 1048584 : i32; - v28 = arith.add v26, v27 : i32 #[overflow = wrapping]; - v29 = hir.bitcast v28 : u32; - v30 = hir.int_to_ptr v29 : ptr; - v31 = hir.load v30 : u8; - v23 = arith.constant 0 : i32; - v32 = arith.zext v31 : u32; - v33 = hir.bitcast v32 : i32; - v35 = arith.neq v33, v23 : i1; - scf.if v35{ + v25 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/GOT.data.internal.__memory_base : ptr + v26 = hir.bitcast v25 : ptr; + v27 = hir.load v26 : i32; + v149 = arith.constant 1048584 : i32; + v29 = arith.add v27, v149 : i32 #[overflow = wrapping]; + v30 = hir.bitcast v29 : u32; + v31 = hir.int_to_ptr v30 : ptr; + v32 = hir.load v31 : u8; + v148 = arith.constant 0 : i32; + v33 = arith.zext v32 : u32; + v34 = hir.bitcast v33 : i32; + v36 = arith.neq v34, v148 : i1; + scf.if v36{ ^block13: scf.yield ; } else { ^block14: - v36 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/GOT.data.internal.__memory_base : ptr - v37 = hir.bitcast v36 : ptr; - v38 = hir.load v37 : i32; + v37 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/GOT.data.internal.__memory_base : ptr + v38 = hir.bitcast v37 : ptr; + v39 = hir.load v38 : i32; + hir.store_local v39 #[local = lv0]; hir.exec @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__wasm_call_ctors() - v215 = arith.constant 1 : u8; - v217 = arith.constant 1048584 : i32; - v40 = arith.add v38, v217 : i32 #[overflow = wrapping]; - v44 = hir.bitcast v40 : u32; - v45 = hir.int_to_ptr v44 : ptr; - hir.store v45, v215; + v40 = hir.load_local : i32 #[local = lv0]; + v147 = arith.constant 1 : u8; + v152 = arith.constant 1048584 : i32; + v42 = arith.add v40, v152 : i32 #[overflow = wrapping]; + v46 = hir.bitcast v42 : u32; + v47 = hir.int_to_ptr v46 : ptr; + hir.store v47, v147; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::input_note::get_inputs_info(v46: i32, v47: felt) { - ^block15(v46: i32, v47: felt): - v49 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__stack_pointer : ptr - v50 = hir.bitcast v49 : ptr; - v51 = hir.load v50 : i32; - v52 = arith.constant 48 : i32; - v53 = arith.sub v51, v52 : i32 #[overflow = wrapping]; - v54 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__stack_pointer : ptr - v55 = hir.bitcast v54 : ptr; - hir.store v55, v53; - hir.exec @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/miden::input_note::get_inputs_info(v47, v53) - v57 = arith.constant 8 : u32; - v56 = hir.bitcast v53 : u32; - v58 = arith.add v56, v57 : u32 #[overflow = checked]; - v224 = arith.constant 8 : u32; - v60 = arith.mod v58, v224 : u32; - hir.assertz v60 #[code = 250]; - v61 = hir.int_to_ptr v58 : ptr; - v62 = hir.load v61 : i64; - v64 = arith.constant 40 : u32; - v63 = hir.bitcast v53 : u32; - v65 = arith.add v63, v64 : u32 #[overflow = checked]; - v223 = arith.constant 8 : u32; - v67 = arith.mod v65, v223 : u32; - hir.assertz v67 #[code = 250]; - v68 = hir.int_to_ptr v65 : ptr; - hir.store v68, v62; - v69 = hir.bitcast v53 : u32; - v222 = arith.constant 8 : u32; - v71 = arith.mod v69, v222 : u32; - hir.assertz v71 #[code = 250]; - v72 = hir.int_to_ptr v69 : ptr; - v73 = hir.load v72 : i64; - v75 = arith.constant 32 : u32; - v74 = hir.bitcast v53 : u32; - v76 = arith.add v74, v75 : u32 #[overflow = checked]; - v221 = arith.constant 8 : u32; - v78 = arith.mod v76, v221 : u32; + private builtin.function @miden_base_sys::bindings::input_note::get_inputs_info(v48: i32, v49: felt) { + ^block15(v48: i32, v49: felt): + hir.store_local v48 #[local = lv0]; + v50 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__stack_pointer : ptr + v51 = hir.bitcast v50 : ptr; + v52 = hir.load v51 : i32; + v157 = arith.constant 32 : i32; + v54 = arith.sub v52, v157 : i32 #[overflow = wrapping]; + hir.store_local v54 #[local = lv2]; + v55 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__stack_pointer : ptr + v56 = hir.bitcast v55 : ptr; + hir.store v56, v54; + v58 = hir.load_local : i32 #[local = lv2]; + hir.exec @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/miden::protocol::input_note::get_inputs_info(v49, v58) + v59 = hir.load_local : i32 #[local = lv0]; + v60 = hir.load_local : i32 #[local = lv2]; + v156 = arith.constant 16 : u32; + v61 = hir.bitcast v60 : u32; + v63 = arith.add v61, v156 : u32 #[overflow = checked]; + v155 = arith.constant 4 : u32; + v65 = arith.mod v63, v155 : u32; + hir.assertz v65 #[code = 250]; + v66 = hir.int_to_ptr v63 : ptr; + v67 = hir.load v66 : felt; + v187 = arith.constant 16 : u32; + v68 = hir.bitcast v59 : u32; + v70 = arith.add v68, v187 : u32 #[overflow = checked]; + v186 = arith.constant 4 : u32; + v72 = arith.mod v70, v186 : u32; + hir.assertz v72 #[code = 250]; + v73 = hir.int_to_ptr v70 : ptr; + hir.store v73, v67; + v74 = hir.load_local : i32 #[local = lv0]; + v75 = hir.load_local : i32 #[local = lv2]; + v76 = hir.bitcast v75 : u32; + v185 = arith.constant 4 : u32; + v78 = arith.mod v76, v185 : u32; hir.assertz v78 #[code = 250]; - v79 = hir.int_to_ptr v76 : ptr; - hir.store v79, v73; - v81 = arith.constant 16 : u32; - v80 = hir.bitcast v53 : u32; - v82 = arith.add v80, v81 : u32 #[overflow = checked]; - v83 = arith.constant 4 : u32; - v84 = arith.mod v82, v83 : u32; - hir.assertz v84 #[code = 250]; - v85 = hir.int_to_ptr v82 : ptr; - v86 = hir.load v85 : felt; - v87 = arith.constant 32 : i32; - v88 = arith.add v53, v87 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/::reverse(v46, v88) - v220 = arith.constant 16 : u32; - v89 = hir.bitcast v46 : u32; - v91 = arith.add v89, v220 : u32 #[overflow = checked]; - v219 = arith.constant 4 : u32; - v93 = arith.mod v91, v219 : u32; + v79 = hir.int_to_ptr v76 : ptr; + v80 = hir.load v79 : felt; + v154 = arith.constant 12 : u32; + v81 = hir.bitcast v74 : u32; + v83 = arith.add v81, v154 : u32 #[overflow = checked]; + v184 = arith.constant 4 : u32; + v85 = arith.mod v83, v184 : u32; + hir.assertz v85 #[code = 250]; + v86 = hir.int_to_ptr v83 : ptr; + hir.store v86, v80; + v87 = hir.load_local : i32 #[local = lv0]; + v88 = hir.load_local : i32 #[local = lv2]; + v183 = arith.constant 4 : u32; + v89 = hir.bitcast v88 : u32; + v91 = arith.add v89, v183 : u32 #[overflow = checked]; + v182 = arith.constant 4 : u32; + v93 = arith.mod v91, v182 : u32; hir.assertz v93 #[code = 250]; v94 = hir.int_to_ptr v91 : ptr; - hir.store v94, v86; - v218 = arith.constant 48 : i32; - v96 = arith.add v53, v218 : i32 #[overflow = wrapping]; - v97 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__stack_pointer : ptr - v98 = hir.bitcast v97 : ptr; - hir.store v98, v96; - builtin.ret ; - }; - - private builtin.function @::reverse(v99: i32, v100: i32) { - ^block17(v99: i32, v100: i32): - v103 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__stack_pointer : ptr - v104 = hir.bitcast v103 : ptr; - v105 = hir.load v104 : i32; - v106 = arith.constant 16 : i32; - v107 = arith.sub v105, v106 : i32 #[overflow = wrapping]; - v109 = arith.constant 8 : u32; - v108 = hir.bitcast v100 : u32; - v110 = arith.add v108, v109 : u32 #[overflow = checked]; - v311 = arith.constant 8 : u32; - v112 = arith.mod v110, v311 : u32; - hir.assertz v112 #[code = 250]; - v113 = hir.int_to_ptr v110 : ptr; - v114 = hir.load v113 : i64; - v310 = arith.constant 8 : u32; - v115 = hir.bitcast v107 : u32; - v117 = arith.add v115, v310 : u32 #[overflow = checked]; - v118 = arith.constant 4 : u32; - v119 = arith.mod v117, v118 : u32; - hir.assertz v119 #[code = 250]; - v120 = hir.int_to_ptr v117 : ptr; - hir.store v120, v114; - v121 = hir.bitcast v100 : u32; - v309 = arith.constant 8 : u32; - v123 = arith.mod v121, v309 : u32; + v95 = hir.load v94 : felt; + v153 = arith.constant 8 : u32; + v96 = hir.bitcast v87 : u32; + v98 = arith.add v96, v153 : u32 #[overflow = checked]; + v181 = arith.constant 4 : u32; + v100 = arith.mod v98, v181 : u32; + hir.assertz v100 #[code = 250]; + v101 = hir.int_to_ptr v98 : ptr; + hir.store v101, v95; + v102 = hir.load_local : i32 #[local = lv0]; + v103 = hir.load_local : i32 #[local = lv2]; + v180 = arith.constant 8 : u32; + v104 = hir.bitcast v103 : u32; + v106 = arith.add v104, v180 : u32 #[overflow = checked]; + v179 = arith.constant 4 : u32; + v108 = arith.mod v106, v179 : u32; + hir.assertz v108 #[code = 250]; + v109 = hir.int_to_ptr v106 : ptr; + v110 = hir.load v109 : felt; + v178 = arith.constant 4 : u32; + v111 = hir.bitcast v102 : u32; + v113 = arith.add v111, v178 : u32 #[overflow = checked]; + v177 = arith.constant 4 : u32; + v115 = arith.mod v113, v177 : u32; + hir.assertz v115 #[code = 250]; + v116 = hir.int_to_ptr v113 : ptr; + hir.store v116, v110; + v117 = hir.load_local : i32 #[local = lv0]; + v118 = hir.load_local : i32 #[local = lv2]; + v176 = arith.constant 12 : u32; + v119 = hir.bitcast v118 : u32; + v121 = arith.add v119, v176 : u32 #[overflow = checked]; + v175 = arith.constant 4 : u32; + v123 = arith.mod v121, v175 : u32; hir.assertz v123 #[code = 250]; - v124 = hir.int_to_ptr v121 : ptr; - v125 = hir.load v124 : i64; - v126 = hir.bitcast v107 : u32; - v308 = arith.constant 4 : u32; - v128 = arith.mod v126, v308 : u32; + v124 = hir.int_to_ptr v121 : ptr; + v125 = hir.load v124 : felt; + v126 = hir.bitcast v117 : u32; + v174 = arith.constant 4 : u32; + v128 = arith.mod v126, v174 : u32; hir.assertz v128 #[code = 250]; - v129 = hir.int_to_ptr v126 : ptr; + v129 = hir.int_to_ptr v126 : ptr; hir.store v129, v125; - v130 = arith.constant 12 : i32; - v131 = arith.add v107, v130 : i32 #[overflow = wrapping]; - v101 = arith.constant 0 : i32; - v279, v280, v281, v282, v283, v284 = scf.while v101, v107, v131, v99 : i32, i32, i32, i32, i32, i32 { - ^block39(v285: i32, v286: i32, v287: i32, v288: i32): - v307 = arith.constant 0 : i32; - v134 = arith.constant 8 : i32; - v135 = arith.eq v285, v134 : i1; - v136 = arith.zext v135 : u32; - v137 = hir.bitcast v136 : i32; - v139 = arith.neq v137, v307 : i1; - v273, v274 = scf.if v139 : i32, i32 { - ^block38: - v233 = ub.poison i32 : i32; - scf.yield v233, v233; - } else { - ^block22: - v141 = arith.add v286, v285 : i32 #[overflow = wrapping]; - v142 = hir.bitcast v141 : u32; - v306 = arith.constant 4 : u32; - v144 = arith.mod v142, v306 : u32; - hir.assertz v144 #[code = 250]; - v145 = hir.int_to_ptr v142 : ptr; - v146 = hir.load v145 : felt; - v148 = hir.bitcast v287 : u32; - v305 = arith.constant 4 : u32; - v150 = arith.mod v148, v305 : u32; - hir.assertz v150 #[code = 250]; - v151 = hir.int_to_ptr v148 : ptr; - v152 = hir.load v151 : i32; - v153 = hir.bitcast v141 : u32; - v304 = arith.constant 4 : u32; - v155 = arith.mod v153, v304 : u32; - hir.assertz v155 #[code = 250]; - v156 = hir.int_to_ptr v153 : ptr; - hir.store v156, v152; - v157 = hir.bitcast v287 : u32; - v303 = arith.constant 4 : u32; - v159 = arith.mod v157, v303 : u32; - hir.assertz v159 #[code = 250]; - v160 = hir.int_to_ptr v157 : ptr; - hir.store v160, v146; - v163 = arith.constant -4 : i32; - v164 = arith.add v287, v163 : i32 #[overflow = wrapping]; - v161 = arith.constant 4 : i32; - v162 = arith.add v285, v161 : i32 #[overflow = wrapping]; - scf.yield v162, v164; - }; - v301 = ub.poison i32 : i32; - v276 = cf.select v139, v301, v288 : i32; - v302 = ub.poison i32 : i32; - v275 = cf.select v139, v302, v286 : i32; - v232 = arith.constant 1 : u32; - v225 = arith.constant 0 : u32; - v278 = cf.select v139, v225, v232 : u32; - v266 = arith.trunc v278 : i1; - scf.condition v266, v273, v275, v274, v276, v286, v288; - } do { - ^block40(v289: i32, v290: i32, v291: i32, v292: i32, v293: i32, v294: i32): - scf.yield v289, v290, v291, v292; - }; - v300 = arith.constant 8 : u32; - v166 = hir.bitcast v283 : u32; - v168 = arith.add v166, v300 : u32 #[overflow = checked]; - v299 = arith.constant 4 : u32; - v170 = arith.mod v168, v299 : u32; - hir.assertz v170 #[code = 250]; - v171 = hir.int_to_ptr v168 : ptr; - v172 = hir.load v171 : i64; - v298 = arith.constant 8 : u32; - v173 = hir.bitcast v284 : u32; - v175 = arith.add v173, v298 : u32 #[overflow = checked]; - v297 = arith.constant 8 : u32; - v177 = arith.mod v175, v297 : u32; - hir.assertz v177 #[code = 250]; - v178 = hir.int_to_ptr v175 : ptr; - hir.store v178, v172; - v179 = hir.bitcast v283 : u32; - v296 = arith.constant 4 : u32; - v181 = arith.mod v179, v296 : u32; - hir.assertz v181 #[code = 250]; - v182 = hir.int_to_ptr v179 : ptr; - v183 = hir.load v182 : i64; - v184 = hir.bitcast v284 : u32; - v295 = arith.constant 8 : u32; - v186 = arith.mod v184, v295 : u32; - hir.assertz v186 #[code = 250]; - v187 = hir.int_to_ptr v184 : ptr; - hir.store v187, v183; + v130 = hir.load_local : i32 #[local = lv2]; + v173 = arith.constant 32 : i32; + v132 = arith.add v130, v173 : i32 #[overflow = wrapping]; + v133 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__stack_pointer : ptr + v134 = hir.bitcast v133 : ptr; + hir.store v134, v132; builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v188: i32) -> felt { - ^block23(v188: i32): - v189 = hir.bitcast v188 : felt; - builtin.ret v189; - }; - - private builtin.function @miden::input_note::get_inputs_info(v191: felt, v192: i32) { - ^block25(v191: felt, v192: i32): - v193, v194, v195, v196, v197 = hir.exec @miden/input_note/get_inputs_info(v191) : felt, felt, felt, felt, felt - v198 = hir.bitcast v192 : u32; - v199 = hir.int_to_ptr v198 : ptr; - hir.store v199, v193; - v200 = arith.constant 4 : u32; - v201 = arith.add v198, v200 : u32 #[overflow = checked]; - v202 = hir.int_to_ptr v201 : ptr; - hir.store v202, v194; - v203 = arith.constant 8 : u32; - v204 = arith.add v198, v203 : u32 #[overflow = checked]; - v205 = hir.int_to_ptr v204 : ptr; - hir.store v205, v195; - v206 = arith.constant 12 : u32; - v207 = arith.add v198, v206 : u32 #[overflow = checked]; - v208 = hir.int_to_ptr v207 : ptr; - hir.store v208, v196; - v209 = arith.constant 16 : u32; - v210 = arith.add v198, v209 : u32 #[overflow = checked]; - v211 = hir.int_to_ptr v210 : ptr; - hir.store v211, v197; - builtin.ret ; + private builtin.function @miden::protocol::input_note::get_inputs_info(v135: felt, v136: i32) { + ^block17(v135: felt, v136: i32): + ub.unreachable ; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -312,8 +205,8 @@ builtin.component miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-inp }; public builtin.function @binding() -> felt { - ^block29: - v212 = hir.exec @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1#binding() : felt - builtin.ret v212; + ^block19: + v137 = hir.exec @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1#binding() : felt + builtin.ret v137; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.masm index ecfde15bd..193e6ad4b 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.masm @@ -1,16 +1,16 @@ -# mod miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1 +# mod ::"miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> felt - exec.::miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1::init + exec."miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1::rust_sdk_input_note_get_inputs_info_binding::miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1#binding + exec.::"miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1"::rust_sdk_input_note_get_inputs_info_binding::"miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1#binding" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -23,7 +23,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -34,7 +34,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1::rust_sdk_input_note_get_inputs_info_binding +# mod ::"miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1"::rust_sdk_input_note_get_inputs_info_binding @callconv("C") proc __wasm_call_ctors( @@ -50,6 +50,7 @@ proc rust_sdk_input_note_get_inputs_info_binding::bindings::__link_custom_sectio nop end +@locals("2") @callconv("C") proc miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1#binding( @@ -64,9 +65,16 @@ proc miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-i nop push.32 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -76,23 +84,34 @@ proc miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-i nop trace.240 nop - exec.::miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1::rust_sdk_input_note_get_inputs_info_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1"::rust_sdk_input_note_get_inputs_info_binding::wit_bindgen::rt::run_ctors_once trace.252 nop + locaddr.0 push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1::rust_sdk_input_note_get_inputs_info_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop - dup.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1::rust_sdk_input_note_get_inputs_info_binding::miden_base_sys::bindings::input_note::get_inputs_info + exec.::"miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1"::rust_sdk_input_note_get_inputs_info_binding::miden_base_sys::bindings::input_note::get_inputs_info + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.16 - dup.1 + swap.1 add u32assert push.4 @@ -108,8 +127,15 @@ proc miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-i exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.32 - movup.2 u32wrapping_add push.1114144 u32divmod.4 @@ -121,6 +147,7 @@ proc miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-i nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -162,9 +189,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1::rust_sdk_input_note_get_inputs_info_binding::__wasm_call_ctors + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1"::rust_sdk_input_note_get_inputs_info_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -195,111 +238,79 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("3") @callconv("C") proc miden_base_sys::bindings::input_note::get_inputs_info( i32, felt ) - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::store_sw trace.252 nop - push.48 - u32wrapping_sub push.1114144 - dup.1 - swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop + push.32 + u32wrapping_sub dup.0 - movup.3 + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1::rust_sdk_input_note_get_inputs_info_binding::miden::input_note::get_inputs_info + exec.::intrinsics::mem::store_sw trace.252 nop - push.8 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.1114144 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.2 + push.0 swap.1 - push.40 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - dup.0 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::"miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1"::rust_sdk_input_note_get_inputs_info_binding::"miden::protocol::input_note::get_inputs_info" trace.252 nop + locaddr.0 + push.0 swap.1 - push.32 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop push.16 - dup.1 + swap.1 add u32assert push.4 @@ -315,17 +326,8 @@ proc miden_base_sys::bindings::input_note::get_inputs_info( exec.::intrinsics::mem::load_felt trace.252 nop - push.32 - dup.2 - u32wrapping_add - dup.3 - trace.240 - nop - exec.::miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1::rust_sdk_input_note_get_inputs_info_binding::::reverse - trace.252 - nop push.16 - movup.3 + movup.2 add u32assert push.4 @@ -341,38 +343,23 @@ proc miden_base_sys::bindings::input_note::get_inputs_info( exec.::intrinsics::mem::store_felt trace.252 nop - push.48 - u32wrapping_add - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop -end - -@callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -382,12 +369,11 @@ proc ::reverse( swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - push.8 - dup.3 + push.12 + movup.2 add u32assert push.4 @@ -398,29 +384,31 @@ proc ::reverse( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - movup.2 - push.8 - dup.1 + locaddr.0 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + push.4 swap.1 - dup.2 + add + u32assert push.4 dup.1 swap.1 @@ -429,140 +417,13 @@ proc ::reverse( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop push.8 - dup.1 + movup.2 add u32assert push.4 @@ -575,29 +436,29 @@ proc ::reverse( swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.0 + push.0 swap.1 - push.8 - dup.4 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop + push.8 + swap.1 + add + u32assert push.4 dup.1 swap.1 @@ -608,12 +469,14 @@ proc ::reverse( swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 + push.4 movup.2 - push.8 + add + u32assert + push.4 dup.1 swap.1 u32mod @@ -621,57 +484,51 @@ proc ::reverse( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc miden::input_note::get_inputs_info(felt, i32) + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden::input_note::get_inputs_info + exec.::intrinsics::mem::load_sw trace.252 nop - movup.5 - dup.0 - movup.2 - swap.1 - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_sw trace.252 nop - push.4 - dup.1 + push.12 + swap.1 add u32assert - movup.2 + push.4 + dup.1 swap.1 + u32mod + u32assert + assertz u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_felt trace.252 nop - push.8 + swap.1 + push.4 dup.1 - add - u32assert - movup.2 swap.1 + u32mod + u32assert + assertz u32divmod.4 swap.1 trace.240 @@ -679,28 +536,32 @@ proc miden::input_note::get_inputs_info(felt, i32) exec.::intrinsics::mem::store_felt trace.252 nop - push.12 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - add - u32assert + push.32 + u32wrapping_add + push.1114144 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::store_sw trace.252 nop end +@locals("2") +@callconv("C") +proc miden::protocol::input_note::get_inputs_info(felt, i32) + drop + drop + push.0 + assert +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.wat index 58077fe9e..3270138da 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.wat @@ -10,9 +10,8 @@ (type (;0;) (func)) (type (;1;) (func (result f32))) (type (;2;) (func (param i32 f32))) - (type (;3;) (func (param i32 i32))) - (type (;4;) (func (param i32) (result f32))) - (type (;5;) (func (param f32 i32))) + (type (;3;) (func (param i32) (result f32))) + (type (;4;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -64,103 +63,46 @@ (func $miden_base_sys::bindings::input_note::get_inputs_info (;4;) (type 2) (param i32 f32) (local i32) global.get $__stack_pointer - i32.const 48 + i32.const 32 i32.sub local.tee 2 global.set $__stack_pointer local.get 1 local.get 2 - call $miden::input_note::get_inputs_info - local.get 2 - local.get 2 - i64.load offset=8 - i64.store offset=40 - local.get 2 - local.get 2 - i64.load - i64.store offset=32 + call $miden::protocol::input_note::get_inputs_info + local.get 0 local.get 2 f32.load offset=16 - local.set 1 + f32.store offset=16 local.get 0 local.get 2 - i32.const 32 - i32.add - call $::reverse + f32.load + f32.store offset=12 local.get 0 - local.get 1 - f32.store offset=16 local.get 2 - i32.const 48 - i32.add - global.set $__stack_pointer - ) - (func $::reverse (;5;) (type 3) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end + f32.load offset=4 + f32.store offset=8 local.get 0 local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 + f32.load offset=8 + f32.store offset=4 local.get 0 local.get 2 - i64.load align=4 - i64.store + f32.load offset=12 + f32.store + local.get 2 + i32.const 32 + i32.add + global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) unreachable ) - (func $miden::input_note::get_inputs_info (;7;) (type 5) (param f32 i32) + (func $miden::protocol::input_note::get_inputs_info (;6;) (type 4) (param f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "Wrust_sdk_input_note_get_inputs_info_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "Wrust_sdk_input_note_get_inputs_info_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.hir index 17ba29fa9..4d951a380 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.hir @@ -12,297 +12,206 @@ builtin.component miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input- private builtin.function @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1#binding() -> i32 { ^block9: - v2 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__stack_pointer : ptr - v3 = hir.bitcast v2 : ptr; - v4 = hir.load v3 : i32; - v5 = arith.constant 16 : i32; - v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; - v7 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__stack_pointer : ptr - v8 = hir.bitcast v7 : ptr; - hir.store v8, v6; + v1 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v196 = arith.constant 32 : i32; + v5 = arith.sub v3, v196 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; hir.exec @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/wit_bindgen::rt::run_ctors_once() - v1 = arith.constant 0 : i32; - v10 = hir.exec @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/intrinsics::felt::from_u32(v1) : felt - hir.exec @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/miden_base_sys::bindings::input_note::get_metadata(v6, v10) + v8 = hir.load_local : i32 #[local = lv0]; + v190 = arith.constant 0 : felt; + hir.exec @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/miden_base_sys::bindings::input_note::get_metadata(v8, v190) v11 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/GOT.data.internal.__memory_base : ptr v12 = hir.bitcast v11 : ptr; v13 = hir.load v12 : i32; - v14 = arith.constant 1048584 : i32; - v15 = arith.add v13, v14 : i32 #[overflow = wrapping]; - v17 = arith.constant 8 : u32; - v16 = hir.bitcast v6 : u32; - v18 = arith.add v16, v17 : u32 #[overflow = checked]; - v249 = arith.constant 8 : u32; - v20 = arith.mod v18, v249 : u32; - hir.assertz v20 #[code = 250]; - v21 = hir.int_to_ptr v18 : ptr; - v22 = hir.load v21 : i64; - v248 = arith.constant 8 : u32; - v23 = hir.bitcast v15 : u32; - v25 = arith.add v23, v248 : u32 #[overflow = checked]; - v26 = arith.constant 4 : u32; - v27 = arith.mod v25, v26 : u32; - hir.assertz v27 #[code = 250]; - v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v22; - v29 = hir.bitcast v6 : u32; - v247 = arith.constant 8 : u32; - v31 = arith.mod v29, v247 : u32; - hir.assertz v31 #[code = 250]; - v32 = hir.int_to_ptr v29 : ptr; - v33 = hir.load v32 : i64; - v34 = hir.bitcast v15 : u32; - v246 = arith.constant 4 : u32; - v36 = arith.mod v34, v246 : u32; + v195 = arith.constant 1048584 : i32; + v15 = arith.add v13, v195 : i32 #[overflow = wrapping]; + hir.store_local v15 #[local = lv1]; + v16 = hir.load_local : i32 #[local = lv0]; + v194 = arith.constant 24 : u32; + v17 = hir.bitcast v16 : u32; + v19 = arith.add v17, v194 : u32 #[overflow = checked]; + v193 = arith.constant 8 : u32; + v21 = arith.mod v19, v193 : u32; + hir.assertz v21 #[code = 250]; + v22 = hir.int_to_ptr v19 : ptr; + v23 = hir.load v22 : i64; + v204 = arith.constant 8 : u32; + v24 = hir.bitcast v15 : u32; + v26 = arith.add v24, v204 : u32 #[overflow = checked]; + v192 = arith.constant 4 : u32; + v28 = arith.mod v26, v192 : u32; + hir.assertz v28 #[code = 250]; + v29 = hir.int_to_ptr v26 : ptr; + hir.store v29, v23; + v30 = hir.load_local : i32 #[local = lv1]; + v31 = hir.load_local : i32 #[local = lv0]; + v191 = arith.constant 16 : u32; + v32 = hir.bitcast v31 : u32; + v34 = arith.add v32, v191 : u32 #[overflow = checked]; + v203 = arith.constant 8 : u32; + v36 = arith.mod v34, v203 : u32; hir.assertz v36 #[code = 250]; v37 = hir.int_to_ptr v34 : ptr; - hir.store v37, v33; - v245 = arith.constant 16 : i32; - v39 = arith.add v6, v245 : i32 #[overflow = wrapping]; - v40 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__stack_pointer : ptr - v41 = hir.bitcast v40 : ptr; - hir.store v41, v39; - builtin.ret v15; + v38 = hir.load v37 : i64; + v39 = hir.bitcast v30 : u32; + v202 = arith.constant 4 : u32; + v41 = arith.mod v39, v202 : u32; + hir.assertz v41 #[code = 250]; + v42 = hir.int_to_ptr v39 : ptr; + hir.store v42, v38; + v43 = hir.load_local : i32 #[local = lv0]; + v201 = arith.constant 32 : i32; + v45 = arith.add v43, v201 : i32 #[overflow = wrapping]; + v46 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__stack_pointer : ptr + v47 = hir.bitcast v46 : ptr; + hir.store v47, v45; + v48 = hir.load_local : i32 #[local = lv1]; + builtin.ret v48; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v43 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/GOT.data.internal.__memory_base : ptr - v44 = hir.bitcast v43 : ptr; - v45 = hir.load v44 : i32; - v46 = arith.constant 1048600 : i32; - v47 = arith.add v45, v46 : i32 #[overflow = wrapping]; - v48 = hir.bitcast v47 : u32; - v49 = hir.int_to_ptr v48 : ptr; - v50 = hir.load v49 : u8; - v42 = arith.constant 0 : i32; - v51 = arith.zext v50 : u32; - v52 = hir.bitcast v51 : i32; - v54 = arith.neq v52, v42 : i1; - scf.if v54{ + v49 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/GOT.data.internal.__memory_base : ptr + v50 = hir.bitcast v49 : ptr; + v51 = hir.load v50 : i32; + v209 = arith.constant 1048600 : i32; + v53 = arith.add v51, v209 : i32 #[overflow = wrapping]; + v54 = hir.bitcast v53 : u32; + v55 = hir.int_to_ptr v54 : ptr; + v56 = hir.load v55 : u8; + v208 = arith.constant 0 : i32; + v57 = arith.zext v56 : u32; + v58 = hir.bitcast v57 : i32; + v60 = arith.neq v58, v208 : i1; + scf.if v60{ ^block13: scf.yield ; } else { ^block14: - v55 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/GOT.data.internal.__memory_base : ptr - v56 = hir.bitcast v55 : ptr; - v57 = hir.load v56 : i32; + v61 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/GOT.data.internal.__memory_base : ptr + v62 = hir.bitcast v61 : ptr; + v63 = hir.load v62 : i32; + hir.store_local v63 #[local = lv0]; hir.exec @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__wasm_call_ctors() - v251 = arith.constant 1 : u8; - v253 = arith.constant 1048600 : i32; - v59 = arith.add v57, v253 : i32 #[overflow = wrapping]; - v63 = hir.bitcast v59 : u32; - v64 = hir.int_to_ptr v63 : ptr; - hir.store v64, v251; + v64 = hir.load_local : i32 #[local = lv0]; + v207 = arith.constant 1 : u8; + v212 = arith.constant 1048600 : i32; + v66 = arith.add v64, v212 : i32 #[overflow = wrapping]; + v70 = hir.bitcast v66 : u32; + v71 = hir.int_to_ptr v70 : ptr; + hir.store v71, v207; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::input_note::get_metadata(v65: i32, v66: felt) { - ^block15(v65: i32, v66: felt): - v68 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__stack_pointer : ptr - v69 = hir.bitcast v68 : ptr; - v70 = hir.load v69 : i32; - v71 = arith.constant 32 : i32; - v72 = arith.sub v70, v71 : i32 #[overflow = wrapping]; - v73 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__stack_pointer : ptr - v74 = hir.bitcast v73 : ptr; - hir.store v74, v72; - hir.exec @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/miden::input_note::get_metadata(v66, v72) - v76 = arith.constant 8 : u32; - v75 = hir.bitcast v72 : u32; - v77 = arith.add v75, v76 : u32 #[overflow = checked]; - v258 = arith.constant 8 : u32; - v79 = arith.mod v77, v258 : u32; - hir.assertz v79 #[code = 250]; - v80 = hir.int_to_ptr v77 : ptr; - v81 = hir.load v80 : i64; - v83 = arith.constant 24 : u32; - v82 = hir.bitcast v72 : u32; - v84 = arith.add v82, v83 : u32 #[overflow = checked]; - v257 = arith.constant 8 : u32; - v86 = arith.mod v84, v257 : u32; - hir.assertz v86 #[code = 250]; - v87 = hir.int_to_ptr v84 : ptr; - hir.store v87, v81; - v88 = hir.bitcast v72 : u32; - v256 = arith.constant 8 : u32; - v90 = arith.mod v88, v256 : u32; - hir.assertz v90 #[code = 250]; - v91 = hir.int_to_ptr v88 : ptr; - v92 = hir.load v91 : i64; - v94 = arith.constant 16 : u32; - v93 = hir.bitcast v72 : u32; - v95 = arith.add v93, v94 : u32 #[overflow = checked]; - v255 = arith.constant 8 : u32; - v97 = arith.mod v95, v255 : u32; - hir.assertz v97 #[code = 250]; - v98 = hir.int_to_ptr v95 : ptr; - hir.store v98, v92; - v99 = arith.constant 16 : i32; - v100 = arith.add v72, v99 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/::reverse(v65, v100) - v254 = arith.constant 32 : i32; - v102 = arith.add v72, v254 : i32 #[overflow = wrapping]; - v103 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__stack_pointer : ptr - v104 = hir.bitcast v103 : ptr; - hir.store v104, v102; - builtin.ret ; - }; - - private builtin.function @::reverse(v105: i32, v106: i32) { - ^block17(v105: i32, v106: i32): - v109 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__stack_pointer : ptr - v110 = hir.bitcast v109 : ptr; - v111 = hir.load v110 : i32; - v112 = arith.constant 16 : i32; - v113 = arith.sub v111, v112 : i32 #[overflow = wrapping]; - v115 = arith.constant 8 : u32; - v114 = hir.bitcast v106 : u32; - v116 = arith.add v114, v115 : u32 #[overflow = checked]; - v345 = arith.constant 8 : u32; - v118 = arith.mod v116, v345 : u32; - hir.assertz v118 #[code = 250]; - v119 = hir.int_to_ptr v116 : ptr; - v120 = hir.load v119 : i64; - v344 = arith.constant 8 : u32; - v121 = hir.bitcast v113 : u32; - v123 = arith.add v121, v344 : u32 #[overflow = checked]; - v124 = arith.constant 4 : u32; - v125 = arith.mod v123, v124 : u32; - hir.assertz v125 #[code = 250]; - v126 = hir.int_to_ptr v123 : ptr; - hir.store v126, v120; - v127 = hir.bitcast v106 : u32; - v343 = arith.constant 8 : u32; - v129 = arith.mod v127, v343 : u32; - hir.assertz v129 #[code = 250]; - v130 = hir.int_to_ptr v127 : ptr; - v131 = hir.load v130 : i64; - v132 = hir.bitcast v113 : u32; - v342 = arith.constant 4 : u32; - v134 = arith.mod v132, v342 : u32; - hir.assertz v134 #[code = 250]; - v135 = hir.int_to_ptr v132 : ptr; - hir.store v135, v131; - v136 = arith.constant 12 : i32; - v137 = arith.add v113, v136 : i32 #[overflow = wrapping]; - v107 = arith.constant 0 : i32; - v313, v314, v315, v316, v317, v318 = scf.while v107, v113, v137, v105 : i32, i32, i32, i32, i32, i32 { - ^block39(v319: i32, v320: i32, v321: i32, v322: i32): - v341 = arith.constant 0 : i32; - v140 = arith.constant 8 : i32; - v141 = arith.eq v319, v140 : i1; - v142 = arith.zext v141 : u32; - v143 = hir.bitcast v142 : i32; - v145 = arith.neq v143, v341 : i1; - v307, v308 = scf.if v145 : i32, i32 { - ^block38: - v267 = ub.poison i32 : i32; - scf.yield v267, v267; - } else { - ^block22: - v147 = arith.add v320, v319 : i32 #[overflow = wrapping]; - v148 = hir.bitcast v147 : u32; - v340 = arith.constant 4 : u32; - v150 = arith.mod v148, v340 : u32; - hir.assertz v150 #[code = 250]; - v151 = hir.int_to_ptr v148 : ptr; - v152 = hir.load v151 : felt; - v154 = hir.bitcast v321 : u32; - v339 = arith.constant 4 : u32; - v156 = arith.mod v154, v339 : u32; - hir.assertz v156 #[code = 250]; - v157 = hir.int_to_ptr v154 : ptr; - v158 = hir.load v157 : i32; - v159 = hir.bitcast v147 : u32; - v338 = arith.constant 4 : u32; - v161 = arith.mod v159, v338 : u32; - hir.assertz v161 #[code = 250]; - v162 = hir.int_to_ptr v159 : ptr; - hir.store v162, v158; - v163 = hir.bitcast v321 : u32; - v337 = arith.constant 4 : u32; - v165 = arith.mod v163, v337 : u32; - hir.assertz v165 #[code = 250]; - v166 = hir.int_to_ptr v163 : ptr; - hir.store v166, v152; - v169 = arith.constant -4 : i32; - v170 = arith.add v321, v169 : i32 #[overflow = wrapping]; - v167 = arith.constant 4 : i32; - v168 = arith.add v319, v167 : i32 #[overflow = wrapping]; - scf.yield v168, v170; - }; - v335 = ub.poison i32 : i32; - v310 = cf.select v145, v335, v322 : i32; - v336 = ub.poison i32 : i32; - v309 = cf.select v145, v336, v320 : i32; - v266 = arith.constant 1 : u32; - v259 = arith.constant 0 : u32; - v312 = cf.select v145, v259, v266 : u32; - v300 = arith.trunc v312 : i1; - scf.condition v300, v307, v309, v308, v310, v320, v322; - } do { - ^block40(v323: i32, v324: i32, v325: i32, v326: i32, v327: i32, v328: i32): - scf.yield v323, v324, v325, v326; - }; - v334 = arith.constant 8 : u32; - v172 = hir.bitcast v317 : u32; - v174 = arith.add v172, v334 : u32 #[overflow = checked]; - v333 = arith.constant 4 : u32; - v176 = arith.mod v174, v333 : u32; - hir.assertz v176 #[code = 250]; - v177 = hir.int_to_ptr v174 : ptr; - v178 = hir.load v177 : i64; - v332 = arith.constant 8 : u32; - v179 = hir.bitcast v318 : u32; - v181 = arith.add v179, v332 : u32 #[overflow = checked]; - v331 = arith.constant 8 : u32; - v183 = arith.mod v181, v331 : u32; - hir.assertz v183 #[code = 250]; - v184 = hir.int_to_ptr v181 : ptr; - hir.store v184, v178; - v185 = hir.bitcast v317 : u32; - v330 = arith.constant 4 : u32; - v187 = arith.mod v185, v330 : u32; - hir.assertz v187 #[code = 250]; - v188 = hir.int_to_ptr v185 : ptr; - v189 = hir.load v188 : i64; - v190 = hir.bitcast v318 : u32; - v329 = arith.constant 8 : u32; - v192 = arith.mod v190, v329 : u32; - hir.assertz v192 #[code = 250]; - v193 = hir.int_to_ptr v190 : ptr; - hir.store v193, v189; + private builtin.function @miden_base_sys::bindings::input_note::get_metadata(v72: i32, v73: felt) { + ^block15(v72: i32, v73: felt): + hir.store_local v72 #[local = lv0]; + v74 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__stack_pointer : ptr + v75 = hir.bitcast v74 : ptr; + v76 = hir.load v75 : i32; + v228 = arith.constant 32 : i32; + v78 = arith.sub v76, v228 : i32 #[overflow = wrapping]; + hir.store_local v78 #[local = lv2]; + v79 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__stack_pointer : ptr + v80 = hir.bitcast v79 : ptr; + hir.store v80, v78; + v82 = hir.load_local : i32 #[local = lv2]; + hir.exec @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/miden::protocol::input_note::get_metadata(v73, v82) + v83 = hir.load_local : i32 #[local = lv0]; + v84 = hir.load_local : i32 #[local = lv2]; + v227 = arith.constant 16 : u32; + v85 = hir.bitcast v84 : u32; + v87 = arith.add v85, v227 : u32 #[overflow = checked]; + v226 = arith.constant 8 : u32; + v89 = arith.mod v87, v226 : u32; + hir.assertz v89 #[code = 250]; + v90 = hir.int_to_ptr v87 : ptr; + v91 = hir.load v90 : i64; + v222, v223 = arith.split v91 : felt, felt; + v225 = arith.constant 24 : u32; + v95 = hir.bitcast v83 : u32; + v97 = arith.add v95, v225 : u32 #[overflow = checked]; + v252 = arith.constant 8 : u32; + v99 = arith.mod v97, v252 : u32; + hir.assertz v99 #[code = 250]; + v224 = arith.join v223, v222 : i64; + v100 = hir.int_to_ptr v97 : ptr; + hir.store v100, v224; + v101 = hir.load_local : i32 #[local = lv0]; + v102 = hir.load_local : i32 #[local = lv2]; + v251 = arith.constant 24 : u32; + v103 = hir.bitcast v102 : u32; + v105 = arith.add v103, v251 : u32 #[overflow = checked]; + v250 = arith.constant 8 : u32; + v107 = arith.mod v105, v250 : u32; + hir.assertz v107 #[code = 250]; + v108 = hir.int_to_ptr v105 : ptr; + v109 = hir.load v108 : i64; + v219, v220 = arith.split v109 : felt, felt; + v249 = arith.constant 16 : u32; + v113 = hir.bitcast v101 : u32; + v115 = arith.add v113, v249 : u32 #[overflow = checked]; + v248 = arith.constant 8 : u32; + v117 = arith.mod v115, v248 : u32; + hir.assertz v117 #[code = 250]; + v221 = arith.join v220, v219 : i64; + v118 = hir.int_to_ptr v115 : ptr; + hir.store v118, v221; + v119 = hir.load_local : i32 #[local = lv0]; + v120 = hir.load_local : i32 #[local = lv2]; + v121 = hir.bitcast v120 : u32; + v247 = arith.constant 8 : u32; + v123 = arith.mod v121, v247 : u32; + hir.assertz v123 #[code = 250]; + v124 = hir.int_to_ptr v121 : ptr; + v125 = hir.load v124 : i64; + v216, v217 = arith.split v125 : felt, felt; + v246 = arith.constant 8 : u32; + v129 = hir.bitcast v119 : u32; + v131 = arith.add v129, v246 : u32 #[overflow = checked]; + v245 = arith.constant 8 : u32; + v133 = arith.mod v131, v245 : u32; + hir.assertz v133 #[code = 250]; + v218 = arith.join v217, v216 : i64; + v134 = hir.int_to_ptr v131 : ptr; + hir.store v134, v218; + v135 = hir.load_local : i32 #[local = lv0]; + v136 = hir.load_local : i32 #[local = lv2]; + v244 = arith.constant 8 : u32; + v137 = hir.bitcast v136 : u32; + v139 = arith.add v137, v244 : u32 #[overflow = checked]; + v243 = arith.constant 8 : u32; + v141 = arith.mod v139, v243 : u32; + hir.assertz v141 #[code = 250]; + v142 = hir.int_to_ptr v139 : ptr; + v143 = hir.load v142 : i64; + v213, v214 = arith.split v143 : felt, felt; + v147 = hir.bitcast v135 : u32; + v242 = arith.constant 8 : u32; + v149 = arith.mod v147, v242 : u32; + hir.assertz v149 #[code = 250]; + v215 = arith.join v214, v213 : i64; + v150 = hir.int_to_ptr v147 : ptr; + hir.store v150, v215; + v151 = hir.load_local : i32 #[local = lv2]; + v241 = arith.constant 32 : i32; + v153 = arith.add v151, v241 : i32 #[overflow = wrapping]; + v154 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__stack_pointer : ptr + v155 = hir.bitcast v154 : ptr; + hir.store v155, v153; builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v194: i32) -> felt { - ^block23(v194: i32): - v195 = hir.bitcast v194 : felt; - builtin.ret v195; - }; - - private builtin.function @miden::input_note::get_metadata(v197: felt, v198: i32) { - ^block25(v197: felt, v198: i32): - v199, v200, v201, v202 = hir.exec @miden/input_note/get_metadata(v197) : felt, felt, felt, felt - v203 = hir.bitcast v198 : u32; - v204 = hir.int_to_ptr v203 : ptr; - hir.store v204, v199; - v205 = arith.constant 4 : u32; - v206 = arith.add v203, v205 : u32 #[overflow = checked]; - v207 = hir.int_to_ptr v206 : ptr; - hir.store v207, v200; - v208 = arith.constant 8 : u32; - v209 = arith.add v203, v208 : u32 #[overflow = checked]; - v210 = hir.int_to_ptr v209 : ptr; - hir.store v210, v201; - v211 = arith.constant 12 : u32; - v212 = arith.add v203, v211 : u32 #[overflow = checked]; - v213 = hir.int_to_ptr v212 : ptr; - hir.store v213, v202; - builtin.ret ; + private builtin.function @miden::protocol::input_note::get_metadata(v156: felt, v157: i32) { + ^block17(v156: felt, v157: i32): + ub.unreachable ; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -317,34 +226,34 @@ builtin.component miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input- }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block29: - v214 = hir.exec @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1#binding() : i32 - v215 = arith.constant 0 : i32; - v216 = arith.add v214, v215 : i32 #[overflow = unchecked]; - v349 = arith.constant 0 : i32; - v350 = arith.constant 0 : i32; - v218 = arith.add v216, v350 : i32 #[overflow = unchecked]; - v220 = arith.add v218, v349 : i32 #[overflow = unchecked]; - v221 = hir.int_to_ptr v220 : ptr; - v222 = hir.load v221 : felt; - v348 = arith.constant 0 : i32; - v223 = arith.constant 4 : i32; - v224 = arith.add v216, v223 : i32 #[overflow = unchecked]; - v226 = arith.add v224, v348 : i32 #[overflow = unchecked]; - v227 = hir.int_to_ptr v226 : ptr; - v228 = hir.load v227 : felt; - v347 = arith.constant 0 : i32; - v229 = arith.constant 8 : i32; - v230 = arith.add v216, v229 : i32 #[overflow = unchecked]; - v232 = arith.add v230, v347 : i32 #[overflow = unchecked]; - v233 = hir.int_to_ptr v232 : ptr; - v234 = hir.load v233 : felt; - v346 = arith.constant 0 : i32; - v235 = arith.constant 12 : i32; - v236 = arith.add v216, v235 : i32 #[overflow = unchecked]; - v238 = arith.add v236, v346 : i32 #[overflow = unchecked]; - v239 = hir.int_to_ptr v238 : ptr; - v240 = hir.load v239 : felt; - builtin.ret v222, v228, v234, v240; + ^block19: + v158 = hir.exec @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1#binding() : i32 + v256 = arith.constant 0 : i32; + v160 = arith.add v158, v256 : i32 #[overflow = unchecked]; + v265 = arith.constant 0 : i32; + v266 = arith.constant 0 : i32; + v162 = arith.add v160, v266 : i32 #[overflow = unchecked]; + v164 = arith.add v162, v265 : i32 #[overflow = unchecked]; + v165 = hir.int_to_ptr v164 : ptr; + v166 = hir.load v165 : felt; + v264 = arith.constant 0 : i32; + v255 = arith.constant 4 : i32; + v168 = arith.add v160, v255 : i32 #[overflow = unchecked]; + v170 = arith.add v168, v264 : i32 #[overflow = unchecked]; + v171 = hir.int_to_ptr v170 : ptr; + v172 = hir.load v171 : felt; + v263 = arith.constant 0 : i32; + v254 = arith.constant 8 : i32; + v174 = arith.add v160, v254 : i32 #[overflow = unchecked]; + v176 = arith.add v174, v263 : i32 #[overflow = unchecked]; + v177 = hir.int_to_ptr v176 : ptr; + v178 = hir.load v177 : felt; + v262 = arith.constant 0 : i32; + v253 = arith.constant 12 : i32; + v180 = arith.add v160, v253 : i32 #[overflow = unchecked]; + v182 = arith.add v180, v262 : i32 #[overflow = unchecked]; + v183 = hir.int_to_ptr v182 : ptr; + v184 = hir.load v183 : felt; + builtin.ret v166, v172, v178, v184; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.masm index 3bb690f4d..c885efb2e 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.masm @@ -1,13 +1,13 @@ -# mod miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1 +# mod ::"miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> (felt, felt, felt, felt) - exec.::miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1::init + exec."miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1::rust_sdk_input_note_get_metadata_binding::miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1#binding + exec.::"miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1"::rust_sdk_input_note_get_metadata_binding::"miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1#binding" trace.252 nop push.0 @@ -62,7 +62,7 @@ pub proc binding( nop movdn.3 swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -75,7 +75,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -86,7 +86,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1::rust_sdk_input_note_get_metadata_binding +# mod ::"miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1"::rust_sdk_input_note_get_metadata_binding @callconv("C") proc __wasm_call_ctors( @@ -102,6 +102,7 @@ proc rust_sdk_input_note_get_metadata_binding::bindings::__link_custom_section_d nop end +@locals("2") @callconv("C") proc miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1#binding( @@ -114,11 +115,18 @@ proc miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-meta exec.::intrinsics::mem::load_sw trace.252 nop - push.16 + push.32 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -128,19 +136,22 @@ proc miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-meta nop trace.240 nop - exec.::miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1::rust_sdk_input_note_get_metadata_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1"::rust_sdk_input_note_get_metadata_binding::wit_bindgen::rt::run_ctors_once trace.252 nop + locaddr.0 push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1::rust_sdk_input_note_get_metadata_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop - dup.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1::rust_sdk_input_note_get_metadata_binding::miden_base_sys::bindings::input_note::get_metadata + exec.::"miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1"::rust_sdk_input_note_get_metadata_binding::miden_base_sys::bindings::input_note::get_metadata trace.252 nop push.1114148 @@ -153,8 +164,25 @@ proc miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-meta nop push.1048584 u32wrapping_add - push.8 - dup.2 + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.24 + swap.1 add u32assert push.8 @@ -172,7 +200,7 @@ proc miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-meta nop swap.1 push.8 - dup.3 + movup.3 add u32assert push.4 @@ -190,7 +218,26 @@ proc miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-meta exec.::intrinsics::mem::store_dw trace.252 nop - dup.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + swap.1 + add + u32assert push.8 dup.1 swap.1 @@ -205,7 +252,7 @@ proc miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-meta trace.252 nop swap.1 - dup.2 + movup.2 push.4 dup.1 swap.1 @@ -221,8 +268,15 @@ proc miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-meta exec.::intrinsics::mem::store_dw trace.252 nop - push.16 - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 u32wrapping_add push.1114144 u32divmod.4 @@ -232,8 +286,17 @@ proc miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-meta exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -275,9 +338,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop trace.240 nop - exec.::miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1::rust_sdk_input_note_get_metadata_binding::__wasm_call_ctors + exec.::"miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1"::rust_sdk_input_note_get_metadata_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -308,11 +387,20 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("3") @callconv("C") proc miden_base_sys::bindings::input_note::get_metadata( i32, felt ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -323,9 +411,16 @@ proc miden_base_sys::bindings::input_note::get_metadata( nop push.32 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.2 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -333,51 +428,40 @@ proc miden_base_sys::bindings::input_note::get_metadata( exec.::intrinsics::mem::store_sw trace.252 nop - dup.0 - movup.3 + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1::rust_sdk_input_note_get_metadata_binding::miden::input_note::get_metadata + exec.::intrinsics::mem::load_sw trace.252 nop - push.8 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::"miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1"::rust_sdk_input_note_get_metadata_binding::"miden::protocol::input_note::get_metadata" trace.252 nop + locaddr.0 + push.0 swap.1 - push.24 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - dup.0 + push.16 + swap.1 + add + u32assert push.8 dup.1 swap.1 @@ -392,8 +476,8 @@ proc miden_base_sys::bindings::input_note::get_metadata( trace.252 nop swap.1 - push.16 - dup.3 + push.24 + movup.3 add u32assert push.8 @@ -402,6 +486,8 @@ proc miden_base_sys::bindings::input_note::get_metadata( u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -411,44 +497,24 @@ proc miden_base_sys::bindings::input_note::get_metadata( exec.::intrinsics::mem::store_dw trace.252 nop - push.16 - dup.1 - u32wrapping_add - movup.2 - trace.240 - nop - exec.::miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1::rust_sdk_input_note_get_metadata_binding::::reverse - trace.252 - nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop -end - -@callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - u32wrapping_sub - push.8 - dup.3 + push.24 + swap.1 add u32assert push.8 @@ -465,16 +531,18 @@ proc ::reverse( trace.252 nop swap.1 - push.8 - dup.3 + push.16 + movup.3 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -484,168 +552,24 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop push.8 dup.1 - add - u32assert - push.4 - dup.1 swap.1 u32mod u32assert @@ -659,7 +583,7 @@ proc ::reverse( nop swap.1 push.8 - dup.4 + movup.3 add u32assert push.8 @@ -668,6 +592,8 @@ proc ::reverse( u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -677,21 +603,26 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - push.4 - dup.1 + locaddr.0 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + push.8 swap.1 - movup.2 + add + u32assert push.8 dup.1 swap.1 @@ -700,73 +631,56 @@ proc ::reverse( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc miden::input_note::get_metadata(felt, i32) trace.240 nop - exec.::miden::input_note::get_metadata + exec.::intrinsics::mem::load_dw trace.252 nop - movup.4 - dup.0 - movup.2 swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 + movup.2 + push.8 dup.1 - add + swap.1 + u32mod u32assert + assertz + swap.2 movup.2 - swap.1 u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::store_dw trace.252 nop - push.8 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_sw trace.252 nop - push.12 - add - u32assert + push.32 + u32wrapping_add + push.1114144 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::store_sw trace.252 nop end +@locals("2") +@callconv("C") +proc miden::protocol::input_note::get_metadata(felt, i32) + drop + drop + push.0 + assert +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.wat index 3650b1cac..4d0513fec 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.wat @@ -13,9 +13,8 @@ (type (;0;) (func)) (type (;1;) (func (result i32))) (type (;2;) (func (param i32 f32))) - (type (;3;) (func (param i32 i32))) - (type (;4;) (func (param i32) (result f32))) - (type (;5;) (func (param f32 i32))) + (type (;3;) (func (param i32) (result f32))) + (type (;4;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -28,7 +27,7 @@ (func $miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1#binding (;2;) (type 1) (result i32) (local i32 i32) global.get $__stack_pointer - i32.const 16 + i32.const 32 i32.sub local.tee 0 global.set $__stack_pointer @@ -42,14 +41,14 @@ i32.add local.tee 1 local.get 0 - i64.load offset=8 + i64.load offset=24 i64.store offset=8 align=4 local.get 1 local.get 0 - i64.load + i64.load offset=16 i64.store align=4 local.get 0 - i32.const 16 + i32.const 32 i32.add global.set $__stack_pointer local.get 1 @@ -81,91 +80,44 @@ global.set $__stack_pointer local.get 1 local.get 2 - call $miden::input_note::get_metadata - local.get 2 + call $miden::protocol::input_note::get_metadata + local.get 0 local.get 2 - i64.load offset=8 + i64.load offset=16 + i64.const 32 + i64.rotl i64.store offset=24 + local.get 0 local.get 2 - local.get 2 - i64.load + i64.load offset=24 + i64.const 32 + i64.rotl i64.store offset=16 local.get 0 local.get 2 - i32.const 16 - i32.add - call $::reverse - local.get 2 - i32.const 32 - i32.add - global.set $__stack_pointer - ) - (func $::reverse (;5;) (type 3) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 + i64.const 32 + i64.rotl i64.store offset=8 local.get 0 local.get 2 - i64.load align=4 + i64.load offset=8 + i64.const 32 + i64.rotl i64.store + local.get 2 + i32.const 32 + i32.add + global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) unreachable ) - (func $miden::input_note::get_metadata (;7;) (type 5) (param f32 i32) + (func $miden::protocol::input_note::get_metadata (;6;) (type 4) (param f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "Qrust_sdk_input_note_get_metadata_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "Qrust_sdk_input_note_get_metadata_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.hir index aa052b0f2..8684a5361 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.hir @@ -12,345 +12,164 @@ builtin.component miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input private builtin.function @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1#binding() -> i32 { ^block9: - v2 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__stack_pointer : ptr - v3 = hir.bitcast v2 : ptr; - v4 = hir.load v3 : i32; - v5 = arith.constant 16 : i32; - v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; - v7 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__stack_pointer : ptr - v8 = hir.bitcast v7 : ptr; - hir.store v8, v6; + v1 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v158 = arith.constant 16 : i32; + v5 = arith.sub v3, v158 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; hir.exec @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/wit_bindgen::rt::run_ctors_once() - v1 = arith.constant 0 : i32; - v10 = hir.exec @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/intrinsics::felt::from_u32(v1) : felt - hir.exec @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/miden_base_sys::bindings::input_note::get_recipient(v6, v10) + v8 = hir.load_local : i32 #[local = lv0]; + v154 = arith.constant 0 : felt; + hir.exec @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/miden_base_sys::bindings::input_note::get_recipient(v8, v154) v11 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/GOT.data.internal.__memory_base : ptr v12 = hir.bitcast v11 : ptr; v13 = hir.load v12 : i32; - v14 = arith.constant 1048584 : i32; - v15 = arith.add v13, v14 : i32 #[overflow = wrapping]; - v17 = arith.constant 8 : u32; - v16 = hir.bitcast v6 : u32; - v18 = arith.add v16, v17 : u32 #[overflow = checked]; - v290 = arith.constant 8 : u32; - v20 = arith.mod v18, v290 : u32; - hir.assertz v20 #[code = 250]; - v21 = hir.int_to_ptr v18 : ptr; - v22 = hir.load v21 : i64; - v289 = arith.constant 8 : u32; - v23 = hir.bitcast v15 : u32; - v25 = arith.add v23, v289 : u32 #[overflow = checked]; - v26 = arith.constant 4 : u32; - v27 = arith.mod v25, v26 : u32; - hir.assertz v27 #[code = 250]; - v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v22; - v29 = hir.bitcast v6 : u32; - v288 = arith.constant 8 : u32; - v31 = arith.mod v29, v288 : u32; - hir.assertz v31 #[code = 250]; - v32 = hir.int_to_ptr v29 : ptr; - v33 = hir.load v32 : i64; - v34 = hir.bitcast v15 : u32; - v287 = arith.constant 4 : u32; - v36 = arith.mod v34, v287 : u32; - hir.assertz v36 #[code = 250]; - v37 = hir.int_to_ptr v34 : ptr; - hir.store v37, v33; - v286 = arith.constant 16 : i32; - v39 = arith.add v6, v286 : i32 #[overflow = wrapping]; - v40 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__stack_pointer : ptr - v41 = hir.bitcast v40 : ptr; - hir.store v41, v39; - builtin.ret v15; + v157 = arith.constant 1048584 : i32; + v15 = arith.add v13, v157 : i32 #[overflow = wrapping]; + hir.store_local v15 #[local = lv1]; + v16 = hir.load_local : i32 #[local = lv0]; + v156 = arith.constant 8 : u32; + v17 = hir.bitcast v16 : u32; + v19 = arith.add v17, v156 : u32 #[overflow = checked]; + v168 = arith.constant 8 : u32; + v21 = arith.mod v19, v168 : u32; + hir.assertz v21 #[code = 250]; + v22 = hir.int_to_ptr v19 : ptr; + v23 = hir.load v22 : i64; + v167 = arith.constant 8 : u32; + v24 = hir.bitcast v15 : u32; + v26 = arith.add v24, v167 : u32 #[overflow = checked]; + v155 = arith.constant 4 : u32; + v28 = arith.mod v26, v155 : u32; + hir.assertz v28 #[code = 250]; + v29 = hir.int_to_ptr v26 : ptr; + hir.store v29, v23; + v30 = hir.load_local : i32 #[local = lv1]; + v31 = hir.load_local : i32 #[local = lv0]; + v32 = hir.bitcast v31 : u32; + v166 = arith.constant 8 : u32; + v34 = arith.mod v32, v166 : u32; + hir.assertz v34 #[code = 250]; + v35 = hir.int_to_ptr v32 : ptr; + v36 = hir.load v35 : i64; + v37 = hir.bitcast v30 : u32; + v165 = arith.constant 4 : u32; + v39 = arith.mod v37, v165 : u32; + hir.assertz v39 #[code = 250]; + v40 = hir.int_to_ptr v37 : ptr; + hir.store v40, v36; + v41 = hir.load_local : i32 #[local = lv0]; + v164 = arith.constant 16 : i32; + v43 = arith.add v41, v164 : i32 #[overflow = wrapping]; + v44 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__stack_pointer : ptr + v45 = hir.bitcast v44 : ptr; + hir.store v45, v43; + v46 = hir.load_local : i32 #[local = lv1]; + builtin.ret v46; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v43 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/GOT.data.internal.__memory_base : ptr - v44 = hir.bitcast v43 : ptr; - v45 = hir.load v44 : i32; - v46 = arith.constant 1048600 : i32; - v47 = arith.add v45, v46 : i32 #[overflow = wrapping]; - v48 = hir.bitcast v47 : u32; - v49 = hir.int_to_ptr v48 : ptr; - v50 = hir.load v49 : u8; - v42 = arith.constant 0 : i32; - v51 = arith.zext v50 : u32; - v52 = hir.bitcast v51 : i32; - v54 = arith.neq v52, v42 : i1; - scf.if v54{ + v47 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/GOT.data.internal.__memory_base : ptr + v48 = hir.bitcast v47 : ptr; + v49 = hir.load v48 : i32; + v173 = arith.constant 1048600 : i32; + v51 = arith.add v49, v173 : i32 #[overflow = wrapping]; + v52 = hir.bitcast v51 : u32; + v53 = hir.int_to_ptr v52 : ptr; + v54 = hir.load v53 : u8; + v172 = arith.constant 0 : i32; + v55 = arith.zext v54 : u32; + v56 = hir.bitcast v55 : i32; + v58 = arith.neq v56, v172 : i1; + scf.if v58{ ^block13: scf.yield ; } else { ^block14: - v55 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/GOT.data.internal.__memory_base : ptr - v56 = hir.bitcast v55 : ptr; - v57 = hir.load v56 : i32; + v59 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/GOT.data.internal.__memory_base : ptr + v60 = hir.bitcast v59 : ptr; + v61 = hir.load v60 : i32; + hir.store_local v61 #[local = lv0]; hir.exec @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__wasm_call_ctors() - v292 = arith.constant 1 : u8; - v294 = arith.constant 1048600 : i32; - v59 = arith.add v57, v294 : i32 #[overflow = wrapping]; - v63 = hir.bitcast v59 : u32; - v64 = hir.int_to_ptr v63 : ptr; - hir.store v64, v292; + v62 = hir.load_local : i32 #[local = lv0]; + v171 = arith.constant 1 : u8; + v176 = arith.constant 1048600 : i32; + v64 = arith.add v62, v176 : i32 #[overflow = wrapping]; + v68 = hir.bitcast v64 : u32; + v69 = hir.int_to_ptr v68 : ptr; + hir.store v69, v171; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::input_note::get_recipient(v65: i32, v66: felt) { - ^block15(v65: i32, v66: felt): - v69 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__stack_pointer : ptr - v70 = hir.bitcast v69 : ptr; - v71 = hir.load v70 : i32; - v72 = arith.constant 48 : i32; - v73 = arith.sub v71, v72 : i32 #[overflow = wrapping]; - v74 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__stack_pointer : ptr - v75 = hir.bitcast v74 : ptr; - hir.store v75, v73; - hir.exec @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/miden::input_note::get_recipient(v66, v73) - v77 = arith.constant 8 : u32; - v76 = hir.bitcast v73 : u32; - v78 = arith.add v76, v77 : u32 #[overflow = checked]; - v307 = arith.constant 8 : u32; - v80 = arith.mod v78, v307 : u32; - hir.assertz v80 #[code = 250]; - v81 = hir.int_to_ptr v78 : ptr; - v82 = hir.load v81 : i64; - v84 = arith.constant 24 : u32; - v83 = hir.bitcast v73 : u32; - v85 = arith.add v83, v84 : u32 #[overflow = checked]; - v306 = arith.constant 8 : u32; - v87 = arith.mod v85, v306 : u32; - hir.assertz v87 #[code = 250]; - v88 = hir.int_to_ptr v85 : ptr; - hir.store v88, v82; - v89 = hir.bitcast v73 : u32; - v305 = arith.constant 8 : u32; - v91 = arith.mod v89, v305 : u32; - hir.assertz v91 #[code = 250]; - v92 = hir.int_to_ptr v89 : ptr; - v93 = hir.load v92 : i64; - v95 = arith.constant 16 : u32; - v94 = hir.bitcast v73 : u32; - v96 = arith.add v94, v95 : u32 #[overflow = checked]; - v304 = arith.constant 8 : u32; - v98 = arith.mod v96, v304 : u32; - hir.assertz v98 #[code = 250]; - v99 = hir.int_to_ptr v96 : ptr; - hir.store v99, v93; - v102 = arith.constant 16 : i32; - v103 = arith.add v73, v102 : i32 #[overflow = wrapping]; - v100 = arith.constant 32 : i32; - v101 = arith.add v73, v100 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/::reverse(v101, v103) - v105 = arith.constant 40 : u32; - v104 = hir.bitcast v73 : u32; - v106 = arith.add v104, v105 : u32 #[overflow = checked]; - v303 = arith.constant 8 : u32; - v108 = arith.mod v106, v303 : u32; - hir.assertz v108 #[code = 250]; - v109 = hir.int_to_ptr v106 : ptr; - v110 = hir.load v109 : i64; - v302 = arith.constant 24 : u32; - v111 = hir.bitcast v73 : u32; - v113 = arith.add v111, v302 : u32 #[overflow = checked]; - v301 = arith.constant 8 : u32; - v115 = arith.mod v113, v301 : u32; - hir.assertz v115 #[code = 250]; - v116 = hir.int_to_ptr v113 : ptr; - hir.store v116, v110; - v118 = arith.constant 32 : u32; - v117 = hir.bitcast v73 : u32; - v119 = arith.add v117, v118 : u32 #[overflow = checked]; - v300 = arith.constant 8 : u32; - v121 = arith.mod v119, v300 : u32; - hir.assertz v121 #[code = 250]; - v122 = hir.int_to_ptr v119 : ptr; - v123 = hir.load v122 : i64; - v299 = arith.constant 16 : u32; - v124 = hir.bitcast v73 : u32; - v126 = arith.add v124, v299 : u32 #[overflow = checked]; - v298 = arith.constant 8 : u32; - v128 = arith.mod v126, v298 : u32; - hir.assertz v128 #[code = 250]; - v129 = hir.int_to_ptr v126 : ptr; - hir.store v129, v123; - v130 = arith.constant 8 : i32; - v131 = arith.add v65, v130 : i32 #[overflow = wrapping]; - v132 = hir.bitcast v131 : u32; - v297 = arith.constant 8 : u32; - v134 = arith.mod v132, v297 : u32; - hir.assertz v134 #[code = 250]; - v135 = hir.int_to_ptr v132 : ptr; - hir.store v135, v110; - v136 = hir.bitcast v65 : u32; - v296 = arith.constant 8 : u32; - v138 = arith.mod v136, v296 : u32; - hir.assertz v138 #[code = 250]; - v139 = hir.int_to_ptr v136 : ptr; - hir.store v139, v123; - v295 = arith.constant 48 : i32; - v141 = arith.add v73, v295 : i32 #[overflow = wrapping]; - v142 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__stack_pointer : ptr - v143 = hir.bitcast v142 : ptr; - hir.store v143, v141; + private builtin.function @miden_base_sys::bindings::input_note::get_recipient(v70: i32, v71: felt) { + ^block15(v70: i32, v71: felt): + hir.store_local v70 #[local = lv0]; + v72 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__stack_pointer : ptr + v73 = hir.bitcast v72 : ptr; + v74 = hir.load v73 : i32; + v184 = arith.constant 16 : i32; + v76 = arith.sub v74, v184 : i32 #[overflow = wrapping]; + hir.store_local v76 #[local = lv2]; + v77 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__stack_pointer : ptr + v78 = hir.bitcast v77 : ptr; + hir.store v78, v76; + v80 = hir.load_local : i32 #[local = lv2]; + hir.exec @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/miden::protocol::input_note::get_recipient(v71, v80) + v81 = hir.load_local : i32 #[local = lv0]; + v82 = hir.load_local : i32 #[local = lv2]; + v83 = hir.bitcast v82 : u32; + v183 = arith.constant 8 : u32; + v85 = arith.mod v83, v183 : u32; + hir.assertz v85 #[code = 250]; + v86 = hir.int_to_ptr v83 : ptr; + v87 = hir.load v86 : i64; + v180, v181 = arith.split v87 : felt, felt; + v196 = arith.constant 8 : u32; + v91 = hir.bitcast v81 : u32; + v93 = arith.add v91, v196 : u32 #[overflow = checked]; + v195 = arith.constant 8 : u32; + v95 = arith.mod v93, v195 : u32; + hir.assertz v95 #[code = 250]; + v182 = arith.join v181, v180 : i64; + v96 = hir.int_to_ptr v93 : ptr; + hir.store v96, v182; + v97 = hir.load_local : i32 #[local = lv0]; + v98 = hir.load_local : i32 #[local = lv2]; + v194 = arith.constant 8 : u32; + v99 = hir.bitcast v98 : u32; + v101 = arith.add v99, v194 : u32 #[overflow = checked]; + v193 = arith.constant 8 : u32; + v103 = arith.mod v101, v193 : u32; + hir.assertz v103 #[code = 250]; + v104 = hir.int_to_ptr v101 : ptr; + v105 = hir.load v104 : i64; + v177, v178 = arith.split v105 : felt, felt; + v109 = hir.bitcast v97 : u32; + v192 = arith.constant 8 : u32; + v111 = arith.mod v109, v192 : u32; + hir.assertz v111 #[code = 250]; + v179 = arith.join v178, v177 : i64; + v112 = hir.int_to_ptr v109 : ptr; + hir.store v112, v179; + v113 = hir.load_local : i32 #[local = lv2]; + v191 = arith.constant 16 : i32; + v115 = arith.add v113, v191 : i32 #[overflow = wrapping]; + v116 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__stack_pointer : ptr + v117 = hir.bitcast v116 : ptr; + hir.store v117, v115; builtin.ret ; }; - private builtin.function @::reverse(v144: i32, v145: i32) { - ^block17(v144: i32, v145: i32): - v148 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__stack_pointer : ptr - v149 = hir.bitcast v148 : ptr; - v150 = hir.load v149 : i32; - v151 = arith.constant 16 : i32; - v152 = arith.sub v150, v151 : i32 #[overflow = wrapping]; - v154 = arith.constant 8 : u32; - v153 = hir.bitcast v145 : u32; - v155 = arith.add v153, v154 : u32 #[overflow = checked]; - v394 = arith.constant 8 : u32; - v157 = arith.mod v155, v394 : u32; - hir.assertz v157 #[code = 250]; - v158 = hir.int_to_ptr v155 : ptr; - v159 = hir.load v158 : i64; - v393 = arith.constant 8 : u32; - v160 = hir.bitcast v152 : u32; - v162 = arith.add v160, v393 : u32 #[overflow = checked]; - v163 = arith.constant 4 : u32; - v164 = arith.mod v162, v163 : u32; - hir.assertz v164 #[code = 250]; - v165 = hir.int_to_ptr v162 : ptr; - hir.store v165, v159; - v166 = hir.bitcast v145 : u32; - v392 = arith.constant 8 : u32; - v168 = arith.mod v166, v392 : u32; - hir.assertz v168 #[code = 250]; - v169 = hir.int_to_ptr v166 : ptr; - v170 = hir.load v169 : i64; - v171 = hir.bitcast v152 : u32; - v391 = arith.constant 4 : u32; - v173 = arith.mod v171, v391 : u32; - hir.assertz v173 #[code = 250]; - v174 = hir.int_to_ptr v171 : ptr; - hir.store v174, v170; - v175 = arith.constant 12 : i32; - v176 = arith.add v152, v175 : i32 #[overflow = wrapping]; - v146 = arith.constant 0 : i32; - v362, v363, v364, v365, v366, v367 = scf.while v146, v152, v176, v144 : i32, i32, i32, i32, i32, i32 { - ^block39(v368: i32, v369: i32, v370: i32, v371: i32): - v390 = arith.constant 0 : i32; - v179 = arith.constant 8 : i32; - v180 = arith.eq v368, v179 : i1; - v181 = arith.zext v180 : u32; - v182 = hir.bitcast v181 : i32; - v184 = arith.neq v182, v390 : i1; - v356, v357 = scf.if v184 : i32, i32 { - ^block38: - v316 = ub.poison i32 : i32; - scf.yield v316, v316; - } else { - ^block22: - v186 = arith.add v369, v368 : i32 #[overflow = wrapping]; - v187 = hir.bitcast v186 : u32; - v389 = arith.constant 4 : u32; - v189 = arith.mod v187, v389 : u32; - hir.assertz v189 #[code = 250]; - v190 = hir.int_to_ptr v187 : ptr; - v191 = hir.load v190 : felt; - v193 = hir.bitcast v370 : u32; - v388 = arith.constant 4 : u32; - v195 = arith.mod v193, v388 : u32; - hir.assertz v195 #[code = 250]; - v196 = hir.int_to_ptr v193 : ptr; - v197 = hir.load v196 : i32; - v198 = hir.bitcast v186 : u32; - v387 = arith.constant 4 : u32; - v200 = arith.mod v198, v387 : u32; - hir.assertz v200 #[code = 250]; - v201 = hir.int_to_ptr v198 : ptr; - hir.store v201, v197; - v202 = hir.bitcast v370 : u32; - v386 = arith.constant 4 : u32; - v204 = arith.mod v202, v386 : u32; - hir.assertz v204 #[code = 250]; - v205 = hir.int_to_ptr v202 : ptr; - hir.store v205, v191; - v208 = arith.constant -4 : i32; - v209 = arith.add v370, v208 : i32 #[overflow = wrapping]; - v206 = arith.constant 4 : i32; - v207 = arith.add v368, v206 : i32 #[overflow = wrapping]; - scf.yield v207, v209; - }; - v384 = ub.poison i32 : i32; - v359 = cf.select v184, v384, v371 : i32; - v385 = ub.poison i32 : i32; - v358 = cf.select v184, v385, v369 : i32; - v315 = arith.constant 1 : u32; - v308 = arith.constant 0 : u32; - v361 = cf.select v184, v308, v315 : u32; - v349 = arith.trunc v361 : i1; - scf.condition v349, v356, v358, v357, v359, v369, v371; - } do { - ^block40(v372: i32, v373: i32, v374: i32, v375: i32, v376: i32, v377: i32): - scf.yield v372, v373, v374, v375; - }; - v383 = arith.constant 8 : u32; - v211 = hir.bitcast v366 : u32; - v213 = arith.add v211, v383 : u32 #[overflow = checked]; - v382 = arith.constant 4 : u32; - v215 = arith.mod v213, v382 : u32; - hir.assertz v215 #[code = 250]; - v216 = hir.int_to_ptr v213 : ptr; - v217 = hir.load v216 : i64; - v381 = arith.constant 8 : u32; - v218 = hir.bitcast v367 : u32; - v220 = arith.add v218, v381 : u32 #[overflow = checked]; - v380 = arith.constant 8 : u32; - v222 = arith.mod v220, v380 : u32; - hir.assertz v222 #[code = 250]; - v223 = hir.int_to_ptr v220 : ptr; - hir.store v223, v217; - v224 = hir.bitcast v366 : u32; - v379 = arith.constant 4 : u32; - v226 = arith.mod v224, v379 : u32; - hir.assertz v226 #[code = 250]; - v227 = hir.int_to_ptr v224 : ptr; - v228 = hir.load v227 : i64; - v229 = hir.bitcast v367 : u32; - v378 = arith.constant 8 : u32; - v231 = arith.mod v229, v378 : u32; - hir.assertz v231 #[code = 250]; - v232 = hir.int_to_ptr v229 : ptr; - hir.store v232, v228; - builtin.ret ; - }; - - private builtin.function @intrinsics::felt::from_u32(v233: i32) -> felt { - ^block23(v233: i32): - v234 = hir.bitcast v233 : felt; - builtin.ret v234; - }; - - private builtin.function @miden::input_note::get_recipient(v236: felt, v237: i32) { - ^block25(v236: felt, v237: i32): - v238, v239, v240, v241 = hir.exec @miden/input_note/get_recipient(v236) : felt, felt, felt, felt - v242 = hir.bitcast v237 : u32; - v243 = hir.int_to_ptr v242 : ptr; - hir.store v243, v238; - v244 = arith.constant 4 : u32; - v245 = arith.add v242, v244 : u32 #[overflow = checked]; - v246 = hir.int_to_ptr v245 : ptr; - hir.store v246, v239; - v247 = arith.constant 8 : u32; - v248 = arith.add v242, v247 : u32 #[overflow = checked]; - v249 = hir.int_to_ptr v248 : ptr; - hir.store v249, v240; - v250 = arith.constant 12 : u32; - v251 = arith.add v242, v250 : u32 #[overflow = checked]; - v252 = hir.int_to_ptr v251 : ptr; - hir.store v252, v241; - builtin.ret ; + private builtin.function @miden::protocol::input_note::get_recipient(v118: felt, v119: i32) { + ^block17(v118: felt, v119: i32): + ub.unreachable ; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -365,36 +184,36 @@ builtin.component miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block29: - v253 = hir.exec @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1#binding() : i32 - v400 = arith.constant 0 : i32; - v254 = arith.constant 0 : i32; - v255 = arith.add v253, v254 : i32 #[overflow = unchecked]; - v257 = arith.add v255, v400 : i32 #[overflow = unchecked]; - v398 = arith.constant 0 : i32; - v399 = arith.constant 0 : i32; - v259 = arith.add v257, v399 : i32 #[overflow = unchecked]; - v261 = arith.add v259, v398 : i32 #[overflow = unchecked]; - v262 = hir.int_to_ptr v261 : ptr; - v263 = hir.load v262 : felt; - v397 = arith.constant 0 : i32; - v264 = arith.constant 4 : i32; - v265 = arith.add v257, v264 : i32 #[overflow = unchecked]; - v267 = arith.add v265, v397 : i32 #[overflow = unchecked]; - v268 = hir.int_to_ptr v267 : ptr; - v269 = hir.load v268 : felt; - v396 = arith.constant 0 : i32; - v270 = arith.constant 8 : i32; - v271 = arith.add v257, v270 : i32 #[overflow = unchecked]; - v273 = arith.add v271, v396 : i32 #[overflow = unchecked]; - v274 = hir.int_to_ptr v273 : ptr; - v275 = hir.load v274 : felt; - v395 = arith.constant 0 : i32; - v276 = arith.constant 12 : i32; - v277 = arith.add v257, v276 : i32 #[overflow = unchecked]; - v279 = arith.add v277, v395 : i32 #[overflow = unchecked]; - v280 = hir.int_to_ptr v279 : ptr; - v281 = hir.load v280 : felt; - builtin.ret v263, v269, v275, v281; + ^block19: + v120 = hir.exec @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1#binding() : i32 + v212 = arith.constant 0 : i32; + v206 = arith.constant 0 : i32; + v122 = arith.add v120, v206 : i32 #[overflow = unchecked]; + v124 = arith.add v122, v212 : i32 #[overflow = unchecked]; + v210 = arith.constant 0 : i32; + v211 = arith.constant 0 : i32; + v126 = arith.add v124, v211 : i32 #[overflow = unchecked]; + v128 = arith.add v126, v210 : i32 #[overflow = unchecked]; + v129 = hir.int_to_ptr v128 : ptr; + v130 = hir.load v129 : felt; + v209 = arith.constant 0 : i32; + v199 = arith.constant 4 : i32; + v132 = arith.add v124, v199 : i32 #[overflow = unchecked]; + v134 = arith.add v132, v209 : i32 #[overflow = unchecked]; + v135 = hir.int_to_ptr v134 : ptr; + v136 = hir.load v135 : felt; + v208 = arith.constant 0 : i32; + v198 = arith.constant 8 : i32; + v138 = arith.add v124, v198 : i32 #[overflow = unchecked]; + v140 = arith.add v138, v208 : i32 #[overflow = unchecked]; + v141 = hir.int_to_ptr v140 : ptr; + v142 = hir.load v141 : felt; + v207 = arith.constant 0 : i32; + v197 = arith.constant 12 : i32; + v144 = arith.add v124, v197 : i32 #[overflow = unchecked]; + v146 = arith.add v144, v207 : i32 #[overflow = unchecked]; + v147 = hir.int_to_ptr v146 : ptr; + v148 = hir.load v147 : felt; + builtin.ret v130, v136, v142, v148; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.masm index 894b43836..72329eebd 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.masm @@ -1,13 +1,13 @@ -# mod miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1 +# mod ::"miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> (felt, felt, felt, felt) - exec.::miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1::init + exec."miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1::rust_sdk_input_note_get_recipient_binding::miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1#binding + exec.::"miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1"::rust_sdk_input_note_get_recipient_binding::"miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1#binding" trace.252 nop push.0 @@ -65,7 +65,7 @@ pub proc binding( nop movdn.3 swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -78,7 +78,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -89,7 +89,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1::rust_sdk_input_note_get_recipient_binding +# mod ::"miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1"::rust_sdk_input_note_get_recipient_binding @callconv("C") proc __wasm_call_ctors( @@ -105,6 +105,7 @@ proc rust_sdk_input_note_get_recipient_binding::bindings::__link_custom_section_ nop end +@locals("2") @callconv("C") proc miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1#binding( @@ -119,9 +120,16 @@ proc miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-rec nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -131,19 +139,22 @@ proc miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-rec nop trace.240 nop - exec.::miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1::rust_sdk_input_note_get_recipient_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1"::rust_sdk_input_note_get_recipient_binding::wit_bindgen::rt::run_ctors_once trace.252 nop + locaddr.0 push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1::rust_sdk_input_note_get_recipient_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop - dup.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1::rust_sdk_input_note_get_recipient_binding::miden_base_sys::bindings::input_note::get_recipient + exec.::"miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1"::rust_sdk_input_note_get_recipient_binding::miden_base_sys::bindings::input_note::get_recipient trace.252 nop push.1114148 @@ -156,8 +167,25 @@ proc miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-rec nop push.1048584 u32wrapping_add + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.2 + swap.1 add u32assert push.8 @@ -175,7 +203,7 @@ proc miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-rec nop swap.1 push.8 - dup.3 + movup.3 add u32assert push.4 @@ -193,7 +221,22 @@ proc miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-rec exec.::intrinsics::mem::store_dw trace.252 nop - dup.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 dup.1 swap.1 @@ -208,7 +251,7 @@ proc miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-rec trace.252 nop swap.1 - dup.2 + movup.2 push.4 dup.1 swap.1 @@ -224,8 +267,15 @@ proc miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-rec exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - movup.2 u32wrapping_add push.1114144 u32divmod.4 @@ -235,8 +285,17 @@ proc miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-rec exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -278,9 +337,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1::rust_sdk_input_note_get_recipient_binding::__wasm_call_ctors + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1"::rust_sdk_input_note_get_recipient_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -311,164 +386,77 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("3") @callconv("C") proc miden_base_sys::bindings::input_note::get_recipient( i32, felt ) - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::store_sw trace.252 nop - push.48 - u32wrapping_sub push.1114144 - dup.1 - swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop + push.16 + u32wrapping_sub dup.0 - movup.3 - trace.240 - nop - exec.::miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1::rust_sdk_input_note_get_recipient_binding::miden::input_note::get_recipient - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_sw trace.252 nop - swap.1 - push.24 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.1114144 u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop - dup.0 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop swap.1 - push.16 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.16 - dup.1 - u32wrapping_add - push.32 - dup.2 - u32wrapping_add trace.240 nop - exec.::miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1::rust_sdk_input_note_get_recipient_binding::::reverse + exec.::"miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1"::rust_sdk_input_note_get_recipient_binding::"miden::protocol::input_note::get_recipient" trace.252 nop - push.40 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 swap.1 - push.24 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - dup.2 - dup.2 - movup.2 - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.32 - dup.3 - add - u32assert push.8 dup.1 swap.1 @@ -483,39 +471,17 @@ proc miden_base_sys::bindings::input_note::get_recipient( trace.252 nop swap.1 - push.16 - dup.5 - add - u32assert push.8 - dup.1 - swap.1 - u32mod + movup.3 + add u32assert - assertz - dup.2 - dup.2 - movup.2 - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.8 - dup.6 - u32wrapping_add push.8 dup.1 swap.1 u32mod u32assert assertz - movup.4 - movup.4 + swap.2 movup.2 u32divmod.4 swap.1 @@ -526,87 +492,26 @@ proc miden_base_sys::bindings::input_note::get_recipient( exec.::intrinsics::mem::store_dw trace.252 nop - movup.3 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.48 - u32wrapping_add - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop -end - -@callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - u32wrapping_sub push.8 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop swap.1 - push.8 - dup.3 add u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - movup.2 push.8 dup.1 swap.1 @@ -621,175 +526,15 @@ proc ::reverse( trace.252 nop swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.4 - add - u32assert push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -799,96 +544,32 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop - swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.16 + u32wrapping_add + push.1114144 u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop end +@locals("2") @callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc miden::input_note::get_recipient(felt, i32) - trace.240 - nop - exec.::miden::input_note::get_recipient - trace.252 - nop - movup.4 - dup.0 - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.12 - add - u32assert - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop +proc miden::protocol::input_note::get_recipient(felt, i32) + drop + drop + push.0 + assert end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.wat index c83459b8f..12e0a830f 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.wat @@ -15,9 +15,8 @@ (type (;0;) (func)) (type (;1;) (func (result i32))) (type (;2;) (func (param i32 f32))) - (type (;3;) (func (param i32 i32))) - (type (;4;) (func (param i32) (result f32))) - (type (;5;) (func (param f32 i32))) + (type (;3;) (func (param i32) (result f32))) + (type (;4;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -75,119 +74,40 @@ end ) (func $miden_base_sys::bindings::input_note::get_recipient (;4;) (type 2) (param i32 f32) - (local i32 i64 i64) + (local i32) global.get $__stack_pointer - i32.const 48 + i32.const 16 i32.sub local.tee 2 global.set $__stack_pointer local.get 1 local.get 2 - call $miden::input_note::get_recipient - local.get 2 - local.get 2 - i64.load offset=8 - i64.store offset=24 - local.get 2 - local.get 2 - i64.load - i64.store offset=16 - local.get 2 - i32.const 32 - i32.add - local.get 2 - i32.const 16 - i32.add - call $::reverse - local.get 2 - local.get 2 - i64.load offset=40 - local.tee 3 - i64.store offset=24 - local.get 2 - local.get 2 - i64.load offset=32 - local.tee 4 - i64.store offset=16 + call $miden::protocol::input_note::get_recipient local.get 0 - i32.const 8 - i32.add - local.get 3 - i64.store - local.get 0 - local.get 4 - i64.store - local.get 2 - i32.const 48 - i32.add - global.set $__stack_pointer - ) - (func $::reverse (;5;) (type 3) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 local.get 2 - local.get 1 i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 + i64.const 32 + i64.rotl i64.store offset=8 local.get 0 local.get 2 - i64.load align=4 + i64.load offset=8 + i64.const 32 + i64.rotl i64.store + local.get 2 + i32.const 16 + i32.add + global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) unreachable ) - (func $miden::input_note::get_recipient (;7;) (type 5) (param f32 i32) + (func $miden::protocol::input_note::get_recipient (;6;) (type 4) (param f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "Srust_sdk_input_note_get_recipient_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "Srust_sdk_input_note_get_recipient_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "recipient" (type $recipient (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.hir index cc201cb1a..6ac24882e 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.hir @@ -12,297 +12,164 @@ builtin.component miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-inp private builtin.function @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1#binding() -> i32 { ^block9: - v2 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__stack_pointer : ptr - v3 = hir.bitcast v2 : ptr; - v4 = hir.load v3 : i32; - v5 = arith.constant 16 : i32; - v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; - v7 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__stack_pointer : ptr - v8 = hir.bitcast v7 : ptr; - hir.store v8, v6; + v1 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v156 = arith.constant 16 : i32; + v5 = arith.sub v3, v156 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; hir.exec @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/wit_bindgen::rt::run_ctors_once() - v1 = arith.constant 0 : i32; - v10 = hir.exec @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/intrinsics::felt::from_u32(v1) : felt - hir.exec @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/miden_base_sys::bindings::input_note::get_script_root(v6, v10) + v8 = hir.load_local : i32 #[local = lv0]; + v152 = arith.constant 0 : felt; + hir.exec @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/miden_base_sys::bindings::input_note::get_script_root(v8, v152) v11 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/GOT.data.internal.__memory_base : ptr v12 = hir.bitcast v11 : ptr; v13 = hir.load v12 : i32; - v14 = arith.constant 1048584 : i32; - v15 = arith.add v13, v14 : i32 #[overflow = wrapping]; - v17 = arith.constant 8 : u32; - v16 = hir.bitcast v6 : u32; - v18 = arith.add v16, v17 : u32 #[overflow = checked]; - v249 = arith.constant 8 : u32; - v20 = arith.mod v18, v249 : u32; - hir.assertz v20 #[code = 250]; - v21 = hir.int_to_ptr v18 : ptr; - v22 = hir.load v21 : i64; - v248 = arith.constant 8 : u32; - v23 = hir.bitcast v15 : u32; - v25 = arith.add v23, v248 : u32 #[overflow = checked]; - v26 = arith.constant 4 : u32; - v27 = arith.mod v25, v26 : u32; - hir.assertz v27 #[code = 250]; - v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v22; - v29 = hir.bitcast v6 : u32; - v247 = arith.constant 8 : u32; - v31 = arith.mod v29, v247 : u32; - hir.assertz v31 #[code = 250]; - v32 = hir.int_to_ptr v29 : ptr; - v33 = hir.load v32 : i64; - v34 = hir.bitcast v15 : u32; - v246 = arith.constant 4 : u32; - v36 = arith.mod v34, v246 : u32; - hir.assertz v36 #[code = 250]; - v37 = hir.int_to_ptr v34 : ptr; - hir.store v37, v33; - v245 = arith.constant 16 : i32; - v39 = arith.add v6, v245 : i32 #[overflow = wrapping]; - v40 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__stack_pointer : ptr - v41 = hir.bitcast v40 : ptr; - hir.store v41, v39; - builtin.ret v15; + v155 = arith.constant 1048584 : i32; + v15 = arith.add v13, v155 : i32 #[overflow = wrapping]; + hir.store_local v15 #[local = lv1]; + v16 = hir.load_local : i32 #[local = lv0]; + v154 = arith.constant 8 : u32; + v17 = hir.bitcast v16 : u32; + v19 = arith.add v17, v154 : u32 #[overflow = checked]; + v166 = arith.constant 8 : u32; + v21 = arith.mod v19, v166 : u32; + hir.assertz v21 #[code = 250]; + v22 = hir.int_to_ptr v19 : ptr; + v23 = hir.load v22 : i64; + v165 = arith.constant 8 : u32; + v24 = hir.bitcast v15 : u32; + v26 = arith.add v24, v165 : u32 #[overflow = checked]; + v153 = arith.constant 4 : u32; + v28 = arith.mod v26, v153 : u32; + hir.assertz v28 #[code = 250]; + v29 = hir.int_to_ptr v26 : ptr; + hir.store v29, v23; + v30 = hir.load_local : i32 #[local = lv1]; + v31 = hir.load_local : i32 #[local = lv0]; + v32 = hir.bitcast v31 : u32; + v164 = arith.constant 8 : u32; + v34 = arith.mod v32, v164 : u32; + hir.assertz v34 #[code = 250]; + v35 = hir.int_to_ptr v32 : ptr; + v36 = hir.load v35 : i64; + v37 = hir.bitcast v30 : u32; + v163 = arith.constant 4 : u32; + v39 = arith.mod v37, v163 : u32; + hir.assertz v39 #[code = 250]; + v40 = hir.int_to_ptr v37 : ptr; + hir.store v40, v36; + v41 = hir.load_local : i32 #[local = lv0]; + v162 = arith.constant 16 : i32; + v43 = arith.add v41, v162 : i32 #[overflow = wrapping]; + v44 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__stack_pointer : ptr + v45 = hir.bitcast v44 : ptr; + hir.store v45, v43; + v46 = hir.load_local : i32 #[local = lv1]; + builtin.ret v46; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v43 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/GOT.data.internal.__memory_base : ptr - v44 = hir.bitcast v43 : ptr; - v45 = hir.load v44 : i32; - v46 = arith.constant 1048600 : i32; - v47 = arith.add v45, v46 : i32 #[overflow = wrapping]; - v48 = hir.bitcast v47 : u32; - v49 = hir.int_to_ptr v48 : ptr; - v50 = hir.load v49 : u8; - v42 = arith.constant 0 : i32; - v51 = arith.zext v50 : u32; - v52 = hir.bitcast v51 : i32; - v54 = arith.neq v52, v42 : i1; - scf.if v54{ + v47 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/GOT.data.internal.__memory_base : ptr + v48 = hir.bitcast v47 : ptr; + v49 = hir.load v48 : i32; + v171 = arith.constant 1048600 : i32; + v51 = arith.add v49, v171 : i32 #[overflow = wrapping]; + v52 = hir.bitcast v51 : u32; + v53 = hir.int_to_ptr v52 : ptr; + v54 = hir.load v53 : u8; + v170 = arith.constant 0 : i32; + v55 = arith.zext v54 : u32; + v56 = hir.bitcast v55 : i32; + v58 = arith.neq v56, v170 : i1; + scf.if v58{ ^block13: scf.yield ; } else { ^block14: - v55 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/GOT.data.internal.__memory_base : ptr - v56 = hir.bitcast v55 : ptr; - v57 = hir.load v56 : i32; + v59 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/GOT.data.internal.__memory_base : ptr + v60 = hir.bitcast v59 : ptr; + v61 = hir.load v60 : i32; + hir.store_local v61 #[local = lv0]; hir.exec @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__wasm_call_ctors() - v251 = arith.constant 1 : u8; - v253 = arith.constant 1048600 : i32; - v59 = arith.add v57, v253 : i32 #[overflow = wrapping]; - v63 = hir.bitcast v59 : u32; - v64 = hir.int_to_ptr v63 : ptr; - hir.store v64, v251; + v62 = hir.load_local : i32 #[local = lv0]; + v169 = arith.constant 1 : u8; + v174 = arith.constant 1048600 : i32; + v64 = arith.add v62, v174 : i32 #[overflow = wrapping]; + v68 = hir.bitcast v64 : u32; + v69 = hir.int_to_ptr v68 : ptr; + hir.store v69, v169; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::input_note::get_script_root(v65: i32, v66: felt) { - ^block15(v65: i32, v66: felt): - v68 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__stack_pointer : ptr - v69 = hir.bitcast v68 : ptr; - v70 = hir.load v69 : i32; - v71 = arith.constant 32 : i32; - v72 = arith.sub v70, v71 : i32 #[overflow = wrapping]; - v73 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__stack_pointer : ptr - v74 = hir.bitcast v73 : ptr; - hir.store v74, v72; - hir.exec @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/miden::input_note::get_script_root(v66, v72) - v76 = arith.constant 8 : u32; - v75 = hir.bitcast v72 : u32; - v77 = arith.add v75, v76 : u32 #[overflow = checked]; - v258 = arith.constant 8 : u32; - v79 = arith.mod v77, v258 : u32; - hir.assertz v79 #[code = 250]; - v80 = hir.int_to_ptr v77 : ptr; - v81 = hir.load v80 : i64; - v83 = arith.constant 24 : u32; - v82 = hir.bitcast v72 : u32; - v84 = arith.add v82, v83 : u32 #[overflow = checked]; - v257 = arith.constant 8 : u32; - v86 = arith.mod v84, v257 : u32; - hir.assertz v86 #[code = 250]; - v87 = hir.int_to_ptr v84 : ptr; - hir.store v87, v81; - v88 = hir.bitcast v72 : u32; - v256 = arith.constant 8 : u32; - v90 = arith.mod v88, v256 : u32; - hir.assertz v90 #[code = 250]; - v91 = hir.int_to_ptr v88 : ptr; - v92 = hir.load v91 : i64; - v94 = arith.constant 16 : u32; - v93 = hir.bitcast v72 : u32; - v95 = arith.add v93, v94 : u32 #[overflow = checked]; - v255 = arith.constant 8 : u32; - v97 = arith.mod v95, v255 : u32; - hir.assertz v97 #[code = 250]; - v98 = hir.int_to_ptr v95 : ptr; - hir.store v98, v92; - v99 = arith.constant 16 : i32; - v100 = arith.add v72, v99 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/::reverse(v65, v100) - v254 = arith.constant 32 : i32; - v102 = arith.add v72, v254 : i32 #[overflow = wrapping]; - v103 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__stack_pointer : ptr - v104 = hir.bitcast v103 : ptr; - hir.store v104, v102; + private builtin.function @miden_base_sys::bindings::input_note::get_script_root(v70: i32, v71: felt) { + ^block15(v70: i32, v71: felt): + hir.store_local v70 #[local = lv0]; + v72 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__stack_pointer : ptr + v73 = hir.bitcast v72 : ptr; + v74 = hir.load v73 : i32; + v182 = arith.constant 16 : i32; + v76 = arith.sub v74, v182 : i32 #[overflow = wrapping]; + hir.store_local v76 #[local = lv2]; + v77 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__stack_pointer : ptr + v78 = hir.bitcast v77 : ptr; + hir.store v78, v76; + v80 = hir.load_local : i32 #[local = lv2]; + hir.exec @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/miden::protocol::input_note::get_script_root(v71, v80) + v81 = hir.load_local : i32 #[local = lv0]; + v82 = hir.load_local : i32 #[local = lv2]; + v83 = hir.bitcast v82 : u32; + v181 = arith.constant 8 : u32; + v85 = arith.mod v83, v181 : u32; + hir.assertz v85 #[code = 250]; + v86 = hir.int_to_ptr v83 : ptr; + v87 = hir.load v86 : i64; + v178, v179 = arith.split v87 : felt, felt; + v194 = arith.constant 8 : u32; + v91 = hir.bitcast v81 : u32; + v93 = arith.add v91, v194 : u32 #[overflow = checked]; + v193 = arith.constant 8 : u32; + v95 = arith.mod v93, v193 : u32; + hir.assertz v95 #[code = 250]; + v180 = arith.join v179, v178 : i64; + v96 = hir.int_to_ptr v93 : ptr; + hir.store v96, v180; + v97 = hir.load_local : i32 #[local = lv0]; + v98 = hir.load_local : i32 #[local = lv2]; + v192 = arith.constant 8 : u32; + v99 = hir.bitcast v98 : u32; + v101 = arith.add v99, v192 : u32 #[overflow = checked]; + v191 = arith.constant 8 : u32; + v103 = arith.mod v101, v191 : u32; + hir.assertz v103 #[code = 250]; + v104 = hir.int_to_ptr v101 : ptr; + v105 = hir.load v104 : i64; + v175, v176 = arith.split v105 : felt, felt; + v109 = hir.bitcast v97 : u32; + v190 = arith.constant 8 : u32; + v111 = arith.mod v109, v190 : u32; + hir.assertz v111 #[code = 250]; + v177 = arith.join v176, v175 : i64; + v112 = hir.int_to_ptr v109 : ptr; + hir.store v112, v177; + v113 = hir.load_local : i32 #[local = lv2]; + v189 = arith.constant 16 : i32; + v115 = arith.add v113, v189 : i32 #[overflow = wrapping]; + v116 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__stack_pointer : ptr + v117 = hir.bitcast v116 : ptr; + hir.store v117, v115; builtin.ret ; }; - private builtin.function @::reverse(v105: i32, v106: i32) { - ^block17(v105: i32, v106: i32): - v109 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__stack_pointer : ptr - v110 = hir.bitcast v109 : ptr; - v111 = hir.load v110 : i32; - v112 = arith.constant 16 : i32; - v113 = arith.sub v111, v112 : i32 #[overflow = wrapping]; - v115 = arith.constant 8 : u32; - v114 = hir.bitcast v106 : u32; - v116 = arith.add v114, v115 : u32 #[overflow = checked]; - v345 = arith.constant 8 : u32; - v118 = arith.mod v116, v345 : u32; - hir.assertz v118 #[code = 250]; - v119 = hir.int_to_ptr v116 : ptr; - v120 = hir.load v119 : i64; - v344 = arith.constant 8 : u32; - v121 = hir.bitcast v113 : u32; - v123 = arith.add v121, v344 : u32 #[overflow = checked]; - v124 = arith.constant 4 : u32; - v125 = arith.mod v123, v124 : u32; - hir.assertz v125 #[code = 250]; - v126 = hir.int_to_ptr v123 : ptr; - hir.store v126, v120; - v127 = hir.bitcast v106 : u32; - v343 = arith.constant 8 : u32; - v129 = arith.mod v127, v343 : u32; - hir.assertz v129 #[code = 250]; - v130 = hir.int_to_ptr v127 : ptr; - v131 = hir.load v130 : i64; - v132 = hir.bitcast v113 : u32; - v342 = arith.constant 4 : u32; - v134 = arith.mod v132, v342 : u32; - hir.assertz v134 #[code = 250]; - v135 = hir.int_to_ptr v132 : ptr; - hir.store v135, v131; - v136 = arith.constant 12 : i32; - v137 = arith.add v113, v136 : i32 #[overflow = wrapping]; - v107 = arith.constant 0 : i32; - v313, v314, v315, v316, v317, v318 = scf.while v107, v113, v137, v105 : i32, i32, i32, i32, i32, i32 { - ^block39(v319: i32, v320: i32, v321: i32, v322: i32): - v341 = arith.constant 0 : i32; - v140 = arith.constant 8 : i32; - v141 = arith.eq v319, v140 : i1; - v142 = arith.zext v141 : u32; - v143 = hir.bitcast v142 : i32; - v145 = arith.neq v143, v341 : i1; - v307, v308 = scf.if v145 : i32, i32 { - ^block38: - v267 = ub.poison i32 : i32; - scf.yield v267, v267; - } else { - ^block22: - v147 = arith.add v320, v319 : i32 #[overflow = wrapping]; - v148 = hir.bitcast v147 : u32; - v340 = arith.constant 4 : u32; - v150 = arith.mod v148, v340 : u32; - hir.assertz v150 #[code = 250]; - v151 = hir.int_to_ptr v148 : ptr; - v152 = hir.load v151 : felt; - v154 = hir.bitcast v321 : u32; - v339 = arith.constant 4 : u32; - v156 = arith.mod v154, v339 : u32; - hir.assertz v156 #[code = 250]; - v157 = hir.int_to_ptr v154 : ptr; - v158 = hir.load v157 : i32; - v159 = hir.bitcast v147 : u32; - v338 = arith.constant 4 : u32; - v161 = arith.mod v159, v338 : u32; - hir.assertz v161 #[code = 250]; - v162 = hir.int_to_ptr v159 : ptr; - hir.store v162, v158; - v163 = hir.bitcast v321 : u32; - v337 = arith.constant 4 : u32; - v165 = arith.mod v163, v337 : u32; - hir.assertz v165 #[code = 250]; - v166 = hir.int_to_ptr v163 : ptr; - hir.store v166, v152; - v169 = arith.constant -4 : i32; - v170 = arith.add v321, v169 : i32 #[overflow = wrapping]; - v167 = arith.constant 4 : i32; - v168 = arith.add v319, v167 : i32 #[overflow = wrapping]; - scf.yield v168, v170; - }; - v335 = ub.poison i32 : i32; - v310 = cf.select v145, v335, v322 : i32; - v336 = ub.poison i32 : i32; - v309 = cf.select v145, v336, v320 : i32; - v266 = arith.constant 1 : u32; - v259 = arith.constant 0 : u32; - v312 = cf.select v145, v259, v266 : u32; - v300 = arith.trunc v312 : i1; - scf.condition v300, v307, v309, v308, v310, v320, v322; - } do { - ^block40(v323: i32, v324: i32, v325: i32, v326: i32, v327: i32, v328: i32): - scf.yield v323, v324, v325, v326; - }; - v334 = arith.constant 8 : u32; - v172 = hir.bitcast v317 : u32; - v174 = arith.add v172, v334 : u32 #[overflow = checked]; - v333 = arith.constant 4 : u32; - v176 = arith.mod v174, v333 : u32; - hir.assertz v176 #[code = 250]; - v177 = hir.int_to_ptr v174 : ptr; - v178 = hir.load v177 : i64; - v332 = arith.constant 8 : u32; - v179 = hir.bitcast v318 : u32; - v181 = arith.add v179, v332 : u32 #[overflow = checked]; - v331 = arith.constant 8 : u32; - v183 = arith.mod v181, v331 : u32; - hir.assertz v183 #[code = 250]; - v184 = hir.int_to_ptr v181 : ptr; - hir.store v184, v178; - v185 = hir.bitcast v317 : u32; - v330 = arith.constant 4 : u32; - v187 = arith.mod v185, v330 : u32; - hir.assertz v187 #[code = 250]; - v188 = hir.int_to_ptr v185 : ptr; - v189 = hir.load v188 : i64; - v190 = hir.bitcast v318 : u32; - v329 = arith.constant 8 : u32; - v192 = arith.mod v190, v329 : u32; - hir.assertz v192 #[code = 250]; - v193 = hir.int_to_ptr v190 : ptr; - hir.store v193, v189; - builtin.ret ; - }; - - private builtin.function @intrinsics::felt::from_u32(v194: i32) -> felt { - ^block23(v194: i32): - v195 = hir.bitcast v194 : felt; - builtin.ret v195; - }; - - private builtin.function @miden::input_note::get_script_root(v197: felt, v198: i32) { - ^block25(v197: felt, v198: i32): - v199, v200, v201, v202 = hir.exec @miden/input_note/get_script_root(v197) : felt, felt, felt, felt - v203 = hir.bitcast v198 : u32; - v204 = hir.int_to_ptr v203 : ptr; - hir.store v204, v199; - v205 = arith.constant 4 : u32; - v206 = arith.add v203, v205 : u32 #[overflow = checked]; - v207 = hir.int_to_ptr v206 : ptr; - hir.store v207, v200; - v208 = arith.constant 8 : u32; - v209 = arith.add v203, v208 : u32 #[overflow = checked]; - v210 = hir.int_to_ptr v209 : ptr; - hir.store v210, v201; - v211 = arith.constant 12 : u32; - v212 = arith.add v203, v211 : u32 #[overflow = checked]; - v213 = hir.int_to_ptr v212 : ptr; - hir.store v213, v202; - builtin.ret ; + private builtin.function @miden::protocol::input_note::get_script_root(v118: felt, v119: i32) { + ^block17(v118: felt, v119: i32): + ub.unreachable ; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -317,34 +184,34 @@ builtin.component miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-inp }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block29: - v214 = hir.exec @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1#binding() : i32 - v215 = arith.constant 0 : i32; - v216 = arith.add v214, v215 : i32 #[overflow = unchecked]; - v349 = arith.constant 0 : i32; - v350 = arith.constant 0 : i32; - v218 = arith.add v216, v350 : i32 #[overflow = unchecked]; - v220 = arith.add v218, v349 : i32 #[overflow = unchecked]; - v221 = hir.int_to_ptr v220 : ptr; - v222 = hir.load v221 : felt; - v348 = arith.constant 0 : i32; - v223 = arith.constant 4 : i32; - v224 = arith.add v216, v223 : i32 #[overflow = unchecked]; - v226 = arith.add v224, v348 : i32 #[overflow = unchecked]; - v227 = hir.int_to_ptr v226 : ptr; - v228 = hir.load v227 : felt; - v347 = arith.constant 0 : i32; - v229 = arith.constant 8 : i32; - v230 = arith.add v216, v229 : i32 #[overflow = unchecked]; - v232 = arith.add v230, v347 : i32 #[overflow = unchecked]; - v233 = hir.int_to_ptr v232 : ptr; - v234 = hir.load v233 : felt; - v346 = arith.constant 0 : i32; - v235 = arith.constant 12 : i32; - v236 = arith.add v216, v235 : i32 #[overflow = unchecked]; - v238 = arith.add v236, v346 : i32 #[overflow = unchecked]; - v239 = hir.int_to_ptr v238 : ptr; - v240 = hir.load v239 : felt; - builtin.ret v222, v228, v234, v240; + ^block19: + v120 = hir.exec @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1#binding() : i32 + v198 = arith.constant 0 : i32; + v122 = arith.add v120, v198 : i32 #[overflow = unchecked]; + v207 = arith.constant 0 : i32; + v208 = arith.constant 0 : i32; + v124 = arith.add v122, v208 : i32 #[overflow = unchecked]; + v126 = arith.add v124, v207 : i32 #[overflow = unchecked]; + v127 = hir.int_to_ptr v126 : ptr; + v128 = hir.load v127 : felt; + v206 = arith.constant 0 : i32; + v197 = arith.constant 4 : i32; + v130 = arith.add v122, v197 : i32 #[overflow = unchecked]; + v132 = arith.add v130, v206 : i32 #[overflow = unchecked]; + v133 = hir.int_to_ptr v132 : ptr; + v134 = hir.load v133 : felt; + v205 = arith.constant 0 : i32; + v196 = arith.constant 8 : i32; + v136 = arith.add v122, v196 : i32 #[overflow = unchecked]; + v138 = arith.add v136, v205 : i32 #[overflow = unchecked]; + v139 = hir.int_to_ptr v138 : ptr; + v140 = hir.load v139 : felt; + v204 = arith.constant 0 : i32; + v195 = arith.constant 12 : i32; + v142 = arith.add v122, v195 : i32 #[overflow = unchecked]; + v144 = arith.add v142, v204 : i32 #[overflow = unchecked]; + v145 = hir.int_to_ptr v144 : ptr; + v146 = hir.load v145 : felt; + builtin.ret v128, v134, v140, v146; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.masm index ae4df808d..fb75c8ed7 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.masm @@ -1,13 +1,13 @@ -# mod miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1 +# mod ::"miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> (felt, felt, felt, felt) - exec.::miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1::init + exec."miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1::rust_sdk_input_note_get_script_root_binding::miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1#binding + exec.::"miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1"::rust_sdk_input_note_get_script_root_binding::"miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1#binding" trace.252 nop push.0 @@ -62,7 +62,7 @@ pub proc binding( nop movdn.3 swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -75,7 +75,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -86,7 +86,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1::rust_sdk_input_note_get_script_root_binding +# mod ::"miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1"::rust_sdk_input_note_get_script_root_binding @callconv("C") proc __wasm_call_ctors( @@ -102,6 +102,7 @@ proc rust_sdk_input_note_get_script_root_binding::bindings::__link_custom_sectio nop end +@locals("2") @callconv("C") proc miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1#binding( @@ -116,9 +117,16 @@ proc miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-s nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -128,19 +136,22 @@ proc miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-s nop trace.240 nop - exec.::miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1::rust_sdk_input_note_get_script_root_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1"::rust_sdk_input_note_get_script_root_binding::wit_bindgen::rt::run_ctors_once trace.252 nop + locaddr.0 push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1::rust_sdk_input_note_get_script_root_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop - dup.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1::rust_sdk_input_note_get_script_root_binding::miden_base_sys::bindings::input_note::get_script_root + exec.::"miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1"::rust_sdk_input_note_get_script_root_binding::miden_base_sys::bindings::input_note::get_script_root trace.252 nop push.1114148 @@ -153,8 +164,25 @@ proc miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-s nop push.1048584 u32wrapping_add + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.2 + swap.1 add u32assert push.8 @@ -172,7 +200,7 @@ proc miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-s nop swap.1 push.8 - dup.3 + movup.3 add u32assert push.4 @@ -190,7 +218,22 @@ proc miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-s exec.::intrinsics::mem::store_dw trace.252 nop - dup.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 dup.1 swap.1 @@ -205,7 +248,7 @@ proc miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-s trace.252 nop swap.1 - dup.2 + movup.2 push.4 dup.1 swap.1 @@ -221,8 +264,15 @@ proc miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-s exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - movup.2 u32wrapping_add push.1114144 u32divmod.4 @@ -232,8 +282,17 @@ proc miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-s exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -275,9 +334,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1"::rust_sdk_input_note_get_script_root_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1::rust_sdk_input_note_get_script_root_binding::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -308,149 +383,77 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("3") @callconv("C") proc miden_base_sys::bindings::input_note::get_script_root( i32, felt ) - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::store_sw trace.252 nop - push.32 - u32wrapping_sub push.1114144 - dup.1 - swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop + push.16 + u32wrapping_sub dup.0 - movup.3 - trace.240 - nop - exec.::miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1::rust_sdk_input_note_get_script_root_binding::miden::input_note::get_script_root - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_sw trace.252 nop - swap.1 - push.24 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.1114144 u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop - dup.0 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop swap.1 - push.16 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.16 - dup.1 - u32wrapping_add - movup.2 trace.240 nop - exec.::miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1::rust_sdk_input_note_get_script_root_binding::::reverse + exec.::"miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1"::rust_sdk_input_note_get_script_root_binding::"miden::protocol::input_note::get_script_root" trace.252 nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop -end - -@callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert push.8 dup.1 swap.1 @@ -466,15 +469,17 @@ proc ::reverse( nop swap.1 push.8 - dup.3 + movup.3 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -484,182 +489,24 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.12 - dup.1 - u32wrapping_add + locaddr.2 push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop - swap.1 push.8 - dup.4 + swap.1 add u32assert push.8 @@ -670,21 +517,6 @@ proc ::reverse( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 trace.240 nop exec.::intrinsics::mem::load_dw @@ -698,6 +530,8 @@ proc ::reverse( u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -707,66 +541,32 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc miden::input_note::get_script_root(felt, i32) - trace.240 - nop - exec.::miden::input_note::get_script_root - trace.252 - nop - movup.4 - dup.0 - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_sw trace.252 nop - push.12 - add - u32assert + push.16 + u32wrapping_add + push.1114144 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::store_sw trace.252 nop end +@locals("2") +@callconv("C") +proc miden::protocol::input_note::get_script_root(felt, i32) + drop + drop + push.0 + assert +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.wat index 3e1dcf1f1..989cf1532 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.wat @@ -13,9 +13,8 @@ (type (;0;) (func)) (type (;1;) (func (result i32))) (type (;2;) (func (param i32 f32))) - (type (;3;) (func (param i32 i32))) - (type (;4;) (func (param i32) (result f32))) - (type (;5;) (func (param f32 i32))) + (type (;3;) (func (param i32) (result f32))) + (type (;4;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -75,97 +74,38 @@ (func $miden_base_sys::bindings::input_note::get_script_root (;4;) (type 2) (param i32 f32) (local i32) global.get $__stack_pointer - i32.const 32 + i32.const 16 i32.sub local.tee 2 global.set $__stack_pointer local.get 1 local.get 2 - call $miden::input_note::get_script_root - local.get 2 - local.get 2 - i64.load offset=8 - i64.store offset=24 - local.get 2 - local.get 2 - i64.load - i64.store offset=16 + call $miden::protocol::input_note::get_script_root local.get 0 local.get 2 - i32.const 16 - i32.add - call $::reverse - local.get 2 - i32.const 32 - i32.add - global.set $__stack_pointer - ) - (func $::reverse (;5;) (type 3) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 + i64.const 32 + i64.rotl i64.store offset=8 local.get 0 local.get 2 - i64.load align=4 + i64.load offset=8 + i64.const 32 + i64.rotl i64.store + local.get 2 + i32.const 16 + i32.add + global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) unreachable ) - (func $miden::input_note::get_script_root (;7;) (type 5) (param f32 i32) + (func $miden::protocol::input_note::get_script_root (;6;) (type 4) (param f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "Wrust_sdk_input_note_get_script_root_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "Wrust_sdk_input_note_get_script_root_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.hir index e24b01cef..966df2945 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.hir @@ -12,133 +12,130 @@ builtin.component miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-no private builtin.function @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1#binding() -> i32 { ^block9: - v2 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/__stack_pointer : ptr - v3 = hir.bitcast v2 : ptr; - v4 = hir.load v3 : i32; - v5 = arith.constant 16 : i32; - v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; - v7 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/__stack_pointer : ptr - v8 = hir.bitcast v7 : ptr; - hir.store v8, v6; + v1 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v113 = arith.constant 16 : i32; + v5 = arith.sub v3, v113 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; hir.exec @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/wit_bindgen::rt::run_ctors_once() - v1 = arith.constant 0 : i32; - v12 = hir.exec @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/intrinsics::felt::from_u32(v1) : felt - v9 = arith.constant 8 : i32; - v10 = arith.add v6, v9 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/miden_base_sys::bindings::input_note::get_sender(v10, v12) + v8 = hir.load_local : i32 #[local = lv0]; + v108 = arith.constant 0 : felt; + v112 = arith.constant 8 : i32; + v10 = arith.add v8, v112 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/miden_base_sys::bindings::input_note::get_sender(v10, v108) v13 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/GOT.data.internal.__memory_base : ptr v14 = hir.bitcast v13 : ptr; v15 = hir.load v14 : i32; - v16 = arith.constant 1048584 : i32; - v17 = arith.add v15, v16 : i32 #[overflow = wrapping]; - v19 = arith.constant 8 : u32; - v18 = hir.bitcast v6 : u32; - v20 = arith.add v18, v19 : u32 #[overflow = checked]; - v111 = arith.constant 8 : u32; - v22 = arith.mod v20, v111 : u32; - hir.assertz v22 #[code = 250]; - v23 = hir.int_to_ptr v20 : ptr; - v24 = hir.load v23 : i64; - v25 = hir.bitcast v17 : u32; - v26 = arith.constant 4 : u32; - v27 = arith.mod v25, v26 : u32; - hir.assertz v27 #[code = 250]; - v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v24; - v110 = arith.constant 16 : i32; - v30 = arith.add v6, v110 : i32 #[overflow = wrapping]; - v31 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/__stack_pointer : ptr - v32 = hir.bitcast v31 : ptr; - hir.store v32, v30; + v111 = arith.constant 1048584 : i32; + v17 = arith.add v15, v111 : i32 #[overflow = wrapping]; + v18 = hir.load_local : i32 #[local = lv0]; + v110 = arith.constant 8 : u32; + v19 = hir.bitcast v18 : u32; + v21 = arith.add v19, v110 : u32 #[overflow = checked]; + v117 = arith.constant 8 : u32; + v23 = arith.mod v21, v117 : u32; + hir.assertz v23 #[code = 250]; + v24 = hir.int_to_ptr v21 : ptr; + v25 = hir.load v24 : i64; + v26 = hir.bitcast v17 : u32; + v109 = arith.constant 4 : u32; + v28 = arith.mod v26, v109 : u32; + hir.assertz v28 #[code = 250]; + v29 = hir.int_to_ptr v26 : ptr; + hir.store v29, v25; + v30 = hir.load_local : i32 #[local = lv0]; + v116 = arith.constant 16 : i32; + v32 = arith.add v30, v116 : i32 #[overflow = wrapping]; + v33 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/__stack_pointer : ptr + v34 = hir.bitcast v33 : ptr; + hir.store v34, v32; builtin.ret v17; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v34 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/GOT.data.internal.__memory_base : ptr - v35 = hir.bitcast v34 : ptr; - v36 = hir.load v35 : i32; - v37 = arith.constant 1048592 : i32; - v38 = arith.add v36, v37 : i32 #[overflow = wrapping]; - v39 = hir.bitcast v38 : u32; - v40 = hir.int_to_ptr v39 : ptr; - v41 = hir.load v40 : u8; - v33 = arith.constant 0 : i32; - v42 = arith.zext v41 : u32; - v43 = hir.bitcast v42 : i32; - v45 = arith.neq v43, v33 : i1; - scf.if v45{ + v36 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/GOT.data.internal.__memory_base : ptr + v37 = hir.bitcast v36 : ptr; + v38 = hir.load v37 : i32; + v122 = arith.constant 1048592 : i32; + v40 = arith.add v38, v122 : i32 #[overflow = wrapping]; + v41 = hir.bitcast v40 : u32; + v42 = hir.int_to_ptr v41 : ptr; + v43 = hir.load v42 : u8; + v121 = arith.constant 0 : i32; + v44 = arith.zext v43 : u32; + v45 = hir.bitcast v44 : i32; + v47 = arith.neq v45, v121 : i1; + scf.if v47{ ^block13: scf.yield ; } else { ^block14: - v46 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/GOT.data.internal.__memory_base : ptr - v47 = hir.bitcast v46 : ptr; - v48 = hir.load v47 : i32; + v48 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/GOT.data.internal.__memory_base : ptr + v49 = hir.bitcast v48 : ptr; + v50 = hir.load v49 : i32; + hir.store_local v50 #[local = lv0]; hir.exec @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/__wasm_call_ctors() - v113 = arith.constant 1 : u8; - v115 = arith.constant 1048592 : i32; - v50 = arith.add v48, v115 : i32 #[overflow = wrapping]; - v54 = hir.bitcast v50 : u32; - v55 = hir.int_to_ptr v54 : ptr; - hir.store v55, v113; + v51 = hir.load_local : i32 #[local = lv0]; + v120 = arith.constant 1 : u8; + v125 = arith.constant 1048592 : i32; + v53 = arith.add v51, v125 : i32 #[overflow = wrapping]; + v57 = hir.bitcast v53 : u32; + v58 = hir.int_to_ptr v57 : ptr; + hir.store v58, v120; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::input_note::get_sender(v56: i32, v57: felt) { - ^block15(v56: i32, v57: felt): - v59 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/__stack_pointer : ptr - v60 = hir.bitcast v59 : ptr; - v61 = hir.load v60 : i32; - v62 = arith.constant 16 : i32; - v63 = arith.sub v61, v62 : i32 #[overflow = wrapping]; - v64 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/__stack_pointer : ptr - v65 = hir.bitcast v64 : ptr; - hir.store v65, v63; - v66 = arith.constant 8 : i32; - v67 = arith.add v63, v66 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/miden::input_note::get_sender(v57, v67) - v69 = arith.constant 8 : u32; - v68 = hir.bitcast v63 : u32; - v70 = arith.add v68, v69 : u32 #[overflow = checked]; - v71 = arith.constant 4 : u32; - v72 = arith.mod v70, v71 : u32; - hir.assertz v72 #[code = 250]; - v73 = hir.int_to_ptr v70 : ptr; - v74 = hir.load v73 : i64; - v75 = hir.bitcast v56 : u32; - v117 = arith.constant 8 : u32; - v77 = arith.mod v75, v117 : u32; - hir.assertz v77 #[code = 250]; - v78 = hir.int_to_ptr v75 : ptr; - hir.store v78, v74; - v116 = arith.constant 16 : i32; - v80 = arith.add v63, v116 : i32 #[overflow = wrapping]; - v81 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/__stack_pointer : ptr - v82 = hir.bitcast v81 : ptr; - hir.store v82, v80; + private builtin.function @miden_base_sys::bindings::input_note::get_sender(v59: i32, v60: felt) { + ^block15(v59: i32, v60: felt): + hir.store_local v59 #[local = lv0]; + v61 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/__stack_pointer : ptr + v62 = hir.bitcast v61 : ptr; + v63 = hir.load v62 : i32; + v129 = arith.constant 16 : i32; + v65 = arith.sub v63, v129 : i32 #[overflow = wrapping]; + hir.store_local v65 #[local = lv2]; + v66 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/__stack_pointer : ptr + v67 = hir.bitcast v66 : ptr; + hir.store v67, v65; + v69 = hir.load_local : i32 #[local = lv2]; + v128 = arith.constant 8 : i32; + v71 = arith.add v69, v128 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/miden::protocol::input_note::get_sender(v60, v71) + v72 = hir.load_local : i32 #[local = lv0]; + v73 = hir.load_local : i32 #[local = lv2]; + v127 = arith.constant 8 : u32; + v74 = hir.bitcast v73 : u32; + v76 = arith.add v74, v127 : u32 #[overflow = checked]; + v126 = arith.constant 4 : u32; + v78 = arith.mod v76, v126 : u32; + hir.assertz v78 #[code = 250]; + v79 = hir.int_to_ptr v76 : ptr; + v80 = hir.load v79 : i64; + v81 = hir.bitcast v72 : u32; + v133 = arith.constant 8 : u32; + v83 = arith.mod v81, v133 : u32; + hir.assertz v83 #[code = 250]; + v84 = hir.int_to_ptr v81 : ptr; + hir.store v84, v80; + v85 = hir.load_local : i32 #[local = lv2]; + v132 = arith.constant 16 : i32; + v87 = arith.add v85, v132 : i32 #[overflow = wrapping]; + v88 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/__stack_pointer : ptr + v89 = hir.bitcast v88 : ptr; + hir.store v89, v87; builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v83: i32) -> felt { - ^block17(v83: i32): - v84 = hir.bitcast v83 : felt; - builtin.ret v84; - }; - - private builtin.function @miden::input_note::get_sender(v86: felt, v87: i32) { - ^block19(v86: felt, v87: i32): - v88, v89 = hir.exec @miden/input_note/get_sender(v86) : felt, felt - v90 = hir.bitcast v87 : u32; - v91 = hir.int_to_ptr v90 : ptr; - hir.store v91, v88; - v92 = arith.constant 4 : u32; - v93 = arith.add v90, v92 : u32 #[overflow = checked]; - v94 = hir.int_to_ptr v93 : ptr; - hir.store v94, v89; - builtin.ret ; + private builtin.function @miden::protocol::input_note::get_sender(v90: felt, v91: i32) { + ^block17(v90: felt, v91: i32): + ub.unreachable ; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -153,20 +150,20 @@ builtin.component miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-no }; public builtin.function @binding() -> felt, felt { - ^block23: - v95 = hir.exec @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1#binding() : i32 - v119 = arith.constant 0 : i32; - v96 = arith.constant 0 : i32; - v97 = arith.add v95, v96 : i32 #[overflow = unchecked]; - v99 = arith.add v97, v119 : i32 #[overflow = unchecked]; - v100 = hir.int_to_ptr v99 : ptr; - v101 = hir.load v100 : felt; - v118 = arith.constant 0 : i32; - v102 = arith.constant 4 : i32; - v103 = arith.add v95, v102 : i32 #[overflow = unchecked]; - v105 = arith.add v103, v118 : i32 #[overflow = unchecked]; - v106 = hir.int_to_ptr v105 : ptr; - v107 = hir.load v106 : felt; - builtin.ret v101, v107; + ^block19: + v92 = hir.exec @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1#binding() : i32 + v139 = arith.constant 0 : i32; + v137 = arith.constant 0 : i32; + v94 = arith.add v92, v137 : i32 #[overflow = unchecked]; + v96 = arith.add v94, v139 : i32 #[overflow = unchecked]; + v97 = hir.int_to_ptr v96 : ptr; + v98 = hir.load v97 : felt; + v138 = arith.constant 0 : i32; + v134 = arith.constant 4 : i32; + v100 = arith.add v92, v134 : i32 #[overflow = unchecked]; + v102 = arith.add v100, v138 : i32 #[overflow = unchecked]; + v103 = hir.int_to_ptr v102 : ptr; + v104 = hir.load v103 : felt; + builtin.ret v98, v104; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.masm index 027fbcb12..fd0bb3f1f 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.masm @@ -1,13 +1,13 @@ -# mod miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1 +# mod ::"miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> (felt, felt) - exec.::miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1::init + exec."miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1::rust_sdk_input_note_get_sender_binding::miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1#binding + exec.::"miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1"::rust_sdk_input_note_get_sender_binding::"miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1#binding" trace.252 nop push.0 @@ -35,7 +35,7 @@ pub proc binding( trace.252 nop swap.1 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -48,7 +48,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -59,7 +59,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1::rust_sdk_input_note_get_sender_binding +# mod ::"miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1"::rust_sdk_input_note_get_sender_binding @callconv("C") proc __wasm_call_ctors( @@ -75,6 +75,7 @@ proc rust_sdk_input_note_get_sender_binding::bindings::__link_custom_section_des nop end +@locals("2") @callconv("C") proc miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1#binding( @@ -89,9 +90,16 @@ proc miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -101,21 +109,24 @@ proc miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender nop trace.240 nop - exec.::miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1::rust_sdk_input_note_get_sender_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1"::rust_sdk_input_note_get_sender_binding::wit_bindgen::rt::run_ctors_once trace.252 nop + locaddr.0 push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1::rust_sdk_input_note_get_sender_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop + push.0 push.8 - dup.2 + movup.2 u32wrapping_add trace.240 nop - exec.::miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1::rust_sdk_input_note_get_sender_binding::miden_base_sys::bindings::input_note::get_sender + exec.::"miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1"::rust_sdk_input_note_get_sender_binding::miden_base_sys::bindings::input_note::get_sender trace.252 nop push.1114148 @@ -128,8 +139,16 @@ proc miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender nop push.1048584 u32wrapping_add + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.2 + swap.1 add u32assert push.8 @@ -162,8 +181,15 @@ proc miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - movup.2 u32wrapping_add push.1114144 u32divmod.4 @@ -175,6 +201,7 @@ proc miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -216,9 +243,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1"::rust_sdk_input_note_get_sender_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1::rust_sdk_input_note_get_sender_binding::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -249,11 +292,20 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("3") @callconv("C") proc miden_base_sys::bindings::input_note::get_sender( i32, felt ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -264,9 +316,16 @@ proc miden_base_sys::bindings::input_note::get_sender( nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.2 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -274,17 +333,40 @@ proc miden_base_sys::bindings::input_note::get_sender( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.1 u32wrapping_add - movup.3 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1"::rust_sdk_input_note_get_sender_binding::"miden::protocol::input_note::get_sender" + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1::rust_sdk_input_note_get_sender_binding::miden::input_note::get_sender + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.1 + swap.1 add u32assert push.4 @@ -301,7 +383,7 @@ proc miden_base_sys::bindings::input_note::get_sender( trace.252 nop swap.1 - movup.3 + movup.2 push.8 dup.1 swap.1 @@ -317,6 +399,14 @@ proc miden_base_sys::bindings::input_note::get_sender( exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114144 @@ -329,38 +419,12 @@ proc miden_base_sys::bindings::input_note::get_sender( nop end +@locals("2") @callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc miden::input_note::get_sender(felt, i32) - trace.240 - nop - exec.::miden::input_note::get_sender - trace.252 - nop - movup.2 - dup.0 - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - add - u32assert - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop +proc miden::protocol::input_note::get_sender(felt, i32) + drop + drop + push.0 + assert end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.wat index 0cc575447..081ca3e98 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.wat @@ -79,7 +79,7 @@ local.get 2 i32.const 8 i32.add - call $miden::input_note::get_sender + call $miden::protocol::input_note::get_sender local.get 0 local.get 2 i64.load offset=8 align=4 @@ -92,11 +92,11 @@ (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) unreachable ) - (func $miden::input_note::get_sender (;6;) (type 4) (param f32 i32) + (func $miden::protocol::input_note::get_sender (;6;) (type 4) (param f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "Mrust_sdk_input_note_get_sender_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "Mrust_sdk_input_note_get_sender_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "account-id" (type $account-id (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.hir index 650d6f9ef..b6af8ac25 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.hir @@ -12,297 +12,164 @@ builtin.component miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-i private builtin.function @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1#binding() -> i32 { ^block9: - v2 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__stack_pointer : ptr - v3 = hir.bitcast v2 : ptr; - v4 = hir.load v3 : i32; - v5 = arith.constant 16 : i32; - v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; - v7 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__stack_pointer : ptr - v8 = hir.bitcast v7 : ptr; - hir.store v8, v6; + v1 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v156 = arith.constant 16 : i32; + v5 = arith.sub v3, v156 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; hir.exec @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/wit_bindgen::rt::run_ctors_once() - v1 = arith.constant 0 : i32; - v10 = hir.exec @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/intrinsics::felt::from_u32(v1) : felt - hir.exec @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/miden_base_sys::bindings::input_note::get_serial_number(v6, v10) + v8 = hir.load_local : i32 #[local = lv0]; + v152 = arith.constant 0 : felt; + hir.exec @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/miden_base_sys::bindings::input_note::get_serial_number(v8, v152) v11 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/GOT.data.internal.__memory_base : ptr v12 = hir.bitcast v11 : ptr; v13 = hir.load v12 : i32; - v14 = arith.constant 1048584 : i32; - v15 = arith.add v13, v14 : i32 #[overflow = wrapping]; - v17 = arith.constant 8 : u32; - v16 = hir.bitcast v6 : u32; - v18 = arith.add v16, v17 : u32 #[overflow = checked]; - v249 = arith.constant 8 : u32; - v20 = arith.mod v18, v249 : u32; - hir.assertz v20 #[code = 250]; - v21 = hir.int_to_ptr v18 : ptr; - v22 = hir.load v21 : i64; - v248 = arith.constant 8 : u32; - v23 = hir.bitcast v15 : u32; - v25 = arith.add v23, v248 : u32 #[overflow = checked]; - v26 = arith.constant 4 : u32; - v27 = arith.mod v25, v26 : u32; - hir.assertz v27 #[code = 250]; - v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v22; - v29 = hir.bitcast v6 : u32; - v247 = arith.constant 8 : u32; - v31 = arith.mod v29, v247 : u32; - hir.assertz v31 #[code = 250]; - v32 = hir.int_to_ptr v29 : ptr; - v33 = hir.load v32 : i64; - v34 = hir.bitcast v15 : u32; - v246 = arith.constant 4 : u32; - v36 = arith.mod v34, v246 : u32; - hir.assertz v36 #[code = 250]; - v37 = hir.int_to_ptr v34 : ptr; - hir.store v37, v33; - v245 = arith.constant 16 : i32; - v39 = arith.add v6, v245 : i32 #[overflow = wrapping]; - v40 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__stack_pointer : ptr - v41 = hir.bitcast v40 : ptr; - hir.store v41, v39; - builtin.ret v15; + v155 = arith.constant 1048584 : i32; + v15 = arith.add v13, v155 : i32 #[overflow = wrapping]; + hir.store_local v15 #[local = lv1]; + v16 = hir.load_local : i32 #[local = lv0]; + v154 = arith.constant 8 : u32; + v17 = hir.bitcast v16 : u32; + v19 = arith.add v17, v154 : u32 #[overflow = checked]; + v166 = arith.constant 8 : u32; + v21 = arith.mod v19, v166 : u32; + hir.assertz v21 #[code = 250]; + v22 = hir.int_to_ptr v19 : ptr; + v23 = hir.load v22 : i64; + v165 = arith.constant 8 : u32; + v24 = hir.bitcast v15 : u32; + v26 = arith.add v24, v165 : u32 #[overflow = checked]; + v153 = arith.constant 4 : u32; + v28 = arith.mod v26, v153 : u32; + hir.assertz v28 #[code = 250]; + v29 = hir.int_to_ptr v26 : ptr; + hir.store v29, v23; + v30 = hir.load_local : i32 #[local = lv1]; + v31 = hir.load_local : i32 #[local = lv0]; + v32 = hir.bitcast v31 : u32; + v164 = arith.constant 8 : u32; + v34 = arith.mod v32, v164 : u32; + hir.assertz v34 #[code = 250]; + v35 = hir.int_to_ptr v32 : ptr; + v36 = hir.load v35 : i64; + v37 = hir.bitcast v30 : u32; + v163 = arith.constant 4 : u32; + v39 = arith.mod v37, v163 : u32; + hir.assertz v39 #[code = 250]; + v40 = hir.int_to_ptr v37 : ptr; + hir.store v40, v36; + v41 = hir.load_local : i32 #[local = lv0]; + v162 = arith.constant 16 : i32; + v43 = arith.add v41, v162 : i32 #[overflow = wrapping]; + v44 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__stack_pointer : ptr + v45 = hir.bitcast v44 : ptr; + hir.store v45, v43; + v46 = hir.load_local : i32 #[local = lv1]; + builtin.ret v46; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v43 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/GOT.data.internal.__memory_base : ptr - v44 = hir.bitcast v43 : ptr; - v45 = hir.load v44 : i32; - v46 = arith.constant 1048600 : i32; - v47 = arith.add v45, v46 : i32 #[overflow = wrapping]; - v48 = hir.bitcast v47 : u32; - v49 = hir.int_to_ptr v48 : ptr; - v50 = hir.load v49 : u8; - v42 = arith.constant 0 : i32; - v51 = arith.zext v50 : u32; - v52 = hir.bitcast v51 : i32; - v54 = arith.neq v52, v42 : i1; - scf.if v54{ + v47 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/GOT.data.internal.__memory_base : ptr + v48 = hir.bitcast v47 : ptr; + v49 = hir.load v48 : i32; + v171 = arith.constant 1048600 : i32; + v51 = arith.add v49, v171 : i32 #[overflow = wrapping]; + v52 = hir.bitcast v51 : u32; + v53 = hir.int_to_ptr v52 : ptr; + v54 = hir.load v53 : u8; + v170 = arith.constant 0 : i32; + v55 = arith.zext v54 : u32; + v56 = hir.bitcast v55 : i32; + v58 = arith.neq v56, v170 : i1; + scf.if v58{ ^block13: scf.yield ; } else { ^block14: - v55 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/GOT.data.internal.__memory_base : ptr - v56 = hir.bitcast v55 : ptr; - v57 = hir.load v56 : i32; + v59 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/GOT.data.internal.__memory_base : ptr + v60 = hir.bitcast v59 : ptr; + v61 = hir.load v60 : i32; + hir.store_local v61 #[local = lv0]; hir.exec @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__wasm_call_ctors() - v251 = arith.constant 1 : u8; - v253 = arith.constant 1048600 : i32; - v59 = arith.add v57, v253 : i32 #[overflow = wrapping]; - v63 = hir.bitcast v59 : u32; - v64 = hir.int_to_ptr v63 : ptr; - hir.store v64, v251; + v62 = hir.load_local : i32 #[local = lv0]; + v169 = arith.constant 1 : u8; + v174 = arith.constant 1048600 : i32; + v64 = arith.add v62, v174 : i32 #[overflow = wrapping]; + v68 = hir.bitcast v64 : u32; + v69 = hir.int_to_ptr v68 : ptr; + hir.store v69, v169; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::input_note::get_serial_number(v65: i32, v66: felt) { - ^block15(v65: i32, v66: felt): - v68 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__stack_pointer : ptr - v69 = hir.bitcast v68 : ptr; - v70 = hir.load v69 : i32; - v71 = arith.constant 32 : i32; - v72 = arith.sub v70, v71 : i32 #[overflow = wrapping]; - v73 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__stack_pointer : ptr - v74 = hir.bitcast v73 : ptr; - hir.store v74, v72; - hir.exec @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/miden::input_note::get_serial_number(v66, v72) - v76 = arith.constant 8 : u32; - v75 = hir.bitcast v72 : u32; - v77 = arith.add v75, v76 : u32 #[overflow = checked]; - v258 = arith.constant 8 : u32; - v79 = arith.mod v77, v258 : u32; - hir.assertz v79 #[code = 250]; - v80 = hir.int_to_ptr v77 : ptr; - v81 = hir.load v80 : i64; - v83 = arith.constant 24 : u32; - v82 = hir.bitcast v72 : u32; - v84 = arith.add v82, v83 : u32 #[overflow = checked]; - v257 = arith.constant 8 : u32; - v86 = arith.mod v84, v257 : u32; - hir.assertz v86 #[code = 250]; - v87 = hir.int_to_ptr v84 : ptr; - hir.store v87, v81; - v88 = hir.bitcast v72 : u32; - v256 = arith.constant 8 : u32; - v90 = arith.mod v88, v256 : u32; - hir.assertz v90 #[code = 250]; - v91 = hir.int_to_ptr v88 : ptr; - v92 = hir.load v91 : i64; - v94 = arith.constant 16 : u32; - v93 = hir.bitcast v72 : u32; - v95 = arith.add v93, v94 : u32 #[overflow = checked]; - v255 = arith.constant 8 : u32; - v97 = arith.mod v95, v255 : u32; - hir.assertz v97 #[code = 250]; - v98 = hir.int_to_ptr v95 : ptr; - hir.store v98, v92; - v99 = arith.constant 16 : i32; - v100 = arith.add v72, v99 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/::reverse(v65, v100) - v254 = arith.constant 32 : i32; - v102 = arith.add v72, v254 : i32 #[overflow = wrapping]; - v103 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__stack_pointer : ptr - v104 = hir.bitcast v103 : ptr; - hir.store v104, v102; + private builtin.function @miden_base_sys::bindings::input_note::get_serial_number(v70: i32, v71: felt) { + ^block15(v70: i32, v71: felt): + hir.store_local v70 #[local = lv0]; + v72 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__stack_pointer : ptr + v73 = hir.bitcast v72 : ptr; + v74 = hir.load v73 : i32; + v182 = arith.constant 16 : i32; + v76 = arith.sub v74, v182 : i32 #[overflow = wrapping]; + hir.store_local v76 #[local = lv2]; + v77 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__stack_pointer : ptr + v78 = hir.bitcast v77 : ptr; + hir.store v78, v76; + v80 = hir.load_local : i32 #[local = lv2]; + hir.exec @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/miden::protocol::input_note::get_serial_number(v71, v80) + v81 = hir.load_local : i32 #[local = lv0]; + v82 = hir.load_local : i32 #[local = lv2]; + v83 = hir.bitcast v82 : u32; + v181 = arith.constant 8 : u32; + v85 = arith.mod v83, v181 : u32; + hir.assertz v85 #[code = 250]; + v86 = hir.int_to_ptr v83 : ptr; + v87 = hir.load v86 : i64; + v178, v179 = arith.split v87 : felt, felt; + v194 = arith.constant 8 : u32; + v91 = hir.bitcast v81 : u32; + v93 = arith.add v91, v194 : u32 #[overflow = checked]; + v193 = arith.constant 8 : u32; + v95 = arith.mod v93, v193 : u32; + hir.assertz v95 #[code = 250]; + v180 = arith.join v179, v178 : i64; + v96 = hir.int_to_ptr v93 : ptr; + hir.store v96, v180; + v97 = hir.load_local : i32 #[local = lv0]; + v98 = hir.load_local : i32 #[local = lv2]; + v192 = arith.constant 8 : u32; + v99 = hir.bitcast v98 : u32; + v101 = arith.add v99, v192 : u32 #[overflow = checked]; + v191 = arith.constant 8 : u32; + v103 = arith.mod v101, v191 : u32; + hir.assertz v103 #[code = 250]; + v104 = hir.int_to_ptr v101 : ptr; + v105 = hir.load v104 : i64; + v175, v176 = arith.split v105 : felt, felt; + v109 = hir.bitcast v97 : u32; + v190 = arith.constant 8 : u32; + v111 = arith.mod v109, v190 : u32; + hir.assertz v111 #[code = 250]; + v177 = arith.join v176, v175 : i64; + v112 = hir.int_to_ptr v109 : ptr; + hir.store v112, v177; + v113 = hir.load_local : i32 #[local = lv2]; + v189 = arith.constant 16 : i32; + v115 = arith.add v113, v189 : i32 #[overflow = wrapping]; + v116 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__stack_pointer : ptr + v117 = hir.bitcast v116 : ptr; + hir.store v117, v115; builtin.ret ; }; - private builtin.function @::reverse(v105: i32, v106: i32) { - ^block17(v105: i32, v106: i32): - v109 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__stack_pointer : ptr - v110 = hir.bitcast v109 : ptr; - v111 = hir.load v110 : i32; - v112 = arith.constant 16 : i32; - v113 = arith.sub v111, v112 : i32 #[overflow = wrapping]; - v115 = arith.constant 8 : u32; - v114 = hir.bitcast v106 : u32; - v116 = arith.add v114, v115 : u32 #[overflow = checked]; - v345 = arith.constant 8 : u32; - v118 = arith.mod v116, v345 : u32; - hir.assertz v118 #[code = 250]; - v119 = hir.int_to_ptr v116 : ptr; - v120 = hir.load v119 : i64; - v344 = arith.constant 8 : u32; - v121 = hir.bitcast v113 : u32; - v123 = arith.add v121, v344 : u32 #[overflow = checked]; - v124 = arith.constant 4 : u32; - v125 = arith.mod v123, v124 : u32; - hir.assertz v125 #[code = 250]; - v126 = hir.int_to_ptr v123 : ptr; - hir.store v126, v120; - v127 = hir.bitcast v106 : u32; - v343 = arith.constant 8 : u32; - v129 = arith.mod v127, v343 : u32; - hir.assertz v129 #[code = 250]; - v130 = hir.int_to_ptr v127 : ptr; - v131 = hir.load v130 : i64; - v132 = hir.bitcast v113 : u32; - v342 = arith.constant 4 : u32; - v134 = arith.mod v132, v342 : u32; - hir.assertz v134 #[code = 250]; - v135 = hir.int_to_ptr v132 : ptr; - hir.store v135, v131; - v136 = arith.constant 12 : i32; - v137 = arith.add v113, v136 : i32 #[overflow = wrapping]; - v107 = arith.constant 0 : i32; - v313, v314, v315, v316, v317, v318 = scf.while v107, v113, v137, v105 : i32, i32, i32, i32, i32, i32 { - ^block39(v319: i32, v320: i32, v321: i32, v322: i32): - v341 = arith.constant 0 : i32; - v140 = arith.constant 8 : i32; - v141 = arith.eq v319, v140 : i1; - v142 = arith.zext v141 : u32; - v143 = hir.bitcast v142 : i32; - v145 = arith.neq v143, v341 : i1; - v307, v308 = scf.if v145 : i32, i32 { - ^block38: - v267 = ub.poison i32 : i32; - scf.yield v267, v267; - } else { - ^block22: - v147 = arith.add v320, v319 : i32 #[overflow = wrapping]; - v148 = hir.bitcast v147 : u32; - v340 = arith.constant 4 : u32; - v150 = arith.mod v148, v340 : u32; - hir.assertz v150 #[code = 250]; - v151 = hir.int_to_ptr v148 : ptr; - v152 = hir.load v151 : felt; - v154 = hir.bitcast v321 : u32; - v339 = arith.constant 4 : u32; - v156 = arith.mod v154, v339 : u32; - hir.assertz v156 #[code = 250]; - v157 = hir.int_to_ptr v154 : ptr; - v158 = hir.load v157 : i32; - v159 = hir.bitcast v147 : u32; - v338 = arith.constant 4 : u32; - v161 = arith.mod v159, v338 : u32; - hir.assertz v161 #[code = 250]; - v162 = hir.int_to_ptr v159 : ptr; - hir.store v162, v158; - v163 = hir.bitcast v321 : u32; - v337 = arith.constant 4 : u32; - v165 = arith.mod v163, v337 : u32; - hir.assertz v165 #[code = 250]; - v166 = hir.int_to_ptr v163 : ptr; - hir.store v166, v152; - v169 = arith.constant -4 : i32; - v170 = arith.add v321, v169 : i32 #[overflow = wrapping]; - v167 = arith.constant 4 : i32; - v168 = arith.add v319, v167 : i32 #[overflow = wrapping]; - scf.yield v168, v170; - }; - v335 = ub.poison i32 : i32; - v310 = cf.select v145, v335, v322 : i32; - v336 = ub.poison i32 : i32; - v309 = cf.select v145, v336, v320 : i32; - v266 = arith.constant 1 : u32; - v259 = arith.constant 0 : u32; - v312 = cf.select v145, v259, v266 : u32; - v300 = arith.trunc v312 : i1; - scf.condition v300, v307, v309, v308, v310, v320, v322; - } do { - ^block40(v323: i32, v324: i32, v325: i32, v326: i32, v327: i32, v328: i32): - scf.yield v323, v324, v325, v326; - }; - v334 = arith.constant 8 : u32; - v172 = hir.bitcast v317 : u32; - v174 = arith.add v172, v334 : u32 #[overflow = checked]; - v333 = arith.constant 4 : u32; - v176 = arith.mod v174, v333 : u32; - hir.assertz v176 #[code = 250]; - v177 = hir.int_to_ptr v174 : ptr; - v178 = hir.load v177 : i64; - v332 = arith.constant 8 : u32; - v179 = hir.bitcast v318 : u32; - v181 = arith.add v179, v332 : u32 #[overflow = checked]; - v331 = arith.constant 8 : u32; - v183 = arith.mod v181, v331 : u32; - hir.assertz v183 #[code = 250]; - v184 = hir.int_to_ptr v181 : ptr; - hir.store v184, v178; - v185 = hir.bitcast v317 : u32; - v330 = arith.constant 4 : u32; - v187 = arith.mod v185, v330 : u32; - hir.assertz v187 #[code = 250]; - v188 = hir.int_to_ptr v185 : ptr; - v189 = hir.load v188 : i64; - v190 = hir.bitcast v318 : u32; - v329 = arith.constant 8 : u32; - v192 = arith.mod v190, v329 : u32; - hir.assertz v192 #[code = 250]; - v193 = hir.int_to_ptr v190 : ptr; - hir.store v193, v189; - builtin.ret ; - }; - - private builtin.function @intrinsics::felt::from_u32(v194: i32) -> felt { - ^block23(v194: i32): - v195 = hir.bitcast v194 : felt; - builtin.ret v195; - }; - - private builtin.function @miden::input_note::get_serial_number(v197: felt, v198: i32) { - ^block25(v197: felt, v198: i32): - v199, v200, v201, v202 = hir.exec @miden/input_note/get_serial_number(v197) : felt, felt, felt, felt - v203 = hir.bitcast v198 : u32; - v204 = hir.int_to_ptr v203 : ptr; - hir.store v204, v199; - v205 = arith.constant 4 : u32; - v206 = arith.add v203, v205 : u32 #[overflow = checked]; - v207 = hir.int_to_ptr v206 : ptr; - hir.store v207, v200; - v208 = arith.constant 8 : u32; - v209 = arith.add v203, v208 : u32 #[overflow = checked]; - v210 = hir.int_to_ptr v209 : ptr; - hir.store v210, v201; - v211 = arith.constant 12 : u32; - v212 = arith.add v203, v211 : u32 #[overflow = checked]; - v213 = hir.int_to_ptr v212 : ptr; - hir.store v213, v202; - builtin.ret ; + private builtin.function @miden::protocol::input_note::get_serial_number(v118: felt, v119: i32) { + ^block17(v118: felt, v119: i32): + ub.unreachable ; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -317,34 +184,34 @@ builtin.component miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-i }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block29: - v214 = hir.exec @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1#binding() : i32 - v215 = arith.constant 0 : i32; - v216 = arith.add v214, v215 : i32 #[overflow = unchecked]; - v349 = arith.constant 0 : i32; - v350 = arith.constant 0 : i32; - v218 = arith.add v216, v350 : i32 #[overflow = unchecked]; - v220 = arith.add v218, v349 : i32 #[overflow = unchecked]; - v221 = hir.int_to_ptr v220 : ptr; - v222 = hir.load v221 : felt; - v348 = arith.constant 0 : i32; - v223 = arith.constant 4 : i32; - v224 = arith.add v216, v223 : i32 #[overflow = unchecked]; - v226 = arith.add v224, v348 : i32 #[overflow = unchecked]; - v227 = hir.int_to_ptr v226 : ptr; - v228 = hir.load v227 : felt; - v347 = arith.constant 0 : i32; - v229 = arith.constant 8 : i32; - v230 = arith.add v216, v229 : i32 #[overflow = unchecked]; - v232 = arith.add v230, v347 : i32 #[overflow = unchecked]; - v233 = hir.int_to_ptr v232 : ptr; - v234 = hir.load v233 : felt; - v346 = arith.constant 0 : i32; - v235 = arith.constant 12 : i32; - v236 = arith.add v216, v235 : i32 #[overflow = unchecked]; - v238 = arith.add v236, v346 : i32 #[overflow = unchecked]; - v239 = hir.int_to_ptr v238 : ptr; - v240 = hir.load v239 : felt; - builtin.ret v222, v228, v234, v240; + ^block19: + v120 = hir.exec @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1#binding() : i32 + v198 = arith.constant 0 : i32; + v122 = arith.add v120, v198 : i32 #[overflow = unchecked]; + v207 = arith.constant 0 : i32; + v208 = arith.constant 0 : i32; + v124 = arith.add v122, v208 : i32 #[overflow = unchecked]; + v126 = arith.add v124, v207 : i32 #[overflow = unchecked]; + v127 = hir.int_to_ptr v126 : ptr; + v128 = hir.load v127 : felt; + v206 = arith.constant 0 : i32; + v197 = arith.constant 4 : i32; + v130 = arith.add v122, v197 : i32 #[overflow = unchecked]; + v132 = arith.add v130, v206 : i32 #[overflow = unchecked]; + v133 = hir.int_to_ptr v132 : ptr; + v134 = hir.load v133 : felt; + v205 = arith.constant 0 : i32; + v196 = arith.constant 8 : i32; + v136 = arith.add v122, v196 : i32 #[overflow = unchecked]; + v138 = arith.add v136, v205 : i32 #[overflow = unchecked]; + v139 = hir.int_to_ptr v138 : ptr; + v140 = hir.load v139 : felt; + v204 = arith.constant 0 : i32; + v195 = arith.constant 12 : i32; + v142 = arith.add v122, v195 : i32 #[overflow = unchecked]; + v144 = arith.add v142, v204 : i32 #[overflow = unchecked]; + v145 = hir.int_to_ptr v144 : ptr; + v146 = hir.load v145 : felt; + builtin.ret v128, v134, v140, v146; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.masm index c7a8e806a..e6ec63c68 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.masm @@ -1,13 +1,13 @@ -# mod miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1 +# mod ::"miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> (felt, felt, felt, felt) - exec.::miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1::init + exec."miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1::rust_sdk_input_note_get_serial_number_binding::miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1#binding + exec.::"miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1"::rust_sdk_input_note_get_serial_number_binding::"miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1#binding" trace.252 nop push.0 @@ -62,7 +62,7 @@ pub proc binding( nop movdn.3 swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -75,7 +75,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -86,7 +86,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1::rust_sdk_input_note_get_serial_number_binding +# mod ::"miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1"::rust_sdk_input_note_get_serial_number_binding @callconv("C") proc __wasm_call_ctors( @@ -102,6 +102,7 @@ proc rust_sdk_input_note_get_serial_number_binding::bindings::__link_custom_sect nop end +@locals("2") @callconv("C") proc miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1#binding( @@ -116,9 +117,16 @@ proc miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -128,19 +136,22 @@ proc miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get nop trace.240 nop - exec.::miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1::rust_sdk_input_note_get_serial_number_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1"::rust_sdk_input_note_get_serial_number_binding::wit_bindgen::rt::run_ctors_once trace.252 nop + locaddr.0 push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1::rust_sdk_input_note_get_serial_number_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop - dup.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1::rust_sdk_input_note_get_serial_number_binding::miden_base_sys::bindings::input_note::get_serial_number + exec.::"miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1"::rust_sdk_input_note_get_serial_number_binding::miden_base_sys::bindings::input_note::get_serial_number trace.252 nop push.1114148 @@ -153,8 +164,25 @@ proc miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get nop push.1048584 u32wrapping_add + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.2 + swap.1 add u32assert push.8 @@ -172,7 +200,7 @@ proc miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get nop swap.1 push.8 - dup.3 + movup.3 add u32assert push.4 @@ -190,7 +218,22 @@ proc miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get exec.::intrinsics::mem::store_dw trace.252 nop - dup.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 dup.1 swap.1 @@ -205,7 +248,7 @@ proc miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get trace.252 nop swap.1 - dup.2 + movup.2 push.4 dup.1 swap.1 @@ -221,8 +264,15 @@ proc miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - movup.2 u32wrapping_add push.1114144 u32divmod.4 @@ -232,8 +282,17 @@ proc miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -275,9 +334,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1"::rust_sdk_input_note_get_serial_number_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1::rust_sdk_input_note_get_serial_number_binding::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -308,149 +383,77 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("3") @callconv("C") proc miden_base_sys::bindings::input_note::get_serial_number( i32, felt ) - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::store_sw trace.252 nop - push.32 - u32wrapping_sub push.1114144 - dup.1 - swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop + push.16 + u32wrapping_sub dup.0 - movup.3 - trace.240 - nop - exec.::miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1::rust_sdk_input_note_get_serial_number_binding::miden::input_note::get_serial_number - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_sw trace.252 nop - swap.1 - push.24 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.1114144 u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop - dup.0 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop swap.1 - push.16 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.16 - dup.1 - u32wrapping_add - movup.2 trace.240 nop - exec.::miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1::rust_sdk_input_note_get_serial_number_binding::::reverse + exec.::"miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1"::rust_sdk_input_note_get_serial_number_binding::"miden::protocol::input_note::get_serial_number" trace.252 nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop -end - -@callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert push.8 dup.1 swap.1 @@ -466,15 +469,17 @@ proc ::reverse( nop swap.1 push.8 - dup.3 + movup.3 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -484,182 +489,24 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.12 - dup.1 - u32wrapping_add + locaddr.2 push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop - swap.1 push.8 - dup.4 + swap.1 add u32assert push.8 @@ -670,21 +517,6 @@ proc ::reverse( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 trace.240 nop exec.::intrinsics::mem::load_dw @@ -698,6 +530,8 @@ proc ::reverse( u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -707,66 +541,32 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc miden::input_note::get_serial_number(felt, i32) - trace.240 - nop - exec.::miden::input_note::get_serial_number - trace.252 - nop - movup.4 - dup.0 - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_sw trace.252 nop - push.12 - add - u32assert + push.16 + u32wrapping_add + push.1114144 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::store_sw trace.252 nop end +@locals("2") +@callconv("C") +proc miden::protocol::input_note::get_serial_number(felt, i32) + drop + drop + push.0 + assert +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.wat index 7b8a4efbf..0ccb77d92 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.wat @@ -13,9 +13,8 @@ (type (;0;) (func)) (type (;1;) (func (result i32))) (type (;2;) (func (param i32 f32))) - (type (;3;) (func (param i32 i32))) - (type (;4;) (func (param i32) (result f32))) - (type (;5;) (func (param f32 i32))) + (type (;3;) (func (param i32) (result f32))) + (type (;4;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -75,97 +74,38 @@ (func $miden_base_sys::bindings::input_note::get_serial_number (;4;) (type 2) (param i32 f32) (local i32) global.get $__stack_pointer - i32.const 32 + i32.const 16 i32.sub local.tee 2 global.set $__stack_pointer local.get 1 local.get 2 - call $miden::input_note::get_serial_number - local.get 2 - local.get 2 - i64.load offset=8 - i64.store offset=24 - local.get 2 - local.get 2 - i64.load - i64.store offset=16 + call $miden::protocol::input_note::get_serial_number local.get 0 local.get 2 - i32.const 16 - i32.add - call $::reverse - local.get 2 - i32.const 32 - i32.add - global.set $__stack_pointer - ) - (func $::reverse (;5;) (type 3) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 + i64.const 32 + i64.rotl i64.store offset=8 local.get 0 local.get 2 - i64.load align=4 + i64.load offset=8 + i64.const 32 + i64.rotl i64.store + local.get 2 + i32.const 16 + i32.add + global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) unreachable ) - (func $miden::input_note::get_serial_number (;7;) (type 5) (param f32 i32) + (func $miden::protocol::input_note::get_serial_number (;6;) (type 4) (param f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "[rust_sdk_input_note_get_serial_number_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "[rust_sdk_input_note_get_serial_number_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.hir index 605781bba..90466f398 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.hir @@ -5,55 +5,1453 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret ; }; + private builtin.function @__rustc::__rust_alloc(v0: i32, v1: i32) -> i32 { + ^block7(v0: i32, v1: i32): + v3 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/GOT.data.internal.__memory_base : ptr + v4 = hir.bitcast v3 : ptr; + v5 = hir.load v4 : i32; + v1020 = arith.constant 1048584 : i32; + v7 = arith.add v5, v1020 : i32 #[overflow = wrapping]; + v10 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::alloc(v7, v1, v0) : i32 + builtin.ret v10; + }; + + private builtin.function @__rustc::__rust_dealloc(v11: i32, v12: i32, v13: i32) { + ^block9(v11: i32, v12: i32, v13: i32): + builtin.ret ; + }; + + private builtin.function @__rustc::__rust_alloc_zeroed(v14: i32, v15: i32) -> i32 { + ^block11(v14: i32, v15: i32): + hir.store_local v14 #[local = lv0]; + hir.store_local v15 #[local = lv1]; + v17 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/GOT.data.internal.__memory_base : ptr + v18 = hir.bitcast v17 : ptr; + v19 = hir.load v18 : i32; + v22 = hir.load_local : i32 #[local = lv1]; + v23 = hir.load_local : i32 #[local = lv0]; + v1024 = arith.constant 1048584 : i32; + v21 = arith.add v19, v1024 : i32 #[overflow = wrapping]; + v24 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::alloc(v21, v22, v23) : i32 + hir.store_local v24 #[local = lv1]; + v1032 = arith.constant 0 : i32; + v1027 = arith.constant 0 : i32; + v26 = arith.eq v24, v1027 : i1; + v27 = arith.zext v26 : u32; + v28 = hir.bitcast v27 : i32; + v30 = arith.neq v28, v1032 : i1; + scf.if v30{ + ^block111: + scf.yield ; + } else { + ^block14: + v31 = hir.load_local : i32 #[local = lv0]; + v1030 = arith.constant 0 : i32; + v1031 = arith.constant 0 : i32; + v33 = arith.eq v31, v1031 : i1; + v34 = arith.zext v33 : u32; + v35 = hir.bitcast v34 : i32; + v37 = arith.neq v35, v1030 : i1; + scf.if v37{ + ^block110: + scf.yield ; + } else { + ^block15: + v38 = hir.load_local : i32 #[local = lv1]; + v40 = hir.load_local : i32 #[local = lv0]; + v1022 = arith.constant 0 : u8; + v42 = hir.bitcast v40 : u32; + v43 = hir.bitcast v38 : u32; + v44 = hir.int_to_ptr v43 : ptr; + hir.mem_set v44, v42, v1022; + scf.yield ; + }; + scf.yield ; + }; + v45 = hir.load_local : i32 #[local = lv1]; + builtin.ret v45; + }; + private builtin.function @rust_sdk_note_add_assets_to_account_binding::bindings::__link_custom_section_describing_imports() { - ^block7: + ^block16: builtin.ret ; }; - private builtin.function @miden:base/note-script@1.0.0#run(v0: felt, v1: felt, v2: felt, v3: felt) { - ^block9(v0: felt, v1: felt, v2: felt, v3: felt): + private builtin.function @miden:base/note-script@1.0.0#run(v46: felt, v47: felt, v48: felt, v49: felt) { + ^block18(v46: felt, v47: felt, v48: felt, v49: felt): hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/wit_bindgen::rt::run_ctors_once() - hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/miden::active_note::add_assets_to_account() + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/miden_base_sys::bindings::active_note::add_assets_to_account() + builtin.ret ; + }; + + private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { + ^block20: builtin.ret ; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { - ^block11: - v5 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/GOT.data.internal.__memory_base : ptr - v6 = hir.bitcast v5 : ptr; - v7 = hir.load v6 : i32; - v8 = arith.constant 1048584 : i32; - v9 = arith.add v7, v8 : i32 #[overflow = wrapping]; - v10 = hir.bitcast v9 : u32; - v11 = hir.int_to_ptr v10 : ptr; - v12 = hir.load v11 : u8; - v4 = arith.constant 0 : i32; - v13 = arith.zext v12 : u32; - v14 = hir.bitcast v13 : i32; - v16 = arith.neq v14, v4 : i1; - scf.if v16{ - ^block13: + ^block22: + v50 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/GOT.data.internal.__memory_base : ptr + v51 = hir.bitcast v50 : ptr; + v52 = hir.load v51 : i32; + v1037 = arith.constant 1048588 : i32; + v54 = arith.add v52, v1037 : i32 #[overflow = wrapping]; + v55 = hir.bitcast v54 : u32; + v56 = hir.int_to_ptr v55 : ptr; + v57 = hir.load v56 : u8; + v1036 = arith.constant 0 : i32; + v58 = arith.zext v57 : u32; + v59 = hir.bitcast v58 : i32; + v61 = arith.neq v59, v1036 : i1; + scf.if v61{ + ^block24: scf.yield ; } else { - ^block14: - v17 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/GOT.data.internal.__memory_base : ptr - v18 = hir.bitcast v17 : ptr; - v19 = hir.load v18 : i32; + ^block25: + v62 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/GOT.data.internal.__memory_base : ptr + v63 = hir.bitcast v62 : ptr; + v64 = hir.load v63 : i32; + hir.store_local v64 #[local = lv0]; hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__wasm_call_ctors() - v32 = arith.constant 1 : u8; - v34 = arith.constant 1048584 : i32; - v21 = arith.add v19, v34 : i32 #[overflow = wrapping]; - v25 = hir.bitcast v21 : u32; - v26 = hir.int_to_ptr v25 : ptr; - hir.store v26, v32; + v65 = hir.load_local : i32 #[local = lv0]; + v1035 = arith.constant 1 : u8; + v1040 = arith.constant 1048588 : i32; + v67 = arith.add v65, v1040 : i32 #[overflow = wrapping]; + v71 = hir.bitcast v67 : u32; + v72 = hir.int_to_ptr v71 : ptr; + hir.store v72, v1035; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden::active_note::add_assets_to_account() { - ^block15: - hir.exec @miden/active_note/add_assets_to_account() + private builtin.function @::alloc(v73: i32, v74: i32, v75: i32) -> i32 { + ^block26(v73: i32, v74: i32, v75: i32): + hir.store_local v73 #[local = lv0]; + hir.store_local v74 #[local = lv1]; + hir.store_local v75 #[local = lv2]; + v77 = hir.load_local : i32 #[local = lv1]; + v1048 = arith.constant 16 : i32; + v1047 = arith.constant 0 : i32; + v1043 = arith.constant 16 : u32; + v81 = hir.bitcast v77 : u32; + v83 = arith.gt v81, v1043 : i1; + v84 = arith.zext v83 : u32; + v85 = hir.bitcast v84 : i32; + v87 = arith.neq v85, v1047 : i1; + v88 = cf.select v87, v77, v1048 : i32; + hir.store_local v88 #[local = lv3]; + v89 = hir.load_local : i32 #[local = lv3]; + v1091 = arith.constant 0 : i32; + v1046 = arith.constant -1 : i32; + v91 = arith.add v89, v1046 : i32 #[overflow = wrapping]; + v92 = arith.band v88, v91 : i32; + v94 = arith.neq v92, v1091 : i1; + v1069, v1070 = scf.if v94 : i32, u32 { + ^block118: + v1061 = arith.constant 0 : u32; + v1065 = ub.poison i32 : i32; + scf.yield v1065, v1061; + } else { + ^block29: + v95 = hir.load_local : i32 #[local = lv2]; + v97 = hir.load_local : i32 #[local = lv1]; + v98 = hir.load_local : i32 #[local = lv3]; + v99 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::max(v97, v98) : i32 + hir.store_local v99 #[local = lv1]; + v1090 = arith.constant 0 : i32; + v1045 = arith.constant -2147483648 : i32; + v100 = arith.sub v1045, v99 : i32 #[overflow = wrapping]; + v102 = hir.bitcast v100 : u32; + v101 = hir.bitcast v95 : u32; + v103 = arith.gt v101, v102 : i1; + v104 = arith.zext v103 : u32; + v105 = hir.bitcast v104 : i32; + v107 = arith.neq v105, v1090 : i1; + v1075 = scf.if v107 : i32 { + ^block117: + v1089 = ub.poison i32 : i32; + scf.yield v1089; + } else { + ^block30: + v1088 = arith.constant 0 : i32; + hir.store_local v1088 #[local = lv3]; + v109 = hir.load_local : i32 #[local = lv2]; + v110 = hir.load_local : i32 #[local = lv1]; + v1086 = arith.constant 0 : i32; + v116 = arith.sub v1086, v110 : i32 #[overflow = wrapping]; + v1087 = arith.constant -1 : i32; + v111 = arith.add v109, v110 : i32 #[overflow = wrapping]; + v113 = arith.add v111, v1087 : i32 #[overflow = wrapping]; + v117 = arith.band v113, v116 : i32; + hir.store_local v117 #[local = lv2]; + v118 = hir.load_local : i32 #[local = lv0]; + v119 = hir.bitcast v118 : u32; + v1044 = arith.constant 4 : u32; + v121 = arith.mod v119, v1044 : u32; + hir.assertz v121 #[code = 250]; + v122 = hir.int_to_ptr v119 : ptr; + v123 = hir.load v122 : i32; + v1085 = arith.constant 0 : i32; + v125 = arith.neq v123, v1085 : i1; + scf.if v125{ + ^block116: + scf.yield ; + } else { + ^block32: + v126 = hir.load_local : i32 #[local = lv0]; + v127 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/intrinsics::mem::heap_base() : i32 + v128 = hir.mem_size : u32; + v134 = hir.bitcast v126 : u32; + v1084 = arith.constant 4 : u32; + v136 = arith.mod v134, v1084 : u32; + hir.assertz v136 #[code = 250]; + v1083 = arith.constant 16 : u32; + v129 = hir.bitcast v128 : i32; + v132 = arith.shl v129, v1083 : i32; + v133 = arith.add v127, v132 : i32 #[overflow = wrapping]; + v137 = hir.int_to_ptr v134 : ptr; + hir.store v137, v133; + scf.yield ; + }; + v138 = hir.load_local : i32 #[local = lv2]; + v139 = hir.load_local : i32 #[local = lv0]; + v140 = hir.bitcast v139 : u32; + v1082 = arith.constant 4 : u32; + v142 = arith.mod v140, v1082 : u32; + hir.assertz v142 #[code = 250]; + v143 = hir.int_to_ptr v140 : ptr; + v144 = hir.load v143 : i32; + hir.store_local v144 #[local = lv4]; + v1080 = arith.constant 0 : i32; + v1081 = arith.constant -1 : i32; + v146 = arith.bxor v144, v1081 : i32; + v148 = hir.bitcast v146 : u32; + v147 = hir.bitcast v138 : u32; + v149 = arith.gt v147, v148 : i1; + v150 = arith.zext v149 : u32; + v151 = hir.bitcast v150 : i32; + v153 = arith.neq v151, v1080 : i1; + scf.if v153{ + ^block115: + scf.yield ; + } else { + ^block34: + v154 = hir.load_local : i32 #[local = lv0]; + v155 = hir.load_local : i32 #[local = lv4]; + v156 = hir.load_local : i32 #[local = lv2]; + v158 = hir.bitcast v154 : u32; + v1079 = arith.constant 4 : u32; + v160 = arith.mod v158, v1079 : u32; + hir.assertz v160 #[code = 250]; + v157 = arith.add v155, v156 : i32 #[overflow = wrapping]; + v161 = hir.int_to_ptr v158 : ptr; + hir.store v161, v157; + v162 = hir.load_local : i32 #[local = lv4]; + v163 = hir.load_local : i32 #[local = lv1]; + v164 = arith.add v162, v163 : i32 #[overflow = wrapping]; + hir.store_local v164 #[local = lv3]; + scf.yield ; + }; + v165 = hir.load_local : i32 #[local = lv3]; + scf.yield v165; + }; + v1066 = arith.constant 1 : u32; + v1078 = arith.constant 0 : u32; + v1076 = cf.select v107, v1078, v1066 : u32; + scf.yield v1075, v1076; + }; + v1077 = arith.constant 0 : u32; + v1074 = arith.eq v1070, v1077 : i1; + cf.cond_br v1074 ^block28, ^block120(v1069); + ^block28: + ub.unreachable ; + ^block120(v1062: i32): + builtin.ret v1062; + }; + + private builtin.function @intrinsics::mem::heap_base() -> i32 { + ^block35: + v166 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v166; + }; + + private builtin.function @>::with_capacity(v168: i32) { + ^block39(v168: i32): + hir.store_local v168 #[local = lv0]; + v169 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v170 = hir.bitcast v169 : ptr; + v171 = hir.load v170 : i32; + v1097 = arith.constant 16 : i32; + v173 = arith.sub v171, v1097 : i32 #[overflow = wrapping]; + hir.store_local v173 #[local = lv1]; + v174 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v175 = hir.bitcast v174 : ptr; + hir.store v175, v173; + v176 = hir.load_local : i32 #[local = lv1]; + v1107 = arith.constant 16 : i32; + v1095 = arith.constant 256 : i32; + v1096 = arith.constant 8 : i32; + v178 = arith.add v176, v1096 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::with_capacity_in(v178, v1095, v1107, v1107) + v182 = hir.load_local : i32 #[local = lv1]; + v1094 = arith.constant 8 : u32; + v183 = hir.bitcast v182 : u32; + v185 = arith.add v183, v1094 : u32 #[overflow = checked]; + v1106 = arith.constant 8 : u32; + v187 = arith.mod v185, v1106 : u32; + hir.assertz v187 #[code = 250]; + v188 = hir.int_to_ptr v185 : ptr; + v189 = hir.load v188 : i64; + v190 = hir.load_local : i32 #[local = lv0]; + v1105 = arith.constant 8 : u32; + v192 = hir.bitcast v190 : u32; + v194 = arith.add v192, v1105 : u32 #[overflow = checked]; + v1092 = arith.constant 4 : u32; + v196 = arith.mod v194, v1092 : u32; + hir.assertz v196 #[code = 250]; + v1093 = arith.constant 0 : i32; + v197 = hir.int_to_ptr v194 : ptr; + hir.store v197, v1093; + v198 = hir.load_local : i32 #[local = lv0]; + v200 = hir.bitcast v198 : u32; + v1104 = arith.constant 4 : u32; + v202 = arith.mod v200, v1104 : u32; + hir.assertz v202 #[code = 250]; + v203 = hir.int_to_ptr v200 : ptr; + hir.store v203, v189; + v204 = hir.load_local : i32 #[local = lv1]; + v1103 = arith.constant 16 : i32; + v206 = arith.add v204, v1103 : i32 #[overflow = wrapping]; + v207 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v208 = hir.bitcast v207 : ptr; + hir.store v208, v206; + builtin.ret ; + }; + + private builtin.function @::with_capacity_in(v209: i32, v210: i32, v211: i32, v212: i32) { + ^block41(v209: i32, v210: i32, v211: i32, v212: i32): + hir.store_local v209 #[local = lv0]; + hir.store_local v212 #[local = lv3]; + v213 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v214 = hir.bitcast v213 : ptr; + v215 = hir.load v214 : i32; + v1114 = arith.constant 16 : i32; + v217 = arith.sub v215, v1114 : i32 #[overflow = wrapping]; + hir.store_local v217 #[local = lv4]; + v218 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v219 = hir.bitcast v218 : ptr; + hir.store v219, v217; + v220 = hir.load_local : i32 #[local = lv4]; + v226 = hir.load_local : i32 #[local = lv3]; + v1112 = arith.constant 0 : i32; + v1113 = arith.constant 4 : i32; + v222 = arith.add v220, v1113 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::try_allocate_in(v222, v210, v1112, v211, v226) + v227 = hir.load_local : i32 #[local = lv4]; + v1111 = arith.constant 8 : u32; + v228 = hir.bitcast v227 : u32; + v230 = arith.add v228, v1111 : u32 #[overflow = checked]; + v1110 = arith.constant 4 : u32; + v232 = arith.mod v230, v1110 : u32; + hir.assertz v232 #[code = 250]; + v233 = hir.int_to_ptr v230 : ptr; + v234 = hir.load v233 : i32; + hir.store_local v234 #[local = lv3]; + v235 = hir.load_local : i32 #[local = lv4]; + v1135 = arith.constant 4 : u32; + v236 = hir.bitcast v235 : u32; + v238 = arith.add v236, v1135 : u32 #[overflow = checked]; + v1134 = arith.constant 4 : u32; + v240 = arith.mod v238, v1134 : u32; + hir.assertz v240 #[code = 250]; + v241 = hir.int_to_ptr v238 : ptr; + v242 = hir.load v241 : i32; + v1133 = arith.constant 0 : i32; + v1109 = arith.constant 1 : i32; + v244 = arith.neq v242, v1109 : i1; + v245 = arith.zext v244 : u32; + v246 = hir.bitcast v245 : i32; + v248 = arith.neq v246, v1133 : i1; + cf.cond_br v248 ^block43, ^block44; + ^block43: + v258 = hir.load_local : i32 #[local = lv0]; + v259 = hir.load_local : i32 #[local = lv4]; + v1108 = arith.constant 12 : u32; + v260 = hir.bitcast v259 : u32; + v262 = arith.add v260, v1108 : u32 #[overflow = checked]; + v1132 = arith.constant 4 : u32; + v264 = arith.mod v262, v1132 : u32; + hir.assertz v264 #[code = 250]; + v265 = hir.int_to_ptr v262 : ptr; + v266 = hir.load v265 : i32; + v1131 = arith.constant 4 : u32; + v267 = hir.bitcast v258 : u32; + v269 = arith.add v267, v1131 : u32 #[overflow = checked]; + v1130 = arith.constant 4 : u32; + v271 = arith.mod v269, v1130 : u32; + hir.assertz v271 #[code = 250]; + v272 = hir.int_to_ptr v269 : ptr; + hir.store v272, v266; + v273 = hir.load_local : i32 #[local = lv0]; + v274 = hir.load_local : i32 #[local = lv3]; + v275 = hir.bitcast v273 : u32; + v1129 = arith.constant 4 : u32; + v277 = arith.mod v275, v1129 : u32; + hir.assertz v277 #[code = 250]; + v278 = hir.int_to_ptr v275 : ptr; + hir.store v278, v274; + v279 = hir.load_local : i32 #[local = lv4]; + v1128 = arith.constant 16 : i32; + v281 = arith.add v279, v1128 : i32 #[overflow = wrapping]; + v282 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v283 = hir.bitcast v282 : ptr; + hir.store v283, v281; + builtin.ret ; + ^block44: + v249 = hir.load_local : i32 #[local = lv3]; + v250 = hir.load_local : i32 #[local = lv4]; + v1127 = arith.constant 12 : u32; + v251 = hir.bitcast v250 : u32; + v253 = arith.add v251, v1127 : u32 #[overflow = checked]; + v1126 = arith.constant 4 : u32; + v255 = arith.mod v253, v1126 : u32; + hir.assertz v255 #[code = 250]; + v256 = hir.int_to_ptr v253 : ptr; + v257 = hir.load v256 : i32; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/alloc::raw_vec::handle_error(v249, v257) + ub.unreachable ; + }; + + private builtin.function @miden_base_sys::bindings::active_note::get_assets(v284: i32) { + ^block45(v284: i32): + hir.store_local v284 #[local = lv0]; + v285 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v286 = hir.bitcast v285 : ptr; + v287 = hir.load v286 : i32; + v1142 = arith.constant 16 : i32; + v289 = arith.sub v287, v1142 : i32 #[overflow = wrapping]; + hir.store_local v289 #[local = lv1]; + v290 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v291 = hir.bitcast v290 : ptr; + hir.store v291, v289; + v292 = hir.load_local : i32 #[local = lv1]; + v1141 = arith.constant 4 : i32; + v294 = arith.add v292, v1141 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/>::with_capacity(v294) + v295 = hir.load_local : i32 #[local = lv0]; + v298 = hir.load_local : i32 #[local = lv1]; + v1139 = arith.constant 8 : u32; + v299 = hir.bitcast v298 : u32; + v301 = arith.add v299, v1139 : u32 #[overflow = checked]; + v1138 = arith.constant 4 : u32; + v303 = arith.mod v301, v1138 : u32; + hir.assertz v303 #[code = 250]; + v304 = hir.int_to_ptr v301 : ptr; + v305 = hir.load v304 : i32; + v1137 = arith.constant 2 : u32; + v307 = hir.bitcast v305 : u32; + v309 = arith.shr v307, v1137 : u32; + v310 = hir.bitcast v309 : i32; + v311 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/miden::protocol::active_note::get_assets(v310) : i32 + v1140 = arith.constant 8 : i32; + v297 = arith.add v295, v1140 : i32 #[overflow = wrapping]; + v312 = hir.bitcast v297 : u32; + v1152 = arith.constant 4 : u32; + v314 = arith.mod v312, v1152 : u32; + hir.assertz v314 #[code = 250]; + v315 = hir.int_to_ptr v312 : ptr; + hir.store v315, v311; + v316 = hir.load_local : i32 #[local = lv0]; + v317 = hir.load_local : i32 #[local = lv1]; + v1151 = arith.constant 4 : u32; + v318 = hir.bitcast v317 : u32; + v320 = arith.add v318, v1151 : u32 #[overflow = checked]; + v1150 = arith.constant 4 : u32; + v322 = arith.mod v320, v1150 : u32; + hir.assertz v322 #[code = 250]; + v323 = hir.int_to_ptr v320 : ptr; + v324 = hir.load v323 : i64; + v325 = hir.bitcast v316 : u32; + v1149 = arith.constant 4 : u32; + v327 = arith.mod v325, v1149 : u32; + hir.assertz v327 #[code = 250]; + v328 = hir.int_to_ptr v325 : ptr; + hir.store v328, v324; + v329 = hir.load_local : i32 #[local = lv1]; + v1148 = arith.constant 16 : i32; + v331 = arith.add v329, v1148 : i32 #[overflow = wrapping]; + v332 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v333 = hir.bitcast v332 : ptr; + hir.store v333, v331; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::active_note::add_assets_to_account() { + ^block47: + v334 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v335 = hir.bitcast v334 : ptr; + v336 = hir.load v335 : i32; + v1167 = arith.constant 48 : i32; + v338 = arith.sub v336, v1167 : i32 #[overflow = wrapping]; + hir.store_local v338 #[local = lv0]; + v339 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v340 = hir.bitcast v339 : ptr; + hir.store v340, v338; + v341 = hir.load_local : i32 #[local = lv0]; + v1166 = arith.constant 32 : i32; + v343 = arith.add v341, v1166 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/miden_base_sys::bindings::active_note::get_assets(v343) + v344 = hir.load_local : i32 #[local = lv0]; + v1165 = arith.constant 32 : u32; + v345 = hir.bitcast v344 : u32; + v347 = arith.add v345, v1165 : u32 #[overflow = checked]; + v1164 = arith.constant 4 : u32; + v349 = arith.mod v347, v1164 : u32; + hir.assertz v349 #[code = 250]; + v350 = hir.int_to_ptr v347 : ptr; + v351 = hir.load v350 : i32; + hir.store_local v351 #[local = lv1]; + v352 = hir.load_local : i32 #[local = lv0]; + v1163 = arith.constant 36 : u32; + v354 = hir.bitcast v352 : u32; + v356 = arith.add v354, v1163 : u32 #[overflow = checked]; + v1212 = arith.constant 4 : u32; + v358 = arith.mod v356, v1212 : u32; + hir.assertz v358 #[code = 250]; + v359 = hir.int_to_ptr v356 : ptr; + v360 = hir.load v359 : i32; + hir.store_local v360 #[local = lv2]; + v361 = hir.load_local : i32 #[local = lv0]; + v1162 = arith.constant 40 : u32; + v362 = hir.bitcast v361 : u32; + v364 = arith.add v362, v1162 : u32 #[overflow = checked]; + v1211 = arith.constant 4 : u32; + v366 = arith.mod v364, v1211 : u32; + hir.assertz v366 #[code = 250]; + v367 = hir.int_to_ptr v364 : ptr; + v368 = hir.load v367 : i32; + v1210 = arith.constant 4 : u32; + v371 = arith.shl v368, v1210 : i32; + hir.store_local v371 #[local = lv3]; + v1161 = arith.constant 12 : u32; + v373 = hir.bitcast v352 : u32; + v375 = arith.add v373, v1161 : u32 #[overflow = checked]; + v1209 = arith.constant 4 : u32; + v377 = arith.mod v375, v1209 : u32; + hir.assertz v377 #[code = 250]; + v372 = arith.add v360, v371 : i32 #[overflow = wrapping]; + v378 = hir.int_to_ptr v375 : ptr; + hir.store v378, v372; + v379 = hir.load_local : i32 #[local = lv0]; + v380 = hir.load_local : i32 #[local = lv1]; + v1160 = arith.constant 8 : u32; + v381 = hir.bitcast v379 : u32; + v383 = arith.add v381, v1160 : u32 #[overflow = checked]; + v1208 = arith.constant 4 : u32; + v385 = arith.mod v383, v1208 : u32; + hir.assertz v385 #[code = 250]; + v386 = hir.int_to_ptr v383 : ptr; + hir.store v386, v380; + v387 = hir.load_local : i32 #[local = lv0]; + v388 = hir.load_local : i32 #[local = lv2]; + v1207 = arith.constant 4 : u32; + v389 = hir.bitcast v387 : u32; + v391 = arith.add v389, v1207 : u32 #[overflow = checked]; + v1206 = arith.constant 4 : u32; + v393 = arith.mod v391, v1206 : u32; + hir.assertz v393 #[code = 250]; + v394 = hir.int_to_ptr v391 : ptr; + hir.store v394, v388; + v395 = hir.load_local : i32 #[local = lv0]; + v396 = hir.load_local : i32 #[local = lv2]; + v397 = hir.bitcast v395 : u32; + v1205 = arith.constant 4 : u32; + v399 = arith.mod v397, v1205 : u32; + hir.assertz v399 #[code = 250]; + v400 = hir.int_to_ptr v397 : ptr; + hir.store v400, v396; + scf.while { + ^block50: + v401 = hir.load_local : i32 #[local = lv3]; + v1204 = arith.constant 0 : i32; + v1176 = arith.constant 0 : i32; + v403 = arith.eq v401, v1176 : i1; + v404 = arith.zext v403 : u32; + v405 = hir.bitcast v404 : i32; + v407 = arith.neq v405, v1204 : i1; + scf.if v407{ + ^block131: + scf.yield ; + } else { + ^block52: + v408 = hir.load_local : i32 #[local = lv0]; + v409 = hir.load_local : i32 #[local = lv2]; + v1158 = arith.constant 16 : i32; + v411 = arith.add v409, v1158 : i32 #[overflow = wrapping]; + hir.store_local v411 #[local = lv1]; + v1203 = arith.constant 4 : u32; + v412 = hir.bitcast v408 : u32; + v414 = arith.add v412, v1203 : u32 #[overflow = checked]; + v1202 = arith.constant 4 : u32; + v416 = arith.mod v414, v1202 : u32; + hir.assertz v416 #[code = 250]; + v417 = hir.int_to_ptr v414 : ptr; + hir.store v417, v411; + v418 = hir.load_local : i32 #[local = lv0]; + v419 = hir.load_local : i32 #[local = lv2]; + v420 = hir.bitcast v419 : u32; + v1201 = arith.constant 8 : u32; + v422 = arith.mod v420, v1201 : u32; + hir.assertz v422 #[code = 250]; + v423 = hir.int_to_ptr v420 : ptr; + v424 = hir.load v423 : i64; + v1157 = arith.constant 16 : u32; + v425 = hir.bitcast v418 : u32; + v427 = arith.add v425, v1157 : u32 #[overflow = checked]; + v1200 = arith.constant 8 : u32; + v429 = arith.mod v427, v1200 : u32; + hir.assertz v429 #[code = 250]; + v430 = hir.int_to_ptr v427 : ptr; + hir.store v430, v424; + v431 = hir.load_local : i32 #[local = lv0]; + v432 = hir.load_local : i32 #[local = lv2]; + v1156 = arith.constant 8 : i32; + v434 = arith.add v432, v1156 : i32 #[overflow = wrapping]; + v435 = hir.bitcast v434 : u32; + v1199 = arith.constant 8 : u32; + v437 = arith.mod v435, v1199 : u32; + hir.assertz v437 #[code = 250]; + v438 = hir.int_to_ptr v435 : ptr; + v439 = hir.load v438 : i64; + v1155 = arith.constant 24 : u32; + v440 = hir.bitcast v431 : u32; + v442 = arith.add v440, v1155 : u32 #[overflow = checked]; + v1198 = arith.constant 8 : u32; + v444 = arith.mod v442, v1198 : u32; + hir.assertz v444 #[code = 250]; + v445 = hir.int_to_ptr v442 : ptr; + hir.store v445, v439; + v446 = hir.load_local : i32 #[local = lv3]; + v1154 = arith.constant -16 : i32; + v448 = arith.add v446, v1154 : i32 #[overflow = wrapping]; + hir.store_local v448 #[local = lv3]; + v449 = hir.load_local : i32 #[local = lv0]; + v1196 = arith.constant 16 : i32; + v454 = arith.add v449, v1196 : i32 #[overflow = wrapping]; + v1197 = arith.constant 32 : i32; + v451 = arith.add v449, v1197 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/miden_base_sys::bindings::native_account::add_asset(v451, v454) + v455 = hir.load_local : i32 #[local = lv1]; + hir.store_local v455 #[local = lv2]; + scf.yield ; + }; + v1189 = arith.constant 1 : u32; + v1186 = arith.constant 0 : u32; + v1194 = cf.select v407, v1186, v1189 : u32; + v1190 = arith.trunc v1194 : i1; + scf.condition v1190; + } do { + ^block130: + scf.yield ; + }; + v456 = hir.load_local : i32 #[local = lv0]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/ as core::ops::drop::Drop>::drop(v456) + v457 = hir.load_local : i32 #[local = lv0]; + v1195 = arith.constant 48 : i32; + v459 = arith.add v457, v1195 : i32 #[overflow = wrapping]; + v460 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v461 = hir.bitcast v460 : ptr; + hir.store v461, v459; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::native_account::add_asset(v462: i32, v463: i32) { + ^block53(v462: i32, v463: i32): + hir.store_local v462 #[local = lv0]; + hir.store_local v463 #[local = lv1]; + v464 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v465 = hir.bitcast v464 : ptr; + v466 = hir.load v465 : i32; + v1222 = arith.constant 16 : i32; + v468 = arith.sub v466, v1222 : i32 #[overflow = wrapping]; + hir.store_local v468 #[local = lv2]; + v469 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v470 = hir.bitcast v469 : ptr; + hir.store v470, v468; + v471 = hir.load_local : i32 #[local = lv1]; + v1221 = arith.constant 12 : u32; + v472 = hir.bitcast v471 : u32; + v474 = arith.add v472, v1221 : u32 #[overflow = checked]; + v1220 = arith.constant 4 : u32; + v476 = arith.mod v474, v1220 : u32; + hir.assertz v476 #[code = 250]; + v477 = hir.int_to_ptr v474 : ptr; + v478 = hir.load v477 : felt; + v479 = hir.load_local : i32 #[local = lv1]; + v1219 = arith.constant 8 : u32; + v480 = hir.bitcast v479 : u32; + v482 = arith.add v480, v1219 : u32 #[overflow = checked]; + v1244 = arith.constant 4 : u32; + v484 = arith.mod v482, v1244 : u32; + hir.assertz v484 #[code = 250]; + v485 = hir.int_to_ptr v482 : ptr; + v486 = hir.load v485 : felt; + v487 = hir.load_local : i32 #[local = lv1]; + v1243 = arith.constant 4 : u32; + v488 = hir.bitcast v487 : u32; + v490 = arith.add v488, v1243 : u32 #[overflow = checked]; + v1242 = arith.constant 4 : u32; + v492 = arith.mod v490, v1242 : u32; + hir.assertz v492 #[code = 250]; + v493 = hir.int_to_ptr v490 : ptr; + v494 = hir.load v493 : felt; + v495 = hir.load_local : i32 #[local = lv1]; + v496 = hir.bitcast v495 : u32; + v1241 = arith.constant 4 : u32; + v498 = arith.mod v496, v1241 : u32; + hir.assertz v498 #[code = 250]; + v499 = hir.int_to_ptr v496 : ptr; + v500 = hir.load v499 : felt; + v501 = hir.load_local : i32 #[local = lv2]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/miden::protocol::native_account::add_asset(v478, v486, v494, v500, v501) + v502 = hir.load_local : i32 #[local = lv0]; + v503 = hir.load_local : i32 #[local = lv2]; + v504 = hir.bitcast v503 : u32; + v1240 = arith.constant 8 : u32; + v506 = arith.mod v504, v1240 : u32; + hir.assertz v506 #[code = 250]; + v507 = hir.int_to_ptr v504 : ptr; + v508 = hir.load v507 : i64; + v1216, v1217 = arith.split v508 : felt, felt; + v1239 = arith.constant 8 : u32; + v512 = hir.bitcast v502 : u32; + v514 = arith.add v512, v1239 : u32 #[overflow = checked]; + v1238 = arith.constant 8 : u32; + v516 = arith.mod v514, v1238 : u32; + hir.assertz v516 #[code = 250]; + v1218 = arith.join v1217, v1216 : i64; + v517 = hir.int_to_ptr v514 : ptr; + hir.store v517, v1218; + v518 = hir.load_local : i32 #[local = lv0]; + v519 = hir.load_local : i32 #[local = lv2]; + v1237 = arith.constant 8 : u32; + v520 = hir.bitcast v519 : u32; + v522 = arith.add v520, v1237 : u32 #[overflow = checked]; + v1236 = arith.constant 8 : u32; + v524 = arith.mod v522, v1236 : u32; + hir.assertz v524 #[code = 250]; + v525 = hir.int_to_ptr v522 : ptr; + v526 = hir.load v525 : i64; + v1213, v1214 = arith.split v526 : felt, felt; + v530 = hir.bitcast v518 : u32; + v1235 = arith.constant 8 : u32; + v532 = arith.mod v530, v1235 : u32; + hir.assertz v532 #[code = 250]; + v1215 = arith.join v1214, v1213 : i64; + v533 = hir.int_to_ptr v530 : ptr; + hir.store v533, v1215; + v534 = hir.load_local : i32 #[local = lv2]; + v1234 = arith.constant 16 : i32; + v536 = arith.add v534, v1234 : i32 #[overflow = wrapping]; + v537 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v538 = hir.bitcast v537 : ptr; + hir.store v538, v536; + builtin.ret ; + }; + + private builtin.function @ as core::ops::drop::Drop>::drop(v539: i32) { + ^block55(v539: i32): + v540 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v541 = hir.bitcast v540 : ptr; + v542 = hir.load v541 : i32; + v1248 = arith.constant 16 : i32; + v544 = arith.sub v542, v1248 : i32 #[overflow = wrapping]; + hir.store_local v544 #[local = lv1]; + v545 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v546 = hir.bitcast v545 : ptr; + hir.store v546, v544; + v547 = hir.load_local : i32 #[local = lv1]; + v1247 = arith.constant 12 : u32; + v549 = hir.bitcast v547 : u32; + v551 = arith.add v549, v1247 : u32 #[overflow = checked]; + v1246 = arith.constant 4 : u32; + v553 = arith.mod v551, v1246 : u32; + hir.assertz v553 #[code = 250]; + v554 = hir.int_to_ptr v551 : ptr; + hir.store v554, v539; + v555 = hir.load_local : i32 #[local = lv1]; + v1245 = arith.constant 12 : i32; + v557 = arith.add v555, v1245 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/< as core::ops::drop::Drop>::drop::DropGuard as core::ops::drop::Drop>::drop(v557) + v558 = hir.load_local : i32 #[local = lv1]; + v1250 = arith.constant 16 : i32; + v560 = arith.add v558, v1250 : i32 #[overflow = wrapping]; + v561 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v562 = hir.bitcast v561 : ptr; + hir.store v562, v560; + builtin.ret ; + }; + + private builtin.function @< as core::ops::drop::Drop>::drop::DropGuard as core::ops::drop::Drop>::drop(v563: i32) { + ^block57(v563: i32): + hir.store_local v563 #[local = lv0]; + v564 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v565 = hir.bitcast v564 : ptr; + v566 = hir.load v565 : i32; + v1255 = arith.constant 16 : i32; + v568 = arith.sub v566, v1255 : i32 #[overflow = wrapping]; + hir.store_local v568 #[local = lv1]; + v569 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v570 = hir.bitcast v569 : ptr; + hir.store v570, v568; + v571 = hir.load_local : i32 #[local = lv1]; + v572 = hir.load_local : i32 #[local = lv0]; + v573 = hir.bitcast v572 : u32; + v1254 = arith.constant 4 : u32; + v575 = arith.mod v573, v1254 : u32; + hir.assertz v575 #[code = 250]; + v576 = hir.int_to_ptr v573 : ptr; + v577 = hir.load v576 : i32; + hir.store_local v577 #[local = lv0]; + v578 = hir.bitcast v577 : u32; + v1267 = arith.constant 4 : u32; + v580 = arith.mod v578, v1267 : u32; + hir.assertz v580 #[code = 250]; + v581 = hir.int_to_ptr v578 : ptr; + v582 = hir.load v581 : i32; + v1253 = arith.constant 12 : u32; + v583 = hir.bitcast v571 : u32; + v585 = arith.add v583, v1253 : u32 #[overflow = checked]; + v1266 = arith.constant 4 : u32; + v587 = arith.mod v585, v1266 : u32; + hir.assertz v587 #[code = 250]; + v588 = hir.int_to_ptr v585 : ptr; + hir.store v588, v582; + v589 = hir.load_local : i32 #[local = lv1]; + v590 = hir.load_local : i32 #[local = lv0]; + v1252 = arith.constant 8 : u32; + v591 = hir.bitcast v590 : u32; + v593 = arith.add v591, v1252 : u32 #[overflow = checked]; + v1265 = arith.constant 4 : u32; + v595 = arith.mod v593, v1265 : u32; + hir.assertz v595 #[code = 250]; + v596 = hir.int_to_ptr v593 : ptr; + v597 = hir.load v596 : i32; + v1264 = arith.constant 8 : u32; + v598 = hir.bitcast v589 : u32; + v600 = arith.add v598, v1264 : u32 #[overflow = checked]; + v1263 = arith.constant 4 : u32; + v602 = arith.mod v600, v1263 : u32; + hir.assertz v602 #[code = 250]; + v603 = hir.int_to_ptr v600 : ptr; + hir.store v603, v597; + v604 = hir.load_local : i32 #[local = lv1]; + v1251 = arith.constant 8 : i32; + v606 = arith.add v604, v1251 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/ as core::ops::drop::Drop>::drop(v606) + v607 = hir.load_local : i32 #[local = lv1]; + v1262 = arith.constant 16 : i32; + v609 = arith.add v607, v1262 : i32 #[overflow = wrapping]; + v610 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v611 = hir.bitcast v610 : ptr; + hir.store v611, v609; + builtin.ret ; + }; + + private builtin.function @ as core::ops::drop::Drop>::drop(v612: i32) { + ^block59(v612: i32): + v1268 = arith.constant 16 : i32; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::deallocate(v612, v1268, v1268) + builtin.ret ; + }; + + private builtin.function @::alloc_impl(v616: i32, v617: i32, v618: i32, v619: i32) { + ^block61(v616: i32, v617: i32, v618: i32, v619: i32): + hir.store_local v616 #[local = lv0]; + hir.store_local v617 #[local = lv1]; + hir.store_local v618 #[local = lv2]; + hir.store_local v619 #[local = lv3]; + v620 = hir.load_local : i32 #[local = lv2]; + v1279 = arith.constant 0 : i32; + v1274 = arith.constant 0 : i32; + v622 = arith.eq v620, v1274 : i1; + v623 = arith.zext v622 : u32; + v624 = hir.bitcast v623 : i32; + v626 = arith.neq v624, v1279 : i1; + scf.if v626{ + ^block132: + scf.yield ; + } else { + ^block64: + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__rustc::__rust_no_alloc_shim_is_unstable_v2() + v627 = hir.load_local : i32 #[local = lv3]; + v1278 = arith.constant 0 : i32; + v629 = arith.neq v627, v1278 : i1; + scf.if v629{ + ^block65: + v633 = hir.load_local : i32 #[local = lv2]; + v634 = hir.load_local : i32 #[local = lv1]; + v635 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__rustc::__rust_alloc_zeroed(v633, v634) : i32 + hir.store_local v635 #[local = lv1]; + scf.yield ; + } else { + ^block66: + v630 = hir.load_local : i32 #[local = lv2]; + v631 = hir.load_local : i32 #[local = lv1]; + v632 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__rustc::__rust_alloc(v630, v631) : i32 + hir.store_local v632 #[local = lv1]; + scf.yield ; + }; + scf.yield ; + }; + v636 = hir.load_local : i32 #[local = lv0]; + v637 = hir.load_local : i32 #[local = lv2]; + v1269 = arith.constant 4 : u32; + v638 = hir.bitcast v636 : u32; + v640 = arith.add v638, v1269 : u32 #[overflow = checked]; + v1277 = arith.constant 4 : u32; + v642 = arith.mod v640, v1277 : u32; + hir.assertz v642 #[code = 250]; + v643 = hir.int_to_ptr v640 : ptr; + hir.store v643, v637; + v644 = hir.load_local : i32 #[local = lv0]; + v645 = hir.load_local : i32 #[local = lv1]; + v646 = hir.bitcast v644 : u32; + v1276 = arith.constant 4 : u32; + v648 = arith.mod v646, v1276 : u32; + hir.assertz v648 #[code = 250]; + v649 = hir.int_to_ptr v646 : ptr; + hir.store v649, v645; + builtin.ret ; + }; + + private builtin.function @::deallocate(v650: i32, v651: i32, v652: i32) { + ^block67(v650: i32, v651: i32, v652: i32): + hir.store_local v652 #[local = lv2]; + v653 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v654 = hir.bitcast v653 : ptr; + v655 = hir.load v654 : i32; + v1285 = arith.constant 16 : i32; + v657 = arith.sub v655, v1285 : i32 #[overflow = wrapping]; + hir.store_local v657 #[local = lv3]; + v658 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v659 = hir.bitcast v658 : ptr; + hir.store v659, v657; + v660 = hir.load_local : i32 #[local = lv3]; + v665 = hir.load_local : i32 #[local = lv2]; + v1284 = arith.constant 4 : i32; + v662 = arith.add v660, v1284 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::current_memory(v662, v650, v651, v665) + v666 = hir.load_local : i32 #[local = lv3]; + v1283 = arith.constant 8 : u32; + v667 = hir.bitcast v666 : u32; + v669 = arith.add v667, v1283 : u32 #[overflow = checked]; + v1282 = arith.constant 4 : u32; + v671 = arith.mod v669, v1282 : u32; + hir.assertz v671 #[code = 250]; + v672 = hir.int_to_ptr v669 : ptr; + v673 = hir.load v672 : i32; + hir.store_local v673 #[local = lv2]; + v1296 = arith.constant 0 : i32; + v1290 = arith.constant 0 : i32; + v675 = arith.eq v673, v1290 : i1; + v676 = arith.zext v675 : u32; + v677 = hir.bitcast v676 : i32; + v679 = arith.neq v677, v1296 : i1; + scf.if v679{ + ^block135: + scf.yield ; + } else { + ^block70: + v680 = hir.load_local : i32 #[local = lv3]; + v1295 = arith.constant 4 : u32; + v681 = hir.bitcast v680 : u32; + v683 = arith.add v681, v1295 : u32 #[overflow = checked]; + v1294 = arith.constant 4 : u32; + v685 = arith.mod v683, v1294 : u32; + hir.assertz v685 #[code = 250]; + v686 = hir.int_to_ptr v683 : ptr; + v687 = hir.load v686 : i32; + v688 = hir.load_local : i32 #[local = lv2]; + v689 = hir.load_local : i32 #[local = lv3]; + v1280 = arith.constant 12 : u32; + v690 = hir.bitcast v689 : u32; + v692 = arith.add v690, v1280 : u32 #[overflow = checked]; + v1293 = arith.constant 4 : u32; + v694 = arith.mod v692, v1293 : u32; + hir.assertz v694 #[code = 250]; + v695 = hir.int_to_ptr v692 : ptr; + v696 = hir.load v695 : i32; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::deallocate(v687, v688, v696) + scf.yield ; + }; + v697 = hir.load_local : i32 #[local = lv3]; + v1292 = arith.constant 16 : i32; + v699 = arith.add v697, v1292 : i32 #[overflow = wrapping]; + v700 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v701 = hir.bitcast v700 : ptr; + hir.store v701, v699; + builtin.ret ; + }; + + private builtin.function @::current_memory(v702: i32, v703: i32, v704: i32, v705: i32) { + ^block71(v702: i32, v703: i32, v704: i32, v705: i32): + hir.store_local v702 #[local = lv0]; + hir.store_local v703 #[local = lv1]; + hir.store_local v704 #[local = lv2]; + hir.store_local v705 #[local = lv3]; + v1300 = arith.constant 0 : i32; + hir.store_local v1300 #[local = lv4]; + v1299 = arith.constant 4 : i32; + hir.store_local v1299 #[local = lv5]; + v708 = hir.load_local : i32 #[local = lv3]; + v1320 = arith.constant 0 : i32; + v1321 = arith.constant 0 : i32; + v710 = arith.eq v708, v1321 : i1; + v711 = arith.zext v710 : u32; + v712 = hir.bitcast v711 : i32; + v714 = arith.neq v712, v1320 : i1; + scf.if v714{ + ^block138: + scf.yield ; + } else { + ^block74: + v715 = hir.load_local : i32 #[local = lv1]; + v716 = hir.bitcast v715 : u32; + v1308 = arith.constant 4 : u32; + v718 = arith.mod v716, v1308 : u32; + hir.assertz v718 #[code = 250]; + v719 = hir.int_to_ptr v716 : ptr; + v720 = hir.load v719 : i32; + hir.store_local v720 #[local = lv6]; + v1318 = arith.constant 0 : i32; + v1319 = arith.constant 0 : i32; + v722 = arith.eq v720, v1319 : i1; + v723 = arith.zext v722 : u32; + v724 = hir.bitcast v723 : i32; + v726 = arith.neq v724, v1318 : i1; + scf.if v726{ + ^block137: + scf.yield ; + } else { + ^block75: + v727 = hir.load_local : i32 #[local = lv0]; + v728 = hir.load_local : i32 #[local = lv2]; + v1317 = arith.constant 4 : u32; + v729 = hir.bitcast v727 : u32; + v731 = arith.add v729, v1317 : u32 #[overflow = checked]; + v1316 = arith.constant 4 : u32; + v733 = arith.mod v731, v1316 : u32; + hir.assertz v733 #[code = 250]; + v734 = hir.int_to_ptr v731 : ptr; + hir.store v734, v728; + v735 = hir.load_local : i32 #[local = lv0]; + v736 = hir.load_local : i32 #[local = lv1]; + v1315 = arith.constant 4 : u32; + v737 = hir.bitcast v736 : u32; + v739 = arith.add v737, v1315 : u32 #[overflow = checked]; + v1314 = arith.constant 4 : u32; + v741 = arith.mod v739, v1314 : u32; + hir.assertz v741 #[code = 250]; + v742 = hir.int_to_ptr v739 : ptr; + v743 = hir.load v742 : i32; + v744 = hir.bitcast v735 : u32; + v1313 = arith.constant 4 : u32; + v746 = arith.mod v744, v1313 : u32; + hir.assertz v746 #[code = 250]; + v747 = hir.int_to_ptr v744 : ptr; + hir.store v747, v743; + v748 = hir.load_local : i32 #[local = lv6]; + v749 = hir.load_local : i32 #[local = lv3]; + v750 = arith.mul v748, v749 : i32 #[overflow = wrapping]; + hir.store_local v750 #[local = lv4]; + v1297 = arith.constant 8 : i32; + hir.store_local v1297 #[local = lv5]; + scf.yield ; + }; + scf.yield ; + }; + v752 = hir.load_local : i32 #[local = lv0]; + v753 = hir.load_local : i32 #[local = lv5]; + v755 = hir.load_local : i32 #[local = lv4]; + v754 = arith.add v752, v753 : i32 #[overflow = wrapping]; + v756 = hir.bitcast v754 : u32; + v1312 = arith.constant 4 : u32; + v758 = arith.mod v756, v1312 : u32; + hir.assertz v758 #[code = 250]; + v759 = hir.int_to_ptr v756 : ptr; + hir.store v759, v755; + builtin.ret ; + }; + + private builtin.function @::deallocate(v760: i32, v761: i32, v762: i32) { + ^block76(v760: i32, v761: i32, v762: i32): + hir.store_local v760 #[local = lv0]; + hir.store_local v761 #[local = lv1]; + hir.store_local v762 #[local = lv2]; + v763 = hir.load_local : i32 #[local = lv2]; + v1325 = arith.constant 0 : i32; + v1323 = arith.constant 0 : i32; + v765 = arith.eq v763, v1323 : i1; + v766 = arith.zext v765 : u32; + v767 = hir.bitcast v766 : i32; + v769 = arith.neq v767, v1325 : i1; + scf.if v769{ + ^block78: + scf.yield ; + } else { + ^block79: + v770 = hir.load_local : i32 #[local = lv0]; + v771 = hir.load_local : i32 #[local = lv2]; + v772 = hir.load_local : i32 #[local = lv1]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__rustc::__rust_dealloc(v770, v771, v772) + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @::allocate(v773: i32, v774: i32, v775: i32) { + ^block80(v773: i32, v774: i32, v775: i32): + hir.store_local v773 #[local = lv0]; + hir.store_local v775 #[local = lv2]; + v776 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v777 = hir.bitcast v776 : ptr; + v778 = hir.load v777 : i32; + v1331 = arith.constant 16 : i32; + v780 = arith.sub v778, v1331 : i32 #[overflow = wrapping]; + hir.store_local v780 #[local = lv3]; + v781 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v782 = hir.bitcast v781 : ptr; + hir.store v782, v780; + v783 = hir.load_local : i32 #[local = lv3]; + v787 = hir.load_local : i32 #[local = lv2]; + v1329 = arith.constant 0 : i32; + v1330 = arith.constant 8 : i32; + v785 = arith.add v783, v1330 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::alloc_impl(v785, v774, v787, v1329) + v789 = hir.load_local : i32 #[local = lv3]; + v1328 = arith.constant 12 : u32; + v790 = hir.bitcast v789 : u32; + v792 = arith.add v790, v1328 : u32 #[overflow = checked]; + v1327 = arith.constant 4 : u32; + v794 = arith.mod v792, v1327 : u32; + hir.assertz v794 #[code = 250]; + v795 = hir.int_to_ptr v792 : ptr; + v796 = hir.load v795 : i32; + hir.store_local v796 #[local = lv2]; + v797 = hir.load_local : i32 #[local = lv0]; + v798 = hir.load_local : i32 #[local = lv3]; + v1326 = arith.constant 8 : u32; + v799 = hir.bitcast v798 : u32; + v801 = arith.add v799, v1326 : u32 #[overflow = checked]; + v1341 = arith.constant 4 : u32; + v803 = arith.mod v801, v1341 : u32; + hir.assertz v803 #[code = 250]; + v804 = hir.int_to_ptr v801 : ptr; + v805 = hir.load v804 : i32; + v806 = hir.bitcast v797 : u32; + v1340 = arith.constant 4 : u32; + v808 = arith.mod v806, v1340 : u32; + hir.assertz v808 #[code = 250]; + v809 = hir.int_to_ptr v806 : ptr; + hir.store v809, v805; + v810 = hir.load_local : i32 #[local = lv0]; + v811 = hir.load_local : i32 #[local = lv2]; + v1339 = arith.constant 4 : u32; + v812 = hir.bitcast v810 : u32; + v814 = arith.add v812, v1339 : u32 #[overflow = checked]; + v1338 = arith.constant 4 : u32; + v816 = arith.mod v814, v1338 : u32; + hir.assertz v816 #[code = 250]; + v817 = hir.int_to_ptr v814 : ptr; + hir.store v817, v811; + v818 = hir.load_local : i32 #[local = lv3]; + v1337 = arith.constant 16 : i32; + v820 = arith.add v818, v1337 : i32 #[overflow = wrapping]; + v821 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v822 = hir.bitcast v821 : ptr; + hir.store v822, v820; + builtin.ret ; + }; + + private builtin.function @::try_allocate_in(v823: i32, v824: i32, v825: i32, v826: i32, v827: i32) { + ^block82(v823: i32, v824: i32, v825: i32, v826: i32, v827: i32): + hir.store_local v823 #[local = lv0]; + hir.store_local v824 #[local = lv1]; + hir.store_local v825 #[local = lv2]; + hir.store_local v826 #[local = lv3]; + hir.store_local v827 #[local = lv4]; + v828 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v829 = hir.bitcast v828 : ptr; + v830 = hir.load v829 : i32; + v1350 = arith.constant 16 : i32; + v832 = arith.sub v830, v1350 : i32 #[overflow = wrapping]; + hir.store_local v832 #[local = lv5]; + v833 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v834 = hir.bitcast v833 : ptr; + hir.store v834, v832; + v835 = hir.load_local : i32 #[local = lv3]; + v836 = hir.load_local : i32 #[local = lv4]; + v847 = hir.load_local : i32 #[local = lv1]; + v848 = hir.bitcast v847 : u32; + v849 = arith.zext v848 : u64; + v850 = hir.bitcast v849 : i64; + v1348 = arith.constant 0 : i32; + v842 = arith.sub v1348, v835 : i32 #[overflow = wrapping]; + v1349 = arith.constant -1 : i32; + v837 = arith.add v835, v836 : i32 #[overflow = wrapping]; + v839 = arith.add v837, v1349 : i32 #[overflow = wrapping]; + v843 = arith.band v839, v842 : i32; + v844 = hir.bitcast v843 : u32; + v845 = arith.zext v844 : u64; + v846 = hir.bitcast v845 : i64; + v851 = arith.mul v846, v850 : i64 #[overflow = wrapping]; + hir.store_local v851 #[local = lv6]; + v1418 = arith.constant 0 : i32; + v1347 = arith.constant 32 : i64; + v854 = hir.cast v1347 : u32; + v853 = hir.bitcast v851 : u64; + v855 = arith.shr v853, v854 : u64; + v856 = hir.bitcast v855 : i64; + v857 = arith.trunc v856 : i32; + v859 = arith.neq v857, v1418 : i1; + v1383 = scf.if v859 : u32 { + ^block142: + v1379 = arith.constant 0 : u32; + scf.yield v1379; + } else { + ^block87: + v860 = hir.load_local : i64 #[local = lv6]; + v861 = arith.trunc v860 : i32; + hir.store_local v861 #[local = lv4]; + v863 = hir.load_local : i32 #[local = lv3]; + v1417 = arith.constant 0 : i32; + v1344 = arith.constant -2147483648 : i32; + v864 = arith.sub v1344, v863 : i32 #[overflow = wrapping]; + v866 = hir.bitcast v864 : u32; + v865 = hir.bitcast v861 : u32; + v867 = arith.lte v865, v866 : i1; + v868 = arith.zext v867 : u32; + v869 = hir.bitcast v868 : i32; + v871 = arith.neq v869, v1417 : i1; + scf.if v871{ + ^block85: + v881 = hir.load_local : i32 #[local = lv4]; + v1416 = arith.constant 0 : i32; + v883 = arith.neq v881, v1416 : i1; + scf.if v883{ + ^block89: + v901 = hir.load_local : i32 #[local = lv2]; + v1415 = arith.constant 0 : i32; + v903 = arith.neq v901, v1415 : i1; + scf.if v903{ + ^block92: + v917 = hir.load_local : i32 #[local = lv5]; + v918 = hir.load_local : i32 #[local = lv3]; + v919 = hir.load_local : i32 #[local = lv4]; + v1364 = arith.constant 1 : i32; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::alloc_impl(v917, v918, v919, v1364) + v921 = hir.load_local : i32 #[local = lv5]; + v922 = hir.bitcast v921 : u32; + v1363 = arith.constant 4 : u32; + v924 = arith.mod v922, v1363 : u32; + hir.assertz v924 #[code = 250]; + v925 = hir.int_to_ptr v922 : ptr; + v926 = hir.load v925 : i32; + hir.store_local v926 #[local = lv2]; + scf.yield ; + } else { + ^block93: + v904 = hir.load_local : i32 #[local = lv5]; + v907 = hir.load_local : i32 #[local = lv3]; + v908 = hir.load_local : i32 #[local = lv4]; + v1342 = arith.constant 8 : i32; + v906 = arith.add v904, v1342 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::allocate(v906, v907, v908) + v909 = hir.load_local : i32 #[local = lv5]; + v1362 = arith.constant 8 : u32; + v910 = hir.bitcast v909 : u32; + v912 = arith.add v910, v1362 : u32 #[overflow = checked]; + v1414 = arith.constant 4 : u32; + v914 = arith.mod v912, v1414 : u32; + hir.assertz v914 #[code = 250]; + v915 = hir.int_to_ptr v912 : ptr; + v916 = hir.load v915 : i32; + hir.store_local v916 #[local = lv2]; + scf.yield ; + }; + v927 = hir.load_local : i32 #[local = lv2]; + v1413 = arith.constant 0 : i32; + v929 = arith.neq v927, v1413 : i1; + scf.if v929{ + ^block94: + v947 = hir.load_local : i32 #[local = lv0]; + v948 = hir.load_local : i32 #[local = lv2]; + v1412 = arith.constant 8 : u32; + v949 = hir.bitcast v947 : u32; + v951 = arith.add v949, v1412 : u32 #[overflow = checked]; + v1411 = arith.constant 4 : u32; + v953 = arith.mod v951, v1411 : u32; + hir.assertz v953 #[code = 250]; + v954 = hir.int_to_ptr v951 : ptr; + hir.store v954, v948; + v955 = hir.load_local : i32 #[local = lv0]; + v956 = hir.load_local : i32 #[local = lv1]; + v1410 = arith.constant 4 : u32; + v957 = hir.bitcast v955 : u32; + v959 = arith.add v957, v1410 : u32 #[overflow = checked]; + v1409 = arith.constant 4 : u32; + v961 = arith.mod v959, v1409 : u32; + hir.assertz v961 #[code = 250]; + v962 = hir.int_to_ptr v959 : ptr; + hir.store v962, v956; + v1408 = arith.constant 0 : i32; + hir.store_local v1408 #[local = lv3]; + scf.yield ; + } else { + ^block95: + v930 = hir.load_local : i32 #[local = lv0]; + v931 = hir.load_local : i32 #[local = lv4]; + v1407 = arith.constant 8 : u32; + v932 = hir.bitcast v930 : u32; + v934 = arith.add v932, v1407 : u32 #[overflow = checked]; + v1406 = arith.constant 4 : u32; + v936 = arith.mod v934, v1406 : u32; + hir.assertz v936 #[code = 250]; + v937 = hir.int_to_ptr v934 : ptr; + hir.store v937, v931; + v938 = hir.load_local : i32 #[local = lv0]; + v939 = hir.load_local : i32 #[local = lv3]; + v1405 = arith.constant 4 : u32; + v940 = hir.bitcast v938 : u32; + v942 = arith.add v940, v1405 : u32 #[overflow = checked]; + v1404 = arith.constant 4 : u32; + v944 = arith.mod v942, v1404 : u32; + hir.assertz v944 #[code = 250]; + v945 = hir.int_to_ptr v942 : ptr; + hir.store v945, v939; + v1403 = arith.constant 1 : i32; + hir.store_local v1403 #[local = lv3]; + scf.yield ; + }; + scf.yield ; + } else { + ^block90: + v884 = hir.load_local : i32 #[local = lv0]; + v885 = hir.load_local : i32 #[local = lv3]; + v1402 = arith.constant 8 : u32; + v886 = hir.bitcast v884 : u32; + v888 = arith.add v886, v1402 : u32 #[overflow = checked]; + v1401 = arith.constant 4 : u32; + v890 = arith.mod v888, v1401 : u32; + hir.assertz v890 #[code = 250]; + v891 = hir.int_to_ptr v888 : ptr; + hir.store v891, v885; + v1400 = arith.constant 0 : i32; + hir.store_local v1400 #[local = lv3]; + v893 = hir.load_local : i32 #[local = lv0]; + v1399 = arith.constant 4 : u32; + v895 = hir.bitcast v893 : u32; + v897 = arith.add v895, v1399 : u32 #[overflow = checked]; + v1398 = arith.constant 4 : u32; + v899 = arith.mod v897, v1398 : u32; + hir.assertz v899 #[code = 250]; + v1397 = arith.constant 0 : i32; + v900 = hir.int_to_ptr v897 : ptr; + hir.store v900, v1397; + scf.yield ; + }; + scf.yield ; + } else { + ^block88: + scf.yield ; + }; + v1396 = arith.constant 0 : u32; + v1381 = arith.constant 1 : u32; + v1389 = cf.select v871, v1381, v1396 : u32; + scf.yield v1389; + }; + scf.index_switch v1383 + case 0 { + ^block86: + v872 = hir.load_local : i32 #[local = lv0]; + v1395 = arith.constant 4 : u32; + v874 = hir.bitcast v872 : u32; + v876 = arith.add v874, v1395 : u32 #[overflow = checked]; + v1394 = arith.constant 4 : u32; + v878 = arith.mod v876, v1394 : u32; + hir.assertz v878 #[code = 250]; + v1393 = arith.constant 0 : i32; + v879 = hir.int_to_ptr v876 : ptr; + hir.store v879, v1393; + v1392 = arith.constant 1 : i32; + hir.store_local v1392 #[local = lv3]; + scf.yield ; + } + default { + ^block146: + scf.yield ; + }; + v964 = hir.load_local : i32 #[local = lv0]; + v965 = hir.load_local : i32 #[local = lv3]; + v966 = hir.bitcast v964 : u32; + v1391 = arith.constant 4 : u32; + v968 = arith.mod v966, v1391 : u32; + hir.assertz v968 #[code = 250]; + v969 = hir.int_to_ptr v966 : ptr; + hir.store v969, v965; + v970 = hir.load_local : i32 #[local = lv5]; + v1390 = arith.constant 16 : i32; + v972 = arith.add v970, v1390 : i32 #[overflow = wrapping]; + v973 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v974 = hir.bitcast v973 : ptr; + hir.store v974, v972; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::handle_error(v975: i32, v976: i32) { + ^block96(v975: i32, v976: i32): + ub.unreachable ; + }; + + private builtin.function @::max(v977: i32, v978: i32) -> i32 { + ^block98(v977: i32, v978: i32): + v1419 = arith.constant 0 : i32; + v985 = hir.bitcast v978 : u32; + v984 = hir.bitcast v977 : u32; + v986 = arith.gt v984, v985 : i1; + v987 = arith.zext v986 : u32; + v988 = hir.bitcast v987 : i32; + v990 = arith.neq v988, v1419 : i1; + v991 = cf.select v990, v977, v978 : i32; + builtin.ret v991; + }; + + private builtin.function @miden::protocol::active_note::get_assets(v992: i32) -> i32 { + ^block100(v992: i32): + v993, v994 = hir.exec @miden/protocol/active_note/get_assets(v992) : i32, i32 + builtin.ret v993; + }; + + private builtin.function @miden::protocol::native_account::add_asset(v996: felt, v997: felt, v998: felt, v999: felt, v1000: i32) { + ^block105(v996: felt, v997: felt, v998: felt, v999: felt, v1000: i32): + v1001, v1002, v1003, v1004 = hir.exec @miden/protocol/native_account/add_asset(v996, v997, v998, v999) : felt, felt, felt, felt + v1005 = hir.bitcast v1000 : u32; + v1006 = hir.int_to_ptr v1005 : ptr; + hir.store v1006, v1001; + v1422 = arith.constant 4 : u32; + v1008 = arith.add v1005, v1422 : u32 #[overflow = checked]; + v1009 = hir.int_to_ptr v1008 : ptr; + hir.store v1009, v1002; + v1421 = arith.constant 8 : u32; + v1011 = arith.add v1005, v1421 : u32 #[overflow = checked]; + v1012 = hir.int_to_ptr v1011 : ptr; + hir.store v1012, v1003; + v1420 = arith.constant 12 : u32; + v1014 = arith.add v1005, v1420 : u32 #[overflow = checked]; + v1015 = hir.int_to_ptr v1014 : ptr; + hir.store v1015, v1004; builtin.ret ; }; @@ -68,9 +1466,9 @@ builtin.component miden:base/note-script@1.0.0 { builtin.segment @1048576 = 0x0000000100000001; }; - public builtin.function @run(v27: felt, v28: felt, v29: felt, v30: felt) { - ^block19(v27: felt, v28: felt, v29: felt, v30: felt): - hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/miden:base/note-script@1.0.0#run(v27, v28, v29, v30) + public builtin.function @run(v1016: felt, v1017: felt, v1018: felt, v1019: felt) { + ^block108(v1016: felt, v1017: felt, v1018: felt, v1019: felt): + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/miden:base/note-script@1.0.0#run(v1016, v1017, v1018, v1019) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.masm index 12e8dab54..cb8febbf5 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.masm @@ -1,14 +1,14 @@ -# mod miden:base/note-script@1.0.0 +# mod ::"miden:base/note-script@1.0.0" @callconv("canon-lift") pub proc run(felt, felt, felt, felt) - exec.::miden:base/note-script@1.0.0::init + exec."miden:base/note-script@1.0.0"::init trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_note_add_assets_to_account_binding::miden:base/note-script@1.0.0#run + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::"miden:base/note-script@1.0.0#run" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -21,7 +21,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -32,7 +32,7 @@ proc init mem_store.278537 end -# mod miden:base/note-script@1.0.0::rust_sdk_note_add_assets_to_account_binding +# mod ::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding @callconv("C") proc __wasm_call_ctors( @@ -41,6 +41,192 @@ proc __wasm_call_ctors( nop end +@locals("2") +@callconv("C") +proc __rustc::__rust_alloc(i32, i32) -> i32 + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + movup.2 + swap.1 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::::alloc + trace.252 + nop +end + +@locals("3") +@callconv("C") +proc __rustc::__rust_dealloc(i32, i32, i32) + drop + drop + drop +end + +@locals("2") +@callconv("C") +proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + movup.3 + u32wrapping_add + movup.2 + swap.1 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::::alloc + trace.252 + nop + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.0 + movup.2 + eq + neq + if.true + nop + else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 + eq + neq + if.true + nop + else + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + swap.1 + movup.2 + push.0 + dup.2 + push.0 + gte + while.true + dup.1 + dup.1 + push.1 + u32overflowing_madd + assertz + dup.4 + swap.1 + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + u32wrapping_add.1 + dup.0 + dup.3 + u32gte + end + dropw + end + end + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop +end + @callconv("C") proc rust_sdk_note_add_assets_to_account_binding::bindings::__link_custom_section_describing_imports( @@ -48,6 +234,7 @@ proc rust_sdk_note_add_assets_to_account_binding::bindings::__link_custom_sectio nop end +@locals("4") @callconv("C") proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop @@ -56,16 +243,24 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_note_add_assets_to_account_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::wit_bindgen::rt::run_ctors_once trace.252 nop trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_note_add_assets_to_account_binding::miden::active_note::add_assets_to_account + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::miden_base_sys::bindings::active_note::add_assets_to_account trace.252 nop end +@callconv("C") +proc __rustc::__rust_no_alloc_shim_is_unstable_v2( + +) + nop +end + +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -78,7 +273,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 + push.1048588 u32wrapping_add u32divmod.4 swap.1 @@ -107,13 +302,29 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_note_add_assets_to_account_binding::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 - push.1048584 + push.1048588 movup.2 u32wrapping_add u32divmod.4 @@ -140,13 +351,3865 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("5") +@callconv("C") +proc ::alloc( + i32, + i32, + i32 +) -> i32 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + push.0 + push.16 + dup.3 + swap.1 + u32gt + neq + movup.2 + swap.1 + cdrop + dup.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.4294967295 + movup.2 + u32wrapping_add + movup.2 + u32and + neq + if.true + push.0 + push.3735929054 + else + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::::max + trace.252 + nop + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.2147483648 + movup.2 + u32wrapping_sub + movup.2 + swap.1 + u32gt + neq + dup.0 + if.true + push.3735929054 + else + push.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + dup.1 + u32wrapping_sub + push.4294967295 + movup.3 + movup.3 + u32wrapping_add + u32wrapping_add + u32and + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + neq + if.true + nop + else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::"intrinsics::mem::heap_base" + trace.252 + nop + trace.240 + nop + exec.::intrinsics::mem::memory_size + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.16 + movup.2 + swap.1 + u32shl + movup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.4294967295 + movup.2 + u32xor + movup.2 + swap.1 + u32gt + neq + if.true + nop + else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movdn.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + u32wrapping_add + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + end + push.1 + push.0 + movup.3 + cdrop + swap.1 + end + push.0 + movup.2 + eq + if.true + drop + push.0 + assert + else + nop + end +end + @callconv("C") -proc miden::active_note::add_assets_to_account( +proc intrinsics::mem::heap_base( + +) -> i32 + trace.240 + nop + exec.::intrinsics::mem::heap_base + trace.252 + nop +end +@locals("4") +@callconv("C") +proc >::with_capacity( + i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + push.256 + push.8 + movup.3 + u32wrapping_add + dup.2 + swap.3 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::::with_capacity_in + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + swap.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@locals("5") +@callconv("C") +proc ::with_capacity_in( + i32, + i32, + i32, + i32 +) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + dup.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.4 + movup.3 + u32wrapping_add + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::::try_allocate_in + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.1 + movup.2 + neq + neq + if.true + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + else + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::alloc::raw_vec::handle_error + trace.252 + nop + push.0 + assert + end +end + +@locals("2") +@callconv("C") +proc miden_base_sys::bindings::active_note::get_assets( + i32 +) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + u32wrapping_add + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::>::with_capacity + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.2 + swap.1 + swap.1 + u32shr + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::"miden::protocol::active_note::get_assets" + trace.252 + nop + push.8 + movup.2 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@locals("4") +@callconv("C") +proc miden_base_sys::bindings::active_note::add_assets_to_account( + +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.48 + u32wrapping_sub + dup.0 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_add + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::miden_base_sys::bindings::active_note::get_assets + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.36 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.0 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.40 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + u32shl + dup.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.12 + movup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movdn.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1 + while.true + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 + eq + neq + dup.0 + if.true + nop + else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_add + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.16 + movup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + u32wrapping_add + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.24 + movup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4294967280 + u32wrapping_add + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + push.32 + movup.2 + u32wrapping_add + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::miden_base_sys::bindings::native_account::add_asset + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + push.1 + push.0 + movup.2 + cdrop + push.1 + u32and + if.true + push.1 + else + push.0 + end + end + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding:: as core::ops::drop::Drop>::drop + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.48 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@locals("3") +@callconv("C") +proc miden_base_sys::bindings::native_account::add_asset( + i32, + i32 +) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + dup.0 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + swap.3 + swap.1 + swap.4 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::"miden::protocol::native_account::add_asset" + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.8 + movup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + swap.2 + movup.2 + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + swap.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + swap.2 + movup.2 + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@locals("2") +@callconv("C") +proc as core::ops::drop::Drop>::drop( + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + u32wrapping_add + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::< as core::ops::drop::Drop>::drop::DropGuard as core::ops::drop::Drop>::drop + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@locals("2") +@callconv("C") +proc < as core::ops::drop::Drop>::drop::DropGuard as core::ops::drop::Drop>::drop( + i32 +) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.0 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + u32wrapping_add + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding:: as core::ops::drop::Drop>::drop + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@locals("1") +@callconv("C") +proc as core::ops::drop::Drop>::drop( + i32 +) + push.16 + dup.0 + swap.2 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::::deallocate + trace.252 + nop +end + +@locals("4") +@callconv("C") +proc ::alloc_impl( + i32, + i32, + i32, + i32 +) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 + eq + neq + if.true + nop + else + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::__rustc::__rust_no_alloc_shim_is_unstable_v2 + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + neq + if.true + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::__rustc::__rust_alloc_zeroed + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + else + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::__rustc::__rust_alloc + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + end + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@locals("4") +@callconv("C") +proc ::deallocate( + i32, + i32, + i32 +) + movup.2 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + dup.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + movup.2 + u32wrapping_add + swap.1 + swap.3 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::"::current_memory" + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.0 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.0 + movup.2 + eq + neq + if.true + nop + else + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.2 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::"::deallocate" + trace.252 + nop + end + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@locals("7") +@callconv("C") +proc ::current_memory( + i32, + i32, + i32, + i32 +) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 + eq + neq + if.true + nop + else + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.0 + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.0 + movup.2 + eq + neq + if.true + nop + else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::intrinsics::i32::wrapping_mul + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + end + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movdn.2 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@locals("3") +@callconv("C") +proc ::deallocate( + i32, + i32, + i32 +) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 + eq + neq + if.true + nop + else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.2 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::__rustc::__rust_dealloc + trace.252 + nop + end +end + +@locals("4") +@callconv("C") +proc ::allocate( + i32, + i32, + i32 +) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + swap.1 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + dup.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.8 + movup.3 + u32wrapping_add + swap.1 + swap.3 + swap.1 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::"::alloc_impl" + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@locals("8") +@callconv("C") +proc ::try_allocate_in( + i32, + i32, + i32, + i32, + i32 +) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + dup.0 + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + dup.4 + u32wrapping_sub + push.4294967295 + movup.5 + movup.5 + u32wrapping_add + u32wrapping_add + u32and + push.0 + trace.240 + nop + exec.::intrinsics::i64::wrapping_mul + trace.252 + nop + dup.1 + dup.1 + locaddr.6 + push.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.0 + push.32 + push.0 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + assertz + dup.0 + push.4294967295 + u32lte + assert + movup.3 + movup.3 + movup.2 + trace.240 + nop + exec.::miden::core::math::u64::shr + trace.252 + nop + drop + neq + if.true + push.0 + else + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + drop + dup.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.2147483648 + movup.2 + u32wrapping_sub + movup.2 + swap.1 + u32lte + neq + dup.0 + if.true + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + neq + if.true + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + neq + if.true + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1 + movdn.3 + swap.2 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::"::alloc_impl" + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + else + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + movup.3 + u32wrapping_add + movup.2 + swap.1 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::"::allocate" + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + neq + if.true + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + else + nop + end + push.0 + push.1 + movup.2 + cdrop + end + eq.0 + if.true + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + else + nop + end + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@locals("2") +@callconv("C") +proc alloc::raw_vec::handle_error(i32, i32) + drop + drop + push.0 + assert +end + +@locals("2") +@callconv("C") +proc ::max( + i32, + i32 +) -> i32 + push.0 + dup.2 + dup.2 + swap.1 + u32gt + neq + cdrop +end + +@callconv("C") +proc miden::protocol::active_note::get_assets(i32) -> i32 + trace.240 + nop + exec.::miden::protocol::active_note::get_assets + trace.252 + nop + swap.1 + drop +end + +@callconv("C") +proc miden::protocol::native_account::add_asset(felt, felt, felt, felt, i32) + trace.240 + nop + exec.::miden::protocol::native_account::add_asset + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 trace.240 nop - exec.::miden::active_note::add_assets_to_account + exec.::intrinsics::mem::store_felt trace.252 nop end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.wat index fdd46dd4d..58094c9e5 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.wat @@ -11,7 +11,17 @@ (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) (core module $main (;0;) (type (;0;) (func)) - (type (;1;) (func (param f32 f32 f32 f32))) + (type (;1;) (func (param i32 i32) (result i32))) + (type (;2;) (func (param i32 i32 i32))) + (type (;3;) (func (param f32 f32 f32 f32))) + (type (;4;) (func (param i32 i32 i32) (result i32))) + (type (;5;) (func (result i32))) + (type (;6;) (func (param i32))) + (type (;7;) (func (param i32 i32 i32 i32))) + (type (;8;) (func (param i32 i32))) + (type (;9;) (func (param i32 i32 i32 i32 i32))) + (type (;10;) (func (param i32) (result i32))) + (type (;11;) (func (param f32 f32 f32 f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -20,16 +30,49 @@ (export "miden:base/note-script@1.0.0#run" (func $miden:base/note-script@1.0.0#run)) (elem (;0;) (i32.const 1) func $rust_sdk_note_add_assets_to_account_binding::bindings::__link_custom_section_describing_imports) (func $__wasm_call_ctors (;0;) (type 0)) - (func $rust_sdk_note_add_assets_to_account_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) - (func $miden:base/note-script@1.0.0#run (;2;) (type 1) (param f32 f32 f32 f32) + (func $__rustc::__rust_alloc (;1;) (type 1) (param i32 i32) (result i32) + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + local.get 1 + local.get 0 + call $::alloc + ) + (func $__rustc::__rust_dealloc (;2;) (type 2) (param i32 i32 i32)) + (func $__rustc::__rust_alloc_zeroed (;3;) (type 1) (param i32 i32) (result i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + local.get 1 + local.get 0 + call $::alloc + local.tee 1 + i32.eqz + br_if 0 (;@1;) + local.get 0 + i32.eqz + br_if 0 (;@1;) + local.get 1 + i32.const 0 + local.get 0 + memory.fill + end + local.get 1 + ) + (func $rust_sdk_note_add_assets_to_account_binding::bindings::__link_custom_section_describing_imports (;4;) (type 0)) + (func $miden:base/note-script@1.0.0#run (;5;) (type 3) (param f32 f32 f32 f32) call $wit_bindgen::rt::run_ctors_once - call $miden::active_note::add_assets_to_account + call $miden_base_sys::bindings::active_note::add_assets_to_account + ) + (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;6;) (type 0) + return ) - (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (func $wit_bindgen::rt::run_ctors_once (;7;) (type 0) (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048584 + i32.const 1048588 i32.add i32.load8_u br_if 0 (;@1;) @@ -37,13 +80,609 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048584 + i32.const 1048588 i32.add i32.const 1 i32.store8 end ) - (func $miden::active_note::add_assets_to_account (;4;) (type 0) + (func $::alloc (;8;) (type 4) (param i32 i32 i32) (result i32) + (local i32 i32) + block ;; label = @1 + local.get 1 + i32.const 16 + local.get 1 + i32.const 16 + i32.gt_u + select + local.tee 3 + local.get 3 + i32.const -1 + i32.add + i32.and + br_if 0 (;@1;) + local.get 2 + i32.const -2147483648 + local.get 1 + local.get 3 + call $::max + local.tee 1 + i32.sub + i32.gt_u + br_if 0 (;@1;) + i32.const 0 + local.set 3 + local.get 2 + local.get 1 + i32.add + i32.const -1 + i32.add + i32.const 0 + local.get 1 + i32.sub + i32.and + local.set 2 + block ;; label = @2 + local.get 0 + i32.load + br_if 0 (;@2;) + local.get 0 + call $intrinsics::mem::heap_base + memory.size + i32.const 16 + i32.shl + i32.add + i32.store + end + block ;; label = @2 + local.get 2 + local.get 0 + i32.load + local.tee 4 + i32.const -1 + i32.xor + i32.gt_u + br_if 0 (;@2;) + local.get 0 + local.get 4 + local.get 2 + i32.add + i32.store + local.get 4 + local.get 1 + i32.add + local.set 3 + end + local.get 3 + return + end + unreachable + ) + (func $intrinsics::mem::heap_base (;9;) (type 5) (result i32) + unreachable + ) + (func $>::with_capacity (;10;) (type 6) (param i32) + (local i32 i64) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 1 + global.set $__stack_pointer + local.get 1 + i32.const 8 + i32.add + i32.const 256 + i32.const 16 + i32.const 16 + call $::with_capacity_in + local.get 1 + i64.load offset=8 + local.set 2 + local.get 0 + i32.const 0 + i32.store offset=8 + local.get 0 + local.get 2 + i64.store align=4 + local.get 1 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $::with_capacity_in (;11;) (type 7) (param i32 i32 i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 4 + global.set $__stack_pointer + local.get 4 + i32.const 4 + i32.add + local.get 1 + i32.const 0 + local.get 2 + local.get 3 + call $::try_allocate_in + local.get 4 + i32.load offset=8 + local.set 3 + block ;; label = @1 + local.get 4 + i32.load offset=4 + i32.const 1 + i32.ne + br_if 0 (;@1;) + local.get 3 + local.get 4 + i32.load offset=12 + call $alloc::raw_vec::handle_error + unreachable + end + local.get 0 + local.get 4 + i32.load offset=12 + i32.store offset=4 + local.get 0 + local.get 3 + i32.store + local.get 4 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $miden_base_sys::bindings::active_note::get_assets (;12;) (type 6) (param i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 1 + global.set $__stack_pointer + local.get 1 + i32.const 4 + i32.add + call $>::with_capacity + local.get 0 + i32.const 8 + i32.add + local.get 1 + i32.load offset=8 + i32.const 2 + i32.shr_u + call $miden::protocol::active_note::get_assets + i32.store + local.get 0 + local.get 1 + i64.load offset=4 align=4 + i64.store align=4 + local.get 1 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $miden_base_sys::bindings::active_note::add_assets_to_account (;13;) (type 0) + (local i32 i32 i32 i32) + global.get $__stack_pointer + i32.const 48 + i32.sub + local.tee 0 + global.set $__stack_pointer + local.get 0 + i32.const 32 + i32.add + call $miden_base_sys::bindings::active_note::get_assets + local.get 0 + i32.load offset=32 + local.set 1 + local.get 0 + local.get 0 + i32.load offset=36 + local.tee 2 + local.get 0 + i32.load offset=40 + i32.const 4 + i32.shl + local.tee 3 + i32.add + i32.store offset=12 + local.get 0 + local.get 1 + i32.store offset=8 + local.get 0 + local.get 2 + i32.store offset=4 + local.get 0 + local.get 2 + i32.store + block ;; label = @1 + loop ;; label = @2 + local.get 3 + i32.eqz + br_if 1 (;@1;) + local.get 0 + local.get 2 + i32.const 16 + i32.add + local.tee 1 + i32.store offset=4 + local.get 0 + local.get 2 + i64.load + i64.store offset=16 + local.get 0 + local.get 2 + i32.const 8 + i32.add + i64.load + i64.store offset=24 + local.get 3 + i32.const -16 + i32.add + local.set 3 + local.get 0 + i32.const 32 + i32.add + local.get 0 + i32.const 16 + i32.add + call $miden_base_sys::bindings::native_account::add_asset + local.get 1 + local.set 2 + br 0 (;@2;) + end + end + local.get 0 + call $ as core::ops::drop::Drop>::drop + local.get 0 + i32.const 48 + i32.add + global.set $__stack_pointer + ) + (func $miden_base_sys::bindings::native_account::add_asset (;14;) (type 8) (param i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 1 + f32.load offset=12 + local.get 1 + f32.load offset=8 + local.get 1 + f32.load offset=4 + local.get 1 + f32.load + local.get 2 + call $miden::protocol::native_account::add_asset + local.get 0 + local.get 2 + i64.load + i64.const 32 + i64.rotl + i64.store offset=8 + local.get 0 + local.get 2 + i64.load offset=8 + i64.const 32 + i64.rotl + i64.store + local.get 2 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $ as core::ops::drop::Drop>::drop (;15;) (type 6) (param i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 1 + global.set $__stack_pointer + local.get 1 + local.get 0 + i32.store offset=12 + local.get 1 + i32.const 12 + i32.add + call $< as core::ops::drop::Drop>::drop::DropGuard as core::ops::drop::Drop>::drop + local.get 1 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $< as core::ops::drop::Drop>::drop::DropGuard as core::ops::drop::Drop>::drop (;16;) (type 6) (param i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 1 + global.set $__stack_pointer + local.get 1 + local.get 0 + i32.load + local.tee 0 + i32.load + i32.store offset=12 + local.get 1 + local.get 0 + i32.load offset=8 + i32.store offset=8 + local.get 1 + i32.const 8 + i32.add + call $ as core::ops::drop::Drop>::drop + local.get 1 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $ as core::ops::drop::Drop>::drop (;17;) (type 6) (param i32) + local.get 0 + i32.const 16 + i32.const 16 + call $::deallocate + ) + (func $::alloc_impl (;18;) (type 7) (param i32 i32 i32 i32) + block ;; label = @1 + local.get 2 + i32.eqz + br_if 0 (;@1;) + call $__rustc::__rust_no_alloc_shim_is_unstable_v2 + block ;; label = @2 + local.get 3 + br_if 0 (;@2;) + local.get 2 + local.get 1 + call $__rustc::__rust_alloc + local.set 1 + br 1 (;@1;) + end + local.get 2 + local.get 1 + call $__rustc::__rust_alloc_zeroed + local.set 1 + end + local.get 0 + local.get 2 + i32.store offset=4 + local.get 0 + local.get 1 + i32.store + ) + (func $::deallocate (;19;) (type 2) (param i32 i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 3 + global.set $__stack_pointer + local.get 3 + i32.const 4 + i32.add + local.get 0 + local.get 1 + local.get 2 + call $::current_memory + block ;; label = @1 + local.get 3 + i32.load offset=8 + local.tee 2 + i32.eqz + br_if 0 (;@1;) + local.get 3 + i32.load offset=4 + local.get 2 + local.get 3 + i32.load offset=12 + call $::deallocate + end + local.get 3 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $::current_memory (;20;) (type 7) (param i32 i32 i32 i32) + (local i32 i32 i32) + i32.const 0 + local.set 4 + i32.const 4 + local.set 5 + block ;; label = @1 + local.get 3 + i32.eqz + br_if 0 (;@1;) + local.get 1 + i32.load + local.tee 6 + i32.eqz + br_if 0 (;@1;) + local.get 0 + local.get 2 + i32.store offset=4 + local.get 0 + local.get 1 + i32.load offset=4 + i32.store + local.get 6 + local.get 3 + i32.mul + local.set 4 + i32.const 8 + local.set 5 + end + local.get 0 + local.get 5 + i32.add + local.get 4 + i32.store + ) + (func $::deallocate (;21;) (type 2) (param i32 i32 i32) + block ;; label = @1 + local.get 2 + i32.eqz + br_if 0 (;@1;) + local.get 0 + local.get 2 + local.get 1 + call $__rustc::__rust_dealloc + end + ) + (func $::allocate (;22;) (type 2) (param i32 i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 3 + global.set $__stack_pointer + local.get 3 + i32.const 8 + i32.add + local.get 1 + local.get 2 + i32.const 0 + call $::alloc_impl + local.get 3 + i32.load offset=12 + local.set 2 + local.get 0 + local.get 3 + i32.load offset=8 + i32.store + local.get 0 + local.get 2 + i32.store offset=4 + local.get 3 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $::try_allocate_in (;23;) (type 9) (param i32 i32 i32 i32 i32) + (local i32 i64) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 5 + global.set $__stack_pointer + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + local.get 3 + local.get 4 + i32.add + i32.const -1 + i32.add + i32.const 0 + local.get 3 + i32.sub + i32.and + i64.extend_i32_u + local.get 1 + i64.extend_i32_u + i64.mul + local.tee 6 + i64.const 32 + i64.shr_u + i32.wrap_i64 + br_if 0 (;@3;) + local.get 6 + i32.wrap_i64 + local.tee 4 + i32.const -2147483648 + local.get 3 + i32.sub + i32.le_u + br_if 1 (;@2;) + end + local.get 0 + i32.const 0 + i32.store offset=4 + i32.const 1 + local.set 3 + br 1 (;@1;) + end + block ;; label = @2 + local.get 4 + br_if 0 (;@2;) + local.get 0 + local.get 3 + i32.store offset=8 + i32.const 0 + local.set 3 + local.get 0 + i32.const 0 + i32.store offset=4 + br 1 (;@1;) + end + block ;; label = @2 + block ;; label = @3 + local.get 2 + br_if 0 (;@3;) + local.get 5 + i32.const 8 + i32.add + local.get 3 + local.get 4 + call $::allocate + local.get 5 + i32.load offset=8 + local.set 2 + br 1 (;@2;) + end + local.get 5 + local.get 3 + local.get 4 + i32.const 1 + call $::alloc_impl + local.get 5 + i32.load + local.set 2 + end + block ;; label = @2 + local.get 2 + br_if 0 (;@2;) + local.get 0 + local.get 4 + i32.store offset=8 + local.get 0 + local.get 3 + i32.store offset=4 + i32.const 1 + local.set 3 + br 1 (;@1;) + end + local.get 0 + local.get 2 + i32.store offset=8 + local.get 0 + local.get 1 + i32.store offset=4 + i32.const 0 + local.set 3 + end + local.get 0 + local.get 3 + i32.store + local.get 5 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $alloc::raw_vec::handle_error (;24;) (type 8) (param i32 i32) + unreachable + ) + (func $::max (;25;) (type 1) (param i32 i32) (result i32) + local.get 0 + local.get 1 + local.get 0 + local.get 1 + i32.gt_u + select + ) + (func $miden::protocol::active_note::get_assets (;26;) (type 10) (param i32) (result i32) + unreachable + ) + (func $miden::protocol::native_account::add_asset (;27;) (type 11) (param f32 f32 f32 f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.hir index d0f5bde76..ca4ad8462 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.hir @@ -12,186 +12,199 @@ builtin.component miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-n private builtin.function @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1#binding() -> felt { ^block9: - v3 = builtin.global_symbol @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/__stack_pointer : ptr - v4 = hir.bitcast v3 : ptr; - v5 = hir.load v4 : i32; - v6 = arith.constant 32 : i32; - v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; - v8 = builtin.global_symbol @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/__stack_pointer : ptr - v9 = hir.bitcast v8 : ptr; - hir.store v9, v7; + v1 = builtin.global_symbol @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v144 = arith.constant 32 : i32; + v5 = arith.sub v3, v144 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/wit_bindgen::rt::run_ctors_once() - v1 = arith.constant 0 : i32; - v12 = hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/intrinsics::felt::from_u32(v1) : felt - v185 = arith.constant 0 : i32; - v167, v168, v169, v170 = scf.while v185, v7, v12 : i32, i32, felt, i32 { - ^block38(v171: i32, v172: i32, v173: felt): - v184 = arith.constant 0 : i32; - v31 = arith.constant 16 : i32; - v15 = arith.eq v171, v31 : i1; - v16 = arith.zext v15 : u32; - v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v184 : i1; - v162 = scf.if v19 : i32 { - ^block37: - v133 = ub.poison i32 : i32; - scf.yield v133; + v143 = arith.constant 0 : i32; + hir.store_local v143 #[local = lv1]; + v139 = arith.constant 0 : felt; + hir.store_local v139 #[local = lv2]; + scf.while { + ^block12: + v11 = hir.load_local : i32 #[local = lv1]; + v166 = arith.constant 0 : i32; + v147 = arith.constant 16 : i32; + v13 = arith.eq v11, v147 : i1; + v14 = arith.zext v13 : u32; + v15 = hir.bitcast v14 : i32; + v17 = arith.neq v15, v166 : i1; + scf.if v17{ + ^block36: + scf.yield ; } else { ^block14: - v183 = arith.constant 16 : i32; - v22 = arith.add v172, v183 : i32 #[overflow = wrapping]; - v23 = arith.add v22, v171 : i32 #[overflow = wrapping]; - v25 = hir.bitcast v23 : u32; - v26 = arith.constant 4 : u32; - v27 = arith.mod v25, v26 : u32; - hir.assertz v27 #[code = 250]; - v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v173; - v29 = arith.constant 4 : i32; - v30 = arith.add v171, v29 : i32 #[overflow = wrapping]; - scf.yield v30; + v18 = hir.load_local : i32 #[local = lv0]; + v21 = hir.load_local : i32 #[local = lv1]; + v23 = hir.load_local : felt #[local = lv2]; + v165 = arith.constant 16 : i32; + v20 = arith.add v18, v165 : i32 #[overflow = wrapping]; + v22 = arith.add v20, v21 : i32 #[overflow = wrapping]; + v24 = hir.bitcast v22 : u32; + v141 = arith.constant 4 : u32; + v26 = arith.mod v24, v141 : u32; + hir.assertz v26 #[code = 250]; + v27 = hir.int_to_ptr v24 : ptr; + hir.store v27, v23; + v28 = hir.load_local : i32 #[local = lv1]; + v140 = arith.constant 4 : i32; + v30 = arith.add v28, v140 : i32 #[overflow = wrapping]; + hir.store_local v30 #[local = lv1]; + scf.yield ; }; - v134 = ub.poison felt : felt; - v164 = cf.select v19, v134, v173 : felt; - v182 = ub.poison i32 : i32; - v163 = cf.select v19, v182, v172 : i32; - v132 = arith.constant 1 : u32; - v126 = arith.constant 0 : u32; - v166 = cf.select v19, v126, v132 : u32; - v156 = arith.trunc v166 : i1; - scf.condition v156, v162, v163, v164, v172; + v155 = arith.constant 1 : u32; + v152 = arith.constant 0 : u32; + v160 = cf.select v17, v152, v155 : u32; + v156 = arith.trunc v160 : i1; + scf.condition v156; } do { - ^block39(v174: i32, v175: i32, v176: felt, v177: i32): - scf.yield v174, v175, v176; + ^block35: + scf.yield ; }; - v181 = arith.constant 16 : i32; - v32 = arith.add v170, v181 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/>::from(v170, v32) - v180 = arith.constant 0 : i32; - v34 = hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/intrinsics::felt::from_u32(v180) : felt - hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/miden_base_sys::bindings::output_note::add_asset(v170, v34) - v179 = arith.constant 0 : i32; - v36 = hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/intrinsics::felt::from_u32(v179) : felt - v178 = arith.constant 32 : i32; - v38 = arith.add v170, v178 : i32 #[overflow = wrapping]; - v39 = builtin.global_symbol @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/__stack_pointer : ptr - v40 = hir.bitcast v39 : ptr; - hir.store v40, v38; - builtin.ret v36; + v31 = hir.load_local : i32 #[local = lv0]; + v164 = arith.constant 16 : i32; + v34 = arith.add v31, v164 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/>::from(v31, v34) + v35 = hir.load_local : i32 #[local = lv0]; + v163 = arith.constant 0 : felt; + hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/miden_base_sys::bindings::output_note::add_asset(v35, v163) + v162 = arith.constant 0 : felt; + hir.store_local v162 #[local = lv2]; + v40 = hir.load_local : i32 #[local = lv0]; + v161 = arith.constant 32 : i32; + v42 = arith.add v40, v161 : i32 #[overflow = wrapping]; + v43 = builtin.global_symbol @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/__stack_pointer : ptr + v44 = hir.bitcast v43 : ptr; + hir.store v44, v42; + v45 = hir.load_local : felt #[local = lv2]; + builtin.ret v45; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block15: - v42 = builtin.global_symbol @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/GOT.data.internal.__memory_base : ptr - v43 = hir.bitcast v42 : ptr; - v44 = hir.load v43 : i32; - v45 = arith.constant 1048584 : i32; - v46 = arith.add v44, v45 : i32 #[overflow = wrapping]; - v47 = hir.bitcast v46 : u32; - v48 = hir.int_to_ptr v47 : ptr; - v49 = hir.load v48 : u8; - v41 = arith.constant 0 : i32; - v50 = arith.zext v49 : u32; - v51 = hir.bitcast v50 : i32; - v53 = arith.neq v51, v41 : i1; - scf.if v53{ + v46 = builtin.global_symbol @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/GOT.data.internal.__memory_base : ptr + v47 = hir.bitcast v46 : ptr; + v48 = hir.load v47 : i32; + v171 = arith.constant 1048584 : i32; + v50 = arith.add v48, v171 : i32 #[overflow = wrapping]; + v51 = hir.bitcast v50 : u32; + v52 = hir.int_to_ptr v51 : ptr; + v53 = hir.load v52 : u8; + v170 = arith.constant 0 : i32; + v54 = arith.zext v53 : u32; + v55 = hir.bitcast v54 : i32; + v57 = arith.neq v55, v170 : i1; + scf.if v57{ ^block17: scf.yield ; } else { ^block18: - v54 = builtin.global_symbol @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/GOT.data.internal.__memory_base : ptr - v55 = hir.bitcast v54 : ptr; - v56 = hir.load v55 : i32; + v58 = builtin.global_symbol @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/GOT.data.internal.__memory_base : ptr + v59 = hir.bitcast v58 : ptr; + v60 = hir.load v59 : i32; + hir.store_local v60 #[local = lv0]; hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/__wasm_call_ctors() - v187 = arith.constant 1 : u8; - v189 = arith.constant 1048584 : i32; - v58 = arith.add v56, v189 : i32 #[overflow = wrapping]; - v62 = hir.bitcast v58 : u32; - v63 = hir.int_to_ptr v62 : ptr; - hir.store v63, v187; + v61 = hir.load_local : i32 #[local = lv0]; + v169 = arith.constant 1 : u8; + v174 = arith.constant 1048584 : i32; + v63 = arith.add v61, v174 : i32 #[overflow = wrapping]; + v67 = hir.bitcast v63 : u32; + v68 = hir.int_to_ptr v67 : ptr; + hir.store v68, v169; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::output_note::add_asset(v64: i32, v65: felt) { - ^block19(v64: i32, v65: felt): - v67 = arith.constant 12 : u32; - v66 = hir.bitcast v64 : u32; - v68 = arith.add v66, v67 : u32 #[overflow = checked]; - v69 = arith.constant 4 : u32; - v70 = arith.mod v68, v69 : u32; - hir.assertz v70 #[code = 250]; - v71 = hir.int_to_ptr v68 : ptr; - v72 = hir.load v71 : felt; - v74 = arith.constant 8 : u32; - v73 = hir.bitcast v64 : u32; - v75 = arith.add v73, v74 : u32 #[overflow = checked]; - v193 = arith.constant 4 : u32; - v77 = arith.mod v75, v193 : u32; - hir.assertz v77 #[code = 250]; - v78 = hir.int_to_ptr v75 : ptr; - v79 = hir.load v78 : felt; - v192 = arith.constant 4 : u32; - v80 = hir.bitcast v64 : u32; - v82 = arith.add v80, v192 : u32 #[overflow = checked]; - v191 = arith.constant 4 : u32; - v84 = arith.mod v82, v191 : u32; + private builtin.function @miden_base_sys::bindings::output_note::add_asset(v69: i32, v70: felt) { + ^block19(v69: i32, v70: felt): + hir.store_local v69 #[local = lv0]; + v71 = hir.load_local : i32 #[local = lv0]; + v177 = arith.constant 12 : u32; + v72 = hir.bitcast v71 : u32; + v74 = arith.add v72, v177 : u32 #[overflow = checked]; + v176 = arith.constant 4 : u32; + v76 = arith.mod v74, v176 : u32; + hir.assertz v76 #[code = 250]; + v77 = hir.int_to_ptr v74 : ptr; + v78 = hir.load v77 : felt; + v79 = hir.load_local : i32 #[local = lv0]; + v175 = arith.constant 8 : u32; + v80 = hir.bitcast v79 : u32; + v82 = arith.add v80, v175 : u32 #[overflow = checked]; + v185 = arith.constant 4 : u32; + v84 = arith.mod v82, v185 : u32; hir.assertz v84 #[code = 250]; v85 = hir.int_to_ptr v82 : ptr; v86 = hir.load v85 : felt; - v87 = hir.bitcast v64 : u32; - v190 = arith.constant 4 : u32; - v89 = arith.mod v87, v190 : u32; - hir.assertz v89 #[code = 250]; - v90 = hir.int_to_ptr v87 : ptr; - v91 = hir.load v90 : felt; - hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/miden::output_note::add_asset(v72, v79, v86, v91, v65) + v87 = hir.load_local : i32 #[local = lv0]; + v184 = arith.constant 4 : u32; + v88 = hir.bitcast v87 : u32; + v90 = arith.add v88, v184 : u32 #[overflow = checked]; + v183 = arith.constant 4 : u32; + v92 = arith.mod v90, v183 : u32; + hir.assertz v92 #[code = 250]; + v93 = hir.int_to_ptr v90 : ptr; + v94 = hir.load v93 : felt; + v95 = hir.load_local : i32 #[local = lv0]; + v96 = hir.bitcast v95 : u32; + v182 = arith.constant 4 : u32; + v98 = arith.mod v96, v182 : u32; + hir.assertz v98 #[code = 250]; + v99 = hir.int_to_ptr v96 : ptr; + v100 = hir.load v99 : felt; + hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/miden::protocol::output_note::add_asset(v78, v86, v94, v100, v70) builtin.ret ; }; - private builtin.function @>::from(v92: i32, v93: i32) { - ^block21(v92: i32, v93: i32): - v95 = arith.constant 8 : u32; - v94 = hir.bitcast v93 : u32; - v96 = arith.add v94, v95 : u32 #[overflow = checked]; - v97 = arith.constant 4 : u32; - v98 = arith.mod v96, v97 : u32; - hir.assertz v98 #[code = 250]; - v99 = hir.int_to_ptr v96 : ptr; - v100 = hir.load v99 : i64; - v197 = arith.constant 8 : u32; - v101 = hir.bitcast v92 : u32; - v103 = arith.add v101, v197 : u32 #[overflow = checked]; - v196 = arith.constant 8 : u32; - v105 = arith.mod v103, v196 : u32; - hir.assertz v105 #[code = 250]; - v106 = hir.int_to_ptr v103 : ptr; - hir.store v106, v100; - v107 = hir.bitcast v93 : u32; - v195 = arith.constant 4 : u32; - v109 = arith.mod v107, v195 : u32; - hir.assertz v109 #[code = 250]; - v110 = hir.int_to_ptr v107 : ptr; - v111 = hir.load v110 : i64; - v112 = hir.bitcast v92 : u32; + private builtin.function @>::from(v102: i32, v103: i32) { + ^block21(v102: i32, v103: i32): + hir.store_local v102 #[local = lv0]; + hir.store_local v103 #[local = lv1]; + v104 = hir.load_local : i32 #[local = lv0]; + v105 = hir.load_local : i32 #[local = lv1]; + v187 = arith.constant 8 : u32; + v106 = hir.bitcast v105 : u32; + v108 = arith.add v106, v187 : u32 #[overflow = checked]; + v186 = arith.constant 4 : u32; + v110 = arith.mod v108, v186 : u32; + hir.assertz v110 #[code = 250]; + v111 = hir.int_to_ptr v108 : ptr; + v112 = hir.load v111 : i64; + v195 = arith.constant 8 : u32; + v113 = hir.bitcast v104 : u32; + v115 = arith.add v113, v195 : u32 #[overflow = checked]; v194 = arith.constant 8 : u32; - v114 = arith.mod v112, v194 : u32; - hir.assertz v114 #[code = 250]; - v115 = hir.int_to_ptr v112 : ptr; - hir.store v115, v111; + v117 = arith.mod v115, v194 : u32; + hir.assertz v117 #[code = 250]; + v118 = hir.int_to_ptr v115 : ptr; + hir.store v118, v112; + v119 = hir.load_local : i32 #[local = lv0]; + v120 = hir.load_local : i32 #[local = lv1]; + v121 = hir.bitcast v120 : u32; + v193 = arith.constant 4 : u32; + v123 = arith.mod v121, v193 : u32; + hir.assertz v123 #[code = 250]; + v124 = hir.int_to_ptr v121 : ptr; + v125 = hir.load v124 : i64; + v126 = hir.bitcast v119 : u32; + v192 = arith.constant 8 : u32; + v128 = arith.mod v126, v192 : u32; + hir.assertz v128 #[code = 250]; + v129 = hir.int_to_ptr v126 : ptr; + hir.store v129, v125; builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v116: i32) -> felt { - ^block23(v116: i32): - v117 = hir.bitcast v116 : felt; - builtin.ret v117; - }; - - private builtin.function @miden::output_note::add_asset(v119: felt, v120: felt, v121: felt, v122: felt, v123: felt) { - ^block25(v119: felt, v120: felt, v121: felt, v122: felt, v123: felt): - hir.exec @miden/output_note/add_asset(v119, v120, v121, v122, v123) + private builtin.function @miden::protocol::output_note::add_asset(v130: felt, v131: felt, v132: felt, v133: felt, v134: felt) { + ^block23(v130: felt, v131: felt, v132: felt, v133: felt, v134: felt): + hir.exec @miden/protocol/output_note/add_asset(v130, v131, v132, v133, v134) builtin.ret ; }; @@ -207,8 +220,8 @@ builtin.component miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-n }; public builtin.function @binding() -> felt { - ^block29: - v124 = hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1#binding() : felt - builtin.ret v124; + ^block28: + v135 = hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1#binding() : felt + builtin.ret v135; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.masm index 4557b265a..a69405faf 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.masm @@ -1,16 +1,16 @@ -# mod miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1 +# mod ::"miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> felt - exec.::miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1::init + exec."miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1::rust_sdk_output_note_add_asset_binding::miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1#binding + exec.::"miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1"::rust_sdk_output_note_add_asset_binding::"miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1#binding" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -23,7 +23,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -34,7 +34,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1::rust_sdk_output_note_add_asset_binding +# mod ::"miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1"::rust_sdk_output_note_add_asset_binding @callconv("C") proc __wasm_call_ctors( @@ -50,6 +50,7 @@ proc rust_sdk_output_note_add_asset_binding::bindings::__link_custom_section_des nop end +@locals("3") @callconv("C") proc miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1#binding( @@ -64,9 +65,16 @@ proc miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset nop push.32 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -76,35 +84,74 @@ proc miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset nop trace.240 nop - exec.::miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1::rust_sdk_output_note_add_asset_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1"::rust_sdk_output_note_add_asset_binding::wit_bindgen::rt::run_ctors_once trace.252 nop push.0 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1::rust_sdk_output_note_add_asset_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_sw trace.252 nop push.0 - movup.2 + locaddr.2 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1 while.true + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.16 - dup.2 + movup.2 eq neq dup.0 if.true - swap.1 - drop - push.3735929054 + nop else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.16 - dup.3 + movup.3 u32wrapping_add - dup.2 + movup.2 u32wrapping_add push.4 dup.1 @@ -112,8 +159,6 @@ proc miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset u32mod u32assert assertz - dup.4 - swap.1 u32divmod.4 swap.1 trace.240 @@ -121,70 +166,87 @@ proc miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - movup.2 u32wrapping_add + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.3735929054 - dup.2 - movup.2 - swap.5 - movdn.2 - cdrop - push.3735929054 - dup.2 - dup.4 - swap.2 - swap.1 - cdrop push.1 push.0 - movup.4 + movup.2 cdrop push.1 u32and - movup.4 - swap.1 if.true - movup.3 - drop push.1 else push.0 end end - drop - drop - drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 dup.1 u32wrapping_add - dup.1 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1::rust_sdk_output_note_add_asset_binding::>::from + exec.::"miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1"::rust_sdk_output_note_add_asset_binding::>::from trace.252 nop + locaddr.0 push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1::rust_sdk_output_note_add_asset_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop - dup.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1::rust_sdk_output_note_add_asset_binding::miden_base_sys::bindings::output_note::add_asset + exec.::"miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1"::rust_sdk_output_note_add_asset_binding::miden_base_sys::bindings::output_note::add_asset trace.252 nop push.0 + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1::rust_sdk_output_note_add_asset_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.32 - movup.2 u32wrapping_add push.1114144 u32divmod.4 @@ -194,8 +256,17 @@ proc miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -237,9 +308,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1"::rust_sdk_output_note_add_asset_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1::rust_sdk_output_note_add_asset_binding::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -270,13 +357,30 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("2") @callconv("C") proc miden_base_sys::bindings::output_note::add_asset( i32, felt ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.1 + swap.1 add u32assert push.4 @@ -292,8 +396,16 @@ proc miden_base_sys::bindings::output_note::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.2 + swap.1 add u32assert push.4 @@ -309,8 +421,16 @@ proc miden_base_sys::bindings::output_note::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.3 + swap.1 add u32assert push.4 @@ -326,7 +446,14 @@ proc miden_base_sys::bindings::output_note::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop - movup.3 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -344,18 +471,51 @@ proc miden_base_sys::bindings::output_note::add_asset( swap.2 trace.240 nop - exec.::miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1::rust_sdk_output_note_add_asset_binding::miden::output_note::add_asset + exec.::"miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1"::rust_sdk_output_note_add_asset_binding::"miden::protocol::output_note::add_asset" trace.252 nop end +@locals("2") @callconv("C") -proc >::from( +proc >::from( i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.2 + swap.1 add u32assert push.4 @@ -373,7 +533,7 @@ proc felt - nop -end - -@callconv("C") -proc miden::output_note::add_asset(felt, felt, felt, felt, felt) +proc miden::protocol::output_note::add_asset(felt, felt, felt, felt, felt) trace.240 nop - exec.::miden::output_note::add_asset + exec.::miden::protocol::output_note::add_asset trace.252 nop end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.wat index 36da73908..989018555 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.wat @@ -59,7 +59,7 @@ local.get 0 i32.const 16 i32.add - call $>::from + call $>::from local.get 0 i32.const 0 call $intrinsics::felt::from_u32 @@ -101,9 +101,9 @@ local.get 0 f32.load local.get 1 - call $miden::output_note::add_asset + call $miden::protocol::output_note::add_asset ) - (func $>::from (;5;) (type 3) (param i32 i32) + (func $>::from (;5;) (type 3) (param i32 i32) local.get 0 local.get 1 i64.load offset=8 align=4 @@ -116,11 +116,11 @@ (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) unreachable ) - (func $miden::output_note::add_asset (;7;) (type 5) (param f32 f32 f32 f32 f32) + (func $miden::protocol::output_note::add_asset (;7;) (type 5) (param f32 f32 f32 f32 f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "Mrust_sdk_output_note_add_asset_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "Mrust_sdk_output_note_add_asset_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.hir index cc91673fd..34811f17d 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.hir @@ -12,76 +12,78 @@ builtin.component miden:rust-sdk-output-note-create-binding/rust-sdk-output-note private builtin.function @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1#binding() -> felt { ^block9: - v3 = builtin.global_symbol @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/__stack_pointer : ptr - v4 = hir.bitcast v3 : ptr; - v5 = hir.load v4 : i32; - v6 = arith.constant 32 : i32; - v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; - v8 = builtin.global_symbol @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/__stack_pointer : ptr - v9 = hir.bitcast v8 : ptr; - hir.store v9, v7; + v1 = builtin.global_symbol @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v153 = arith.constant 32 : i32; + v5 = arith.sub v3, v153 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/wit_bindgen::rt::run_ctors_once() - v1 = arith.constant 0 : i32; - v12 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/intrinsics::felt::from_u32(v1) : felt - v202 = arith.constant 0 : i32; - v182, v183, v184, v185 = scf.while v202, v7, v12 : i32, i32, felt, i32 { - ^block38(v186: i32, v187: i32, v188: felt): - v201 = arith.constant 0 : i32; - v31 = arith.constant 16 : i32; - v15 = arith.eq v186, v31 : i1; - v16 = arith.zext v15 : u32; - v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v201 : i1; - v177 = scf.if v19 : i32 { - ^block37: - v148 = ub.poison i32 : i32; - scf.yield v148; + v152 = arith.constant 0 : i32; + hir.store_local v152 #[local = lv1]; + v148 = arith.constant 0 : felt; + hir.store_local v148 #[local = lv2]; + scf.while { + ^block12: + v11 = hir.load_local : i32 #[local = lv1]; + v173 = arith.constant 0 : i32; + v156 = arith.constant 16 : i32; + v13 = arith.eq v11, v156 : i1; + v14 = arith.zext v13 : u32; + v15 = hir.bitcast v14 : i32; + v17 = arith.neq v15, v173 : i1; + scf.if v17{ + ^block36: + scf.yield ; } else { ^block14: - v200 = arith.constant 16 : i32; - v22 = arith.add v187, v200 : i32 #[overflow = wrapping]; - v23 = arith.add v22, v186 : i32 #[overflow = wrapping]; - v25 = hir.bitcast v23 : u32; - v26 = arith.constant 4 : u32; - v27 = arith.mod v25, v26 : u32; - hir.assertz v27 #[code = 250]; - v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v188; - v29 = arith.constant 4 : i32; - v30 = arith.add v186, v29 : i32 #[overflow = wrapping]; - scf.yield v30; + v18 = hir.load_local : i32 #[local = lv0]; + v21 = hir.load_local : i32 #[local = lv1]; + v23 = hir.load_local : felt #[local = lv2]; + v172 = arith.constant 16 : i32; + v20 = arith.add v18, v172 : i32 #[overflow = wrapping]; + v22 = arith.add v20, v21 : i32 #[overflow = wrapping]; + v24 = hir.bitcast v22 : u32; + v150 = arith.constant 4 : u32; + v26 = arith.mod v24, v150 : u32; + hir.assertz v26 #[code = 250]; + v27 = hir.int_to_ptr v24 : ptr; + hir.store v27, v23; + v28 = hir.load_local : i32 #[local = lv1]; + v149 = arith.constant 4 : i32; + v30 = arith.add v28, v149 : i32 #[overflow = wrapping]; + hir.store_local v30 #[local = lv1]; + scf.yield ; }; - v149 = ub.poison felt : felt; - v179 = cf.select v19, v149, v188 : felt; - v199 = ub.poison i32 : i32; - v178 = cf.select v19, v199, v187 : i32; - v147 = arith.constant 1 : u32; - v141 = arith.constant 0 : u32; - v181 = cf.select v19, v141, v147 : u32; - v171 = arith.trunc v181 : i1; - scf.condition v171, v177, v178, v179, v187; + v163 = arith.constant 1 : u32; + v160 = arith.constant 0 : u32; + v168 = cf.select v17, v160, v163 : u32; + v164 = arith.trunc v168 : i1; + scf.condition v164; } do { - ^block39(v189: i32, v190: i32, v191: felt, v192: i32): - scf.yield v189, v190, v191; + ^block35: + scf.yield ; }; - v198 = arith.constant 16 : i32; - v32 = arith.add v185, v198 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/>::from(v185, v32) - v197 = arith.constant 0 : i32; - v34 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/intrinsics::felt::from_u32(v197) : felt - v196 = arith.constant 0 : i32; - v36 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/intrinsics::felt::from_u32(v196) : felt - v195 = arith.constant 0 : i32; - v38 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/intrinsics::felt::from_u32(v195) : felt - v194 = arith.constant 0 : i32; - v40 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/intrinsics::felt::from_u32(v194) : felt - v41 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/miden_base_sys::bindings::output_note::create(v34, v38, v36, v40, v185) : felt - v193 = arith.constant 32 : i32; - v43 = arith.add v185, v193 : i32 #[overflow = wrapping]; + v31 = hir.load_local : i32 #[local = lv0]; + v171 = arith.constant 16 : i32; + v34 = arith.add v31, v171 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/>::from(v31, v34) + v39 = hir.load_local : i32 #[local = lv0]; + v147 = arith.constant 1 : felt; + v170 = arith.constant 0 : felt; + v40 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/miden_base_sys::bindings::output_note::create(v170, v147, v39) : felt + hir.store_local v40 #[local = lv2]; + v41 = hir.load_local : i32 #[local = lv0]; + v169 = arith.constant 32 : i32; + v43 = arith.add v41, v169 : i32 #[overflow = wrapping]; v44 = builtin.global_symbol @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/__stack_pointer : ptr v45 = hir.bitcast v44 : ptr; hir.store v45, v43; - builtin.ret v41; + v46 = hir.load_local : felt #[local = lv2]; + builtin.ret v46; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { @@ -89,15 +91,15 @@ builtin.component miden:rust-sdk-output-note-create-binding/rust-sdk-output-note v47 = builtin.global_symbol @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/GOT.data.internal.__memory_base : ptr v48 = hir.bitcast v47 : ptr; v49 = hir.load v48 : i32; - v50 = arith.constant 1048584 : i32; - v51 = arith.add v49, v50 : i32 #[overflow = wrapping]; + v178 = arith.constant 1048584 : i32; + v51 = arith.add v49, v178 : i32 #[overflow = wrapping]; v52 = hir.bitcast v51 : u32; v53 = hir.int_to_ptr v52 : ptr; v54 = hir.load v53 : u8; - v46 = arith.constant 0 : i32; + v177 = arith.constant 0 : i32; v55 = arith.zext v54 : u32; v56 = hir.bitcast v55 : i32; - v58 = arith.neq v56, v46 : i1; + v58 = arith.neq v56, v177 : i1; scf.if v58{ ^block17: scf.yield ; @@ -106,97 +108,104 @@ builtin.component miden:rust-sdk-output-note-create-binding/rust-sdk-output-note v59 = builtin.global_symbol @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/GOT.data.internal.__memory_base : ptr v60 = hir.bitcast v59 : ptr; v61 = hir.load v60 : i32; + hir.store_local v61 #[local = lv0]; hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/__wasm_call_ctors() - v204 = arith.constant 1 : u8; - v206 = arith.constant 1048584 : i32; - v63 = arith.add v61, v206 : i32 #[overflow = wrapping]; - v67 = hir.bitcast v63 : u32; - v68 = hir.int_to_ptr v67 : ptr; - hir.store v68, v204; + v62 = hir.load_local : i32 #[local = lv0]; + v176 = arith.constant 1 : u8; + v181 = arith.constant 1048584 : i32; + v64 = arith.add v62, v181 : i32 #[overflow = wrapping]; + v68 = hir.bitcast v64 : u32; + v69 = hir.int_to_ptr v68 : ptr; + hir.store v69, v176; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::output_note::create(v69: felt, v70: felt, v71: felt, v72: felt, v73: i32) -> felt { - ^block19(v69: felt, v70: felt, v71: felt, v72: felt, v73: i32): - v76 = arith.constant 12 : u32; - v75 = hir.bitcast v73 : u32; - v77 = arith.add v75, v76 : u32 #[overflow = checked]; - v78 = arith.constant 4 : u32; - v79 = arith.mod v77, v78 : u32; - hir.assertz v79 #[code = 250]; - v80 = hir.int_to_ptr v77 : ptr; - v81 = hir.load v80 : felt; - v83 = arith.constant 8 : u32; - v82 = hir.bitcast v73 : u32; - v84 = arith.add v82, v83 : u32 #[overflow = checked]; - v210 = arith.constant 4 : u32; - v86 = arith.mod v84, v210 : u32; - hir.assertz v86 #[code = 250]; - v87 = hir.int_to_ptr v84 : ptr; - v88 = hir.load v87 : felt; - v209 = arith.constant 4 : u32; - v89 = hir.bitcast v73 : u32; - v91 = arith.add v89, v209 : u32 #[overflow = checked]; - v208 = arith.constant 4 : u32; - v93 = arith.mod v91, v208 : u32; - hir.assertz v93 #[code = 250]; - v94 = hir.int_to_ptr v91 : ptr; - v95 = hir.load v94 : felt; - v96 = hir.bitcast v73 : u32; - v207 = arith.constant 4 : u32; - v98 = arith.mod v96, v207 : u32; - hir.assertz v98 #[code = 250]; - v99 = hir.int_to_ptr v96 : ptr; - v100 = hir.load v99 : felt; - v101 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/miden::output_note::create(v69, v70, v71, v72, v81, v88, v95, v100) : felt - builtin.ret v101; + private builtin.function @miden_base_sys::bindings::output_note::create(v70: felt, v71: felt, v72: i32) -> felt { + ^block19(v70: felt, v71: felt, v72: i32): + hir.store_local v72 #[local = lv2]; + v76 = hir.load_local : i32 #[local = lv2]; + v184 = arith.constant 12 : u32; + v77 = hir.bitcast v76 : u32; + v79 = arith.add v77, v184 : u32 #[overflow = checked]; + v183 = arith.constant 4 : u32; + v81 = arith.mod v79, v183 : u32; + hir.assertz v81 #[code = 250]; + v82 = hir.int_to_ptr v79 : ptr; + v83 = hir.load v82 : felt; + v84 = hir.load_local : i32 #[local = lv2]; + v182 = arith.constant 8 : u32; + v85 = hir.bitcast v84 : u32; + v87 = arith.add v85, v182 : u32 #[overflow = checked]; + v192 = arith.constant 4 : u32; + v89 = arith.mod v87, v192 : u32; + hir.assertz v89 #[code = 250]; + v90 = hir.int_to_ptr v87 : ptr; + v91 = hir.load v90 : felt; + v92 = hir.load_local : i32 #[local = lv2]; + v191 = arith.constant 4 : u32; + v93 = hir.bitcast v92 : u32; + v95 = arith.add v93, v191 : u32 #[overflow = checked]; + v190 = arith.constant 4 : u32; + v97 = arith.mod v95, v190 : u32; + hir.assertz v97 #[code = 250]; + v98 = hir.int_to_ptr v95 : ptr; + v99 = hir.load v98 : felt; + v100 = hir.load_local : i32 #[local = lv2]; + v101 = hir.bitcast v100 : u32; + v189 = arith.constant 4 : u32; + v103 = arith.mod v101, v189 : u32; + hir.assertz v103 #[code = 250]; + v104 = hir.int_to_ptr v101 : ptr; + v105 = hir.load v104 : felt; + v106 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/miden::protocol::output_note::create(v70, v71, v83, v91, v99, v105) : felt + builtin.ret v106; }; - private builtin.function @>::from(v102: i32, v103: i32) { - ^block21(v102: i32, v103: i32): - v105 = arith.constant 8 : u32; - v104 = hir.bitcast v103 : u32; - v106 = arith.add v104, v105 : u32 #[overflow = checked]; - v107 = arith.constant 4 : u32; - v108 = arith.mod v106, v107 : u32; - hir.assertz v108 #[code = 250]; - v109 = hir.int_to_ptr v106 : ptr; - v110 = hir.load v109 : i64; - v214 = arith.constant 8 : u32; - v111 = hir.bitcast v102 : u32; - v113 = arith.add v111, v214 : u32 #[overflow = checked]; - v213 = arith.constant 8 : u32; - v115 = arith.mod v113, v213 : u32; + private builtin.function @>::from(v107: i32, v108: i32) { + ^block21(v107: i32, v108: i32): + hir.store_local v107 #[local = lv0]; + hir.store_local v108 #[local = lv1]; + v109 = hir.load_local : i32 #[local = lv0]; + v110 = hir.load_local : i32 #[local = lv1]; + v194 = arith.constant 8 : u32; + v111 = hir.bitcast v110 : u32; + v113 = arith.add v111, v194 : u32 #[overflow = checked]; + v193 = arith.constant 4 : u32; + v115 = arith.mod v113, v193 : u32; hir.assertz v115 #[code = 250]; v116 = hir.int_to_ptr v113 : ptr; - hir.store v116, v110; - v117 = hir.bitcast v103 : u32; - v212 = arith.constant 4 : u32; - v119 = arith.mod v117, v212 : u32; - hir.assertz v119 #[code = 250]; - v120 = hir.int_to_ptr v117 : ptr; - v121 = hir.load v120 : i64; - v122 = hir.bitcast v102 : u32; - v211 = arith.constant 8 : u32; - v124 = arith.mod v122, v211 : u32; - hir.assertz v124 #[code = 250]; - v125 = hir.int_to_ptr v122 : ptr; - hir.store v125, v121; + v117 = hir.load v116 : i64; + v202 = arith.constant 8 : u32; + v118 = hir.bitcast v109 : u32; + v120 = arith.add v118, v202 : u32 #[overflow = checked]; + v201 = arith.constant 8 : u32; + v122 = arith.mod v120, v201 : u32; + hir.assertz v122 #[code = 250]; + v123 = hir.int_to_ptr v120 : ptr; + hir.store v123, v117; + v124 = hir.load_local : i32 #[local = lv0]; + v125 = hir.load_local : i32 #[local = lv1]; + v126 = hir.bitcast v125 : u32; + v200 = arith.constant 4 : u32; + v128 = arith.mod v126, v200 : u32; + hir.assertz v128 #[code = 250]; + v129 = hir.int_to_ptr v126 : ptr; + v130 = hir.load v129 : i64; + v131 = hir.bitcast v124 : u32; + v199 = arith.constant 8 : u32; + v133 = arith.mod v131, v199 : u32; + hir.assertz v133 #[code = 250]; + v134 = hir.int_to_ptr v131 : ptr; + hir.store v134, v130; builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v126: i32) -> felt { - ^block23(v126: i32): - v127 = hir.bitcast v126 : felt; - builtin.ret v127; - }; - - private builtin.function @miden::output_note::create(v129: felt, v130: felt, v131: felt, v132: felt, v133: felt, v134: felt, v135: felt, v136: felt) -> felt { - ^block25(v129: felt, v130: felt, v131: felt, v132: felt, v133: felt, v134: felt, v135: felt, v136: felt): - v137 = hir.exec @miden/output_note/create(v129, v130, v131, v132, v133, v134, v135, v136) : felt - builtin.ret v137; + private builtin.function @miden::protocol::output_note::create(v135: felt, v136: felt, v137: felt, v138: felt, v139: felt, v140: felt) -> felt { + ^block23(v135: felt, v136: felt, v137: felt, v138: felt, v139: felt, v140: felt): + v141 = hir.exec @miden/protocol/output_note/create(v135, v136, v137, v138, v139, v140) : felt + builtin.ret v141; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -211,8 +220,8 @@ builtin.component miden:rust-sdk-output-note-create-binding/rust-sdk-output-note }; public builtin.function @binding() -> felt { - ^block29: - v139 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1#binding() : felt - builtin.ret v139; + ^block28: + v143 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1#binding() : felt + builtin.ret v143; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.masm index ed2bb0ca4..c56dd63ad 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.masm @@ -1,16 +1,16 @@ -# mod miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1 +# mod ::"miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> felt - exec.::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::init + exec."miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::rust_sdk_output_note_create_binding::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1#binding + exec.::"miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1"::rust_sdk_output_note_create_binding::"miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1#binding" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -23,7 +23,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -34,7 +34,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::rust_sdk_output_note_create_binding +# mod ::"miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1"::rust_sdk_output_note_create_binding @callconv("C") proc __wasm_call_ctors( @@ -50,6 +50,7 @@ proc rust_sdk_output_note_create_binding::bindings::__link_custom_section_descri nop end +@locals("3") @callconv("C") proc miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1#binding( @@ -64,9 +65,16 @@ proc miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-bindi nop push.32 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -76,35 +84,74 @@ proc miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-bindi nop trace.240 nop - exec.::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::rust_sdk_output_note_create_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1"::rust_sdk_output_note_create_binding::wit_bindgen::rt::run_ctors_once trace.252 nop push.0 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::rust_sdk_output_note_create_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_sw trace.252 nop push.0 - movup.2 + locaddr.2 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1 while.true + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.16 - dup.2 + movup.2 eq neq dup.0 if.true - swap.1 - drop - push.3735929054 + nop else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.16 - dup.3 + movup.3 u32wrapping_add - dup.2 + movup.2 u32wrapping_add push.4 dup.1 @@ -112,8 +159,6 @@ proc miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-bindi u32mod u32assert assertz - dup.4 - swap.1 u32divmod.4 swap.1 trace.240 @@ -121,87 +166,86 @@ proc miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-bindi exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - movup.2 u32wrapping_add + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.3735929054 - dup.2 - movup.2 - swap.5 - movdn.2 - cdrop - push.3735929054 - dup.2 - dup.4 - swap.2 - swap.1 - cdrop push.1 push.0 - movup.4 + movup.2 cdrop push.1 u32and - movup.4 - swap.1 if.true - movup.3 - drop push.1 else push.0 end end - drop - drop - drop - push.16 - dup.1 - u32wrapping_add - dup.1 + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::rust_sdk_output_note_create_binding::>::from + exec.::intrinsics::mem::load_sw trace.252 nop - push.0 + push.16 + dup.1 + u32wrapping_add + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::rust_sdk_output_note_create_binding::intrinsics::felt::from_u32 + exec.::"miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1"::rust_sdk_output_note_create_binding::>::from trace.252 nop + locaddr.0 push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::rust_sdk_output_note_create_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop + push.1 push.0 trace.240 nop - exec.::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::rust_sdk_output_note_create_binding::intrinsics::felt::from_u32 + exec.::"miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1"::rust_sdk_output_note_create_binding::miden_base_sys::bindings::output_note::create trace.252 nop + locaddr.2 push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::rust_sdk_output_note_create_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop - dup.4 - swap.1 - swap.3 - swap.2 + locaddr.0 + push.0 swap.1 - swap.4 trace.240 nop - exec.::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::rust_sdk_output_note_create_binding::miden_base_sys::bindings::output_note::create + exec.::intrinsics::mem::load_sw trace.252 nop push.32 - movup.2 u32wrapping_add push.1114144 u32divmod.4 @@ -211,8 +255,17 @@ proc miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-bindi exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -254,9 +307,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1"::rust_sdk_output_note_create_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::rust_sdk_output_note_create_binding::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -287,16 +356,32 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("3") @callconv("C") proc miden_base_sys::bindings::output_note::create( - felt, - felt, felt, felt, i32 ) -> felt + movup.2 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.5 + swap.1 add u32assert push.4 @@ -312,8 +397,16 @@ proc miden_base_sys::bindings::output_note::create( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.6 + swap.1 add u32assert push.4 @@ -329,8 +422,16 @@ proc miden_base_sys::bindings::output_note::create( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.7 + swap.1 add u32assert push.4 @@ -346,7 +447,14 @@ proc miden_base_sys::bindings::output_note::create( exec.::intrinsics::mem::load_felt trace.252 nop - movup.7 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -360,28 +468,59 @@ proc miden_base_sys::bindings::output_note::create( exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - swap.6 - swap.2 + movup.2 + swap.3 + movdn.2 swap.5 swap.1 - swap.7 - swap.3 swap.4 trace.240 nop - exec.::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::rust_sdk_output_note_create_binding::miden::output_note::create + exec.::"miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1"::rust_sdk_output_note_create_binding::"miden::protocol::output_note::create" trace.252 nop end +@locals("2") @callconv("C") -proc >::from( +proc >::from( i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.2 + swap.1 add u32assert push.4 @@ -399,7 +538,7 @@ proc felt - nop -end - -@callconv("C") -proc miden::output_note::create( - felt, - felt, +proc miden::protocol::output_note::create( felt, felt, felt, @@ -468,7 +615,7 @@ proc miden::output_note::create( ) -> felt trace.240 nop - exec.::miden::output_note::create + exec.::miden::protocol::output_note::create trace.252 nop end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.wat index c0e8a0403..63b75faee 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.wat @@ -11,10 +11,10 @@ (core module $main (;0;) (type (;0;) (func)) (type (;1;) (func (result f32))) - (type (;2;) (func (param f32 f32 f32 f32 i32) (result f32))) + (type (;2;) (func (param f32 f32 i32) (result f32))) (type (;3;) (func (param i32 i32))) (type (;4;) (func (param i32) (result f32))) - (type (;5;) (func (param f32 f32 f32 f32 f32 f32 f32 f32) (result f32))) + (type (;5;) (func (param f32 f32 f32 f32 f32 f32) (result f32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -25,7 +25,7 @@ (func $__wasm_call_ctors (;0;) (type 0)) (func $rust_sdk_output_note_create_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) (func $miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1#binding (;2;) (type 1) (result f32) - (local i32 i32 f32 f32) + (local i32 i32 f32) global.get $__stack_pointer i32.const 32 i32.sub @@ -61,18 +61,10 @@ local.get 0 i32.const 16 i32.add - call $>::from + call $>::from i32.const 0 call $intrinsics::felt::from_u32 - local.set 2 - i32.const 0 - call $intrinsics::felt::from_u32 - local.set 3 - local.get 2 - i32.const 0 - call $intrinsics::felt::from_u32 - local.get 3 - i32.const 0 + i32.const 1 call $intrinsics::felt::from_u32 local.get 0 call $miden_base_sys::bindings::output_note::create @@ -101,22 +93,20 @@ i32.store8 end ) - (func $miden_base_sys::bindings::output_note::create (;4;) (type 2) (param f32 f32 f32 f32 i32) (result f32) + (func $miden_base_sys::bindings::output_note::create (;4;) (type 2) (param f32 f32 i32) (result f32) local.get 0 local.get 1 local.get 2 - local.get 3 - local.get 4 f32.load offset=12 - local.get 4 + local.get 2 f32.load offset=8 - local.get 4 + local.get 2 f32.load offset=4 - local.get 4 + local.get 2 f32.load - call $miden::output_note::create + call $miden::protocol::output_note::create ) - (func $>::from (;5;) (type 3) (param i32 i32) + (func $>::from (;5;) (type 3) (param i32 i32) local.get 0 local.get 1 i64.load offset=8 align=4 @@ -129,11 +119,11 @@ (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) unreachable ) - (func $miden::output_note::create (;7;) (type 5) (param f32 f32 f32 f32 f32 f32 f32 f32) (result f32) + (func $miden::protocol::output_note::create (;7;) (type 5) (param f32 f32 f32 f32 f32 f32) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "Grust_sdk_output_note_create_binding\01\0b0.0.1\03\01\01\00\00") + (@custom "rodata,miden_account" (after data) "Grust_sdk_output_note_create_binding\01\0b0.0.1\03\01\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "note-idx" (type $note-idx (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.hir index 180891820..dbadaaf94 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.hir @@ -10,57 +10,66 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- v3 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/GOT.data.internal.__memory_base : ptr v4 = hir.bitcast v3 : ptr; v5 = hir.load v4 : i32; - v6 = arith.constant 1048584 : i32; - v7 = arith.add v5, v6 : i32 #[overflow = wrapping]; - v8 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::alloc(v7, v1, v0) : i32 - builtin.ret v8; + v747 = arith.constant 1048584 : i32; + v7 = arith.add v5, v747 : i32 #[overflow = wrapping]; + v10 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::alloc(v7, v1, v0) : i32 + builtin.ret v10; }; - private builtin.function @__rustc::__rust_dealloc(v9: i32, v10: i32, v11: i32) { - ^block9(v9: i32, v10: i32, v11: i32): + private builtin.function @__rustc::__rust_dealloc(v11: i32, v12: i32, v13: i32) { + ^block9(v11: i32, v12: i32, v13: i32): builtin.ret ; }; - private builtin.function @__rustc::__rust_alloc_zeroed(v12: i32, v13: i32) -> i32 { - ^block11(v12: i32, v13: i32): - v15 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/GOT.data.internal.__memory_base : ptr - v16 = hir.bitcast v15 : ptr; - v17 = hir.load v16 : i32; - v18 = arith.constant 1048584 : i32; - v19 = arith.add v17, v18 : i32 #[overflow = wrapping]; - v20 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::alloc(v19, v13, v12) : i32 - v656 = arith.constant 0 : i32; - v21 = arith.constant 0 : i32; - v22 = arith.eq v20, v21 : i1; - v23 = arith.zext v22 : u32; - v24 = hir.bitcast v23 : i32; - v26 = arith.neq v24, v656 : i1; - scf.if v26{ - ^block13: + private builtin.function @__rustc::__rust_alloc_zeroed(v14: i32, v15: i32) -> i32 { + ^block11(v14: i32, v15: i32): + hir.store_local v14 #[local = lv0]; + hir.store_local v15 #[local = lv1]; + v17 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/GOT.data.internal.__memory_base : ptr + v18 = hir.bitcast v17 : ptr; + v19 = hir.load v18 : i32; + v22 = hir.load_local : i32 #[local = lv1]; + v23 = hir.load_local : i32 #[local = lv0]; + v751 = arith.constant 1048584 : i32; + v21 = arith.add v19, v751 : i32 #[overflow = wrapping]; + v24 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::alloc(v21, v22, v23) : i32 + hir.store_local v24 #[local = lv1]; + v759 = arith.constant 0 : i32; + v754 = arith.constant 0 : i32; + v26 = arith.eq v24, v754 : i1; + v27 = arith.zext v26 : u32; + v28 = hir.bitcast v27 : i32; + v30 = arith.neq v28, v759 : i1; + scf.if v30{ + ^block94: scf.yield ; } else { ^block14: - v654 = arith.constant 0 : i32; - v655 = arith.constant 0 : i32; - v28 = arith.eq v12, v655 : i1; - v29 = arith.zext v28 : u32; - v30 = hir.bitcast v29 : i32; - v32 = arith.neq v30, v654 : i1; - scf.if v32{ - ^block94: + v31 = hir.load_local : i32 #[local = lv0]; + v757 = arith.constant 0 : i32; + v758 = arith.constant 0 : i32; + v33 = arith.eq v31, v758 : i1; + v34 = arith.zext v33 : u32; + v35 = hir.bitcast v34 : i32; + v37 = arith.neq v35, v757 : i1; + scf.if v37{ + ^block93: scf.yield ; } else { ^block15: - v648 = arith.constant 0 : u8; - v35 = hir.bitcast v12 : u32; - v36 = hir.bitcast v20 : u32; - v37 = hir.int_to_ptr v36 : ptr; - hir.mem_set v37, v35, v648; + v38 = hir.load_local : i32 #[local = lv1]; + v40 = hir.load_local : i32 #[local = lv0]; + v749 = arith.constant 0 : u8; + v42 = hir.bitcast v40 : u32; + v43 = hir.bitcast v38 : u32; + v44 = hir.int_to_ptr v43 : ptr; + hir.mem_set v44, v42, v749; scf.yield ; }; scf.yield ; }; - builtin.ret v20; + v45 = hir.load_local : i32 #[local = lv1]; + builtin.ret v45; }; private builtin.function @rust_sdk_output_note_get_assets_binding::bindings::__link_custom_section_describing_imports() { @@ -70,39 +79,45 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- private builtin.function @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1#binding() -> felt { ^block18: - v42 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v43 = hir.bitcast v42 : ptr; - v44 = hir.load v43 : i32; - v45 = arith.constant 16 : i32; - v46 = arith.sub v44, v45 : i32 #[overflow = wrapping]; v47 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr v48 = hir.bitcast v47 : ptr; - hir.store v48, v46; + v49 = hir.load v48 : i32; + v765 = arith.constant 16 : i32; + v51 = arith.sub v49, v765 : i32 #[overflow = wrapping]; + hir.store_local v51 #[local = lv0]; + v52 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v53 = hir.bitcast v52 : ptr; + hir.store v53, v51; hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/wit_bindgen::rt::run_ctors_once() - v40 = arith.constant 0 : i32; - v52 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/intrinsics::felt::from_u32(v40) : felt - v49 = arith.constant 4 : i32; - v50 = arith.add v46, v49 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/miden_base_sys::bindings::output_note::get_assets(v50, v52) - v54 = arith.constant 12 : u32; - v53 = hir.bitcast v46 : u32; - v55 = arith.add v53, v54 : u32 #[overflow = checked]; - v56 = arith.constant 4 : u32; - v57 = arith.mod v55, v56 : u32; - hir.assertz v57 #[code = 250]; - v58 = hir.int_to_ptr v55 : ptr; - v59 = hir.load v58 : i32; - v60 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/intrinsics::felt::from_u32(v59) : felt - v658 = arith.constant 16 : i32; - v659 = arith.constant 4 : i32; - v62 = arith.add v46, v659 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::deallocate(v62, v658, v658) - v657 = arith.constant 16 : i32; - v66 = arith.add v46, v657 : i32 #[overflow = wrapping]; - v67 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v68 = hir.bitcast v67 : ptr; - hir.store v68, v66; - builtin.ret v60; + v54 = hir.load_local : i32 #[local = lv0]; + v761 = arith.constant 0 : felt; + v764 = arith.constant 4 : i32; + v56 = arith.add v54, v764 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/miden_base_sys::bindings::output_note::get_assets(v56, v761) + v59 = hir.load_local : i32 #[local = lv0]; + v763 = arith.constant 12 : u32; + v60 = hir.bitcast v59 : u32; + v62 = arith.add v60, v763 : u32 #[overflow = checked]; + v762 = arith.constant 4 : u32; + v64 = arith.mod v62, v762 : u32; + hir.assertz v64 #[code = 250]; + v65 = hir.int_to_ptr v62 : ptr; + v66 = hir.load v65 : i32; + v67 = hir.bitcast v66 : felt; + hir.store_local v67 #[local = lv1]; + v68 = hir.load_local : i32 #[local = lv0]; + v770 = arith.constant 16 : i32; + v771 = arith.constant 4 : i32; + v70 = arith.add v68, v771 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::deallocate(v70, v770, v770) + v73 = hir.load_local : i32 #[local = lv0]; + v769 = arith.constant 16 : i32; + v75 = arith.add v73, v769 : i32 #[overflow = wrapping]; + v76 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v77 = hir.bitcast v76 : ptr; + hir.store v77, v75; + v78 = hir.load_local : felt #[local = lv1]; + builtin.ret v78; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { @@ -112,820 +127,970 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block22: - v70 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/GOT.data.internal.__memory_base : ptr - v71 = hir.bitcast v70 : ptr; - v72 = hir.load v71 : i32; - v73 = arith.constant 1048588 : i32; - v74 = arith.add v72, v73 : i32 #[overflow = wrapping]; - v75 = hir.bitcast v74 : u32; - v76 = hir.int_to_ptr v75 : ptr; - v77 = hir.load v76 : u8; - v69 = arith.constant 0 : i32; - v78 = arith.zext v77 : u32; - v79 = hir.bitcast v78 : i32; - v81 = arith.neq v79, v69 : i1; - scf.if v81{ + v79 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/GOT.data.internal.__memory_base : ptr + v80 = hir.bitcast v79 : ptr; + v81 = hir.load v80 : i32; + v776 = arith.constant 1048588 : i32; + v83 = arith.add v81, v776 : i32 #[overflow = wrapping]; + v84 = hir.bitcast v83 : u32; + v85 = hir.int_to_ptr v84 : ptr; + v86 = hir.load v85 : u8; + v775 = arith.constant 0 : i32; + v87 = arith.zext v86 : u32; + v88 = hir.bitcast v87 : i32; + v90 = arith.neq v88, v775 : i1; + scf.if v90{ ^block24: scf.yield ; } else { ^block25: - v82 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/GOT.data.internal.__memory_base : ptr - v83 = hir.bitcast v82 : ptr; - v84 = hir.load v83 : i32; + v91 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/GOT.data.internal.__memory_base : ptr + v92 = hir.bitcast v91 : ptr; + v93 = hir.load v92 : i32; + hir.store_local v93 #[local = lv0]; hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__wasm_call_ctors() - v661 = arith.constant 1 : u8; - v663 = arith.constant 1048588 : i32; - v86 = arith.add v84, v663 : i32 #[overflow = wrapping]; - v90 = hir.bitcast v86 : u32; - v91 = hir.int_to_ptr v90 : ptr; - hir.store v91, v661; + v94 = hir.load_local : i32 #[local = lv0]; + v774 = arith.constant 1 : u8; + v779 = arith.constant 1048588 : i32; + v96 = arith.add v94, v779 : i32 #[overflow = wrapping]; + v100 = hir.bitcast v96 : u32; + v101 = hir.int_to_ptr v100 : ptr; + hir.store v101, v774; scf.yield ; }; builtin.ret ; }; - private builtin.function @::alloc(v92: i32, v93: i32, v94: i32) -> i32 { - ^block26(v92: i32, v93: i32, v94: i32): - v97 = arith.constant 16 : i32; - v96 = arith.constant 0 : i32; - v665 = arith.constant 16 : u32; - v99 = hir.bitcast v93 : u32; - v101 = arith.gt v99, v665 : i1; - v102 = arith.zext v101 : u32; - v103 = hir.bitcast v102 : i32; - v105 = arith.neq v103, v96 : i1; - v106 = cf.select v105, v93, v97 : i32; - v705 = arith.constant 0 : i32; - v107 = arith.constant -1 : i32; - v108 = arith.add v106, v107 : i32 #[overflow = wrapping]; - v109 = arith.band v106, v108 : i32; - v111 = arith.neq v109, v705 : i1; - v674, v675 = scf.if v111 : i32, u32 { - ^block100: - v666 = arith.constant 0 : u32; - v670 = ub.poison i32 : i32; - scf.yield v670, v666; + private builtin.function @::alloc(v102: i32, v103: i32, v104: i32) -> i32 { + ^block26(v102: i32, v103: i32, v104: i32): + hir.store_local v102 #[local = lv0]; + hir.store_local v103 #[local = lv1]; + hir.store_local v104 #[local = lv2]; + v106 = hir.load_local : i32 #[local = lv1]; + v787 = arith.constant 16 : i32; + v786 = arith.constant 0 : i32; + v782 = arith.constant 16 : u32; + v110 = hir.bitcast v106 : u32; + v112 = arith.gt v110, v782 : i1; + v113 = arith.zext v112 : u32; + v114 = hir.bitcast v113 : i32; + v116 = arith.neq v114, v786 : i1; + v117 = cf.select v116, v106, v787 : i32; + hir.store_local v117 #[local = lv3]; + v118 = hir.load_local : i32 #[local = lv3]; + v830 = arith.constant 0 : i32; + v785 = arith.constant -1 : i32; + v120 = arith.add v118, v785 : i32 #[overflow = wrapping]; + v121 = arith.band v117, v120 : i32; + v123 = arith.neq v121, v830 : i1; + v808, v809 = scf.if v123 : i32, u32 { + ^block101: + v800 = arith.constant 0 : u32; + v804 = ub.poison i32 : i32; + scf.yield v804, v800; } else { ^block29: - v113 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::max(v93, v106) : i32 - v704 = arith.constant 0 : i32; - v112 = arith.constant -2147483648 : i32; - v114 = arith.sub v112, v113 : i32 #[overflow = wrapping]; - v116 = hir.bitcast v114 : u32; - v115 = hir.bitcast v94 : u32; - v117 = arith.gt v115, v116 : i1; - v118 = arith.zext v117 : u32; - v119 = hir.bitcast v118 : i32; - v121 = arith.neq v119, v704 : i1; - v689 = scf.if v121 : i32 { - ^block99: - v703 = ub.poison i32 : i32; - scf.yield v703; + v124 = hir.load_local : i32 #[local = lv2]; + v126 = hir.load_local : i32 #[local = lv1]; + v127 = hir.load_local : i32 #[local = lv3]; + v128 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::max(v126, v127) : i32 + hir.store_local v128 #[local = lv1]; + v829 = arith.constant 0 : i32; + v784 = arith.constant -2147483648 : i32; + v129 = arith.sub v784, v128 : i32 #[overflow = wrapping]; + v131 = hir.bitcast v129 : u32; + v130 = hir.bitcast v124 : u32; + v132 = arith.gt v130, v131 : i1; + v133 = arith.zext v132 : u32; + v134 = hir.bitcast v133 : i32; + v136 = arith.neq v134, v829 : i1; + v814 = scf.if v136 : i32 { + ^block100: + v828 = ub.poison i32 : i32; + scf.yield v828; } else { ^block30: - v701 = arith.constant 0 : i32; - v127 = arith.sub v701, v113 : i32 #[overflow = wrapping]; - v702 = arith.constant -1 : i32; - v123 = arith.add v94, v113 : i32 #[overflow = wrapping]; - v125 = arith.add v123, v702 : i32 #[overflow = wrapping]; - v128 = arith.band v125, v127 : i32; - v129 = hir.bitcast v92 : u32; - v130 = arith.constant 4 : u32; - v131 = arith.mod v129, v130 : u32; - hir.assertz v131 #[code = 250]; - v132 = hir.int_to_ptr v129 : ptr; - v133 = hir.load v132 : i32; - v700 = arith.constant 0 : i32; - v135 = arith.neq v133, v700 : i1; - scf.if v135{ - ^block98: + v827 = arith.constant 0 : i32; + hir.store_local v827 #[local = lv3]; + v138 = hir.load_local : i32 #[local = lv2]; + v139 = hir.load_local : i32 #[local = lv1]; + v825 = arith.constant 0 : i32; + v145 = arith.sub v825, v139 : i32 #[overflow = wrapping]; + v826 = arith.constant -1 : i32; + v140 = arith.add v138, v139 : i32 #[overflow = wrapping]; + v142 = arith.add v140, v826 : i32 #[overflow = wrapping]; + v146 = arith.band v142, v145 : i32; + hir.store_local v146 #[local = lv2]; + v147 = hir.load_local : i32 #[local = lv0]; + v148 = hir.bitcast v147 : u32; + v783 = arith.constant 4 : u32; + v150 = arith.mod v148, v783 : u32; + hir.assertz v150 #[code = 250]; + v151 = hir.int_to_ptr v148 : ptr; + v152 = hir.load v151 : i32; + v824 = arith.constant 0 : i32; + v154 = arith.neq v152, v824 : i1; + scf.if v154{ + ^block99: scf.yield ; } else { ^block32: - v136 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/intrinsics::mem::heap_base() : i32 - v137 = hir.mem_size : u32; - v143 = hir.bitcast v92 : u32; - v699 = arith.constant 4 : u32; - v145 = arith.mod v143, v699 : u32; - hir.assertz v145 #[code = 250]; - v698 = arith.constant 16 : u32; - v138 = hir.bitcast v137 : i32; - v141 = arith.shl v138, v698 : i32; - v142 = arith.add v136, v141 : i32 #[overflow = wrapping]; - v146 = hir.int_to_ptr v143 : ptr; - hir.store v146, v142; + v155 = hir.load_local : i32 #[local = lv0]; + v156 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/intrinsics::mem::heap_base() : i32 + v157 = hir.mem_size : u32; + v163 = hir.bitcast v155 : u32; + v823 = arith.constant 4 : u32; + v165 = arith.mod v163, v823 : u32; + hir.assertz v165 #[code = 250]; + v822 = arith.constant 16 : u32; + v158 = hir.bitcast v157 : i32; + v161 = arith.shl v158, v822 : i32; + v162 = arith.add v156, v161 : i32 #[overflow = wrapping]; + v166 = hir.int_to_ptr v163 : ptr; + hir.store v166, v162; scf.yield ; }; - v149 = hir.bitcast v92 : u32; - v697 = arith.constant 4 : u32; - v151 = arith.mod v149, v697 : u32; - hir.assertz v151 #[code = 250]; - v152 = hir.int_to_ptr v149 : ptr; - v153 = hir.load v152 : i32; - v695 = arith.constant 0 : i32; - v696 = arith.constant -1 : i32; - v155 = arith.bxor v153, v696 : i32; - v157 = hir.bitcast v155 : u32; - v156 = hir.bitcast v128 : u32; - v158 = arith.gt v156, v157 : i1; - v159 = arith.zext v158 : u32; - v160 = hir.bitcast v159 : i32; - v162 = arith.neq v160, v695 : i1; - v688 = scf.if v162 : i32 { - ^block33: - v694 = arith.constant 0 : i32; - scf.yield v694; + v167 = hir.load_local : i32 #[local = lv2]; + v168 = hir.load_local : i32 #[local = lv0]; + v169 = hir.bitcast v168 : u32; + v821 = arith.constant 4 : u32; + v171 = arith.mod v169, v821 : u32; + hir.assertz v171 #[code = 250]; + v172 = hir.int_to_ptr v169 : ptr; + v173 = hir.load v172 : i32; + hir.store_local v173 #[local = lv4]; + v819 = arith.constant 0 : i32; + v820 = arith.constant -1 : i32; + v175 = arith.bxor v173, v820 : i32; + v177 = hir.bitcast v175 : u32; + v176 = hir.bitcast v167 : u32; + v178 = arith.gt v176, v177 : i1; + v179 = arith.zext v178 : u32; + v180 = hir.bitcast v179 : i32; + v182 = arith.neq v180, v819 : i1; + scf.if v182{ + ^block98: + scf.yield ; } else { ^block34: - v164 = hir.bitcast v92 : u32; - v693 = arith.constant 4 : u32; - v166 = arith.mod v164, v693 : u32; - hir.assertz v166 #[code = 250]; - v163 = arith.add v153, v128 : i32 #[overflow = wrapping]; - v167 = hir.int_to_ptr v164 : ptr; - hir.store v167, v163; - v169 = arith.add v153, v113 : i32 #[overflow = wrapping]; - scf.yield v169; + v183 = hir.load_local : i32 #[local = lv0]; + v184 = hir.load_local : i32 #[local = lv4]; + v185 = hir.load_local : i32 #[local = lv2]; + v187 = hir.bitcast v183 : u32; + v818 = arith.constant 4 : u32; + v189 = arith.mod v187, v818 : u32; + hir.assertz v189 #[code = 250]; + v186 = arith.add v184, v185 : i32 #[overflow = wrapping]; + v190 = hir.int_to_ptr v187 : ptr; + hir.store v190, v186; + v191 = hir.load_local : i32 #[local = lv4]; + v192 = hir.load_local : i32 #[local = lv1]; + v193 = arith.add v191, v192 : i32 #[overflow = wrapping]; + hir.store_local v193 #[local = lv3]; + scf.yield ; }; - scf.yield v688; + v194 = hir.load_local : i32 #[local = lv3]; + scf.yield v194; }; - v671 = arith.constant 1 : u32; - v692 = arith.constant 0 : u32; - v690 = cf.select v121, v692, v671 : u32; - scf.yield v689, v690; + v805 = arith.constant 1 : u32; + v817 = arith.constant 0 : u32; + v815 = cf.select v136, v817, v805 : u32; + scf.yield v814, v815; }; - v691 = arith.constant 0 : u32; - v687 = arith.eq v675, v691 : i1; - cf.cond_br v687 ^block28, ^block102(v674); + v816 = arith.constant 0 : u32; + v813 = arith.eq v809, v816 : i1; + cf.cond_br v813 ^block28, ^block103(v808); ^block28: ub.unreachable ; - ^block102(v667: i32): - builtin.ret v667; + ^block103(v801: i32): + builtin.ret v801; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { ^block35: - v172 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v172; + v195 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v195; }; - private builtin.function @>::with_capacity(v174: i32) { - ^block39(v174: i32): - v177 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v178 = hir.bitcast v177 : ptr; - v179 = hir.load v178 : i32; - v180 = arith.constant 16 : i32; - v181 = arith.sub v179, v180 : i32 #[overflow = wrapping]; - v182 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v183 = hir.bitcast v182 : ptr; - hir.store v183, v181; - v710 = arith.constant 16 : i32; - v184 = arith.constant 8 : i32; - v185 = arith.add v181, v184 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::with_capacity_in(v185, v710, v710) - v189 = arith.constant 8 : u32; - v188 = hir.bitcast v181 : u32; - v190 = arith.add v188, v189 : u32 #[overflow = checked]; - v709 = arith.constant 8 : u32; - v192 = arith.mod v190, v709 : u32; - hir.assertz v192 #[code = 250]; - v193 = hir.int_to_ptr v190 : ptr; - v194 = hir.load v193 : i64; - v708 = arith.constant 8 : u32; - v196 = hir.bitcast v174 : u32; - v198 = arith.add v196, v708 : u32 #[overflow = checked]; - v199 = arith.constant 4 : u32; - v200 = arith.mod v198, v199 : u32; - hir.assertz v200 #[code = 250]; - v175 = arith.constant 0 : i32; - v201 = hir.int_to_ptr v198 : ptr; - hir.store v201, v175; - v202 = hir.bitcast v174 : u32; - v707 = arith.constant 4 : u32; - v204 = arith.mod v202, v707 : u32; - hir.assertz v204 #[code = 250]; - v205 = hir.int_to_ptr v202 : ptr; - hir.store v205, v194; - v706 = arith.constant 16 : i32; - v207 = arith.add v181, v706 : i32 #[overflow = wrapping]; - v208 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v209 = hir.bitcast v208 : ptr; - hir.store v209, v207; + private builtin.function @>::with_capacity(v197: i32) { + ^block39(v197: i32): + hir.store_local v197 #[local = lv0]; + v198 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v199 = hir.bitcast v198 : ptr; + v200 = hir.load v199 : i32; + v836 = arith.constant 16 : i32; + v202 = arith.sub v200, v836 : i32 #[overflow = wrapping]; + hir.store_local v202 #[local = lv1]; + v203 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v204 = hir.bitcast v203 : ptr; + hir.store v204, v202; + v205 = hir.load_local : i32 #[local = lv1]; + v846 = arith.constant 16 : i32; + v834 = arith.constant 256 : i32; + v835 = arith.constant 8 : i32; + v207 = arith.add v205, v835 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::with_capacity_in(v207, v834, v846, v846) + v211 = hir.load_local : i32 #[local = lv1]; + v833 = arith.constant 8 : u32; + v212 = hir.bitcast v211 : u32; + v214 = arith.add v212, v833 : u32 #[overflow = checked]; + v845 = arith.constant 8 : u32; + v216 = arith.mod v214, v845 : u32; + hir.assertz v216 #[code = 250]; + v217 = hir.int_to_ptr v214 : ptr; + v218 = hir.load v217 : i64; + v219 = hir.load_local : i32 #[local = lv0]; + v844 = arith.constant 8 : u32; + v221 = hir.bitcast v219 : u32; + v223 = arith.add v221, v844 : u32 #[overflow = checked]; + v831 = arith.constant 4 : u32; + v225 = arith.mod v223, v831 : u32; + hir.assertz v225 #[code = 250]; + v832 = arith.constant 0 : i32; + v226 = hir.int_to_ptr v223 : ptr; + hir.store v226, v832; + v227 = hir.load_local : i32 #[local = lv0]; + v229 = hir.bitcast v227 : u32; + v843 = arith.constant 4 : u32; + v231 = arith.mod v229, v843 : u32; + hir.assertz v231 #[code = 250]; + v232 = hir.int_to_ptr v229 : ptr; + hir.store v232, v218; + v233 = hir.load_local : i32 #[local = lv1]; + v842 = arith.constant 16 : i32; + v235 = arith.add v233, v842 : i32 #[overflow = wrapping]; + v236 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v237 = hir.bitcast v236 : ptr; + hir.store v237, v235; builtin.ret ; }; - private builtin.function @::with_capacity_in(v210: i32, v211: i32, v212: i32) { - ^block41(v210: i32, v211: i32, v212: i32): - v214 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v215 = hir.bitcast v214 : ptr; - v216 = hir.load v215 : i32; - v217 = arith.constant 16 : i32; - v218 = arith.sub v216, v217 : i32 #[overflow = wrapping]; - v219 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v220 = hir.bitcast v219 : ptr; - hir.store v220, v218; - v213 = arith.constant 0 : i32; - v223 = arith.constant 256 : i32; - v221 = arith.constant 4 : i32; - v222 = arith.add v218, v221 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::try_allocate_in(v222, v223, v213, v211, v212) - v226 = arith.constant 8 : u32; - v225 = hir.bitcast v218 : u32; - v227 = arith.add v225, v226 : u32 #[overflow = checked]; - v228 = arith.constant 4 : u32; - v229 = arith.mod v227, v228 : u32; - hir.assertz v229 #[code = 250]; - v230 = hir.int_to_ptr v227 : ptr; - v231 = hir.load v230 : i32; - v721 = arith.constant 4 : u32; - v232 = hir.bitcast v218 : u32; - v234 = arith.add v232, v721 : u32 #[overflow = checked]; - v720 = arith.constant 4 : u32; - v236 = arith.mod v234, v720 : u32; - hir.assertz v236 #[code = 250]; - v237 = hir.int_to_ptr v234 : ptr; - v238 = hir.load v237 : i32; - v719 = arith.constant 0 : i32; - v239 = arith.constant 1 : i32; - v240 = arith.neq v238, v239 : i1; - v241 = arith.zext v240 : u32; - v242 = hir.bitcast v241 : i32; - v244 = arith.neq v242, v719 : i1; - cf.cond_br v244 ^block43, ^block44; + private builtin.function @::with_capacity_in(v238: i32, v239: i32, v240: i32, v241: i32) { + ^block41(v238: i32, v239: i32, v240: i32, v241: i32): + hir.store_local v238 #[local = lv0]; + hir.store_local v241 #[local = lv3]; + v242 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v243 = hir.bitcast v242 : ptr; + v244 = hir.load v243 : i32; + v853 = arith.constant 16 : i32; + v246 = arith.sub v244, v853 : i32 #[overflow = wrapping]; + hir.store_local v246 #[local = lv4]; + v247 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v248 = hir.bitcast v247 : ptr; + hir.store v248, v246; + v249 = hir.load_local : i32 #[local = lv4]; + v255 = hir.load_local : i32 #[local = lv3]; + v851 = arith.constant 0 : i32; + v852 = arith.constant 4 : i32; + v251 = arith.add v249, v852 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::try_allocate_in(v251, v239, v851, v240, v255) + v256 = hir.load_local : i32 #[local = lv4]; + v850 = arith.constant 8 : u32; + v257 = hir.bitcast v256 : u32; + v259 = arith.add v257, v850 : u32 #[overflow = checked]; + v849 = arith.constant 4 : u32; + v261 = arith.mod v259, v849 : u32; + hir.assertz v261 #[code = 250]; + v262 = hir.int_to_ptr v259 : ptr; + v263 = hir.load v262 : i32; + hir.store_local v263 #[local = lv3]; + v264 = hir.load_local : i32 #[local = lv4]; + v874 = arith.constant 4 : u32; + v265 = hir.bitcast v264 : u32; + v267 = arith.add v265, v874 : u32 #[overflow = checked]; + v873 = arith.constant 4 : u32; + v269 = arith.mod v267, v873 : u32; + hir.assertz v269 #[code = 250]; + v270 = hir.int_to_ptr v267 : ptr; + v271 = hir.load v270 : i32; + v872 = arith.constant 0 : i32; + v848 = arith.constant 1 : i32; + v273 = arith.neq v271, v848 : i1; + v274 = arith.zext v273 : u32; + v275 = hir.bitcast v274 : i32; + v277 = arith.neq v275, v872 : i1; + cf.cond_br v277 ^block43, ^block44; ^block43: - v253 = arith.constant 12 : u32; - v252 = hir.bitcast v218 : u32; - v254 = arith.add v252, v253 : u32 #[overflow = checked]; - v718 = arith.constant 4 : u32; - v256 = arith.mod v254, v718 : u32; - hir.assertz v256 #[code = 250]; - v257 = hir.int_to_ptr v254 : ptr; - v258 = hir.load v257 : i32; - v717 = arith.constant 4 : u32; - v259 = hir.bitcast v210 : u32; - v261 = arith.add v259, v717 : u32 #[overflow = checked]; - v716 = arith.constant 4 : u32; - v263 = arith.mod v261, v716 : u32; - hir.assertz v263 #[code = 250]; - v264 = hir.int_to_ptr v261 : ptr; - hir.store v264, v258; - v265 = hir.bitcast v210 : u32; - v715 = arith.constant 4 : u32; - v267 = arith.mod v265, v715 : u32; - hir.assertz v267 #[code = 250]; - v268 = hir.int_to_ptr v265 : ptr; - hir.store v268, v231; - v714 = arith.constant 16 : i32; - v270 = arith.add v218, v714 : i32 #[overflow = wrapping]; - v271 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v272 = hir.bitcast v271 : ptr; - hir.store v272, v270; + v287 = hir.load_local : i32 #[local = lv0]; + v288 = hir.load_local : i32 #[local = lv4]; + v847 = arith.constant 12 : u32; + v289 = hir.bitcast v288 : u32; + v291 = arith.add v289, v847 : u32 #[overflow = checked]; + v871 = arith.constant 4 : u32; + v293 = arith.mod v291, v871 : u32; + hir.assertz v293 #[code = 250]; + v294 = hir.int_to_ptr v291 : ptr; + v295 = hir.load v294 : i32; + v870 = arith.constant 4 : u32; + v296 = hir.bitcast v287 : u32; + v298 = arith.add v296, v870 : u32 #[overflow = checked]; + v869 = arith.constant 4 : u32; + v300 = arith.mod v298, v869 : u32; + hir.assertz v300 #[code = 250]; + v301 = hir.int_to_ptr v298 : ptr; + hir.store v301, v295; + v302 = hir.load_local : i32 #[local = lv0]; + v303 = hir.load_local : i32 #[local = lv3]; + v304 = hir.bitcast v302 : u32; + v868 = arith.constant 4 : u32; + v306 = arith.mod v304, v868 : u32; + hir.assertz v306 #[code = 250]; + v307 = hir.int_to_ptr v304 : ptr; + hir.store v307, v303; + v308 = hir.load_local : i32 #[local = lv4]; + v867 = arith.constant 16 : i32; + v310 = arith.add v308, v867 : i32 #[overflow = wrapping]; + v311 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v312 = hir.bitcast v311 : ptr; + hir.store v312, v310; builtin.ret ; ^block44: - v713 = arith.constant 12 : u32; - v245 = hir.bitcast v218 : u32; - v247 = arith.add v245, v713 : u32 #[overflow = checked]; - v712 = arith.constant 4 : u32; - v249 = arith.mod v247, v712 : u32; - hir.assertz v249 #[code = 250]; - v250 = hir.int_to_ptr v247 : ptr; - v251 = hir.load v250 : i32; - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/alloc::raw_vec::handle_error(v231, v251) + v278 = hir.load_local : i32 #[local = lv3]; + v279 = hir.load_local : i32 #[local = lv4]; + v866 = arith.constant 12 : u32; + v280 = hir.bitcast v279 : u32; + v282 = arith.add v280, v866 : u32 #[overflow = checked]; + v865 = arith.constant 4 : u32; + v284 = arith.mod v282, v865 : u32; + hir.assertz v284 #[code = 250]; + v285 = hir.int_to_ptr v282 : ptr; + v286 = hir.load v285 : i32; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/alloc::raw_vec::handle_error(v278, v286) ub.unreachable ; }; - private builtin.function @miden_base_sys::bindings::output_note::get_assets(v273: i32, v274: felt) { - ^block45(v273: i32, v274: felt): - v276 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v277 = hir.bitcast v276 : ptr; - v278 = hir.load v277 : i32; - v279 = arith.constant 16 : i32; - v280 = arith.sub v278, v279 : i32 #[overflow = wrapping]; - v281 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v282 = hir.bitcast v281 : ptr; - hir.store v282, v280; - v283 = arith.constant 4 : i32; - v284 = arith.add v280, v283 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/>::with_capacity(v284) - v288 = arith.constant 8 : u32; - v287 = hir.bitcast v280 : u32; - v289 = arith.add v287, v288 : u32 #[overflow = checked]; - v290 = arith.constant 4 : u32; - v291 = arith.mod v289, v290 : u32; - hir.assertz v291 #[code = 250]; - v292 = hir.int_to_ptr v289 : ptr; - v293 = hir.load v292 : i32; - v722 = arith.constant 2 : u32; - v295 = hir.bitcast v293 : u32; - v297 = arith.shr v295, v722 : u32; - v298 = hir.bitcast v297 : i32; - v299 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/miden::output_note::get_assets(v298, v274) : i32 - v285 = arith.constant 8 : i32; - v286 = arith.add v273, v285 : i32 #[overflow = wrapping]; - v300 = hir.bitcast v286 : u32; - v727 = arith.constant 4 : u32; - v302 = arith.mod v300, v727 : u32; - hir.assertz v302 #[code = 250]; - v303 = hir.int_to_ptr v300 : ptr; - hir.store v303, v299; - v726 = arith.constant 4 : u32; - v304 = hir.bitcast v280 : u32; - v306 = arith.add v304, v726 : u32 #[overflow = checked]; - v725 = arith.constant 4 : u32; - v308 = arith.mod v306, v725 : u32; - hir.assertz v308 #[code = 250]; - v309 = hir.int_to_ptr v306 : ptr; - v310 = hir.load v309 : i64; - v311 = hir.bitcast v273 : u32; - v724 = arith.constant 4 : u32; - v313 = arith.mod v311, v724 : u32; - hir.assertz v313 #[code = 250]; - v314 = hir.int_to_ptr v311 : ptr; - hir.store v314, v310; - v723 = arith.constant 16 : i32; - v316 = arith.add v280, v723 : i32 #[overflow = wrapping]; - v317 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v318 = hir.bitcast v317 : ptr; - hir.store v318, v316; + private builtin.function @miden_base_sys::bindings::output_note::get_assets(v313: i32, v314: felt) { + ^block45(v313: i32, v314: felt): + hir.store_local v313 #[local = lv0]; + hir.store_local v314 #[local = lv1]; + v315 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v316 = hir.bitcast v315 : ptr; + v317 = hir.load v316 : i32; + v881 = arith.constant 16 : i32; + v319 = arith.sub v317, v881 : i32 #[overflow = wrapping]; + hir.store_local v319 #[local = lv2]; + v320 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v321 = hir.bitcast v320 : ptr; + hir.store v321, v319; + v322 = hir.load_local : i32 #[local = lv2]; + v880 = arith.constant 4 : i32; + v324 = arith.add v322, v880 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/>::with_capacity(v324) + v325 = hir.load_local : i32 #[local = lv0]; + v328 = hir.load_local : i32 #[local = lv2]; + v878 = arith.constant 8 : u32; + v329 = hir.bitcast v328 : u32; + v331 = arith.add v329, v878 : u32 #[overflow = checked]; + v877 = arith.constant 4 : u32; + v333 = arith.mod v331, v877 : u32; + hir.assertz v333 #[code = 250]; + v334 = hir.int_to_ptr v331 : ptr; + v335 = hir.load v334 : i32; + v341 = hir.load_local : felt #[local = lv1]; + v876 = arith.constant 2 : u32; + v337 = hir.bitcast v335 : u32; + v339 = arith.shr v337, v876 : u32; + v340 = hir.bitcast v339 : i32; + v342 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/miden::protocol::output_note::get_assets(v340, v341) : i32 + v879 = arith.constant 8 : i32; + v327 = arith.add v325, v879 : i32 #[overflow = wrapping]; + v343 = hir.bitcast v327 : u32; + v891 = arith.constant 4 : u32; + v345 = arith.mod v343, v891 : u32; + hir.assertz v345 #[code = 250]; + v346 = hir.int_to_ptr v343 : ptr; + hir.store v346, v342; + v347 = hir.load_local : i32 #[local = lv0]; + v348 = hir.load_local : i32 #[local = lv2]; + v890 = arith.constant 4 : u32; + v349 = hir.bitcast v348 : u32; + v351 = arith.add v349, v890 : u32 #[overflow = checked]; + v889 = arith.constant 4 : u32; + v353 = arith.mod v351, v889 : u32; + hir.assertz v353 #[code = 250]; + v354 = hir.int_to_ptr v351 : ptr; + v355 = hir.load v354 : i64; + v356 = hir.bitcast v347 : u32; + v888 = arith.constant 4 : u32; + v358 = arith.mod v356, v888 : u32; + hir.assertz v358 #[code = 250]; + v359 = hir.int_to_ptr v356 : ptr; + hir.store v359, v355; + v360 = hir.load_local : i32 #[local = lv2]; + v887 = arith.constant 16 : i32; + v362 = arith.add v360, v887 : i32 #[overflow = wrapping]; + v363 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v364 = hir.bitcast v363 : ptr; + hir.store v364, v362; builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v319: i32) -> felt { - ^block47(v319: i32): - v320 = hir.bitcast v319 : felt; - builtin.ret v320; - }; - - private builtin.function @::alloc_impl(v322: i32, v323: i32, v324: i32, v325: i32) { - ^block49(v322: i32, v323: i32, v324: i32, v325: i32): - v743 = arith.constant 0 : i32; - v326 = arith.constant 0 : i32; - v327 = arith.eq v324, v326 : i1; - v328 = arith.zext v327 : u32; - v329 = hir.bitcast v328 : i32; - v331 = arith.neq v329, v743 : i1; - v739 = scf.if v331 : i32 { + private builtin.function @::alloc_impl(v365: i32, v366: i32, v367: i32, v368: i32) { + ^block47(v365: i32, v366: i32, v367: i32, v368: i32): + hir.store_local v365 #[local = lv0]; + hir.store_local v366 #[local = lv1]; + hir.store_local v367 #[local = lv2]; + hir.store_local v368 #[local = lv3]; + v369 = hir.load_local : i32 #[local = lv2]; + v902 = arith.constant 0 : i32; + v897 = arith.constant 0 : i32; + v371 = arith.eq v369, v897 : i1; + v372 = arith.zext v371 : u32; + v373 = hir.bitcast v372 : i32; + v375 = arith.neq v373, v902 : i1; + scf.if v375{ ^block108: - scf.yield v323; + scf.yield ; } else { - ^block52: + ^block50: hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v742 = arith.constant 0 : i32; - v333 = arith.neq v325, v742 : i1; - v738 = scf.if v333 : i32 { - ^block53: - v335 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__rustc::__rust_alloc_zeroed(v324, v323) : i32 - scf.yield v335; + v376 = hir.load_local : i32 #[local = lv3]; + v901 = arith.constant 0 : i32; + v378 = arith.neq v376, v901 : i1; + scf.if v378{ + ^block51: + v382 = hir.load_local : i32 #[local = lv2]; + v383 = hir.load_local : i32 #[local = lv1]; + v384 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__rustc::__rust_alloc_zeroed(v382, v383) : i32 + hir.store_local v384 #[local = lv1]; + scf.yield ; } else { - ^block54: - v334 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__rustc::__rust_alloc(v324, v323) : i32 - scf.yield v334; + ^block52: + v379 = hir.load_local : i32 #[local = lv2]; + v380 = hir.load_local : i32 #[local = lv1]; + v381 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__rustc::__rust_alloc(v379, v380) : i32 + hir.store_local v381 #[local = lv1]; + scf.yield ; }; - scf.yield v738; + scf.yield ; }; - v339 = arith.constant 4 : u32; - v338 = hir.bitcast v322 : u32; - v340 = arith.add v338, v339 : u32 #[overflow = checked]; - v741 = arith.constant 4 : u32; - v342 = arith.mod v340, v741 : u32; - hir.assertz v342 #[code = 250]; - v343 = hir.int_to_ptr v340 : ptr; - hir.store v343, v324; - v345 = hir.bitcast v322 : u32; - v740 = arith.constant 4 : u32; - v347 = arith.mod v345, v740 : u32; - hir.assertz v347 #[code = 250]; - v348 = hir.int_to_ptr v345 : ptr; - hir.store v348, v739; + v385 = hir.load_local : i32 #[local = lv0]; + v386 = hir.load_local : i32 #[local = lv2]; + v892 = arith.constant 4 : u32; + v387 = hir.bitcast v385 : u32; + v389 = arith.add v387, v892 : u32 #[overflow = checked]; + v900 = arith.constant 4 : u32; + v391 = arith.mod v389, v900 : u32; + hir.assertz v391 #[code = 250]; + v392 = hir.int_to_ptr v389 : ptr; + hir.store v392, v386; + v393 = hir.load_local : i32 #[local = lv0]; + v394 = hir.load_local : i32 #[local = lv1]; + v395 = hir.bitcast v393 : u32; + v899 = arith.constant 4 : u32; + v397 = arith.mod v395, v899 : u32; + hir.assertz v397 #[code = 250]; + v398 = hir.int_to_ptr v395 : ptr; + hir.store v398, v394; builtin.ret ; }; - private builtin.function @::deallocate(v349: i32, v350: i32, v351: i32) { - ^block55(v349: i32, v350: i32, v351: i32): - v353 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v354 = hir.bitcast v353 : ptr; - v355 = hir.load v354 : i32; - v356 = arith.constant 16 : i32; - v357 = arith.sub v355, v356 : i32 #[overflow = wrapping]; - v358 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v359 = hir.bitcast v358 : ptr; - hir.store v359, v357; - v360 = arith.constant 4 : i32; - v361 = arith.add v357, v360 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::current_memory(v361, v349, v350, v351) - v363 = arith.constant 8 : u32; - v362 = hir.bitcast v357 : u32; - v364 = arith.add v362, v363 : u32 #[overflow = checked]; - v365 = arith.constant 4 : u32; - v366 = arith.mod v364, v365 : u32; - hir.assertz v366 #[code = 250]; - v367 = hir.int_to_ptr v364 : ptr; - v368 = hir.load v367 : i32; - v750 = arith.constant 0 : i32; - v352 = arith.constant 0 : i32; - v370 = arith.eq v368, v352 : i1; - v371 = arith.zext v370 : u32; - v372 = hir.bitcast v371 : i32; - v374 = arith.neq v372, v750 : i1; - scf.if v374{ + private builtin.function @::deallocate(v399: i32, v400: i32, v401: i32) { + ^block53(v399: i32, v400: i32, v401: i32): + hir.store_local v401 #[local = lv2]; + v402 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v403 = hir.bitcast v402 : ptr; + v404 = hir.load v403 : i32; + v908 = arith.constant 16 : i32; + v406 = arith.sub v404, v908 : i32 #[overflow = wrapping]; + hir.store_local v406 #[local = lv3]; + v407 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v408 = hir.bitcast v407 : ptr; + hir.store v408, v406; + v409 = hir.load_local : i32 #[local = lv3]; + v414 = hir.load_local : i32 #[local = lv2]; + v907 = arith.constant 4 : i32; + v411 = arith.add v409, v907 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::current_memory(v411, v399, v400, v414) + v415 = hir.load_local : i32 #[local = lv3]; + v906 = arith.constant 8 : u32; + v416 = hir.bitcast v415 : u32; + v418 = arith.add v416, v906 : u32 #[overflow = checked]; + v905 = arith.constant 4 : u32; + v420 = arith.mod v418, v905 : u32; + hir.assertz v420 #[code = 250]; + v421 = hir.int_to_ptr v418 : ptr; + v422 = hir.load v421 : i32; + hir.store_local v422 #[local = lv2]; + v919 = arith.constant 0 : i32; + v913 = arith.constant 0 : i32; + v424 = arith.eq v422, v913 : i1; + v425 = arith.zext v424 : u32; + v426 = hir.bitcast v425 : i32; + v428 = arith.neq v426, v919 : i1; + scf.if v428{ ^block111: scf.yield ; } else { - ^block58: - v749 = arith.constant 4 : u32; - v375 = hir.bitcast v357 : u32; - v377 = arith.add v375, v749 : u32 #[overflow = checked]; - v748 = arith.constant 4 : u32; - v379 = arith.mod v377, v748 : u32; - hir.assertz v379 #[code = 250]; - v380 = hir.int_to_ptr v377 : ptr; - v381 = hir.load v380 : i32; - v383 = arith.constant 12 : u32; - v382 = hir.bitcast v357 : u32; - v384 = arith.add v382, v383 : u32 #[overflow = checked]; - v747 = arith.constant 4 : u32; - v386 = arith.mod v384, v747 : u32; - hir.assertz v386 #[code = 250]; - v387 = hir.int_to_ptr v384 : ptr; - v388 = hir.load v387 : i32; - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::deallocate(v381, v368, v388) + ^block56: + v429 = hir.load_local : i32 #[local = lv3]; + v918 = arith.constant 4 : u32; + v430 = hir.bitcast v429 : u32; + v432 = arith.add v430, v918 : u32 #[overflow = checked]; + v917 = arith.constant 4 : u32; + v434 = arith.mod v432, v917 : u32; + hir.assertz v434 #[code = 250]; + v435 = hir.int_to_ptr v432 : ptr; + v436 = hir.load v435 : i32; + v437 = hir.load_local : i32 #[local = lv2]; + v438 = hir.load_local : i32 #[local = lv3]; + v903 = arith.constant 12 : u32; + v439 = hir.bitcast v438 : u32; + v441 = arith.add v439, v903 : u32 #[overflow = checked]; + v916 = arith.constant 4 : u32; + v443 = arith.mod v441, v916 : u32; + hir.assertz v443 #[code = 250]; + v444 = hir.int_to_ptr v441 : ptr; + v445 = hir.load v444 : i32; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::deallocate(v436, v437, v445) scf.yield ; }; - v746 = arith.constant 16 : i32; - v391 = arith.add v357, v746 : i32 #[overflow = wrapping]; - v392 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v393 = hir.bitcast v392 : ptr; - hir.store v393, v391; + v446 = hir.load_local : i32 #[local = lv3]; + v915 = arith.constant 16 : i32; + v448 = arith.add v446, v915 : i32 #[overflow = wrapping]; + v449 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v450 = hir.bitcast v449 : ptr; + hir.store v450, v448; builtin.ret ; }; - private builtin.function @::current_memory(v394: i32, v395: i32, v396: i32, v397: i32) { - ^block59(v394: i32, v395: i32, v396: i32, v397: i32): - v776 = arith.constant 0 : i32; - v398 = arith.constant 0 : i32; - v402 = arith.eq v397, v398 : i1; - v403 = arith.zext v402 : u32; - v404 = hir.bitcast v403 : i32; - v406 = arith.neq v404, v776 : i1; - v763, v764 = scf.if v406 : i32, i32 { + private builtin.function @::current_memory(v451: i32, v452: i32, v453: i32, v454: i32) { + ^block57(v451: i32, v452: i32, v453: i32, v454: i32): + hir.store_local v451 #[local = lv0]; + hir.store_local v452 #[local = lv1]; + hir.store_local v453 #[local = lv2]; + hir.store_local v454 #[local = lv3]; + v923 = arith.constant 0 : i32; + hir.store_local v923 #[local = lv4]; + v922 = arith.constant 4 : i32; + hir.store_local v922 #[local = lv5]; + v457 = hir.load_local : i32 #[local = lv3]; + v943 = arith.constant 0 : i32; + v944 = arith.constant 0 : i32; + v459 = arith.eq v457, v944 : i1; + v460 = arith.zext v459 : u32; + v461 = hir.bitcast v460 : i32; + v463 = arith.neq v461, v943 : i1; + scf.if v463{ ^block114: - v775 = arith.constant 0 : i32; - v400 = arith.constant 4 : i32; - scf.yield v400, v775; + scf.yield ; } else { - ^block62: - v407 = hir.bitcast v395 : u32; - v442 = arith.constant 4 : u32; - v409 = arith.mod v407, v442 : u32; - hir.assertz v409 #[code = 250]; - v410 = hir.int_to_ptr v407 : ptr; - v411 = hir.load v410 : i32; - v773 = arith.constant 0 : i32; - v774 = arith.constant 0 : i32; - v413 = arith.eq v411, v774 : i1; - v414 = arith.zext v413 : u32; - v415 = hir.bitcast v414 : i32; - v417 = arith.neq v415, v773 : i1; - v761 = scf.if v417 : i32 { + ^block60: + v464 = hir.load_local : i32 #[local = lv1]; + v465 = hir.bitcast v464 : u32; + v931 = arith.constant 4 : u32; + v467 = arith.mod v465, v931 : u32; + hir.assertz v467 #[code = 250]; + v468 = hir.int_to_ptr v465 : ptr; + v469 = hir.load v468 : i32; + hir.store_local v469 #[local = lv6]; + v941 = arith.constant 0 : i32; + v942 = arith.constant 0 : i32; + v471 = arith.eq v469, v942 : i1; + v472 = arith.zext v471 : u32; + v473 = hir.bitcast v472 : i32; + v475 = arith.neq v473, v941 : i1; + scf.if v475{ ^block113: - v772 = arith.constant 0 : i32; - scf.yield v772; + scf.yield ; } else { - ^block63: - v771 = arith.constant 4 : u32; - v418 = hir.bitcast v394 : u32; - v420 = arith.add v418, v771 : u32 #[overflow = checked]; - v770 = arith.constant 4 : u32; - v422 = arith.mod v420, v770 : u32; - hir.assertz v422 #[code = 250]; - v423 = hir.int_to_ptr v420 : ptr; - hir.store v423, v396; - v769 = arith.constant 4 : u32; - v424 = hir.bitcast v395 : u32; - v426 = arith.add v424, v769 : u32 #[overflow = checked]; - v768 = arith.constant 4 : u32; - v428 = arith.mod v426, v768 : u32; - hir.assertz v428 #[code = 250]; - v429 = hir.int_to_ptr v426 : ptr; - v430 = hir.load v429 : i32; - v431 = hir.bitcast v394 : u32; - v767 = arith.constant 4 : u32; - v433 = arith.mod v431, v767 : u32; - hir.assertz v433 #[code = 250]; - v434 = hir.int_to_ptr v431 : ptr; - hir.store v434, v430; - v435 = arith.mul v411, v397 : i32 #[overflow = wrapping]; - scf.yield v435; + ^block61: + v476 = hir.load_local : i32 #[local = lv0]; + v477 = hir.load_local : i32 #[local = lv2]; + v940 = arith.constant 4 : u32; + v478 = hir.bitcast v476 : u32; + v480 = arith.add v478, v940 : u32 #[overflow = checked]; + v939 = arith.constant 4 : u32; + v482 = arith.mod v480, v939 : u32; + hir.assertz v482 #[code = 250]; + v483 = hir.int_to_ptr v480 : ptr; + hir.store v483, v477; + v484 = hir.load_local : i32 #[local = lv0]; + v485 = hir.load_local : i32 #[local = lv1]; + v938 = arith.constant 4 : u32; + v486 = hir.bitcast v485 : u32; + v488 = arith.add v486, v938 : u32 #[overflow = checked]; + v937 = arith.constant 4 : u32; + v490 = arith.mod v488, v937 : u32; + hir.assertz v490 #[code = 250]; + v491 = hir.int_to_ptr v488 : ptr; + v492 = hir.load v491 : i32; + v493 = hir.bitcast v484 : u32; + v936 = arith.constant 4 : u32; + v495 = arith.mod v493, v936 : u32; + hir.assertz v495 #[code = 250]; + v496 = hir.int_to_ptr v493 : ptr; + hir.store v496, v492; + v497 = hir.load_local : i32 #[local = lv6]; + v498 = hir.load_local : i32 #[local = lv3]; + v499 = arith.mul v497, v498 : i32 #[overflow = wrapping]; + hir.store_local v499 #[local = lv4]; + v920 = arith.constant 8 : i32; + hir.store_local v920 #[local = lv5]; + scf.yield ; }; - v436 = arith.constant 8 : i32; - v766 = arith.constant 4 : i32; - v762 = cf.select v417, v766, v436 : i32; - scf.yield v762, v761; + scf.yield ; }; - v439 = arith.add v394, v763 : i32 #[overflow = wrapping]; - v441 = hir.bitcast v439 : u32; - v765 = arith.constant 4 : u32; - v443 = arith.mod v441, v765 : u32; - hir.assertz v443 #[code = 250]; - v444 = hir.int_to_ptr v441 : ptr; - hir.store v444, v764; + v501 = hir.load_local : i32 #[local = lv0]; + v502 = hir.load_local : i32 #[local = lv5]; + v504 = hir.load_local : i32 #[local = lv4]; + v503 = arith.add v501, v502 : i32 #[overflow = wrapping]; + v505 = hir.bitcast v503 : u32; + v935 = arith.constant 4 : u32; + v507 = arith.mod v505, v935 : u32; + hir.assertz v507 #[code = 250]; + v508 = hir.int_to_ptr v505 : ptr; + hir.store v508, v504; builtin.ret ; }; - private builtin.function @::deallocate(v445: i32, v446: i32, v447: i32) { - ^block64(v445: i32, v446: i32, v447: i32): - v778 = arith.constant 0 : i32; - v448 = arith.constant 0 : i32; - v449 = arith.eq v447, v448 : i1; - v450 = arith.zext v449 : u32; - v451 = hir.bitcast v450 : i32; - v453 = arith.neq v451, v778 : i1; - scf.if v453{ - ^block66: + private builtin.function @::deallocate(v509: i32, v510: i32, v511: i32) { + ^block62(v509: i32, v510: i32, v511: i32): + hir.store_local v509 #[local = lv0]; + hir.store_local v510 #[local = lv1]; + hir.store_local v511 #[local = lv2]; + v512 = hir.load_local : i32 #[local = lv2]; + v948 = arith.constant 0 : i32; + v946 = arith.constant 0 : i32; + v514 = arith.eq v512, v946 : i1; + v515 = arith.zext v514 : u32; + v516 = hir.bitcast v515 : i32; + v518 = arith.neq v516, v948 : i1; + scf.if v518{ + ^block64: scf.yield ; } else { - ^block67: - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__rustc::__rust_dealloc(v445, v447, v446) + ^block65: + v519 = hir.load_local : i32 #[local = lv0]; + v520 = hir.load_local : i32 #[local = lv2]; + v521 = hir.load_local : i32 #[local = lv1]; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__rustc::__rust_dealloc(v519, v520, v521) scf.yield ; }; builtin.ret ; }; - private builtin.function @::allocate(v454: i32, v455: i32, v456: i32) { - ^block68(v454: i32, v455: i32, v456: i32): - v458 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v459 = hir.bitcast v458 : ptr; - v460 = hir.load v459 : i32; - v461 = arith.constant 16 : i32; - v462 = arith.sub v460, v461 : i32 #[overflow = wrapping]; - v463 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v464 = hir.bitcast v463 : ptr; - hir.store v464, v462; - v457 = arith.constant 0 : i32; - v465 = arith.constant 8 : i32; - v466 = arith.add v462, v465 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::alloc_impl(v466, v455, v456, v457) - v469 = arith.constant 12 : u32; - v468 = hir.bitcast v462 : u32; - v470 = arith.add v468, v469 : u32 #[overflow = checked]; - v471 = arith.constant 4 : u32; - v472 = arith.mod v470, v471 : u32; - hir.assertz v472 #[code = 250]; - v473 = hir.int_to_ptr v470 : ptr; - v474 = hir.load v473 : i32; - v476 = arith.constant 8 : u32; - v475 = hir.bitcast v462 : u32; - v477 = arith.add v475, v476 : u32 #[overflow = checked]; - v783 = arith.constant 4 : u32; - v479 = arith.mod v477, v783 : u32; - hir.assertz v479 #[code = 250]; - v480 = hir.int_to_ptr v477 : ptr; - v481 = hir.load v480 : i32; - v482 = hir.bitcast v454 : u32; - v782 = arith.constant 4 : u32; - v484 = arith.mod v482, v782 : u32; - hir.assertz v484 #[code = 250]; - v485 = hir.int_to_ptr v482 : ptr; - hir.store v485, v481; - v781 = arith.constant 4 : u32; - v486 = hir.bitcast v454 : u32; - v488 = arith.add v486, v781 : u32 #[overflow = checked]; - v780 = arith.constant 4 : u32; - v490 = arith.mod v488, v780 : u32; - hir.assertz v490 #[code = 250]; - v491 = hir.int_to_ptr v488 : ptr; - hir.store v491, v474; - v779 = arith.constant 16 : i32; - v493 = arith.add v462, v779 : i32 #[overflow = wrapping]; - v494 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v495 = hir.bitcast v494 : ptr; - hir.store v495, v493; + private builtin.function @::allocate(v522: i32, v523: i32, v524: i32) { + ^block66(v522: i32, v523: i32, v524: i32): + hir.store_local v522 #[local = lv0]; + hir.store_local v524 #[local = lv2]; + v525 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v526 = hir.bitcast v525 : ptr; + v527 = hir.load v526 : i32; + v954 = arith.constant 16 : i32; + v529 = arith.sub v527, v954 : i32 #[overflow = wrapping]; + hir.store_local v529 #[local = lv3]; + v530 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v531 = hir.bitcast v530 : ptr; + hir.store v531, v529; + v532 = hir.load_local : i32 #[local = lv3]; + v536 = hir.load_local : i32 #[local = lv2]; + v952 = arith.constant 0 : i32; + v953 = arith.constant 8 : i32; + v534 = arith.add v532, v953 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::alloc_impl(v534, v523, v536, v952) + v538 = hir.load_local : i32 #[local = lv3]; + v951 = arith.constant 12 : u32; + v539 = hir.bitcast v538 : u32; + v541 = arith.add v539, v951 : u32 #[overflow = checked]; + v950 = arith.constant 4 : u32; + v543 = arith.mod v541, v950 : u32; + hir.assertz v543 #[code = 250]; + v544 = hir.int_to_ptr v541 : ptr; + v545 = hir.load v544 : i32; + hir.store_local v545 #[local = lv2]; + v546 = hir.load_local : i32 #[local = lv0]; + v547 = hir.load_local : i32 #[local = lv3]; + v949 = arith.constant 8 : u32; + v548 = hir.bitcast v547 : u32; + v550 = arith.add v548, v949 : u32 #[overflow = checked]; + v964 = arith.constant 4 : u32; + v552 = arith.mod v550, v964 : u32; + hir.assertz v552 #[code = 250]; + v553 = hir.int_to_ptr v550 : ptr; + v554 = hir.load v553 : i32; + v555 = hir.bitcast v546 : u32; + v963 = arith.constant 4 : u32; + v557 = arith.mod v555, v963 : u32; + hir.assertz v557 #[code = 250]; + v558 = hir.int_to_ptr v555 : ptr; + hir.store v558, v554; + v559 = hir.load_local : i32 #[local = lv0]; + v560 = hir.load_local : i32 #[local = lv2]; + v962 = arith.constant 4 : u32; + v561 = hir.bitcast v559 : u32; + v563 = arith.add v561, v962 : u32 #[overflow = checked]; + v961 = arith.constant 4 : u32; + v565 = arith.mod v563, v961 : u32; + hir.assertz v565 #[code = 250]; + v566 = hir.int_to_ptr v563 : ptr; + hir.store v566, v560; + v567 = hir.load_local : i32 #[local = lv3]; + v960 = arith.constant 16 : i32; + v569 = arith.add v567, v960 : i32 #[overflow = wrapping]; + v570 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v571 = hir.bitcast v570 : ptr; + hir.store v571, v569; builtin.ret ; }; - private builtin.function @::try_allocate_in(v496: i32, v497: i32, v498: i32, v499: i32, v500: i32) { - ^block70(v496: i32, v497: i32, v498: i32, v499: i32, v500: i32): - v503 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v504 = hir.bitcast v503 : ptr; - v505 = hir.load v504 : i32; - v506 = arith.constant 16 : i32; - v507 = arith.sub v505, v506 : i32 #[overflow = wrapping]; - v508 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v509 = hir.bitcast v508 : ptr; - hir.store v509, v507; - v519 = hir.bitcast v497 : u32; - v520 = arith.zext v519 : u64; - v521 = hir.bitcast v520 : i64; - v501 = arith.constant 0 : i32; - v514 = arith.sub v501, v499 : i32 #[overflow = wrapping]; - v511 = arith.constant -1 : i32; - v510 = arith.add v499, v500 : i32 #[overflow = wrapping]; - v512 = arith.add v510, v511 : i32 #[overflow = wrapping]; - v515 = arith.band v512, v514 : i32; - v516 = hir.bitcast v515 : u32; - v517 = arith.zext v516 : u64; - v518 = hir.bitcast v517 : i64; - v522 = arith.mul v518, v521 : i64 #[overflow = wrapping]; - v886 = arith.constant 0 : i32; - v523 = arith.constant 32 : i64; - v525 = hir.cast v523 : u32; - v524 = hir.bitcast v522 : u64; - v526 = arith.shr v524, v525 : u64; - v527 = hir.bitcast v526 : i64; - v528 = arith.trunc v527 : i32; - v530 = arith.neq v528, v886 : i1; - v799, v800, v801, v802, v803, v804 = scf.if v530 : i32, i32, i32, i32, i32, u32 { + private builtin.function @::try_allocate_in(v572: i32, v573: i32, v574: i32, v575: i32, v576: i32) { + ^block68(v572: i32, v573: i32, v574: i32, v575: i32, v576: i32): + hir.store_local v572 #[local = lv0]; + hir.store_local v573 #[local = lv1]; + hir.store_local v574 #[local = lv2]; + hir.store_local v575 #[local = lv3]; + hir.store_local v576 #[local = lv4]; + v577 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v578 = hir.bitcast v577 : ptr; + v579 = hir.load v578 : i32; + v973 = arith.constant 16 : i32; + v581 = arith.sub v579, v973 : i32 #[overflow = wrapping]; + hir.store_local v581 #[local = lv5]; + v582 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v583 = hir.bitcast v582 : ptr; + hir.store v583, v581; + v584 = hir.load_local : i32 #[local = lv3]; + v585 = hir.load_local : i32 #[local = lv4]; + v596 = hir.load_local : i32 #[local = lv1]; + v597 = hir.bitcast v596 : u32; + v598 = arith.zext v597 : u64; + v599 = hir.bitcast v598 : i64; + v971 = arith.constant 0 : i32; + v591 = arith.sub v971, v584 : i32 #[overflow = wrapping]; + v972 = arith.constant -1 : i32; + v586 = arith.add v584, v585 : i32 #[overflow = wrapping]; + v588 = arith.add v586, v972 : i32 #[overflow = wrapping]; + v592 = arith.band v588, v591 : i32; + v593 = hir.bitcast v592 : u32; + v594 = arith.zext v593 : u64; + v595 = hir.bitcast v594 : i64; + v600 = arith.mul v595, v599 : i64 #[overflow = wrapping]; + hir.store_local v600 #[local = lv6]; + v1041 = arith.constant 0 : i32; + v970 = arith.constant 32 : i64; + v603 = hir.cast v970 : u32; + v602 = hir.bitcast v600 : u64; + v604 = arith.shr v602, v603 : u64; + v605 = hir.bitcast v604 : i64; + v606 = arith.trunc v605 : i32; + v608 = arith.neq v606, v1041 : i1; + v1006 = scf.if v608 : u32 { ^block118: - v784 = arith.constant 0 : u32; - v791 = ub.poison i32 : i32; - scf.yield v496, v507, v791, v791, v791, v784; + v1002 = arith.constant 0 : u32; + scf.yield v1002; } else { - ^block75: - v531 = arith.trunc v522 : i32; - v885 = arith.constant 0 : i32; - v532 = arith.constant -2147483648 : i32; - v533 = arith.sub v532, v499 : i32 #[overflow = wrapping]; - v535 = hir.bitcast v533 : u32; - v534 = hir.bitcast v531 : u32; - v536 = arith.lte v534, v535 : i1; - v537 = arith.zext v536 : u32; - v538 = hir.bitcast v537 : i32; - v540 = arith.neq v538, v885 : i1; - v847 = scf.if v540 : i32 { - ^block73: - v884 = arith.constant 0 : i32; - v551 = arith.neq v531, v884 : i1; - v846 = scf.if v551 : i32 { - ^block77: - v883 = arith.constant 0 : i32; - v567 = arith.neq v498, v883 : i1; - v845 = scf.if v567 : i32 { - ^block80: - v549 = arith.constant 1 : i32; - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::alloc_impl(v507, v499, v531, v549) - v578 = hir.bitcast v507 : u32; - v619 = arith.constant 4 : u32; - v580 = arith.mod v578, v619 : u32; - hir.assertz v580 #[code = 250]; - v581 = hir.int_to_ptr v578 : ptr; - v582 = hir.load v581 : i32; - scf.yield v582; + ^block73: + v609 = hir.load_local : i64 #[local = lv6]; + v610 = arith.trunc v609 : i32; + hir.store_local v610 #[local = lv4]; + v612 = hir.load_local : i32 #[local = lv3]; + v1040 = arith.constant 0 : i32; + v967 = arith.constant -2147483648 : i32; + v613 = arith.sub v967, v612 : i32 #[overflow = wrapping]; + v615 = hir.bitcast v613 : u32; + v614 = hir.bitcast v610 : u32; + v616 = arith.lte v614, v615 : i1; + v617 = arith.zext v616 : u32; + v618 = hir.bitcast v617 : i32; + v620 = arith.neq v618, v1040 : i1; + scf.if v620{ + ^block71: + v630 = hir.load_local : i32 #[local = lv4]; + v1039 = arith.constant 0 : i32; + v632 = arith.neq v630, v1039 : i1; + scf.if v632{ + ^block75: + v650 = hir.load_local : i32 #[local = lv2]; + v1038 = arith.constant 0 : i32; + v652 = arith.neq v650, v1038 : i1; + scf.if v652{ + ^block78: + v666 = hir.load_local : i32 #[local = lv5]; + v667 = hir.load_local : i32 #[local = lv3]; + v668 = hir.load_local : i32 #[local = lv4]; + v987 = arith.constant 1 : i32; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::alloc_impl(v666, v667, v668, v987) + v670 = hir.load_local : i32 #[local = lv5]; + v671 = hir.bitcast v670 : u32; + v986 = arith.constant 4 : u32; + v673 = arith.mod v671, v986 : u32; + hir.assertz v673 #[code = 250]; + v674 = hir.int_to_ptr v671 : ptr; + v675 = hir.load v674 : i32; + hir.store_local v675 #[local = lv2]; + scf.yield ; } else { - ^block81: - v568 = arith.constant 8 : i32; - v569 = arith.add v507, v568 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::allocate(v569, v499, v531) - v553 = arith.constant 8 : u32; - v570 = hir.bitcast v507 : u32; - v572 = arith.add v570, v553 : u32 #[overflow = checked]; - v882 = arith.constant 4 : u32; - v574 = arith.mod v572, v882 : u32; - hir.assertz v574 #[code = 250]; - v575 = hir.int_to_ptr v572 : ptr; - v576 = hir.load v575 : i32; - scf.yield v576; + ^block79: + v653 = hir.load_local : i32 #[local = lv5]; + v656 = hir.load_local : i32 #[local = lv3]; + v657 = hir.load_local : i32 #[local = lv4]; + v965 = arith.constant 8 : i32; + v655 = arith.add v653, v965 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::allocate(v655, v656, v657) + v658 = hir.load_local : i32 #[local = lv5]; + v985 = arith.constant 8 : u32; + v659 = hir.bitcast v658 : u32; + v661 = arith.add v659, v985 : u32 #[overflow = checked]; + v1037 = arith.constant 4 : u32; + v663 = arith.mod v661, v1037 : u32; + hir.assertz v663 #[code = 250]; + v664 = hir.int_to_ptr v661 : ptr; + v665 = hir.load v664 : i32; + hir.store_local v665 #[local = lv2]; + scf.yield ; }; - v881 = arith.constant 0 : i32; - v585 = arith.neq v845, v881 : i1; - scf.if v585{ - ^block82: - v880 = arith.constant 8 : u32; - v602 = hir.bitcast v496 : u32; - v604 = arith.add v602, v880 : u32 #[overflow = checked]; - v879 = arith.constant 4 : u32; - v606 = arith.mod v604, v879 : u32; - hir.assertz v606 #[code = 250]; - v607 = hir.int_to_ptr v604 : ptr; - hir.store v607, v845; - v878 = arith.constant 4 : u32; - v609 = hir.bitcast v496 : u32; - v611 = arith.add v609, v878 : u32 #[overflow = checked]; - v877 = arith.constant 4 : u32; - v613 = arith.mod v611, v877 : u32; - hir.assertz v613 #[code = 250]; - v614 = hir.int_to_ptr v611 : ptr; - hir.store v614, v497; + v676 = hir.load_local : i32 #[local = lv2]; + v1036 = arith.constant 0 : i32; + v678 = arith.neq v676, v1036 : i1; + scf.if v678{ + ^block80: + v696 = hir.load_local : i32 #[local = lv0]; + v697 = hir.load_local : i32 #[local = lv2]; + v1035 = arith.constant 8 : u32; + v698 = hir.bitcast v696 : u32; + v700 = arith.add v698, v1035 : u32 #[overflow = checked]; + v1034 = arith.constant 4 : u32; + v702 = arith.mod v700, v1034 : u32; + hir.assertz v702 #[code = 250]; + v703 = hir.int_to_ptr v700 : ptr; + hir.store v703, v697; + v704 = hir.load_local : i32 #[local = lv0]; + v705 = hir.load_local : i32 #[local = lv1]; + v1033 = arith.constant 4 : u32; + v706 = hir.bitcast v704 : u32; + v708 = arith.add v706, v1033 : u32 #[overflow = checked]; + v1032 = arith.constant 4 : u32; + v710 = arith.mod v708, v1032 : u32; + hir.assertz v710 #[code = 250]; + v711 = hir.int_to_ptr v708 : ptr; + hir.store v711, v705; + v1031 = arith.constant 0 : i32; + hir.store_local v1031 #[local = lv3]; scf.yield ; } else { - ^block83: - v876 = arith.constant 8 : u32; - v588 = hir.bitcast v496 : u32; - v590 = arith.add v588, v876 : u32 #[overflow = checked]; - v875 = arith.constant 4 : u32; - v592 = arith.mod v590, v875 : u32; - hir.assertz v592 #[code = 250]; - v593 = hir.int_to_ptr v590 : ptr; - hir.store v593, v531; - v874 = arith.constant 4 : u32; - v595 = hir.bitcast v496 : u32; - v597 = arith.add v595, v874 : u32 #[overflow = checked]; - v873 = arith.constant 4 : u32; - v599 = arith.mod v597, v873 : u32; - hir.assertz v599 #[code = 250]; - v600 = hir.int_to_ptr v597 : ptr; - hir.store v600, v499; + ^block81: + v679 = hir.load_local : i32 #[local = lv0]; + v680 = hir.load_local : i32 #[local = lv4]; + v1030 = arith.constant 8 : u32; + v681 = hir.bitcast v679 : u32; + v683 = arith.add v681, v1030 : u32 #[overflow = checked]; + v1029 = arith.constant 4 : u32; + v685 = arith.mod v683, v1029 : u32; + hir.assertz v685 #[code = 250]; + v686 = hir.int_to_ptr v683 : ptr; + hir.store v686, v680; + v687 = hir.load_local : i32 #[local = lv0]; + v688 = hir.load_local : i32 #[local = lv3]; + v1028 = arith.constant 4 : u32; + v689 = hir.bitcast v687 : u32; + v691 = arith.add v689, v1028 : u32 #[overflow = checked]; + v1027 = arith.constant 4 : u32; + v693 = arith.mod v691, v1027 : u32; + hir.assertz v693 #[code = 250]; + v694 = hir.int_to_ptr v691 : ptr; + hir.store v694, v688; + v1026 = arith.constant 1 : i32; + hir.store_local v1026 #[local = lv3]; scf.yield ; }; - v871 = arith.constant 1 : i32; - v872 = arith.constant 0 : i32; - v844 = cf.select v585, v872, v871 : i32; - scf.yield v844; + scf.yield ; } else { - ^block78: - v870 = arith.constant 8 : u32; - v552 = hir.bitcast v496 : u32; - v554 = arith.add v552, v870 : u32 #[overflow = checked]; - v869 = arith.constant 4 : u32; - v556 = arith.mod v554, v869 : u32; - hir.assertz v556 #[code = 250]; - v557 = hir.int_to_ptr v554 : ptr; - hir.store v557, v499; - v868 = arith.constant 4 : u32; - v560 = hir.bitcast v496 : u32; - v562 = arith.add v560, v868 : u32 #[overflow = checked]; - v867 = arith.constant 4 : u32; - v564 = arith.mod v562, v867 : u32; - hir.assertz v564 #[code = 250]; - v866 = arith.constant 0 : i32; - v565 = hir.int_to_ptr v562 : ptr; - hir.store v565, v866; - v865 = arith.constant 0 : i32; - scf.yield v865; + ^block76: + v633 = hir.load_local : i32 #[local = lv0]; + v634 = hir.load_local : i32 #[local = lv3]; + v1025 = arith.constant 8 : u32; + v635 = hir.bitcast v633 : u32; + v637 = arith.add v635, v1025 : u32 #[overflow = checked]; + v1024 = arith.constant 4 : u32; + v639 = arith.mod v637, v1024 : u32; + hir.assertz v639 #[code = 250]; + v640 = hir.int_to_ptr v637 : ptr; + hir.store v640, v634; + v1023 = arith.constant 0 : i32; + hir.store_local v1023 #[local = lv3]; + v642 = hir.load_local : i32 #[local = lv0]; + v1022 = arith.constant 4 : u32; + v644 = hir.bitcast v642 : u32; + v646 = arith.add v644, v1022 : u32 #[overflow = checked]; + v1021 = arith.constant 4 : u32; + v648 = arith.mod v646, v1021 : u32; + hir.assertz v648 #[code = 250]; + v1020 = arith.constant 0 : i32; + v649 = hir.int_to_ptr v646 : ptr; + hir.store v649, v1020; + scf.yield ; }; - scf.yield v846; + scf.yield ; } else { - ^block76: - v864 = ub.poison i32 : i32; - scf.yield v864; + ^block74: + scf.yield ; }; - v859 = arith.constant 0 : u32; - v792 = arith.constant 1 : u32; - v852 = cf.select v540, v792, v859 : u32; - v860 = ub.poison i32 : i32; - v851 = cf.select v540, v507, v860 : i32; - v861 = ub.poison i32 : i32; - v850 = cf.select v540, v496, v861 : i32; - v862 = ub.poison i32 : i32; - v849 = cf.select v540, v862, v507 : i32; - v863 = ub.poison i32 : i32; - v848 = cf.select v540, v863, v496 : i32; - scf.yield v848, v849, v850, v847, v851, v852; + v1019 = arith.constant 0 : u32; + v1004 = arith.constant 1 : u32; + v1012 = cf.select v620, v1004, v1019 : u32; + scf.yield v1012; }; - v805, v806, v807 = scf.index_switch v804 : i32, i32, i32 + scf.index_switch v1006 case 0 { - ^block74: - v858 = arith.constant 4 : u32; - v543 = hir.bitcast v799 : u32; - v545 = arith.add v543, v858 : u32 #[overflow = checked]; - v857 = arith.constant 4 : u32; - v547 = arith.mod v545, v857 : u32; - hir.assertz v547 #[code = 250]; - v856 = arith.constant 0 : i32; - v548 = hir.int_to_ptr v545 : ptr; - hir.store v548, v856; - v855 = arith.constant 1 : i32; - scf.yield v799, v855, v800; + ^block72: + v621 = hir.load_local : i32 #[local = lv0]; + v1018 = arith.constant 4 : u32; + v623 = hir.bitcast v621 : u32; + v625 = arith.add v623, v1018 : u32 #[overflow = checked]; + v1017 = arith.constant 4 : u32; + v627 = arith.mod v625, v1017 : u32; + hir.assertz v627 #[code = 250]; + v1016 = arith.constant 0 : i32; + v628 = hir.int_to_ptr v625 : ptr; + hir.store v628, v1016; + v1015 = arith.constant 1 : i32; + hir.store_local v1015 #[local = lv3]; + scf.yield ; } default { ^block122: - scf.yield v801, v802, v803; + scf.yield ; }; - v618 = hir.bitcast v805 : u32; - v854 = arith.constant 4 : u32; - v620 = arith.mod v618, v854 : u32; - hir.assertz v620 #[code = 250]; - v621 = hir.int_to_ptr v618 : ptr; - hir.store v621, v806; - v853 = arith.constant 16 : i32; - v626 = arith.add v807, v853 : i32 #[overflow = wrapping]; - v627 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v628 = hir.bitcast v627 : ptr; - hir.store v628, v626; + v713 = hir.load_local : i32 #[local = lv0]; + v714 = hir.load_local : i32 #[local = lv3]; + v715 = hir.bitcast v713 : u32; + v1014 = arith.constant 4 : u32; + v717 = arith.mod v715, v1014 : u32; + hir.assertz v717 #[code = 250]; + v718 = hir.int_to_ptr v715 : ptr; + hir.store v718, v714; + v719 = hir.load_local : i32 #[local = lv5]; + v1013 = arith.constant 16 : i32; + v721 = arith.add v719, v1013 : i32 #[overflow = wrapping]; + v722 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v723 = hir.bitcast v722 : ptr; + hir.store v723, v721; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v629: i32, v630: i32) { - ^block84(v629: i32, v630: i32): + private builtin.function @alloc::raw_vec::handle_error(v724: i32, v725: i32) { + ^block82(v724: i32, v725: i32): ub.unreachable ; }; - private builtin.function @::max(v631: i32, v632: i32) -> i32 { - ^block86(v631: i32, v632: i32): - v639 = arith.constant 0 : i32; - v635 = hir.bitcast v632 : u32; - v634 = hir.bitcast v631 : u32; - v636 = arith.gt v634, v635 : i1; - v637 = arith.zext v636 : u32; - v638 = hir.bitcast v637 : i32; - v640 = arith.neq v638, v639 : i1; - v641 = cf.select v640, v631, v632 : i32; - builtin.ret v641; + private builtin.function @::max(v726: i32, v727: i32) -> i32 { + ^block84(v726: i32, v727: i32): + v1042 = arith.constant 0 : i32; + v734 = hir.bitcast v727 : u32; + v733 = hir.bitcast v726 : u32; + v735 = arith.gt v733, v734 : i1; + v736 = arith.zext v735 : u32; + v737 = hir.bitcast v736 : i32; + v739 = arith.neq v737, v1042 : i1; + v740 = cf.select v739, v726, v727 : i32; + builtin.ret v740; }; - private builtin.function @miden::output_note::get_assets(v642: i32, v643: felt) -> i32 { - ^block88(v642: i32, v643: felt): - v644, v645 = hir.exec @miden/output_note/get_assets(v642, v643) : i32, i32 - builtin.ret v644; + private builtin.function @miden::protocol::output_note::get_assets(v741: i32, v742: felt) -> i32 { + ^block86(v741: i32, v742: felt): + v743, v744 = hir.exec @miden/protocol/output_note/get_assets(v741, v742) : i32, i32 + builtin.ret v743; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -940,8 +1105,8 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- }; public builtin.function @binding() -> felt { - ^block92: - v647 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1#binding() : felt - builtin.ret v647; + ^block91: + v746 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1#binding() : felt + builtin.ret v746; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.masm index a1120044e..11b16912b 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.masm @@ -1,16 +1,16 @@ -# mod miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1 +# mod ::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> felt - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::init + exec."miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1#binding + exec.::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::rust_sdk_output_note_get_assets_binding::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1#binding" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -23,7 +23,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -34,7 +34,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding +# mod ::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::rust_sdk_output_note_get_assets_binding @callconv("C") proc __wasm_call_ctors( @@ -43,6 +43,7 @@ proc __wasm_call_ctors( nop end +@locals("2") @callconv("C") proc __rustc::__rust_alloc(i32, i32) -> i32 push.1114148 @@ -59,11 +60,12 @@ proc __rustc::__rust_alloc(i32, i32) -> i32 swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::::alloc + exec.::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::rust_sdk_output_note_get_assets_binding::::alloc trace.252 nop end +@locals("3") @callconv("C") proc __rustc::__rust_dealloc(i32, i32, i32) drop @@ -71,8 +73,25 @@ proc __rustc::__rust_dealloc(i32, i32, i32) drop end +@locals("2") @callconv("C") proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114148 u32divmod.4 swap.1 @@ -81,38 +100,84 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.1048584 + movup.3 u32wrapping_add - dup.1 - swap.2 - swap.3 + movup.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::rust_sdk_output_note_get_assets_binding::::alloc + trace.252 + nop + dup.0 + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::::alloc + exec.::intrinsics::mem::store_sw trace.252 nop push.0 push.0 - dup.2 + movup.2 eq neq if.true - swap.1 - drop + nop else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.0 - dup.3 + movup.2 eq neq if.true - swap.1 - drop + nop else + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 + swap.1 movup.2 - dup.2 push.0 dup.2 push.0 @@ -154,6 +219,14 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 dropw end end + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end @callconv("C") @@ -163,6 +236,7 @@ proc rust_sdk_output_note_get_assets_binding::bindings::__link_custom_section_de nop end +@locals("2") @callconv("C") proc miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1#binding( @@ -177,9 +251,16 @@ proc miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-asse nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -189,25 +270,36 @@ proc miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-asse nop trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::rust_sdk_output_note_get_assets_binding::wit_bindgen::rt::run_ctors_once trace.252 nop + locaddr.0 push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop + push.0 push.4 - dup.2 + movup.2 u32wrapping_add trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::miden_base_sys::bindings::output_note::get_assets + exec.::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::rust_sdk_output_note_get_assets_binding::miden_base_sys::bindings::output_note::get_assets + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.12 - dup.1 + swap.1 add u32assert push.4 @@ -223,25 +315,43 @@ proc miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-asse exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop push.16 push.4 - dup.3 + movup.2 u32wrapping_add dup.1 swap.2 swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::::deallocate + exec.::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::rust_sdk_output_note_get_assets_binding::::deallocate + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.16 - movup.2 u32wrapping_add push.1114144 u32divmod.4 @@ -251,6 +361,14 @@ proc miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-asse exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop end @callconv("C") @@ -260,6 +378,7 @@ proc __rustc::__rust_no_alloc_shim_is_unstable_v2( nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -301,9 +420,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::rust_sdk_output_note_get_assets_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -334,95 +469,221 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("5") @callconv("C") proc ::alloc( i32, i32, i32 ) -> i32 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 push.0 push.16 - dup.4 + dup.3 swap.1 u32gt neq - dup.3 + movup.2 swap.1 cdrop + dup.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.4294967295 - dup.2 + movup.2 u32wrapping_add - dup.2 + movup.2 u32and neq if.true - dropw push.0 push.3735929054 else - movup.2 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::::max + exec.::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::rust_sdk_output_note_get_assets_binding::::max + trace.252 + nop + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw trace.252 nop push.0 push.2147483648 - dup.2 + movup.2 u32wrapping_sub - dup.4 + movup.2 swap.1 u32gt neq dup.0 if.true - movdn.3 - drop - drop - drop push.3735929054 else push.0 - dup.2 - u32wrapping_sub - push.4294967295 - movup.5 - dup.4 - u32wrapping_add - u32wrapping_add - u32and - dup.3 - push.4 - dup.1 + locaddr.3 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.1 push.0 - neq - if.true - nop - else - trace.240 - nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::intrinsics::mem::heap_base - trace.252 - nop - trace.240 - nop + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + dup.1 + u32wrapping_sub + push.4294967295 + movup.3 + movup.3 + u32wrapping_add + u32wrapping_add + u32and + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + neq + if.true + nop + else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::rust_sdk_output_note_get_assets_binding::"intrinsics::mem::heap_base" + trace.252 + nop + trace.240 + nop exec.::intrinsics::mem::memory_size trace.252 nop - dup.5 + movup.2 push.4 dup.1 swap.1 @@ -444,7 +705,22 @@ proc ::alloc( trace.252 nop end - dup.3 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -458,31 +734,58 @@ proc ::alloc( exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 push.4294967295 - dup.2 + movup.2 u32xor - dup.3 + movup.2 swap.1 u32gt neq if.true - drop - drop - movdn.2 - drop - drop - push.0 + nop else - movup.4 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 push.4 dup.1 swap.1 u32mod u32assert assertz - movup.2 - dup.2 + movdn.2 u32wrapping_add swap.1 u32divmod.4 @@ -492,9 +795,40 @@ proc ::alloc( exec.::intrinsics::mem::store_sw trace.252 nop - movup.2 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop u32wrapping_add + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end push.1 push.0 @@ -525,10 +859,19 @@ proc intrinsics::mem::heap_base( nop end +@locals("4") @callconv("C") proc >::with_capacity( i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -539,9 +882,16 @@ proc >::with_capacity( nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.1 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -549,20 +899,38 @@ proc >::with_capacity( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 + push.256 push.8 - dup.2 + movup.3 u32wrapping_add - dup.1 + dup.2 + swap.3 swap.2 swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::::with_capacity_in + exec.::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::rust_sdk_output_note_get_assets_binding::::with_capacity_in + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.1 + swap.1 add u32assert push.8 @@ -579,8 +947,16 @@ proc >::with_capacity( trace.252 nop swap.1 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.4 + swap.1 add u32assert push.4 @@ -598,7 +974,14 @@ proc >::with_capacity( exec.::intrinsics::mem::store_sw trace.252 nop - movup.3 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -614,6 +997,14 @@ proc >::with_capacity( exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114144 @@ -626,12 +1017,31 @@ proc >::with_capacity( nop end +@locals("5") @callconv("C") proc ::with_capacity_in( + i32, i32, i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -642,60 +1052,105 @@ proc ::with_capacity_in( nop push.16 u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 + dup.0 + locaddr.4 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::store_sw trace.252 nop - push.0 - push.256 - push.4 - dup.3 - u32wrapping_add - movup.4 - swap.6 - movdn.4 - movup.3 - swap.5 - movdn.3 + push.1114144 + u32divmod.4 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::::try_allocate_in + exec.::intrinsics::mem::store_sw trace.252 nop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.4 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.4 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.4 + movup.3 + u32wrapping_add + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::rust_sdk_output_note_get_assets_binding::::try_allocate_in + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 swap.1 trace.240 nop @@ -708,8 +1163,24 @@ proc ::with_capacity_in( neq neq if.true + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.2 + swap.1 add u32assert push.4 @@ -726,7 +1197,7 @@ proc ::with_capacity_in( trace.252 nop push.4 - dup.4 + movup.2 add u32assert push.4 @@ -742,7 +1213,23 @@ proc ::with_capacity_in( exec.::intrinsics::mem::store_sw trace.252 nop - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 push.4 dup.1 swap.1 @@ -756,6 +1243,14 @@ proc ::with_capacity_in( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114144 @@ -767,10 +1262,24 @@ proc ::with_capacity_in( trace.252 nop else - movup.2 - drop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - movup.2 + swap.1 add u32assert push.4 @@ -789,7 +1298,7 @@ proc ::with_capacity_in( swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::alloc::raw_vec::handle_error + exec.::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::rust_sdk_output_note_get_assets_binding::alloc::raw_vec::handle_error trace.252 nop push.0 @@ -797,11 +1306,28 @@ proc ::with_capacity_in( end end +@locals("3") @callconv("C") proc miden_base_sys::bindings::output_note::get_assets( i32, felt ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -812,9 +1338,16 @@ proc miden_base_sys::bindings::output_note::get_assets( nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.2 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -822,16 +1355,39 @@ proc miden_base_sys::bindings::output_note::get_assets( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 u32wrapping_add trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::>::with_capacity + exec.::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::rust_sdk_output_note_get_assets_binding::>::with_capacity + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.1 + swap.1 add u32assert push.4 @@ -847,19 +1403,25 @@ proc miden_base_sys::bindings::output_note::get_assets( exec.::intrinsics::mem::load_sw trace.252 nop - push.2 + locaddr.1 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.2 + movup.2 swap.1 u32shr - movup.3 - swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::miden::output_note::get_assets + exec.::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::rust_sdk_output_note_get_assets_binding::"miden::protocol::output_note::get_assets" trace.252 nop push.8 - dup.3 + movup.2 u32wrapping_add push.4 dup.1 @@ -874,8 +1436,24 @@ proc miden_base_sys::bindings::output_note::get_assets( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + swap.1 add u32assert push.4 @@ -892,7 +1470,7 @@ proc miden_base_sys::bindings::output_note::get_assets( trace.252 nop swap.1 - movup.3 + movup.2 push.4 dup.1 swap.1 @@ -908,6 +1486,14 @@ proc miden_base_sys::bindings::output_note::get_assets( exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114144 @@ -920,11 +1506,7 @@ proc miden_base_sys::bindings::output_note::get_assets( nop end -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - +@locals("4") @callconv("C") proc ::alloc_impl( i32, @@ -932,44 +1514,151 @@ proc ::alloc_impl( i32, i32 ) + locaddr.0 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 push.0 - dup.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 eq neq if.true - movup.3 - drop - swap.1 + nop else trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::__rustc::__rust_no_alloc_shim_is_unstable_v2 + exec.::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::rust_sdk_output_note_get_assets_binding::__rustc::__rust_no_alloc_shim_is_unstable_v2 trace.252 nop + locaddr.3 push.0 - movup.4 - neq + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + neq if.true + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop swap.1 - dup.2 trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::__rustc::__rust_alloc_zeroed + exec.::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::rust_sdk_output_note_get_assets_binding::__rustc::__rust_alloc_zeroed + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw trace.252 nop else + locaddr.2 + push.0 swap.1 - dup.2 trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::__rustc::__rust_alloc + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::rust_sdk_output_note_get_assets_binding::__rustc::__rust_alloc + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw trace.252 nop end end + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.2 + movup.2 add u32assert push.4 @@ -978,8 +1667,6 @@ proc ::alloc_impl( u32mod u32assert assertz - movup.3 - swap.1 u32divmod.4 swap.1 trace.240 @@ -987,6 +1674,22 @@ proc ::alloc_impl( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop swap.1 push.4 dup.1 @@ -1003,12 +1706,22 @@ proc ::alloc_impl( nop end +@locals("4") @callconv("C") proc ::deallocate( i32, i32, i32 ) + movup.2 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -1019,9 +1732,16 @@ proc ::deallocate( nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.3 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1029,21 +1749,44 @@ proc ::deallocate( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + movup.2 u32wrapping_add swap.1 - swap.4 swap.3 swap.2 swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::::current_memory + exec.::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::rust_sdk_output_note_get_assets_binding::"::current_memory" + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.1 + swap.1 add u32assert push.4 @@ -1059,16 +1802,33 @@ proc ::deallocate( exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.2 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 - dup.2 + push.0 + movup.2 eq neq if.true - drop + nop else + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.2 + swap.1 add u32assert push.4 @@ -1084,8 +1844,24 @@ proc ::deallocate( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.3 + swap.1 add u32assert push.4 @@ -1101,13 +1877,21 @@ proc ::deallocate( exec.::intrinsics::mem::load_sw trace.252 nop - movdn.2 + swap.2 trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::::deallocate + exec.::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::rust_sdk_output_note_get_assets_binding::"::deallocate" trace.252 nop end + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114144 @@ -1120,6 +1904,7 @@ proc ::deallocate( nop end +@locals("7") @callconv("C") proc ::current_memory( i32, @@ -1127,20 +1912,80 @@ proc ::current_memory( i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + locaddr.5 push.0 - dup.5 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 eq neq if.true - movdn.3 - drop - drop - drop - push.0 - push.4 + nop else - dup.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -1154,25 +1999,41 @@ proc ::current_memory( exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.6 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 - dup.2 + push.0 + movup.2 eq neq - dup.0 if.true + nop + else + locaddr.0 + push.0 swap.1 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 push.0 - else + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.3 + movup.2 add u32assert push.4 @@ -1181,8 +2042,6 @@ proc ::current_memory( u32mod u32assert assertz - movup.5 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1190,8 +2049,24 @@ proc ::current_memory( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - movup.4 + swap.1 add u32assert push.4 @@ -1207,7 +2082,7 @@ proc ::current_memory( exec.::intrinsics::mem::load_sw trace.252 nop - dup.3 + swap.1 push.4 dup.1 swap.1 @@ -1221,21 +2096,71 @@ proc ::current_memory( exec.::intrinsics::mem::store_sw trace.252 nop - swap.3 + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop trace.240 nop exec.::intrinsics::i32::wrapping_mul trace.252 nop - movup.2 + locaddr.4 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.8 - push.4 - movup.3 - cdrop end - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movdn.2 u32wrapping_add push.4 dup.1 @@ -1252,38 +2177,110 @@ proc ::current_memory( nop end +@locals("3") @callconv("C") proc ::deallocate( i32, i32, i32 ) + locaddr.0 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 push.0 - dup.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 eq neq if.true - drop - drop - drop + nop else - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::__rustc::__rust_dealloc + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.2 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::rust_sdk_output_note_get_assets_binding::__rustc::__rust_dealloc trace.252 nop end end +@locals("4") @callconv("C") proc ::allocate( i32, i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + swap.1 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -1294,9 +2291,16 @@ proc ::allocate( nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.3 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1304,24 +2308,44 @@ proc ::allocate( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.8 - dup.2 + movup.3 u32wrapping_add - movup.2 - swap.5 - movdn.2 swap.1 swap.3 - swap.4 swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::::alloc_impl + exec.::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::rust_sdk_output_note_get_assets_binding::"::alloc_impl" + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.12 - dup.2 + swap.1 add u32assert push.4 @@ -1337,8 +2361,32 @@ proc ::allocate( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.3 + swap.1 add u32assert push.4 @@ -1354,7 +2402,7 @@ proc ::allocate( exec.::intrinsics::mem::load_sw trace.252 nop - dup.2 + swap.1 push.4 dup.1 swap.1 @@ -1368,6 +2416,22 @@ proc ::allocate( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 movup.2 add @@ -1385,6 +2449,14 @@ proc ::allocate( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114144 @@ -1397,6 +2469,7 @@ proc ::allocate( nop end +@locals("8") @callconv("C") proc ::try_allocate_in( i32, @@ -1405,6 +2478,46 @@ proc ::try_allocate_in( i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -1415,9 +2528,16 @@ proc ::try_allocate_in( nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.5 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1425,14 +2545,37 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop - dup.2 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.0 - dup.7 + dup.4 u32wrapping_sub push.4294967295 - movup.9 - dup.9 + movup.5 + movup.5 u32wrapping_add u32wrapping_add u32and @@ -1442,6 +2585,18 @@ proc ::try_allocate_in( exec.::intrinsics::i64::wrapping_mul trace.252 nop + dup.1 + dup.1 + locaddr.6 + push.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop push.0 push.32 push.0 @@ -1455,64 +2610,118 @@ proc ::try_allocate_in( push.4294967295 u32lte assert - dup.3 - dup.3 + movup.3 + movup.3 movup.2 trace.240 nop - exec.::std::math::u64::shr + exec.::miden::core::math::u64::shr trace.252 nop drop neq if.true - drop - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop push.0 - push.3735929054 - dup.0 - dup.1 - swap.4 - swap.1 - swap.3 - swap.5 else + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 drop + dup.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.2147483648 - dup.7 + movup.2 u32wrapping_sub - dup.2 + movup.2 swap.1 u32lte neq dup.0 if.true + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 - dup.2 neq if.true + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 - movup.6 neq if.true + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.1 - dup.3 - dup.7 - dup.4 + movdn.3 swap.2 trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::::alloc_impl + exec.::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::rust_sdk_output_note_get_assets_binding::"::alloc_impl" + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop - dup.2 push.4 dup.1 swap.1 @@ -1526,20 +2735,59 @@ proc ::try_allocate_in( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop else + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.3 + movup.3 u32wrapping_add - dup.6 - dup.3 - swap.2 + movup.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1"::rust_sdk_output_note_get_assets_binding::"::allocate" + trace.252 + nop + locaddr.5 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::::allocate + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.3 + swap.1 add u32assert push.4 @@ -1555,18 +2803,44 @@ proc ::try_allocate_in( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 - dup.1 neq - dup.0 if.true - movup.7 - movup.4 - drop - drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.5 + movup.2 add u32assert push.4 @@ -1575,8 +2849,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1584,8 +2856,24 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.4 + movup.2 add u32assert push.4 @@ -1594,8 +2882,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.5 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1603,13 +2889,34 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + push.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop else - movup.6 - movup.2 - drop - drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.5 + movup.2 add u32assert push.4 @@ -1618,8 +2925,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.3 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1627,8 +2932,24 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.4 + movup.2 add u32assert push.4 @@ -1637,8 +2958,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.5 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1646,22 +2965,35 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + push.1 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.1 - push.0 - movup.2 - cdrop else - movup.2 - swap.5 - movdn.2 - swap.4 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 swap.1 - drop - drop - drop + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.1 + movup.2 add u32assert push.4 @@ -1670,8 +3002,6 @@ proc ::try_allocate_in( u32mod u32assert assertz - movup.4 - swap.1 u32divmod.4 swap.1 trace.240 @@ -1679,8 +3009,25 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + push.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + swap.1 add u32assert push.4 @@ -1698,68 +3045,27 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop - push.0 - swap.1 - swap.3 - swap.2 - swap.1 end else - swap.1 - drop - movup.3 - drop - movup.3 - drop - movup.3 - drop - push.3735929054 + nop end push.0 push.1 - dup.3 - cdrop - push.3735929054 - dup.3 - dup.5 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.7 - swap.1 - cdrop - push.3735929054 - dup.5 - movup.2 - swap.7 - movdn.2 - cdrop - push.3735929054 movup.2 - swap.7 - movdn.2 - swap.1 - swap.5 cdrop - swap.1 - swap.5 - swap.4 - swap.2 - swap.3 - swap.1 end - movup.5 eq.0 if.true - movup.2 - drop - movup.2 - drop - movup.2 - drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + swap.1 add u32assert push.4 @@ -1778,11 +3084,34 @@ proc ::try_allocate_in( trace.252 nop push.1 + locaddr.3 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop else - drop - drop + nop end + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 push.4 dup.1 swap.1 @@ -1796,6 +3125,14 @@ proc ::try_allocate_in( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114144 @@ -1808,6 +3145,7 @@ proc ::try_allocate_in( nop end +@locals("2") @callconv("C") proc alloc::raw_vec::handle_error(i32, i32) drop @@ -1816,6 +3154,7 @@ proc alloc::raw_vec::handle_error(i32, i32) assert end +@locals("2") @callconv("C") proc ::max( i32, @@ -1831,10 +3170,10 @@ proc ::max( end @callconv("C") -proc miden::output_note::get_assets(i32, felt) -> i32 +proc miden::protocol::output_note::get_assets(i32, felt) -> i32 trace.240 nop - exec.::miden::output_note::get_assets + exec.::miden::protocol::output_note::get_assets trace.252 nop swap.1 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.wat index 1b50173b4..65c3a06fd 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.wat @@ -14,9 +14,9 @@ (type (;4;) (func (param i32 i32 i32) (result i32))) (type (;5;) (func (result i32))) (type (;6;) (func (param i32))) - (type (;7;) (func (param i32 f32))) - (type (;8;) (func (param i32) (result f32))) - (type (;9;) (func (param i32 i32 i32 i32))) + (type (;7;) (func (param i32 i32 i32 i32))) + (type (;8;) (func (param i32 f32))) + (type (;9;) (func (param i32) (result f32))) (type (;10;) (func (param i32 i32 i32 i32 i32))) (type (;11;) (func (param i32 i32))) (type (;12;) (func (param i32 f32) (result i32))) @@ -195,6 +195,7 @@ local.get 1 i32.const 8 i32.add + i32.const 256 i32.const 16 i32.const 16 call $::with_capacity_in @@ -212,49 +213,49 @@ i32.add global.set $__stack_pointer ) - (func $::with_capacity_in (;11;) (type 2) (param i32 i32 i32) + (func $::with_capacity_in (;11;) (type 7) (param i32 i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 i32.sub - local.tee 3 + local.tee 4 global.set $__stack_pointer - local.get 3 + local.get 4 i32.const 4 i32.add - i32.const 256 - i32.const 0 local.get 1 + i32.const 0 local.get 2 - call $::try_allocate_in local.get 3 + call $::try_allocate_in + local.get 4 i32.load offset=8 - local.set 2 + local.set 3 block ;; label = @1 - local.get 3 + local.get 4 i32.load offset=4 i32.const 1 i32.ne br_if 0 (;@1;) - local.get 2 local.get 3 + local.get 4 i32.load offset=12 call $alloc::raw_vec::handle_error unreachable end local.get 0 - local.get 3 + local.get 4 i32.load offset=12 i32.store offset=4 local.get 0 - local.get 2 - i32.store local.get 3 + i32.store + local.get 4 i32.const 16 i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::output_note::get_assets (;12;) (type 7) (param i32 f32) + (func $miden_base_sys::bindings::output_note::get_assets (;12;) (type 8) (param i32 f32) (local i32) global.get $__stack_pointer i32.const 16 @@ -273,7 +274,7 @@ i32.const 2 i32.shr_u local.get 1 - call $miden::output_note::get_assets + call $miden::protocol::output_note::get_assets i32.store local.get 0 local.get 2 @@ -284,10 +285,10 @@ i32.add global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;13;) (type 8) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;13;) (type 9) (param i32) (result f32) unreachable ) - (func $::alloc_impl (;14;) (type 9) (param i32 i32 i32 i32) + (func $::alloc_impl (;14;) (type 7) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -346,7 +347,7 @@ i32.add global.set $__stack_pointer ) - (func $::current_memory (;16;) (type 9) (param i32 i32 i32 i32) + (func $::current_memory (;16;) (type 7) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -543,11 +544,11 @@ i32.gt_u select ) - (func $miden::output_note::get_assets (;22;) (type 12) (param i32 f32) (result i32) + (func $miden::protocol::output_note::get_assets (;22;) (type 12) (param i32 f32) (result i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "Orust_sdk_output_note_get_assets_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "Orust_sdk_output_note_get_assets_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.hir index bf0315c8d..f7ea719cd 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.hir @@ -12,291 +12,204 @@ builtin.component miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-ou private builtin.function @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1#binding() -> felt { ^block9: - v3 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__stack_pointer : ptr - v4 = hir.bitcast v3 : ptr; - v5 = hir.load v4 : i32; - v6 = arith.constant 32 : i32; - v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; - v8 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__stack_pointer : ptr - v9 = hir.bitcast v8 : ptr; - hir.store v9, v7; + v1 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v161 = arith.constant 32 : i32; + v5 = arith.sub v3, v161 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; hir.exec @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/wit_bindgen::rt::run_ctors_once() - v1 = arith.constant 0 : i32; - v11 = hir.exec @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/intrinsics::felt::from_u32(v1) : felt - hir.exec @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/miden_base_sys::bindings::output_note::get_assets_info(v7, v11) - v13 = arith.constant 16 : u32; - v12 = hir.bitcast v7 : u32; - v14 = arith.add v12, v13 : u32 #[overflow = checked]; - v15 = arith.constant 4 : u32; - v16 = arith.mod v14, v15 : u32; + v8 = hir.load_local : i32 #[local = lv0]; + v158 = arith.constant 0 : felt; + hir.exec @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/miden_base_sys::bindings::output_note::get_assets_info(v8, v158) + v11 = hir.load_local : i32 #[local = lv0]; + v160 = arith.constant 16 : u32; + v12 = hir.bitcast v11 : u32; + v14 = arith.add v12, v160 : u32 #[overflow = checked]; + v159 = arith.constant 4 : u32; + v16 = arith.mod v14, v159 : u32; hir.assertz v16 #[code = 250]; v17 = hir.int_to_ptr v14 : ptr; v18 = hir.load v17 : felt; - v213 = arith.constant 32 : i32; - v20 = arith.add v7, v213 : i32 #[overflow = wrapping]; - v21 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__stack_pointer : ptr - v22 = hir.bitcast v21 : ptr; - hir.store v22, v20; + v19 = hir.load_local : i32 #[local = lv0]; + v163 = arith.constant 32 : i32; + v21 = arith.add v19, v163 : i32 #[overflow = wrapping]; + v22 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__stack_pointer : ptr + v23 = hir.bitcast v22 : ptr; + hir.store v23, v21; builtin.ret v18; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v24 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/GOT.data.internal.__memory_base : ptr - v25 = hir.bitcast v24 : ptr; - v26 = hir.load v25 : i32; - v27 = arith.constant 1048584 : i32; - v28 = arith.add v26, v27 : i32 #[overflow = wrapping]; - v29 = hir.bitcast v28 : u32; - v30 = hir.int_to_ptr v29 : ptr; - v31 = hir.load v30 : u8; - v23 = arith.constant 0 : i32; - v32 = arith.zext v31 : u32; - v33 = hir.bitcast v32 : i32; - v35 = arith.neq v33, v23 : i1; - scf.if v35{ + v25 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/GOT.data.internal.__memory_base : ptr + v26 = hir.bitcast v25 : ptr; + v27 = hir.load v26 : i32; + v168 = arith.constant 1048584 : i32; + v29 = arith.add v27, v168 : i32 #[overflow = wrapping]; + v30 = hir.bitcast v29 : u32; + v31 = hir.int_to_ptr v30 : ptr; + v32 = hir.load v31 : u8; + v167 = arith.constant 0 : i32; + v33 = arith.zext v32 : u32; + v34 = hir.bitcast v33 : i32; + v36 = arith.neq v34, v167 : i1; + scf.if v36{ ^block13: scf.yield ; } else { ^block14: - v36 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/GOT.data.internal.__memory_base : ptr - v37 = hir.bitcast v36 : ptr; - v38 = hir.load v37 : i32; + v37 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/GOT.data.internal.__memory_base : ptr + v38 = hir.bitcast v37 : ptr; + v39 = hir.load v38 : i32; + hir.store_local v39 #[local = lv0]; hir.exec @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__wasm_call_ctors() - v215 = arith.constant 1 : u8; - v217 = arith.constant 1048584 : i32; - v40 = arith.add v38, v217 : i32 #[overflow = wrapping]; - v44 = hir.bitcast v40 : u32; - v45 = hir.int_to_ptr v44 : ptr; - hir.store v45, v215; + v40 = hir.load_local : i32 #[local = lv0]; + v166 = arith.constant 1 : u8; + v171 = arith.constant 1048584 : i32; + v42 = arith.add v40, v171 : i32 #[overflow = wrapping]; + v46 = hir.bitcast v42 : u32; + v47 = hir.int_to_ptr v46 : ptr; + hir.store v47, v166; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::output_note::get_assets_info(v46: i32, v47: felt) { - ^block15(v46: i32, v47: felt): - v49 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__stack_pointer : ptr - v50 = hir.bitcast v49 : ptr; - v51 = hir.load v50 : i32; - v52 = arith.constant 48 : i32; - v53 = arith.sub v51, v52 : i32 #[overflow = wrapping]; - v54 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__stack_pointer : ptr - v55 = hir.bitcast v54 : ptr; - hir.store v55, v53; - hir.exec @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/miden::output_note::get_assets_info(v47, v53) - v57 = arith.constant 8 : u32; - v56 = hir.bitcast v53 : u32; - v58 = arith.add v56, v57 : u32 #[overflow = checked]; - v224 = arith.constant 8 : u32; - v60 = arith.mod v58, v224 : u32; - hir.assertz v60 #[code = 250]; - v61 = hir.int_to_ptr v58 : ptr; - v62 = hir.load v61 : i64; - v64 = arith.constant 40 : u32; - v63 = hir.bitcast v53 : u32; - v65 = arith.add v63, v64 : u32 #[overflow = checked]; - v223 = arith.constant 8 : u32; - v67 = arith.mod v65, v223 : u32; - hir.assertz v67 #[code = 250]; - v68 = hir.int_to_ptr v65 : ptr; - hir.store v68, v62; - v69 = hir.bitcast v53 : u32; - v222 = arith.constant 8 : u32; - v71 = arith.mod v69, v222 : u32; - hir.assertz v71 #[code = 250]; - v72 = hir.int_to_ptr v69 : ptr; - v73 = hir.load v72 : i64; - v75 = arith.constant 32 : u32; - v74 = hir.bitcast v53 : u32; - v76 = arith.add v74, v75 : u32 #[overflow = checked]; - v221 = arith.constant 8 : u32; - v78 = arith.mod v76, v221 : u32; + private builtin.function @miden_base_sys::bindings::output_note::get_assets_info(v48: i32, v49: felt) { + ^block15(v48: i32, v49: felt): + hir.store_local v48 #[local = lv0]; + v50 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__stack_pointer : ptr + v51 = hir.bitcast v50 : ptr; + v52 = hir.load v51 : i32; + v176 = arith.constant 32 : i32; + v54 = arith.sub v52, v176 : i32 #[overflow = wrapping]; + hir.store_local v54 #[local = lv2]; + v55 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__stack_pointer : ptr + v56 = hir.bitcast v55 : ptr; + hir.store v56, v54; + v58 = hir.load_local : i32 #[local = lv2]; + hir.exec @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/miden::protocol::output_note::get_assets_info(v49, v58) + v59 = hir.load_local : i32 #[local = lv0]; + v60 = hir.load_local : i32 #[local = lv2]; + v175 = arith.constant 16 : u32; + v61 = hir.bitcast v60 : u32; + v63 = arith.add v61, v175 : u32 #[overflow = checked]; + v174 = arith.constant 4 : u32; + v65 = arith.mod v63, v174 : u32; + hir.assertz v65 #[code = 250]; + v66 = hir.int_to_ptr v63 : ptr; + v67 = hir.load v66 : felt; + v206 = arith.constant 16 : u32; + v68 = hir.bitcast v59 : u32; + v70 = arith.add v68, v206 : u32 #[overflow = checked]; + v205 = arith.constant 4 : u32; + v72 = arith.mod v70, v205 : u32; + hir.assertz v72 #[code = 250]; + v73 = hir.int_to_ptr v70 : ptr; + hir.store v73, v67; + v74 = hir.load_local : i32 #[local = lv0]; + v75 = hir.load_local : i32 #[local = lv2]; + v76 = hir.bitcast v75 : u32; + v204 = arith.constant 4 : u32; + v78 = arith.mod v76, v204 : u32; hir.assertz v78 #[code = 250]; - v79 = hir.int_to_ptr v76 : ptr; - hir.store v79, v73; - v81 = arith.constant 16 : u32; - v80 = hir.bitcast v53 : u32; - v82 = arith.add v80, v81 : u32 #[overflow = checked]; - v83 = arith.constant 4 : u32; - v84 = arith.mod v82, v83 : u32; - hir.assertz v84 #[code = 250]; - v85 = hir.int_to_ptr v82 : ptr; - v86 = hir.load v85 : felt; - v87 = arith.constant 32 : i32; - v88 = arith.add v53, v87 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/::reverse(v46, v88) - v220 = arith.constant 16 : u32; - v89 = hir.bitcast v46 : u32; - v91 = arith.add v89, v220 : u32 #[overflow = checked]; - v219 = arith.constant 4 : u32; - v93 = arith.mod v91, v219 : u32; + v79 = hir.int_to_ptr v76 : ptr; + v80 = hir.load v79 : felt; + v173 = arith.constant 12 : u32; + v81 = hir.bitcast v74 : u32; + v83 = arith.add v81, v173 : u32 #[overflow = checked]; + v203 = arith.constant 4 : u32; + v85 = arith.mod v83, v203 : u32; + hir.assertz v85 #[code = 250]; + v86 = hir.int_to_ptr v83 : ptr; + hir.store v86, v80; + v87 = hir.load_local : i32 #[local = lv0]; + v88 = hir.load_local : i32 #[local = lv2]; + v202 = arith.constant 4 : u32; + v89 = hir.bitcast v88 : u32; + v91 = arith.add v89, v202 : u32 #[overflow = checked]; + v201 = arith.constant 4 : u32; + v93 = arith.mod v91, v201 : u32; hir.assertz v93 #[code = 250]; v94 = hir.int_to_ptr v91 : ptr; - hir.store v94, v86; - v218 = arith.constant 48 : i32; - v96 = arith.add v53, v218 : i32 #[overflow = wrapping]; - v97 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__stack_pointer : ptr - v98 = hir.bitcast v97 : ptr; - hir.store v98, v96; - builtin.ret ; - }; - - private builtin.function @::reverse(v99: i32, v100: i32) { - ^block17(v99: i32, v100: i32): - v103 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__stack_pointer : ptr - v104 = hir.bitcast v103 : ptr; - v105 = hir.load v104 : i32; - v106 = arith.constant 16 : i32; - v107 = arith.sub v105, v106 : i32 #[overflow = wrapping]; - v109 = arith.constant 8 : u32; - v108 = hir.bitcast v100 : u32; - v110 = arith.add v108, v109 : u32 #[overflow = checked]; - v311 = arith.constant 8 : u32; - v112 = arith.mod v110, v311 : u32; - hir.assertz v112 #[code = 250]; - v113 = hir.int_to_ptr v110 : ptr; - v114 = hir.load v113 : i64; - v310 = arith.constant 8 : u32; - v115 = hir.bitcast v107 : u32; - v117 = arith.add v115, v310 : u32 #[overflow = checked]; - v118 = arith.constant 4 : u32; - v119 = arith.mod v117, v118 : u32; - hir.assertz v119 #[code = 250]; - v120 = hir.int_to_ptr v117 : ptr; - hir.store v120, v114; - v121 = hir.bitcast v100 : u32; - v309 = arith.constant 8 : u32; - v123 = arith.mod v121, v309 : u32; + v95 = hir.load v94 : felt; + v172 = arith.constant 8 : u32; + v96 = hir.bitcast v87 : u32; + v98 = arith.add v96, v172 : u32 #[overflow = checked]; + v200 = arith.constant 4 : u32; + v100 = arith.mod v98, v200 : u32; + hir.assertz v100 #[code = 250]; + v101 = hir.int_to_ptr v98 : ptr; + hir.store v101, v95; + v102 = hir.load_local : i32 #[local = lv0]; + v103 = hir.load_local : i32 #[local = lv2]; + v199 = arith.constant 8 : u32; + v104 = hir.bitcast v103 : u32; + v106 = arith.add v104, v199 : u32 #[overflow = checked]; + v198 = arith.constant 4 : u32; + v108 = arith.mod v106, v198 : u32; + hir.assertz v108 #[code = 250]; + v109 = hir.int_to_ptr v106 : ptr; + v110 = hir.load v109 : felt; + v197 = arith.constant 4 : u32; + v111 = hir.bitcast v102 : u32; + v113 = arith.add v111, v197 : u32 #[overflow = checked]; + v196 = arith.constant 4 : u32; + v115 = arith.mod v113, v196 : u32; + hir.assertz v115 #[code = 250]; + v116 = hir.int_to_ptr v113 : ptr; + hir.store v116, v110; + v117 = hir.load_local : i32 #[local = lv0]; + v118 = hir.load_local : i32 #[local = lv2]; + v195 = arith.constant 12 : u32; + v119 = hir.bitcast v118 : u32; + v121 = arith.add v119, v195 : u32 #[overflow = checked]; + v194 = arith.constant 4 : u32; + v123 = arith.mod v121, v194 : u32; hir.assertz v123 #[code = 250]; - v124 = hir.int_to_ptr v121 : ptr; - v125 = hir.load v124 : i64; - v126 = hir.bitcast v107 : u32; - v308 = arith.constant 4 : u32; - v128 = arith.mod v126, v308 : u32; + v124 = hir.int_to_ptr v121 : ptr; + v125 = hir.load v124 : felt; + v126 = hir.bitcast v117 : u32; + v193 = arith.constant 4 : u32; + v128 = arith.mod v126, v193 : u32; hir.assertz v128 #[code = 250]; - v129 = hir.int_to_ptr v126 : ptr; + v129 = hir.int_to_ptr v126 : ptr; hir.store v129, v125; - v130 = arith.constant 12 : i32; - v131 = arith.add v107, v130 : i32 #[overflow = wrapping]; - v101 = arith.constant 0 : i32; - v279, v280, v281, v282, v283, v284 = scf.while v101, v107, v131, v99 : i32, i32, i32, i32, i32, i32 { - ^block39(v285: i32, v286: i32, v287: i32, v288: i32): - v307 = arith.constant 0 : i32; - v134 = arith.constant 8 : i32; - v135 = arith.eq v285, v134 : i1; - v136 = arith.zext v135 : u32; - v137 = hir.bitcast v136 : i32; - v139 = arith.neq v137, v307 : i1; - v273, v274 = scf.if v139 : i32, i32 { - ^block38: - v233 = ub.poison i32 : i32; - scf.yield v233, v233; - } else { - ^block22: - v141 = arith.add v286, v285 : i32 #[overflow = wrapping]; - v142 = hir.bitcast v141 : u32; - v306 = arith.constant 4 : u32; - v144 = arith.mod v142, v306 : u32; - hir.assertz v144 #[code = 250]; - v145 = hir.int_to_ptr v142 : ptr; - v146 = hir.load v145 : felt; - v148 = hir.bitcast v287 : u32; - v305 = arith.constant 4 : u32; - v150 = arith.mod v148, v305 : u32; - hir.assertz v150 #[code = 250]; - v151 = hir.int_to_ptr v148 : ptr; - v152 = hir.load v151 : i32; - v153 = hir.bitcast v141 : u32; - v304 = arith.constant 4 : u32; - v155 = arith.mod v153, v304 : u32; - hir.assertz v155 #[code = 250]; - v156 = hir.int_to_ptr v153 : ptr; - hir.store v156, v152; - v157 = hir.bitcast v287 : u32; - v303 = arith.constant 4 : u32; - v159 = arith.mod v157, v303 : u32; - hir.assertz v159 #[code = 250]; - v160 = hir.int_to_ptr v157 : ptr; - hir.store v160, v146; - v163 = arith.constant -4 : i32; - v164 = arith.add v287, v163 : i32 #[overflow = wrapping]; - v161 = arith.constant 4 : i32; - v162 = arith.add v285, v161 : i32 #[overflow = wrapping]; - scf.yield v162, v164; - }; - v301 = ub.poison i32 : i32; - v276 = cf.select v139, v301, v288 : i32; - v302 = ub.poison i32 : i32; - v275 = cf.select v139, v302, v286 : i32; - v232 = arith.constant 1 : u32; - v225 = arith.constant 0 : u32; - v278 = cf.select v139, v225, v232 : u32; - v266 = arith.trunc v278 : i1; - scf.condition v266, v273, v275, v274, v276, v286, v288; - } do { - ^block40(v289: i32, v290: i32, v291: i32, v292: i32, v293: i32, v294: i32): - scf.yield v289, v290, v291, v292; - }; - v300 = arith.constant 8 : u32; - v166 = hir.bitcast v283 : u32; - v168 = arith.add v166, v300 : u32 #[overflow = checked]; - v299 = arith.constant 4 : u32; - v170 = arith.mod v168, v299 : u32; - hir.assertz v170 #[code = 250]; - v171 = hir.int_to_ptr v168 : ptr; - v172 = hir.load v171 : i64; - v298 = arith.constant 8 : u32; - v173 = hir.bitcast v284 : u32; - v175 = arith.add v173, v298 : u32 #[overflow = checked]; - v297 = arith.constant 8 : u32; - v177 = arith.mod v175, v297 : u32; - hir.assertz v177 #[code = 250]; - v178 = hir.int_to_ptr v175 : ptr; - hir.store v178, v172; - v179 = hir.bitcast v283 : u32; - v296 = arith.constant 4 : u32; - v181 = arith.mod v179, v296 : u32; - hir.assertz v181 #[code = 250]; - v182 = hir.int_to_ptr v179 : ptr; - v183 = hir.load v182 : i64; - v184 = hir.bitcast v284 : u32; - v295 = arith.constant 8 : u32; - v186 = arith.mod v184, v295 : u32; - hir.assertz v186 #[code = 250]; - v187 = hir.int_to_ptr v184 : ptr; - hir.store v187, v183; + v130 = hir.load_local : i32 #[local = lv2]; + v192 = arith.constant 32 : i32; + v132 = arith.add v130, v192 : i32 #[overflow = wrapping]; + v133 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__stack_pointer : ptr + v134 = hir.bitcast v133 : ptr; + hir.store v134, v132; builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v188: i32) -> felt { - ^block23(v188: i32): - v189 = hir.bitcast v188 : felt; - builtin.ret v189; - }; - - private builtin.function @miden::output_note::get_assets_info(v191: felt, v192: i32) { - ^block25(v191: felt, v192: i32): - v193, v194, v195, v196, v197 = hir.exec @miden/output_note/get_assets_info(v191) : felt, felt, felt, felt, felt - v198 = hir.bitcast v192 : u32; - v199 = hir.int_to_ptr v198 : ptr; - hir.store v199, v193; - v200 = arith.constant 4 : u32; - v201 = arith.add v198, v200 : u32 #[overflow = checked]; - v202 = hir.int_to_ptr v201 : ptr; - hir.store v202, v194; - v203 = arith.constant 8 : u32; - v204 = arith.add v198, v203 : u32 #[overflow = checked]; - v205 = hir.int_to_ptr v204 : ptr; - hir.store v205, v195; - v206 = arith.constant 12 : u32; - v207 = arith.add v198, v206 : u32 #[overflow = checked]; - v208 = hir.int_to_ptr v207 : ptr; - hir.store v208, v196; - v209 = arith.constant 16 : u32; - v210 = arith.add v198, v209 : u32 #[overflow = checked]; - v211 = hir.int_to_ptr v210 : ptr; - hir.store v211, v197; + private builtin.function @miden::protocol::output_note::get_assets_info(v135: felt, v136: i32) { + ^block17(v135: felt, v136: i32): + v137, v138, v139, v140, v141 = hir.exec @miden/protocol/output_note/get_assets_info(v135) : felt, felt, felt, felt, felt + v142 = hir.bitcast v136 : u32; + v143 = hir.int_to_ptr v142 : ptr; + hir.store v143, v137; + v210 = arith.constant 4 : u32; + v145 = arith.add v142, v210 : u32 #[overflow = checked]; + v146 = hir.int_to_ptr v145 : ptr; + hir.store v146, v138; + v209 = arith.constant 8 : u32; + v148 = arith.add v142, v209 : u32 #[overflow = checked]; + v149 = hir.int_to_ptr v148 : ptr; + hir.store v149, v139; + v208 = arith.constant 12 : u32; + v151 = arith.add v142, v208 : u32 #[overflow = checked]; + v152 = hir.int_to_ptr v151 : ptr; + hir.store v152, v140; + v207 = arith.constant 16 : u32; + v154 = arith.add v142, v207 : u32 #[overflow = checked]; + v155 = hir.int_to_ptr v154 : ptr; + hir.store v155, v141; builtin.ret ; }; @@ -312,8 +225,8 @@ builtin.component miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-ou }; public builtin.function @binding() -> felt { - ^block29: - v212 = hir.exec @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1#binding() : felt - builtin.ret v212; + ^block22: + v156 = hir.exec @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1#binding() : felt + builtin.ret v156; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.masm index 75ef05506..ff246f5b6 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.masm @@ -1,16 +1,16 @@ -# mod miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1 +# mod ::"miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> felt - exec.::miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1::init + exec."miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1::rust_sdk_output_note_get_assets_info_binding::miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1#binding + exec.::"miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1"::rust_sdk_output_note_get_assets_info_binding::"miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1#binding" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -23,7 +23,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -34,7 +34,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1::rust_sdk_output_note_get_assets_info_binding +# mod ::"miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1"::rust_sdk_output_note_get_assets_info_binding @callconv("C") proc __wasm_call_ctors( @@ -50,6 +50,7 @@ proc rust_sdk_output_note_get_assets_info_binding::bindings::__link_custom_secti nop end +@locals("2") @callconv("C") proc miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1#binding( @@ -64,9 +65,16 @@ proc miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get nop push.32 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -76,23 +84,34 @@ proc miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get nop trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1::rust_sdk_output_note_get_assets_info_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1"::rust_sdk_output_note_get_assets_info_binding::wit_bindgen::rt::run_ctors_once trace.252 nop + locaddr.0 push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1::rust_sdk_output_note_get_assets_info_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop - dup.1 + push.0 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1"::rust_sdk_output_note_get_assets_info_binding::miden_base_sys::bindings::output_note::get_assets_info + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1::rust_sdk_output_note_get_assets_info_binding::miden_base_sys::bindings::output_note::get_assets_info + exec.::intrinsics::mem::load_sw trace.252 nop push.16 - dup.1 + swap.1 add u32assert push.4 @@ -108,8 +127,15 @@ proc miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.32 - movup.2 u32wrapping_add push.1114144 u32divmod.4 @@ -121,6 +147,7 @@ proc miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -162,9 +189,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1"::rust_sdk_output_note_get_assets_info_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1::rust_sdk_output_note_get_assets_info_binding::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -195,11 +238,20 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("3") @callconv("C") proc miden_base_sys::bindings::output_note::get_assets_info( i32, felt ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -208,11 +260,18 @@ proc miden_base_sys::bindings::output_note::get_assets_info( exec.::intrinsics::mem::load_sw trace.252 nop - push.48 + push.32 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.2 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -220,36 +279,41 @@ proc miden_base_sys::bindings::output_note::get_assets_info( exec.::intrinsics::mem::store_sw trace.252 nop - dup.0 - movup.3 + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1::rust_sdk_output_note_get_assets_info_binding::miden::output_note::get_assets_info + exec.::intrinsics::mem::load_sw trace.252 nop - push.8 - dup.1 - add - u32assert - push.8 - dup.1 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1"::rust_sdk_output_note_get_assets_info_binding::"miden::protocol::output_note::get_assets_info" + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + push.16 swap.1 - push.40 - dup.3 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -257,15 +321,16 @@ proc miden_base_sys::bindings::output_note::get_assets_info( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop - dup.0 - push.8 + push.16 + movup.2 + add + u32assert + push.4 dup.1 swap.1 u32mod @@ -275,33 +340,25 @@ proc miden_base_sys::bindings::output_note::get_assets_info( swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.0 + push.0 swap.1 - push.32 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - dup.1 - add - u32assert push.4 dup.1 swap.1 @@ -315,17 +372,8 @@ proc miden_base_sys::bindings::output_note::get_assets_info( exec.::intrinsics::mem::load_felt trace.252 nop - push.32 - dup.2 - u32wrapping_add - dup.3 - trace.240 - nop - exec.::miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1::rust_sdk_output_note_get_assets_info_binding::::reverse - trace.252 - nop - push.16 - movup.3 + push.12 + movup.2 add u32assert push.4 @@ -341,38 +389,27 @@ proc miden_base_sys::bindings::output_note::get_assets_info( exec.::intrinsics::mem::store_felt trace.252 nop - push.48 - u32wrapping_add - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop -end - -@callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - u32wrapping_sub - push.8 - dup.3 + push.4 + swap.1 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -382,12 +419,11 @@ proc ::reverse( swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 push.8 - dup.3 + movup.2 add u32assert push.4 @@ -398,29 +434,31 @@ proc ::reverse( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - movup.2 - push.8 - dup.1 + locaddr.0 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + push.8 swap.1 - dup.2 + add + u32assert push.4 dup.1 swap.1 @@ -429,140 +467,13 @@ proc ::reverse( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop - push.12 - dup.1 - u32wrapping_add - push.0 + push.4 movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.8 - dup.1 add u32assert push.4 @@ -575,15 +486,30 @@ proc ::reverse( swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 swap.1 - push.8 - dup.4 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -591,13 +517,12 @@ proc ::reverse( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_felt trace.252 nop + swap.1 push.4 dup.1 swap.1 @@ -608,38 +533,34 @@ proc ::reverse( swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.2 + push.0 swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop end @callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc miden::output_note::get_assets_info(felt, i32) +proc miden::protocol::output_note::get_assets_info(felt, i32) trace.240 nop - exec.::miden::output_note::get_assets_info + exec.::miden::protocol::output_note::get_assets_info trace.252 nop movup.5 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.wat index ffe88ea9d..7ee8159e0 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.wat @@ -10,9 +10,8 @@ (type (;0;) (func)) (type (;1;) (func (result f32))) (type (;2;) (func (param i32 f32))) - (type (;3;) (func (param i32 i32))) - (type (;4;) (func (param i32) (result f32))) - (type (;5;) (func (param f32 i32))) + (type (;3;) (func (param i32) (result f32))) + (type (;4;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -64,103 +63,46 @@ (func $miden_base_sys::bindings::output_note::get_assets_info (;4;) (type 2) (param i32 f32) (local i32) global.get $__stack_pointer - i32.const 48 + i32.const 32 i32.sub local.tee 2 global.set $__stack_pointer local.get 1 local.get 2 - call $miden::output_note::get_assets_info - local.get 2 - local.get 2 - i64.load offset=8 - i64.store offset=40 - local.get 2 - local.get 2 - i64.load - i64.store offset=32 + call $miden::protocol::output_note::get_assets_info + local.get 0 local.get 2 f32.load offset=16 - local.set 1 + f32.store offset=16 local.get 0 local.get 2 - i32.const 32 - i32.add - call $::reverse + f32.load + f32.store offset=12 local.get 0 - local.get 1 - f32.store offset=16 local.get 2 - i32.const 48 - i32.add - global.set $__stack_pointer - ) - (func $::reverse (;5;) (type 3) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end + f32.load offset=4 + f32.store offset=8 local.get 0 local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 + f32.load offset=8 + f32.store offset=4 local.get 0 local.get 2 - i64.load align=4 - i64.store + f32.load offset=12 + f32.store + local.get 2 + i32.const 32 + i32.add + global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) unreachable ) - (func $miden::output_note::get_assets_info (;7;) (type 5) (param f32 i32) + (func $miden::protocol::output_note::get_assets_info (;6;) (type 4) (param f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "Yrust_sdk_output_note_get_assets_info_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "Yrust_sdk_output_note_get_assets_info_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.hir index d19593080..c8ca5bef7 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.hir @@ -12,296 +12,237 @@ builtin.component miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-outpu private builtin.function @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1#binding() -> i32 { ^block9: - v2 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__stack_pointer : ptr - v3 = hir.bitcast v2 : ptr; - v4 = hir.load v3 : i32; - v5 = arith.constant 16 : i32; - v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; - v7 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__stack_pointer : ptr - v8 = hir.bitcast v7 : ptr; - hir.store v8, v6; + v1 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v227 = arith.constant 32 : i32; + v5 = arith.sub v3, v227 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; hir.exec @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/wit_bindgen::rt::run_ctors_once() - v1 = arith.constant 0 : i32; - v10 = hir.exec @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/intrinsics::felt::from_u32(v1) : felt - hir.exec @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/miden_base_sys::bindings::output_note::get_metadata(v6, v10) + v8 = hir.load_local : i32 #[local = lv0]; + v221 = arith.constant 0 : felt; + hir.exec @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/miden_base_sys::bindings::output_note::get_metadata(v8, v221) v11 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/GOT.data.internal.__memory_base : ptr v12 = hir.bitcast v11 : ptr; v13 = hir.load v12 : i32; - v14 = arith.constant 1048584 : i32; - v15 = arith.add v13, v14 : i32 #[overflow = wrapping]; - v17 = arith.constant 8 : u32; - v16 = hir.bitcast v6 : u32; - v18 = arith.add v16, v17 : u32 #[overflow = checked]; - v249 = arith.constant 8 : u32; - v20 = arith.mod v18, v249 : u32; - hir.assertz v20 #[code = 250]; - v21 = hir.int_to_ptr v18 : ptr; - v22 = hir.load v21 : i64; - v248 = arith.constant 8 : u32; - v23 = hir.bitcast v15 : u32; - v25 = arith.add v23, v248 : u32 #[overflow = checked]; - v26 = arith.constant 4 : u32; - v27 = arith.mod v25, v26 : u32; - hir.assertz v27 #[code = 250]; - v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v22; - v29 = hir.bitcast v6 : u32; - v247 = arith.constant 8 : u32; - v31 = arith.mod v29, v247 : u32; - hir.assertz v31 #[code = 250]; - v32 = hir.int_to_ptr v29 : ptr; - v33 = hir.load v32 : i64; - v34 = hir.bitcast v15 : u32; - v246 = arith.constant 4 : u32; - v36 = arith.mod v34, v246 : u32; + v226 = arith.constant 1048584 : i32; + v15 = arith.add v13, v226 : i32 #[overflow = wrapping]; + hir.store_local v15 #[local = lv1]; + v16 = hir.load_local : i32 #[local = lv0]; + v225 = arith.constant 24 : u32; + v17 = hir.bitcast v16 : u32; + v19 = arith.add v17, v225 : u32 #[overflow = checked]; + v224 = arith.constant 8 : u32; + v21 = arith.mod v19, v224 : u32; + hir.assertz v21 #[code = 250]; + v22 = hir.int_to_ptr v19 : ptr; + v23 = hir.load v22 : i64; + v235 = arith.constant 8 : u32; + v24 = hir.bitcast v15 : u32; + v26 = arith.add v24, v235 : u32 #[overflow = checked]; + v223 = arith.constant 4 : u32; + v28 = arith.mod v26, v223 : u32; + hir.assertz v28 #[code = 250]; + v29 = hir.int_to_ptr v26 : ptr; + hir.store v29, v23; + v30 = hir.load_local : i32 #[local = lv1]; + v31 = hir.load_local : i32 #[local = lv0]; + v222 = arith.constant 16 : u32; + v32 = hir.bitcast v31 : u32; + v34 = arith.add v32, v222 : u32 #[overflow = checked]; + v234 = arith.constant 8 : u32; + v36 = arith.mod v34, v234 : u32; hir.assertz v36 #[code = 250]; v37 = hir.int_to_ptr v34 : ptr; - hir.store v37, v33; - v245 = arith.constant 16 : i32; - v39 = arith.add v6, v245 : i32 #[overflow = wrapping]; - v40 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__stack_pointer : ptr - v41 = hir.bitcast v40 : ptr; - hir.store v41, v39; - builtin.ret v15; + v38 = hir.load v37 : i64; + v39 = hir.bitcast v30 : u32; + v233 = arith.constant 4 : u32; + v41 = arith.mod v39, v233 : u32; + hir.assertz v41 #[code = 250]; + v42 = hir.int_to_ptr v39 : ptr; + hir.store v42, v38; + v43 = hir.load_local : i32 #[local = lv0]; + v232 = arith.constant 32 : i32; + v45 = arith.add v43, v232 : i32 #[overflow = wrapping]; + v46 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__stack_pointer : ptr + v47 = hir.bitcast v46 : ptr; + hir.store v47, v45; + v48 = hir.load_local : i32 #[local = lv1]; + builtin.ret v48; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v43 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/GOT.data.internal.__memory_base : ptr - v44 = hir.bitcast v43 : ptr; - v45 = hir.load v44 : i32; - v46 = arith.constant 1048600 : i32; - v47 = arith.add v45, v46 : i32 #[overflow = wrapping]; - v48 = hir.bitcast v47 : u32; - v49 = hir.int_to_ptr v48 : ptr; - v50 = hir.load v49 : u8; - v42 = arith.constant 0 : i32; - v51 = arith.zext v50 : u32; - v52 = hir.bitcast v51 : i32; - v54 = arith.neq v52, v42 : i1; - scf.if v54{ + v49 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/GOT.data.internal.__memory_base : ptr + v50 = hir.bitcast v49 : ptr; + v51 = hir.load v50 : i32; + v240 = arith.constant 1048600 : i32; + v53 = arith.add v51, v240 : i32 #[overflow = wrapping]; + v54 = hir.bitcast v53 : u32; + v55 = hir.int_to_ptr v54 : ptr; + v56 = hir.load v55 : u8; + v239 = arith.constant 0 : i32; + v57 = arith.zext v56 : u32; + v58 = hir.bitcast v57 : i32; + v60 = arith.neq v58, v239 : i1; + scf.if v60{ ^block13: scf.yield ; } else { ^block14: - v55 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/GOT.data.internal.__memory_base : ptr - v56 = hir.bitcast v55 : ptr; - v57 = hir.load v56 : i32; + v61 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/GOT.data.internal.__memory_base : ptr + v62 = hir.bitcast v61 : ptr; + v63 = hir.load v62 : i32; + hir.store_local v63 #[local = lv0]; hir.exec @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__wasm_call_ctors() - v251 = arith.constant 1 : u8; - v253 = arith.constant 1048600 : i32; - v59 = arith.add v57, v253 : i32 #[overflow = wrapping]; - v63 = hir.bitcast v59 : u32; - v64 = hir.int_to_ptr v63 : ptr; - hir.store v64, v251; + v64 = hir.load_local : i32 #[local = lv0]; + v238 = arith.constant 1 : u8; + v243 = arith.constant 1048600 : i32; + v66 = arith.add v64, v243 : i32 #[overflow = wrapping]; + v70 = hir.bitcast v66 : u32; + v71 = hir.int_to_ptr v70 : ptr; + hir.store v71, v238; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::output_note::get_metadata(v65: i32, v66: felt) { - ^block15(v65: i32, v66: felt): - v68 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__stack_pointer : ptr - v69 = hir.bitcast v68 : ptr; - v70 = hir.load v69 : i32; - v71 = arith.constant 32 : i32; - v72 = arith.sub v70, v71 : i32 #[overflow = wrapping]; - v73 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__stack_pointer : ptr - v74 = hir.bitcast v73 : ptr; - hir.store v74, v72; - hir.exec @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/miden::output_note::get_metadata(v66, v72) - v76 = arith.constant 8 : u32; - v75 = hir.bitcast v72 : u32; - v77 = arith.add v75, v76 : u32 #[overflow = checked]; - v258 = arith.constant 8 : u32; - v79 = arith.mod v77, v258 : u32; - hir.assertz v79 #[code = 250]; - v80 = hir.int_to_ptr v77 : ptr; - v81 = hir.load v80 : i64; - v83 = arith.constant 24 : u32; - v82 = hir.bitcast v72 : u32; - v84 = arith.add v82, v83 : u32 #[overflow = checked]; + private builtin.function @miden_base_sys::bindings::output_note::get_metadata(v72: i32, v73: felt) { + ^block15(v72: i32, v73: felt): + hir.store_local v72 #[local = lv0]; + v74 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__stack_pointer : ptr + v75 = hir.bitcast v74 : ptr; + v76 = hir.load v75 : i32; + v259 = arith.constant 32 : i32; + v78 = arith.sub v76, v259 : i32 #[overflow = wrapping]; + hir.store_local v78 #[local = lv2]; + v79 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__stack_pointer : ptr + v80 = hir.bitcast v79 : ptr; + hir.store v80, v78; + v82 = hir.load_local : i32 #[local = lv2]; + hir.exec @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/miden::protocol::output_note::get_metadata(v73, v82) + v83 = hir.load_local : i32 #[local = lv0]; + v84 = hir.load_local : i32 #[local = lv2]; + v258 = arith.constant 16 : u32; + v85 = hir.bitcast v84 : u32; + v87 = arith.add v85, v258 : u32 #[overflow = checked]; v257 = arith.constant 8 : u32; - v86 = arith.mod v84, v257 : u32; - hir.assertz v86 #[code = 250]; - v87 = hir.int_to_ptr v84 : ptr; - hir.store v87, v81; - v88 = hir.bitcast v72 : u32; - v256 = arith.constant 8 : u32; - v90 = arith.mod v88, v256 : u32; - hir.assertz v90 #[code = 250]; - v91 = hir.int_to_ptr v88 : ptr; - v92 = hir.load v91 : i64; - v94 = arith.constant 16 : u32; - v93 = hir.bitcast v72 : u32; - v95 = arith.add v93, v94 : u32 #[overflow = checked]; - v255 = arith.constant 8 : u32; - v97 = arith.mod v95, v255 : u32; - hir.assertz v97 #[code = 250]; - v98 = hir.int_to_ptr v95 : ptr; - hir.store v98, v92; - v99 = arith.constant 16 : i32; - v100 = arith.add v72, v99 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/::reverse(v65, v100) - v254 = arith.constant 32 : i32; - v102 = arith.add v72, v254 : i32 #[overflow = wrapping]; - v103 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__stack_pointer : ptr - v104 = hir.bitcast v103 : ptr; - hir.store v104, v102; + v89 = arith.mod v87, v257 : u32; + hir.assertz v89 #[code = 250]; + v90 = hir.int_to_ptr v87 : ptr; + v91 = hir.load v90 : i64; + v253, v254 = arith.split v91 : felt, felt; + v256 = arith.constant 24 : u32; + v95 = hir.bitcast v83 : u32; + v97 = arith.add v95, v256 : u32 #[overflow = checked]; + v283 = arith.constant 8 : u32; + v99 = arith.mod v97, v283 : u32; + hir.assertz v99 #[code = 250]; + v255 = arith.join v254, v253 : i64; + v100 = hir.int_to_ptr v97 : ptr; + hir.store v100, v255; + v101 = hir.load_local : i32 #[local = lv0]; + v102 = hir.load_local : i32 #[local = lv2]; + v282 = arith.constant 24 : u32; + v103 = hir.bitcast v102 : u32; + v105 = arith.add v103, v282 : u32 #[overflow = checked]; + v281 = arith.constant 8 : u32; + v107 = arith.mod v105, v281 : u32; + hir.assertz v107 #[code = 250]; + v108 = hir.int_to_ptr v105 : ptr; + v109 = hir.load v108 : i64; + v250, v251 = arith.split v109 : felt, felt; + v280 = arith.constant 16 : u32; + v113 = hir.bitcast v101 : u32; + v115 = arith.add v113, v280 : u32 #[overflow = checked]; + v279 = arith.constant 8 : u32; + v117 = arith.mod v115, v279 : u32; + hir.assertz v117 #[code = 250]; + v252 = arith.join v251, v250 : i64; + v118 = hir.int_to_ptr v115 : ptr; + hir.store v118, v252; + v119 = hir.load_local : i32 #[local = lv0]; + v120 = hir.load_local : i32 #[local = lv2]; + v121 = hir.bitcast v120 : u32; + v278 = arith.constant 8 : u32; + v123 = arith.mod v121, v278 : u32; + hir.assertz v123 #[code = 250]; + v124 = hir.int_to_ptr v121 : ptr; + v125 = hir.load v124 : i64; + v247, v248 = arith.split v125 : felt, felt; + v277 = arith.constant 8 : u32; + v129 = hir.bitcast v119 : u32; + v131 = arith.add v129, v277 : u32 #[overflow = checked]; + v276 = arith.constant 8 : u32; + v133 = arith.mod v131, v276 : u32; + hir.assertz v133 #[code = 250]; + v249 = arith.join v248, v247 : i64; + v134 = hir.int_to_ptr v131 : ptr; + hir.store v134, v249; + v135 = hir.load_local : i32 #[local = lv0]; + v136 = hir.load_local : i32 #[local = lv2]; + v275 = arith.constant 8 : u32; + v137 = hir.bitcast v136 : u32; + v139 = arith.add v137, v275 : u32 #[overflow = checked]; + v274 = arith.constant 8 : u32; + v141 = arith.mod v139, v274 : u32; + hir.assertz v141 #[code = 250]; + v142 = hir.int_to_ptr v139 : ptr; + v143 = hir.load v142 : i64; + v244, v245 = arith.split v143 : felt, felt; + v147 = hir.bitcast v135 : u32; + v273 = arith.constant 8 : u32; + v149 = arith.mod v147, v273 : u32; + hir.assertz v149 #[code = 250]; + v246 = arith.join v245, v244 : i64; + v150 = hir.int_to_ptr v147 : ptr; + hir.store v150, v246; + v151 = hir.load_local : i32 #[local = lv2]; + v272 = arith.constant 32 : i32; + v153 = arith.add v151, v272 : i32 #[overflow = wrapping]; + v154 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__stack_pointer : ptr + v155 = hir.bitcast v154 : ptr; + hir.store v155, v153; builtin.ret ; }; - private builtin.function @::reverse(v105: i32, v106: i32) { - ^block17(v105: i32, v106: i32): - v109 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__stack_pointer : ptr - v110 = hir.bitcast v109 : ptr; - v111 = hir.load v110 : i32; - v112 = arith.constant 16 : i32; - v113 = arith.sub v111, v112 : i32 #[overflow = wrapping]; - v115 = arith.constant 8 : u32; - v114 = hir.bitcast v106 : u32; - v116 = arith.add v114, v115 : u32 #[overflow = checked]; - v345 = arith.constant 8 : u32; - v118 = arith.mod v116, v345 : u32; - hir.assertz v118 #[code = 250]; - v119 = hir.int_to_ptr v116 : ptr; - v120 = hir.load v119 : i64; - v344 = arith.constant 8 : u32; - v121 = hir.bitcast v113 : u32; - v123 = arith.add v121, v344 : u32 #[overflow = checked]; - v124 = arith.constant 4 : u32; - v125 = arith.mod v123, v124 : u32; - hir.assertz v125 #[code = 250]; - v126 = hir.int_to_ptr v123 : ptr; - hir.store v126, v120; - v127 = hir.bitcast v106 : u32; - v343 = arith.constant 8 : u32; - v129 = arith.mod v127, v343 : u32; - hir.assertz v129 #[code = 250]; - v130 = hir.int_to_ptr v127 : ptr; - v131 = hir.load v130 : i64; - v132 = hir.bitcast v113 : u32; - v342 = arith.constant 4 : u32; - v134 = arith.mod v132, v342 : u32; - hir.assertz v134 #[code = 250]; - v135 = hir.int_to_ptr v132 : ptr; - hir.store v135, v131; - v136 = arith.constant 12 : i32; - v137 = arith.add v113, v136 : i32 #[overflow = wrapping]; - v107 = arith.constant 0 : i32; - v313, v314, v315, v316, v317, v318 = scf.while v107, v113, v137, v105 : i32, i32, i32, i32, i32, i32 { - ^block39(v319: i32, v320: i32, v321: i32, v322: i32): - v341 = arith.constant 0 : i32; - v140 = arith.constant 8 : i32; - v141 = arith.eq v319, v140 : i1; - v142 = arith.zext v141 : u32; - v143 = hir.bitcast v142 : i32; - v145 = arith.neq v143, v341 : i1; - v307, v308 = scf.if v145 : i32, i32 { - ^block38: - v267 = ub.poison i32 : i32; - scf.yield v267, v267; - } else { - ^block22: - v147 = arith.add v320, v319 : i32 #[overflow = wrapping]; - v148 = hir.bitcast v147 : u32; - v340 = arith.constant 4 : u32; - v150 = arith.mod v148, v340 : u32; - hir.assertz v150 #[code = 250]; - v151 = hir.int_to_ptr v148 : ptr; - v152 = hir.load v151 : felt; - v154 = hir.bitcast v321 : u32; - v339 = arith.constant 4 : u32; - v156 = arith.mod v154, v339 : u32; - hir.assertz v156 #[code = 250]; - v157 = hir.int_to_ptr v154 : ptr; - v158 = hir.load v157 : i32; - v159 = hir.bitcast v147 : u32; - v338 = arith.constant 4 : u32; - v161 = arith.mod v159, v338 : u32; - hir.assertz v161 #[code = 250]; - v162 = hir.int_to_ptr v159 : ptr; - hir.store v162, v158; - v163 = hir.bitcast v321 : u32; - v337 = arith.constant 4 : u32; - v165 = arith.mod v163, v337 : u32; - hir.assertz v165 #[code = 250]; - v166 = hir.int_to_ptr v163 : ptr; - hir.store v166, v152; - v169 = arith.constant -4 : i32; - v170 = arith.add v321, v169 : i32 #[overflow = wrapping]; - v167 = arith.constant 4 : i32; - v168 = arith.add v319, v167 : i32 #[overflow = wrapping]; - scf.yield v168, v170; - }; - v335 = ub.poison i32 : i32; - v310 = cf.select v145, v335, v322 : i32; - v336 = ub.poison i32 : i32; - v309 = cf.select v145, v336, v320 : i32; - v266 = arith.constant 1 : u32; - v259 = arith.constant 0 : u32; - v312 = cf.select v145, v259, v266 : u32; - v300 = arith.trunc v312 : i1; - scf.condition v300, v307, v309, v308, v310, v320, v322; - } do { - ^block40(v323: i32, v324: i32, v325: i32, v326: i32, v327: i32, v328: i32): - scf.yield v323, v324, v325, v326; - }; - v334 = arith.constant 8 : u32; - v172 = hir.bitcast v317 : u32; - v174 = arith.add v172, v334 : u32 #[overflow = checked]; - v333 = arith.constant 4 : u32; - v176 = arith.mod v174, v333 : u32; - hir.assertz v176 #[code = 250]; - v177 = hir.int_to_ptr v174 : ptr; - v178 = hir.load v177 : i64; - v332 = arith.constant 8 : u32; - v179 = hir.bitcast v318 : u32; - v181 = arith.add v179, v332 : u32 #[overflow = checked]; - v331 = arith.constant 8 : u32; - v183 = arith.mod v181, v331 : u32; - hir.assertz v183 #[code = 250]; - v184 = hir.int_to_ptr v181 : ptr; - hir.store v184, v178; - v185 = hir.bitcast v317 : u32; - v330 = arith.constant 4 : u32; - v187 = arith.mod v185, v330 : u32; - hir.assertz v187 #[code = 250]; - v188 = hir.int_to_ptr v185 : ptr; - v189 = hir.load v188 : i64; - v190 = hir.bitcast v318 : u32; - v329 = arith.constant 8 : u32; - v192 = arith.mod v190, v329 : u32; - hir.assertz v192 #[code = 250]; - v193 = hir.int_to_ptr v190 : ptr; - hir.store v193, v189; - builtin.ret ; - }; - - private builtin.function @intrinsics::felt::from_u32(v194: i32) -> felt { - ^block23(v194: i32): - v195 = hir.bitcast v194 : felt; - builtin.ret v195; - }; - - private builtin.function @miden::output_note::get_metadata(v197: felt, v198: i32) { - ^block25(v197: felt, v198: i32): - v199, v200, v201, v202 = hir.exec @miden/output_note/get_metadata(v197) : felt, felt, felt, felt - v203 = hir.bitcast v198 : u32; - v204 = hir.int_to_ptr v203 : ptr; - hir.store v204, v199; - v205 = arith.constant 4 : u32; - v206 = arith.add v203, v205 : u32 #[overflow = checked]; - v207 = hir.int_to_ptr v206 : ptr; - hir.store v207, v200; - v208 = arith.constant 8 : u32; - v209 = arith.add v203, v208 : u32 #[overflow = checked]; - v210 = hir.int_to_ptr v209 : ptr; - hir.store v210, v201; - v211 = arith.constant 12 : u32; - v212 = arith.add v203, v211 : u32 #[overflow = checked]; - v213 = hir.int_to_ptr v212 : ptr; - hir.store v213, v202; + private builtin.function @miden::protocol::output_note::get_metadata(v156: felt, v157: i32) { + ^block17(v156: felt, v157: i32): + v158, v159, v160, v161, v162, v163, v164, v165 = hir.exec @miden/protocol/output_note/get_metadata(v156) : felt, felt, felt, felt, felt, felt, felt, felt + v166 = hir.bitcast v157 : u32; + v167 = hir.int_to_ptr v166 : ptr; + hir.store v167, v158; + v290 = arith.constant 4 : u32; + v169 = arith.add v166, v290 : u32 #[overflow = checked]; + v170 = hir.int_to_ptr v169 : ptr; + hir.store v170, v159; + v289 = arith.constant 8 : u32; + v172 = arith.add v166, v289 : u32 #[overflow = checked]; + v173 = hir.int_to_ptr v172 : ptr; + hir.store v173, v160; + v288 = arith.constant 12 : u32; + v175 = arith.add v166, v288 : u32 #[overflow = checked]; + v176 = hir.int_to_ptr v175 : ptr; + hir.store v176, v161; + v287 = arith.constant 16 : u32; + v178 = arith.add v166, v287 : u32 #[overflow = checked]; + v179 = hir.int_to_ptr v178 : ptr; + hir.store v179, v162; + v286 = arith.constant 20 : u32; + v181 = arith.add v166, v286 : u32 #[overflow = checked]; + v182 = hir.int_to_ptr v181 : ptr; + hir.store v182, v163; + v285 = arith.constant 24 : u32; + v184 = arith.add v166, v285 : u32 #[overflow = checked]; + v185 = hir.int_to_ptr v184 : ptr; + hir.store v185, v164; + v284 = arith.constant 28 : u32; + v187 = arith.add v166, v284 : u32 #[overflow = checked]; + v188 = hir.int_to_ptr v187 : ptr; + hir.store v188, v165; builtin.ret ; }; @@ -317,34 +258,34 @@ builtin.component miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-outpu }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block29: - v214 = hir.exec @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1#binding() : i32 - v215 = arith.constant 0 : i32; - v216 = arith.add v214, v215 : i32 #[overflow = unchecked]; - v349 = arith.constant 0 : i32; - v350 = arith.constant 0 : i32; - v218 = arith.add v216, v350 : i32 #[overflow = unchecked]; - v220 = arith.add v218, v349 : i32 #[overflow = unchecked]; - v221 = hir.int_to_ptr v220 : ptr; - v222 = hir.load v221 : felt; - v348 = arith.constant 0 : i32; - v223 = arith.constant 4 : i32; - v224 = arith.add v216, v223 : i32 #[overflow = unchecked]; - v226 = arith.add v224, v348 : i32 #[overflow = unchecked]; - v227 = hir.int_to_ptr v226 : ptr; - v228 = hir.load v227 : felt; - v347 = arith.constant 0 : i32; - v229 = arith.constant 8 : i32; - v230 = arith.add v216, v229 : i32 #[overflow = unchecked]; - v232 = arith.add v230, v347 : i32 #[overflow = unchecked]; - v233 = hir.int_to_ptr v232 : ptr; - v234 = hir.load v233 : felt; - v346 = arith.constant 0 : i32; - v235 = arith.constant 12 : i32; - v236 = arith.add v216, v235 : i32 #[overflow = unchecked]; - v238 = arith.add v236, v346 : i32 #[overflow = unchecked]; - v239 = hir.int_to_ptr v238 : ptr; - v240 = hir.load v239 : felt; - builtin.ret v222, v228, v234, v240; + ^block22: + v189 = hir.exec @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1#binding() : i32 + v294 = arith.constant 0 : i32; + v191 = arith.add v189, v294 : i32 #[overflow = unchecked]; + v303 = arith.constant 0 : i32; + v304 = arith.constant 0 : i32; + v193 = arith.add v191, v304 : i32 #[overflow = unchecked]; + v195 = arith.add v193, v303 : i32 #[overflow = unchecked]; + v196 = hir.int_to_ptr v195 : ptr; + v197 = hir.load v196 : felt; + v302 = arith.constant 0 : i32; + v293 = arith.constant 4 : i32; + v199 = arith.add v191, v293 : i32 #[overflow = unchecked]; + v201 = arith.add v199, v302 : i32 #[overflow = unchecked]; + v202 = hir.int_to_ptr v201 : ptr; + v203 = hir.load v202 : felt; + v301 = arith.constant 0 : i32; + v292 = arith.constant 8 : i32; + v205 = arith.add v191, v292 : i32 #[overflow = unchecked]; + v207 = arith.add v205, v301 : i32 #[overflow = unchecked]; + v208 = hir.int_to_ptr v207 : ptr; + v209 = hir.load v208 : felt; + v300 = arith.constant 0 : i32; + v291 = arith.constant 12 : i32; + v211 = arith.add v191, v291 : i32 #[overflow = unchecked]; + v213 = arith.add v211, v300 : i32 #[overflow = unchecked]; + v214 = hir.int_to_ptr v213 : ptr; + v215 = hir.load v214 : felt; + builtin.ret v197, v203, v209, v215; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.masm index 93f1c238b..a1cc6574d 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.masm @@ -1,13 +1,13 @@ -# mod miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1 +# mod ::"miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> (felt, felt, felt, felt) - exec.::miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1::init + exec."miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1::rust_sdk_output_note_get_metadata_binding::miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1#binding + exec.::"miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1"::rust_sdk_output_note_get_metadata_binding::"miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1#binding" trace.252 nop push.0 @@ -62,7 +62,7 @@ pub proc binding( nop movdn.3 swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -75,7 +75,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -86,7 +86,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1::rust_sdk_output_note_get_metadata_binding +# mod ::"miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1"::rust_sdk_output_note_get_metadata_binding @callconv("C") proc __wasm_call_ctors( @@ -102,6 +102,7 @@ proc rust_sdk_output_note_get_metadata_binding::bindings::__link_custom_section_ nop end +@locals("2") @callconv("C") proc miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1#binding( @@ -114,11 +115,18 @@ proc miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-me exec.::intrinsics::mem::load_sw trace.252 nop - push.16 + push.32 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -128,19 +136,22 @@ proc miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-me nop trace.240 nop - exec.::miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1::rust_sdk_output_note_get_metadata_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1"::rust_sdk_output_note_get_metadata_binding::wit_bindgen::rt::run_ctors_once trace.252 nop + locaddr.0 push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1::rust_sdk_output_note_get_metadata_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop - dup.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1::rust_sdk_output_note_get_metadata_binding::miden_base_sys::bindings::output_note::get_metadata + exec.::"miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1"::rust_sdk_output_note_get_metadata_binding::miden_base_sys::bindings::output_note::get_metadata trace.252 nop push.1114148 @@ -153,8 +164,25 @@ proc miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-me nop push.1048584 u32wrapping_add - push.8 - dup.2 + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.24 + swap.1 add u32assert push.8 @@ -172,7 +200,7 @@ proc miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-me nop swap.1 push.8 - dup.3 + movup.3 add u32assert push.4 @@ -190,7 +218,26 @@ proc miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-me exec.::intrinsics::mem::store_dw trace.252 nop - dup.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + swap.1 + add + u32assert push.8 dup.1 swap.1 @@ -205,7 +252,7 @@ proc miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-me trace.252 nop swap.1 - dup.2 + movup.2 push.4 dup.1 swap.1 @@ -221,8 +268,15 @@ proc miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-me exec.::intrinsics::mem::store_dw trace.252 nop - push.16 - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 u32wrapping_add push.1114144 u32divmod.4 @@ -232,8 +286,17 @@ proc miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-me exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -275,9 +338,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1"::rust_sdk_output_note_get_metadata_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1::rust_sdk_output_note_get_metadata_binding::__wasm_call_ctors + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -308,11 +387,20 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("3") @callconv("C") proc miden_base_sys::bindings::output_note::get_metadata( i32, felt ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -323,9 +411,16 @@ proc miden_base_sys::bindings::output_note::get_metadata( nop push.32 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.2 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -333,15 +428,38 @@ proc miden_base_sys::bindings::output_note::get_metadata( exec.::intrinsics::mem::store_sw trace.252 nop - dup.0 - movup.3 + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1::rust_sdk_output_note_get_metadata_binding::miden::output_note::get_metadata + exec.::intrinsics::mem::load_sw trace.252 nop - push.8 - dup.1 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1"::rust_sdk_output_note_get_metadata_binding::"miden::protocol::output_note::get_metadata" + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + swap.1 add u32assert push.8 @@ -359,7 +477,7 @@ proc miden_base_sys::bindings::output_note::get_metadata( nop swap.1 push.24 - dup.3 + movup.3 add u32assert push.8 @@ -368,6 +486,8 @@ proc miden_base_sys::bindings::output_note::get_metadata( u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -377,7 +497,26 @@ proc miden_base_sys::bindings::output_note::get_metadata( exec.::intrinsics::mem::store_dw trace.252 nop - dup.0 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.24 + swap.1 + add + u32assert push.8 dup.1 swap.1 @@ -393,7 +532,7 @@ proc miden_base_sys::bindings::output_note::get_metadata( nop swap.1 push.16 - dup.3 + movup.3 add u32assert push.8 @@ -402,6 +541,8 @@ proc miden_base_sys::bindings::output_note::get_metadata( u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -411,46 +552,22 @@ proc miden_base_sys::bindings::output_note::get_metadata( exec.::intrinsics::mem::store_dw trace.252 nop - push.16 - dup.1 - u32wrapping_add - movup.2 - trace.240 - nop - exec.::miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1::rust_sdk_output_note_get_metadata_binding::::reverse - trace.252 - nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop -end - -@callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert push.8 dup.1 swap.1 @@ -466,15 +583,17 @@ proc ::reverse( nop swap.1 push.8 - dup.3 + movup.3 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -484,7 +603,26 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + swap.1 + add + u32assert push.8 dup.1 swap.1 @@ -499,13 +637,15 @@ proc ::reverse( trace.252 nop swap.1 - dup.2 - push.4 + movup.2 + push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -515,214 +655,87 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - push.12 - dup.1 - u32wrapping_add + locaddr.2 push.0 - movup.2 swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_sw trace.252 nop +end + +@callconv("C") +proc miden::protocol::output_note::get_metadata(felt, i32) + trace.240 + nop + exec.::miden::protocol::output_note::get_metadata + trace.252 + nop + movup.8 + dup.0 + movup.2 swap.1 - push.8 - dup.4 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop push.4 dup.1 - swap.1 - u32mod + add u32assert - assertz + movup.2 + swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_felt trace.252 nop - swap.1 - movup.2 push.8 dup.1 - swap.1 - u32mod + add u32assert - assertz + movup.2 + swap.1 u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc miden::output_note::get_metadata(felt, i32) + push.12 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 trace.240 nop - exec.::miden::output_note::get_metadata + exec.::intrinsics::mem::store_felt trace.252 nop - movup.4 - dup.0 + push.16 + dup.1 + add + u32assert movup.2 swap.1 u32divmod.4 @@ -732,7 +745,7 @@ proc miden::output_note::get_metadata(felt, i32) exec.::intrinsics::mem::store_felt trace.252 nop - push.4 + push.20 dup.1 add u32assert @@ -745,7 +758,7 @@ proc miden::output_note::get_metadata(felt, i32) exec.::intrinsics::mem::store_felt trace.252 nop - push.8 + push.24 dup.1 add u32assert @@ -758,7 +771,7 @@ proc miden::output_note::get_metadata(felt, i32) exec.::intrinsics::mem::store_felt trace.252 nop - push.12 + push.28 add u32assert u32divmod.4 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.wat index 50fd74900..21ca5794e 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.wat @@ -13,9 +13,8 @@ (type (;0;) (func)) (type (;1;) (func (result i32))) (type (;2;) (func (param i32 f32))) - (type (;3;) (func (param i32 i32))) - (type (;4;) (func (param i32) (result f32))) - (type (;5;) (func (param f32 i32))) + (type (;3;) (func (param i32) (result f32))) + (type (;4;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -28,7 +27,7 @@ (func $miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1#binding (;2;) (type 1) (result i32) (local i32 i32) global.get $__stack_pointer - i32.const 16 + i32.const 32 i32.sub local.tee 0 global.set $__stack_pointer @@ -42,14 +41,14 @@ i32.add local.tee 1 local.get 0 - i64.load offset=8 + i64.load offset=24 i64.store offset=8 align=4 local.get 1 local.get 0 - i64.load + i64.load offset=16 i64.store align=4 local.get 0 - i32.const 16 + i32.const 32 i32.add global.set $__stack_pointer local.get 1 @@ -81,91 +80,44 @@ global.set $__stack_pointer local.get 1 local.get 2 - call $miden::output_note::get_metadata - local.get 2 + call $miden::protocol::output_note::get_metadata + local.get 0 local.get 2 - i64.load offset=8 + i64.load offset=16 + i64.const 32 + i64.rotl i64.store offset=24 + local.get 0 local.get 2 - local.get 2 - i64.load + i64.load offset=24 + i64.const 32 + i64.rotl i64.store offset=16 local.get 0 local.get 2 - i32.const 16 - i32.add - call $::reverse - local.get 2 - i32.const 32 - i32.add - global.set $__stack_pointer - ) - (func $::reverse (;5;) (type 3) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 + i64.const 32 + i64.rotl i64.store offset=8 local.get 0 local.get 2 - i64.load align=4 + i64.load offset=8 + i64.const 32 + i64.rotl i64.store + local.get 2 + i32.const 32 + i32.add + global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) unreachable ) - (func $miden::output_note::get_metadata (;7;) (type 5) (param f32 i32) + (func $miden::protocol::output_note::get_metadata (;6;) (type 4) (param f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "Srust_sdk_output_note_get_metadata_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "Srust_sdk_output_note_get_metadata_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.hir index ce2428a71..1ee72bc07 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.hir @@ -12,296 +12,179 @@ builtin.component miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-outp private builtin.function @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1#binding() -> i32 { ^block9: - v2 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__stack_pointer : ptr - v3 = hir.bitcast v2 : ptr; - v4 = hir.load v3 : i32; - v5 = arith.constant 16 : i32; - v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; - v7 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__stack_pointer : ptr - v8 = hir.bitcast v7 : ptr; - hir.store v8, v6; + v1 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v173 = arith.constant 16 : i32; + v5 = arith.sub v3, v173 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; hir.exec @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/wit_bindgen::rt::run_ctors_once() - v1 = arith.constant 0 : i32; - v10 = hir.exec @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/intrinsics::felt::from_u32(v1) : felt - hir.exec @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/miden_base_sys::bindings::output_note::get_recipient(v6, v10) + v8 = hir.load_local : i32 #[local = lv0]; + v169 = arith.constant 0 : felt; + hir.exec @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/miden_base_sys::bindings::output_note::get_recipient(v8, v169) v11 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/GOT.data.internal.__memory_base : ptr v12 = hir.bitcast v11 : ptr; v13 = hir.load v12 : i32; - v14 = arith.constant 1048584 : i32; - v15 = arith.add v13, v14 : i32 #[overflow = wrapping]; - v17 = arith.constant 8 : u32; - v16 = hir.bitcast v6 : u32; - v18 = arith.add v16, v17 : u32 #[overflow = checked]; - v251 = arith.constant 8 : u32; - v20 = arith.mod v18, v251 : u32; - hir.assertz v20 #[code = 250]; - v21 = hir.int_to_ptr v18 : ptr; - v22 = hir.load v21 : i64; - v250 = arith.constant 8 : u32; - v23 = hir.bitcast v15 : u32; - v25 = arith.add v23, v250 : u32 #[overflow = checked]; - v26 = arith.constant 4 : u32; - v27 = arith.mod v25, v26 : u32; - hir.assertz v27 #[code = 250]; - v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v22; - v29 = hir.bitcast v6 : u32; - v249 = arith.constant 8 : u32; - v31 = arith.mod v29, v249 : u32; - hir.assertz v31 #[code = 250]; - v32 = hir.int_to_ptr v29 : ptr; - v33 = hir.load v32 : i64; - v34 = hir.bitcast v15 : u32; - v248 = arith.constant 4 : u32; - v36 = arith.mod v34, v248 : u32; - hir.assertz v36 #[code = 250]; - v37 = hir.int_to_ptr v34 : ptr; - hir.store v37, v33; - v247 = arith.constant 16 : i32; - v39 = arith.add v6, v247 : i32 #[overflow = wrapping]; - v40 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__stack_pointer : ptr - v41 = hir.bitcast v40 : ptr; - hir.store v41, v39; - builtin.ret v15; + v172 = arith.constant 1048584 : i32; + v15 = arith.add v13, v172 : i32 #[overflow = wrapping]; + hir.store_local v15 #[local = lv1]; + v16 = hir.load_local : i32 #[local = lv0]; + v171 = arith.constant 8 : u32; + v17 = hir.bitcast v16 : u32; + v19 = arith.add v17, v171 : u32 #[overflow = checked]; + v183 = arith.constant 8 : u32; + v21 = arith.mod v19, v183 : u32; + hir.assertz v21 #[code = 250]; + v22 = hir.int_to_ptr v19 : ptr; + v23 = hir.load v22 : i64; + v182 = arith.constant 8 : u32; + v24 = hir.bitcast v15 : u32; + v26 = arith.add v24, v182 : u32 #[overflow = checked]; + v170 = arith.constant 4 : u32; + v28 = arith.mod v26, v170 : u32; + hir.assertz v28 #[code = 250]; + v29 = hir.int_to_ptr v26 : ptr; + hir.store v29, v23; + v30 = hir.load_local : i32 #[local = lv1]; + v31 = hir.load_local : i32 #[local = lv0]; + v32 = hir.bitcast v31 : u32; + v181 = arith.constant 8 : u32; + v34 = arith.mod v32, v181 : u32; + hir.assertz v34 #[code = 250]; + v35 = hir.int_to_ptr v32 : ptr; + v36 = hir.load v35 : i64; + v37 = hir.bitcast v30 : u32; + v180 = arith.constant 4 : u32; + v39 = arith.mod v37, v180 : u32; + hir.assertz v39 #[code = 250]; + v40 = hir.int_to_ptr v37 : ptr; + hir.store v40, v36; + v41 = hir.load_local : i32 #[local = lv0]; + v179 = arith.constant 16 : i32; + v43 = arith.add v41, v179 : i32 #[overflow = wrapping]; + v44 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__stack_pointer : ptr + v45 = hir.bitcast v44 : ptr; + hir.store v45, v43; + v46 = hir.load_local : i32 #[local = lv1]; + builtin.ret v46; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v43 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/GOT.data.internal.__memory_base : ptr - v44 = hir.bitcast v43 : ptr; - v45 = hir.load v44 : i32; - v46 = arith.constant 1048600 : i32; - v47 = arith.add v45, v46 : i32 #[overflow = wrapping]; - v48 = hir.bitcast v47 : u32; - v49 = hir.int_to_ptr v48 : ptr; - v50 = hir.load v49 : u8; - v42 = arith.constant 0 : i32; - v51 = arith.zext v50 : u32; - v52 = hir.bitcast v51 : i32; - v54 = arith.neq v52, v42 : i1; - scf.if v54{ + v47 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/GOT.data.internal.__memory_base : ptr + v48 = hir.bitcast v47 : ptr; + v49 = hir.load v48 : i32; + v188 = arith.constant 1048600 : i32; + v51 = arith.add v49, v188 : i32 #[overflow = wrapping]; + v52 = hir.bitcast v51 : u32; + v53 = hir.int_to_ptr v52 : ptr; + v54 = hir.load v53 : u8; + v187 = arith.constant 0 : i32; + v55 = arith.zext v54 : u32; + v56 = hir.bitcast v55 : i32; + v58 = arith.neq v56, v187 : i1; + scf.if v58{ ^block13: scf.yield ; } else { ^block14: - v55 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/GOT.data.internal.__memory_base : ptr - v56 = hir.bitcast v55 : ptr; - v57 = hir.load v56 : i32; + v59 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/GOT.data.internal.__memory_base : ptr + v60 = hir.bitcast v59 : ptr; + v61 = hir.load v60 : i32; + hir.store_local v61 #[local = lv0]; hir.exec @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__wasm_call_ctors() - v253 = arith.constant 1 : u8; - v255 = arith.constant 1048600 : i32; - v59 = arith.add v57, v255 : i32 #[overflow = wrapping]; - v63 = hir.bitcast v59 : u32; - v64 = hir.int_to_ptr v63 : ptr; - hir.store v64, v253; + v62 = hir.load_local : i32 #[local = lv0]; + v186 = arith.constant 1 : u8; + v191 = arith.constant 1048600 : i32; + v64 = arith.add v62, v191 : i32 #[overflow = wrapping]; + v68 = hir.bitcast v64 : u32; + v69 = hir.int_to_ptr v68 : ptr; + hir.store v69, v186; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::output_note::get_recipient(v65: i32, v66: felt) { - ^block15(v65: i32, v66: felt): - v68 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__stack_pointer : ptr - v69 = hir.bitcast v68 : ptr; - v70 = hir.load v69 : i32; - v71 = arith.constant 32 : i32; - v72 = arith.sub v70, v71 : i32 #[overflow = wrapping]; - v73 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__stack_pointer : ptr - v74 = hir.bitcast v73 : ptr; - hir.store v74, v72; - hir.exec @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/miden::output_note::get_recipient(v66, v72) - v76 = arith.constant 8 : u32; - v75 = hir.bitcast v72 : u32; - v77 = arith.add v75, v76 : u32 #[overflow = checked]; - v260 = arith.constant 8 : u32; - v79 = arith.mod v77, v260 : u32; - hir.assertz v79 #[code = 250]; - v80 = hir.int_to_ptr v77 : ptr; - v81 = hir.load v80 : i64; - v83 = arith.constant 24 : u32; - v82 = hir.bitcast v72 : u32; - v84 = arith.add v82, v83 : u32 #[overflow = checked]; - v259 = arith.constant 8 : u32; - v86 = arith.mod v84, v259 : u32; - hir.assertz v86 #[code = 250]; - v87 = hir.int_to_ptr v84 : ptr; - hir.store v87, v81; - v88 = hir.bitcast v72 : u32; - v258 = arith.constant 8 : u32; - v90 = arith.mod v88, v258 : u32; - hir.assertz v90 #[code = 250]; - v91 = hir.int_to_ptr v88 : ptr; - v92 = hir.load v91 : i64; - v94 = arith.constant 16 : u32; - v93 = hir.bitcast v72 : u32; - v95 = arith.add v93, v94 : u32 #[overflow = checked]; - v257 = arith.constant 8 : u32; - v97 = arith.mod v95, v257 : u32; - hir.assertz v97 #[code = 250]; - v98 = hir.int_to_ptr v95 : ptr; - hir.store v98, v92; - v99 = arith.constant 16 : i32; - v100 = arith.add v72, v99 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/::reverse(v65, v100) - v256 = arith.constant 32 : i32; - v102 = arith.add v72, v256 : i32 #[overflow = wrapping]; - v103 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__stack_pointer : ptr - v104 = hir.bitcast v103 : ptr; - hir.store v104, v102; - builtin.ret ; - }; - - private builtin.function @::reverse(v105: i32, v106: i32) { - ^block17(v105: i32, v106: i32): - v109 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__stack_pointer : ptr - v110 = hir.bitcast v109 : ptr; - v111 = hir.load v110 : i32; - v112 = arith.constant 16 : i32; - v113 = arith.sub v111, v112 : i32 #[overflow = wrapping]; - v115 = arith.constant 8 : u32; - v114 = hir.bitcast v106 : u32; - v116 = arith.add v114, v115 : u32 #[overflow = checked]; - v347 = arith.constant 8 : u32; - v118 = arith.mod v116, v347 : u32; - hir.assertz v118 #[code = 250]; - v119 = hir.int_to_ptr v116 : ptr; - v120 = hir.load v119 : i64; - v346 = arith.constant 8 : u32; - v121 = hir.bitcast v113 : u32; - v123 = arith.add v121, v346 : u32 #[overflow = checked]; - v124 = arith.constant 4 : u32; - v125 = arith.mod v123, v124 : u32; - hir.assertz v125 #[code = 250]; - v126 = hir.int_to_ptr v123 : ptr; - hir.store v126, v120; - v127 = hir.bitcast v106 : u32; - v345 = arith.constant 8 : u32; - v129 = arith.mod v127, v345 : u32; - hir.assertz v129 #[code = 250]; - v130 = hir.int_to_ptr v127 : ptr; - v131 = hir.load v130 : i64; - v132 = hir.bitcast v113 : u32; - v344 = arith.constant 4 : u32; - v134 = arith.mod v132, v344 : u32; - hir.assertz v134 #[code = 250]; - v135 = hir.int_to_ptr v132 : ptr; - hir.store v135, v131; - v136 = arith.constant 12 : i32; - v137 = arith.add v113, v136 : i32 #[overflow = wrapping]; - v107 = arith.constant 0 : i32; - v315, v316, v317, v318, v319, v320 = scf.while v107, v113, v137, v105 : i32, i32, i32, i32, i32, i32 { - ^block39(v321: i32, v322: i32, v323: i32, v324: i32): - v343 = arith.constant 0 : i32; - v140 = arith.constant 8 : i32; - v141 = arith.eq v321, v140 : i1; - v142 = arith.zext v141 : u32; - v143 = hir.bitcast v142 : i32; - v145 = arith.neq v143, v343 : i1; - v309, v310 = scf.if v145 : i32, i32 { - ^block38: - v269 = ub.poison i32 : i32; - scf.yield v269, v269; - } else { - ^block22: - v147 = arith.add v322, v321 : i32 #[overflow = wrapping]; - v148 = hir.bitcast v147 : u32; - v342 = arith.constant 4 : u32; - v150 = arith.mod v148, v342 : u32; - hir.assertz v150 #[code = 250]; - v151 = hir.int_to_ptr v148 : ptr; - v152 = hir.load v151 : felt; - v154 = hir.bitcast v323 : u32; - v341 = arith.constant 4 : u32; - v156 = arith.mod v154, v341 : u32; - hir.assertz v156 #[code = 250]; - v157 = hir.int_to_ptr v154 : ptr; - v158 = hir.load v157 : i32; - v159 = hir.bitcast v147 : u32; - v340 = arith.constant 4 : u32; - v161 = arith.mod v159, v340 : u32; - hir.assertz v161 #[code = 250]; - v162 = hir.int_to_ptr v159 : ptr; - hir.store v162, v158; - v163 = hir.bitcast v323 : u32; - v339 = arith.constant 4 : u32; - v165 = arith.mod v163, v339 : u32; - hir.assertz v165 #[code = 250]; - v166 = hir.int_to_ptr v163 : ptr; - hir.store v166, v152; - v169 = arith.constant -4 : i32; - v170 = arith.add v323, v169 : i32 #[overflow = wrapping]; - v167 = arith.constant 4 : i32; - v168 = arith.add v321, v167 : i32 #[overflow = wrapping]; - scf.yield v168, v170; - }; - v337 = ub.poison i32 : i32; - v312 = cf.select v145, v337, v324 : i32; - v338 = ub.poison i32 : i32; - v311 = cf.select v145, v338, v322 : i32; - v268 = arith.constant 1 : u32; - v261 = arith.constant 0 : u32; - v314 = cf.select v145, v261, v268 : u32; - v302 = arith.trunc v314 : i1; - scf.condition v302, v309, v311, v310, v312, v322, v324; - } do { - ^block40(v325: i32, v326: i32, v327: i32, v328: i32, v329: i32, v330: i32): - scf.yield v325, v326, v327, v328; - }; - v336 = arith.constant 8 : u32; - v172 = hir.bitcast v319 : u32; - v174 = arith.add v172, v336 : u32 #[overflow = checked]; - v335 = arith.constant 4 : u32; - v176 = arith.mod v174, v335 : u32; - hir.assertz v176 #[code = 250]; - v177 = hir.int_to_ptr v174 : ptr; - v178 = hir.load v177 : i64; - v334 = arith.constant 8 : u32; - v179 = hir.bitcast v320 : u32; - v181 = arith.add v179, v334 : u32 #[overflow = checked]; - v333 = arith.constant 8 : u32; - v183 = arith.mod v181, v333 : u32; - hir.assertz v183 #[code = 250]; - v184 = hir.int_to_ptr v181 : ptr; - hir.store v184, v178; - v185 = hir.bitcast v319 : u32; - v332 = arith.constant 4 : u32; - v187 = arith.mod v185, v332 : u32; - hir.assertz v187 #[code = 250]; - v188 = hir.int_to_ptr v185 : ptr; - v189 = hir.load v188 : i64; - v190 = hir.bitcast v320 : u32; - v331 = arith.constant 8 : u32; - v192 = arith.mod v190, v331 : u32; - hir.assertz v192 #[code = 250]; - v193 = hir.int_to_ptr v190 : ptr; - hir.store v193, v189; + private builtin.function @miden_base_sys::bindings::output_note::get_recipient(v70: i32, v71: felt) { + ^block15(v70: i32, v71: felt): + hir.store_local v70 #[local = lv0]; + v72 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__stack_pointer : ptr + v73 = hir.bitcast v72 : ptr; + v74 = hir.load v73 : i32; + v199 = arith.constant 16 : i32; + v76 = arith.sub v74, v199 : i32 #[overflow = wrapping]; + hir.store_local v76 #[local = lv2]; + v77 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__stack_pointer : ptr + v78 = hir.bitcast v77 : ptr; + hir.store v78, v76; + v80 = hir.load_local : i32 #[local = lv2]; + hir.exec @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/miden::protocol::output_note::get_recipient(v71, v80) + v81 = hir.load_local : i32 #[local = lv0]; + v82 = hir.load_local : i32 #[local = lv2]; + v83 = hir.bitcast v82 : u32; + v198 = arith.constant 8 : u32; + v85 = arith.mod v83, v198 : u32; + hir.assertz v85 #[code = 250]; + v86 = hir.int_to_ptr v83 : ptr; + v87 = hir.load v86 : i64; + v195, v196 = arith.split v87 : felt, felt; + v211 = arith.constant 8 : u32; + v91 = hir.bitcast v81 : u32; + v93 = arith.add v91, v211 : u32 #[overflow = checked]; + v210 = arith.constant 8 : u32; + v95 = arith.mod v93, v210 : u32; + hir.assertz v95 #[code = 250]; + v197 = arith.join v196, v195 : i64; + v96 = hir.int_to_ptr v93 : ptr; + hir.store v96, v197; + v97 = hir.load_local : i32 #[local = lv0]; + v98 = hir.load_local : i32 #[local = lv2]; + v209 = arith.constant 8 : u32; + v99 = hir.bitcast v98 : u32; + v101 = arith.add v99, v209 : u32 #[overflow = checked]; + v208 = arith.constant 8 : u32; + v103 = arith.mod v101, v208 : u32; + hir.assertz v103 #[code = 250]; + v104 = hir.int_to_ptr v101 : ptr; + v105 = hir.load v104 : i64; + v192, v193 = arith.split v105 : felt, felt; + v109 = hir.bitcast v97 : u32; + v207 = arith.constant 8 : u32; + v111 = arith.mod v109, v207 : u32; + hir.assertz v111 #[code = 250]; + v194 = arith.join v193, v192 : i64; + v112 = hir.int_to_ptr v109 : ptr; + hir.store v112, v194; + v113 = hir.load_local : i32 #[local = lv2]; + v206 = arith.constant 16 : i32; + v115 = arith.add v113, v206 : i32 #[overflow = wrapping]; + v116 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__stack_pointer : ptr + v117 = hir.bitcast v116 : ptr; + hir.store v117, v115; builtin.ret ; }; - private builtin.function @intrinsics::felt::from_u32(v194: i32) -> felt { - ^block23(v194: i32): - v195 = hir.bitcast v194 : felt; - builtin.ret v195; - }; - - private builtin.function @miden::output_note::get_recipient(v197: felt, v198: i32) { - ^block25(v197: felt, v198: i32): - v199, v200, v201, v202 = hir.exec @miden/output_note/get_recipient(v197) : felt, felt, felt, felt - v203 = hir.bitcast v198 : u32; - v204 = hir.int_to_ptr v203 : ptr; - hir.store v204, v199; - v205 = arith.constant 4 : u32; - v206 = arith.add v203, v205 : u32 #[overflow = checked]; - v207 = hir.int_to_ptr v206 : ptr; - hir.store v207, v200; - v208 = arith.constant 8 : u32; - v209 = arith.add v203, v208 : u32 #[overflow = checked]; - v210 = hir.int_to_ptr v209 : ptr; - hir.store v210, v201; - v211 = arith.constant 12 : u32; - v212 = arith.add v203, v211 : u32 #[overflow = checked]; - v213 = hir.int_to_ptr v212 : ptr; - hir.store v213, v202; + private builtin.function @miden::protocol::output_note::get_recipient(v118: felt, v119: i32) { + ^block17(v118: felt, v119: i32): + v120, v121, v122, v123 = hir.exec @miden/protocol/output_note/get_recipient(v118) : felt, felt, felt, felt + v124 = hir.bitcast v119 : u32; + v125 = hir.int_to_ptr v124 : ptr; + hir.store v125, v120; + v214 = arith.constant 4 : u32; + v127 = arith.add v124, v214 : u32 #[overflow = checked]; + v128 = hir.int_to_ptr v127 : ptr; + hir.store v128, v121; + v213 = arith.constant 8 : u32; + v130 = arith.add v124, v213 : u32 #[overflow = checked]; + v131 = hir.int_to_ptr v130 : ptr; + hir.store v131, v122; + v212 = arith.constant 12 : u32; + v133 = arith.add v124, v212 : u32 #[overflow = checked]; + v134 = hir.int_to_ptr v133 : ptr; + hir.store v134, v123; builtin.ret ; }; @@ -317,36 +200,36 @@ builtin.component miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-outp }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block29: - v214 = hir.exec @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1#binding() : i32 - v353 = arith.constant 0 : i32; - v215 = arith.constant 0 : i32; - v216 = arith.add v214, v215 : i32 #[overflow = unchecked]; - v218 = arith.add v216, v353 : i32 #[overflow = unchecked]; - v351 = arith.constant 0 : i32; - v352 = arith.constant 0 : i32; - v220 = arith.add v218, v352 : i32 #[overflow = unchecked]; - v222 = arith.add v220, v351 : i32 #[overflow = unchecked]; - v223 = hir.int_to_ptr v222 : ptr; - v224 = hir.load v223 : felt; - v350 = arith.constant 0 : i32; - v225 = arith.constant 4 : i32; - v226 = arith.add v218, v225 : i32 #[overflow = unchecked]; - v228 = arith.add v226, v350 : i32 #[overflow = unchecked]; - v229 = hir.int_to_ptr v228 : ptr; - v230 = hir.load v229 : felt; - v349 = arith.constant 0 : i32; - v231 = arith.constant 8 : i32; - v232 = arith.add v218, v231 : i32 #[overflow = unchecked]; - v234 = arith.add v232, v349 : i32 #[overflow = unchecked]; - v235 = hir.int_to_ptr v234 : ptr; - v236 = hir.load v235 : felt; - v348 = arith.constant 0 : i32; - v237 = arith.constant 12 : i32; - v238 = arith.add v218, v237 : i32 #[overflow = unchecked]; - v240 = arith.add v238, v348 : i32 #[overflow = unchecked]; - v241 = hir.int_to_ptr v240 : ptr; - v242 = hir.load v241 : felt; - builtin.ret v224, v230, v236, v242; + ^block22: + v135 = hir.exec @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1#binding() : i32 + v230 = arith.constant 0 : i32; + v224 = arith.constant 0 : i32; + v137 = arith.add v135, v224 : i32 #[overflow = unchecked]; + v139 = arith.add v137, v230 : i32 #[overflow = unchecked]; + v228 = arith.constant 0 : i32; + v229 = arith.constant 0 : i32; + v141 = arith.add v139, v229 : i32 #[overflow = unchecked]; + v143 = arith.add v141, v228 : i32 #[overflow = unchecked]; + v144 = hir.int_to_ptr v143 : ptr; + v145 = hir.load v144 : felt; + v227 = arith.constant 0 : i32; + v217 = arith.constant 4 : i32; + v147 = arith.add v139, v217 : i32 #[overflow = unchecked]; + v149 = arith.add v147, v227 : i32 #[overflow = unchecked]; + v150 = hir.int_to_ptr v149 : ptr; + v151 = hir.load v150 : felt; + v226 = arith.constant 0 : i32; + v216 = arith.constant 8 : i32; + v153 = arith.add v139, v216 : i32 #[overflow = unchecked]; + v155 = arith.add v153, v226 : i32 #[overflow = unchecked]; + v156 = hir.int_to_ptr v155 : ptr; + v157 = hir.load v156 : felt; + v225 = arith.constant 0 : i32; + v215 = arith.constant 12 : i32; + v159 = arith.add v139, v215 : i32 #[overflow = unchecked]; + v161 = arith.add v159, v225 : i32 #[overflow = unchecked]; + v162 = hir.int_to_ptr v161 : ptr; + v163 = hir.load v162 : felt; + builtin.ret v145, v151, v157, v163; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.masm index 144af393b..10a6eea7b 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.masm @@ -1,13 +1,13 @@ -# mod miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1 +# mod ::"miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1" @callconv("canon-lift") pub proc binding( ) -> (felt, felt, felt, felt) - exec.::miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1::init + exec."miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1"::init trace.240 nop - exec.::miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1::rust_sdk_output_note_get_recipient_binding::miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1#binding + exec.::"miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1"::rust_sdk_output_note_get_recipient_binding::"miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1#binding" trace.252 nop push.0 @@ -65,7 +65,7 @@ pub proc binding( nop movdn.3 swap.2 - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -78,7 +78,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -89,7 +89,7 @@ proc init mem_store.278537 end -# mod miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1::rust_sdk_output_note_get_recipient_binding +# mod ::"miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1"::rust_sdk_output_note_get_recipient_binding @callconv("C") proc __wasm_call_ctors( @@ -105,6 +105,7 @@ proc rust_sdk_output_note_get_recipient_binding::bindings::__link_custom_section nop end +@locals("2") @callconv("C") proc miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1#binding( @@ -119,9 +120,16 @@ proc miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-r nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -131,19 +139,22 @@ proc miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-r nop trace.240 nop - exec.::miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1::rust_sdk_output_note_get_recipient_binding::wit_bindgen::rt::run_ctors_once + exec.::"miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1"::rust_sdk_output_note_get_recipient_binding::wit_bindgen::rt::run_ctors_once trace.252 nop + locaddr.0 push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1::rust_sdk_output_note_get_recipient_binding::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop - dup.1 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1::rust_sdk_output_note_get_recipient_binding::miden_base_sys::bindings::output_note::get_recipient + exec.::"miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1"::rust_sdk_output_note_get_recipient_binding::miden_base_sys::bindings::output_note::get_recipient trace.252 nop push.1114148 @@ -156,8 +167,25 @@ proc miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-r nop push.1048584 u32wrapping_add + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.2 + swap.1 add u32assert push.8 @@ -175,7 +203,7 @@ proc miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-r nop swap.1 push.8 - dup.3 + movup.3 add u32assert push.4 @@ -193,7 +221,22 @@ proc miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-r exec.::intrinsics::mem::store_dw trace.252 nop - dup.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 dup.1 swap.1 @@ -208,7 +251,7 @@ proc miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-r trace.252 nop swap.1 - dup.2 + movup.2 push.4 dup.1 swap.1 @@ -224,8 +267,15 @@ proc miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-r exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - movup.2 u32wrapping_add push.1114144 u32divmod.4 @@ -235,8 +285,17 @@ proc miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-r exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -278,9 +337,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1::rust_sdk_output_note_get_recipient_binding::__wasm_call_ctors + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1"::rust_sdk_output_note_get_recipient_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -311,149 +386,77 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("3") @callconv("C") proc miden_base_sys::bindings::output_note::get_recipient( i32, felt ) - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::store_sw trace.252 nop - push.32 - u32wrapping_sub push.1114144 - dup.1 - swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop + push.16 + u32wrapping_sub dup.0 - movup.3 - trace.240 - nop - exec.::miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1::rust_sdk_output_note_get_recipient_binding::miden::output_note::get_recipient - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_sw trace.252 nop - swap.1 - push.24 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.1114144 u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop - dup.0 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop swap.1 - push.16 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::"miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1"::rust_sdk_output_note_get_recipient_binding::"miden::protocol::output_note::get_recipient" trace.252 nop - push.16 - dup.1 - u32wrapping_add - movup.2 - trace.240 - nop - exec.::miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1::rust_sdk_output_note_get_recipient_binding::::reverse - trace.252 - nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop -end - -@callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert push.8 dup.1 swap.1 @@ -469,15 +472,17 @@ proc ::reverse( nop swap.1 push.8 - dup.3 + movup.3 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -487,167 +492,27 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop push.8 - dup.1 + swap.1 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod @@ -661,16 +526,15 @@ proc ::reverse( trace.252 nop swap.1 - push.8 - dup.4 - add - u32assert + movup.2 push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -680,48 +544,31 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop - swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.16 + u32wrapping_add + push.1114144 u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop end @callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc miden::output_note::get_recipient(felt, i32) +proc miden::protocol::output_note::get_recipient(felt, i32) trace.240 nop - exec.::miden::output_note::get_recipient + exec.::miden::protocol::output_note::get_recipient trace.252 nop movup.4 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.wat index 8ce966423..726a029a6 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.wat @@ -15,9 +15,8 @@ (type (;0;) (func)) (type (;1;) (func (result i32))) (type (;2;) (func (param i32 f32))) - (type (;3;) (func (param i32 i32))) - (type (;4;) (func (param i32) (result f32))) - (type (;5;) (func (param f32 i32))) + (type (;3;) (func (param i32) (result f32))) + (type (;4;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -77,97 +76,38 @@ (func $miden_base_sys::bindings::output_note::get_recipient (;4;) (type 2) (param i32 f32) (local i32) global.get $__stack_pointer - i32.const 32 + i32.const 16 i32.sub local.tee 2 global.set $__stack_pointer local.get 1 local.get 2 - call $miden::output_note::get_recipient - local.get 2 - local.get 2 - i64.load offset=8 - i64.store offset=24 - local.get 2 - local.get 2 - i64.load - i64.store offset=16 + call $miden::protocol::output_note::get_recipient local.get 0 local.get 2 - i32.const 16 - i32.add - call $::reverse - local.get 2 - i32.const 32 - i32.add - global.set $__stack_pointer - ) - (func $::reverse (;5;) (type 3) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 + i64.const 32 + i64.rotl i64.store offset=8 local.get 0 local.get 2 - i64.load align=4 + i64.load offset=8 + i64.const 32 + i64.rotl i64.store + local.get 2 + i32.const 16 + i32.add + global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) unreachable ) - (func $miden::output_note::get_recipient (;7;) (type 5) (param f32 i32) + (func $miden::protocol::output_note::get_recipient (;6;) (type 4) (param f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "Urust_sdk_output_note_get_recipient_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "Urust_sdk_output_note_get_recipient_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "recipient" (type $recipient (;1;))) (core instance $main (;0;) (instantiate $main)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_array_attachment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_array_attachment_binding.hir new file mode 100644 index 000000000..4466575a6 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_array_attachment_binding.hir @@ -0,0 +1,221 @@ +builtin.component miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1 { + builtin.module public @rust_sdk_output_note_set_array_attachment_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_output_note_set_array_attachment_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1#binding() -> felt { + ^block9: + v1 = builtin.global_symbol @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v151 = arith.constant 32 : i32; + v5 = arith.sub v3, v151 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; + hir.exec @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/wit_bindgen::rt::run_ctors_once() + v150 = arith.constant 0 : i32; + hir.store_local v150 #[local = lv1]; + v143 = arith.constant 0 : felt; + hir.store_local v143 #[local = lv2]; + v181 = arith.constant 0 : felt; + hir.store_local v181 #[local = lv3]; + v180 = arith.constant 0 : felt; + hir.store_local v180 #[local = lv4]; + scf.while { + ^block12: + v15 = hir.load_local : i32 #[local = lv1]; + v179 = arith.constant 0 : i32; + v145 = arith.constant 16 : i32; + v17 = arith.eq v15, v145 : i1; + v18 = arith.zext v17 : u32; + v19 = hir.bitcast v18 : i32; + v21 = arith.neq v19, v179 : i1; + scf.if v21{ + ^block34: + scf.yield ; + } else { + ^block14: + v22 = hir.load_local : i32 #[local = lv0]; + v25 = hir.load_local : i32 #[local = lv1]; + v27 = hir.load_local : felt #[local = lv4]; + v178 = arith.constant 16 : i32; + v24 = arith.add v22, v178 : i32 #[overflow = wrapping]; + v26 = arith.add v24, v25 : i32 #[overflow = wrapping]; + v28 = hir.bitcast v26 : u32; + v152 = arith.constant 4 : u32; + v30 = arith.mod v28, v152 : u32; + hir.assertz v30 #[code = 250]; + v31 = hir.int_to_ptr v28 : ptr; + hir.store v31, v27; + v32 = hir.load_local : i32 #[local = lv1]; + v144 = arith.constant 4 : i32; + v34 = arith.add v32, v144 : i32 #[overflow = wrapping]; + hir.store_local v34 #[local = lv1]; + scf.yield ; + }; + v166 = arith.constant 1 : u32; + v163 = arith.constant 0 : u32; + v171 = cf.select v21, v163, v166 : u32; + v167 = arith.trunc v171 : i1; + scf.condition v167; + } do { + ^block33: + scf.yield ; + }; + v35 = hir.load_local : i32 #[local = lv0]; + v149 = arith.constant 24 : u32; + v37 = hir.bitcast v35 : u32; + v39 = arith.add v37, v149 : u32 #[overflow = checked]; + v177 = arith.constant 4 : u32; + v41 = arith.mod v39, v177 : u32; + hir.assertz v41 #[code = 250]; + v42 = hir.int_to_ptr v39 : ptr; + v43 = hir.load v42 : i64; + v147 = arith.constant 8 : u32; + v44 = hir.bitcast v35 : u32; + v46 = arith.add v44, v147 : u32 #[overflow = checked]; + v176 = arith.constant 8 : u32; + v48 = arith.mod v46, v176 : u32; + hir.assertz v48 #[code = 250]; + v49 = hir.int_to_ptr v46 : ptr; + hir.store v49, v43; + v50 = hir.load_local : i32 #[local = lv0]; + v146 = arith.constant 16 : u32; + v52 = hir.bitcast v50 : u32; + v54 = arith.add v52, v146 : u32 #[overflow = checked]; + v175 = arith.constant 4 : u32; + v56 = arith.mod v54, v175 : u32; + hir.assertz v56 #[code = 250]; + v57 = hir.int_to_ptr v54 : ptr; + v58 = hir.load v57 : i64; + v59 = hir.bitcast v50 : u32; + v174 = arith.constant 8 : u32; + v61 = arith.mod v59, v174 : u32; + hir.assertz v61 #[code = 250]; + v62 = hir.int_to_ptr v59 : ptr; + hir.store v62, v58; + v63 = hir.load_local : felt #[local = lv2]; + v64 = hir.load_local : felt #[local = lv3]; + v65 = hir.load_local : i32 #[local = lv0]; + hir.exec @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/miden_base_sys::bindings::output_note::set_array_attachment(v63, v64, v65) + v173 = arith.constant 0 : felt; + hir.store_local v173 #[local = lv4]; + v68 = hir.load_local : i32 #[local = lv0]; + v172 = arith.constant 32 : i32; + v70 = arith.add v68, v172 : i32 #[overflow = wrapping]; + v71 = builtin.global_symbol @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/__stack_pointer : ptr + v72 = hir.bitcast v71 : ptr; + hir.store v72, v70; + v73 = hir.load_local : felt #[local = lv4]; + builtin.ret v73; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block15: + v74 = builtin.global_symbol @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/GOT.data.internal.__memory_base : ptr + v75 = hir.bitcast v74 : ptr; + v76 = hir.load v75 : i32; + v186 = arith.constant 1048584 : i32; + v78 = arith.add v76, v186 : i32 #[overflow = wrapping]; + v79 = hir.bitcast v78 : u32; + v80 = hir.int_to_ptr v79 : ptr; + v81 = hir.load v80 : u8; + v185 = arith.constant 0 : i32; + v82 = arith.zext v81 : u32; + v83 = hir.bitcast v82 : i32; + v85 = arith.neq v83, v185 : i1; + scf.if v85{ + ^block17: + scf.yield ; + } else { + ^block18: + v86 = builtin.global_symbol @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/GOT.data.internal.__memory_base : ptr + v87 = hir.bitcast v86 : ptr; + v88 = hir.load v87 : i32; + hir.store_local v88 #[local = lv0]; + hir.exec @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/__wasm_call_ctors() + v89 = hir.load_local : i32 #[local = lv0]; + v184 = arith.constant 1 : u8; + v189 = arith.constant 1048584 : i32; + v91 = arith.add v89, v189 : i32 #[overflow = wrapping]; + v95 = hir.bitcast v91 : u32; + v96 = hir.int_to_ptr v95 : ptr; + hir.store v96, v184; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::output_note::set_array_attachment(v97: felt, v98: felt, v99: i32) { + ^block19(v97: felt, v98: felt, v99: i32): + hir.store_local v99 #[local = lv2]; + v102 = hir.load_local : i32 #[local = lv2]; + v192 = arith.constant 12 : u32; + v103 = hir.bitcast v102 : u32; + v105 = arith.add v103, v192 : u32 #[overflow = checked]; + v191 = arith.constant 4 : u32; + v107 = arith.mod v105, v191 : u32; + hir.assertz v107 #[code = 250]; + v108 = hir.int_to_ptr v105 : ptr; + v109 = hir.load v108 : felt; + v110 = hir.load_local : i32 #[local = lv2]; + v190 = arith.constant 8 : u32; + v111 = hir.bitcast v110 : u32; + v113 = arith.add v111, v190 : u32 #[overflow = checked]; + v200 = arith.constant 4 : u32; + v115 = arith.mod v113, v200 : u32; + hir.assertz v115 #[code = 250]; + v116 = hir.int_to_ptr v113 : ptr; + v117 = hir.load v116 : felt; + v118 = hir.load_local : i32 #[local = lv2]; + v199 = arith.constant 4 : u32; + v119 = hir.bitcast v118 : u32; + v121 = arith.add v119, v199 : u32 #[overflow = checked]; + v198 = arith.constant 4 : u32; + v123 = arith.mod v121, v198 : u32; + hir.assertz v123 #[code = 250]; + v124 = hir.int_to_ptr v121 : ptr; + v125 = hir.load v124 : felt; + v126 = hir.load_local : i32 #[local = lv2]; + v127 = hir.bitcast v126 : u32; + v197 = arith.constant 4 : u32; + v129 = arith.mod v127, v197 : u32; + hir.assertz v129 #[code = 250]; + v130 = hir.int_to_ptr v127 : ptr; + v131 = hir.load v130 : felt; + hir.exec @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/miden::protocol::output_note::set_array_attachment(v97, v98, v109, v117, v125, v131) + builtin.ret ; + }; + + private builtin.function @miden::protocol::output_note::set_array_attachment(v132: felt, v133: felt, v134: felt, v135: felt, v136: felt, v137: felt) { + ^block21(v132: felt, v133: felt, v134: felt, v135: felt, v136: felt, v137: felt): + hir.exec @miden/protocol/output_note/set_array_attachment(v132, v133, v134, v135, v136, v137) + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt { + ^block26: + v138 = hir.exec @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1#binding() : felt + builtin.ret v138; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_array_attachment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_array_attachment_binding.masm new file mode 100644 index 000000000..4d67ddedd --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_array_attachment_binding.masm @@ -0,0 +1,603 @@ +# mod ::"miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1" + +@callconv("canon-lift") +pub proc binding( + +) -> felt + exec."miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1"::init + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1"::rust_sdk_output_note_set_array_attachment_binding::"miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1#binding" + trace.252 + nop + exec.::miden::core::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::miden::core::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod ::"miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1"::rust_sdk_output_note_set_array_attachment_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_output_note_set_array_attachment_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@locals("5") +@callconv("C") +proc miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1#binding( + +) -> felt + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + dup.0 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1"::rust_sdk_output_note_set_array_attachment_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.1 + while.true + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.16 + movup.2 + eq + neq + dup.0 + if.true + nop + else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.16 + movup.3 + u32wrapping_add + movup.2 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + u32wrapping_add + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + push.1 + push.0 + movup.2 + cdrop + push.1 + u32and + if.true + push.1 + else + push.0 + end + end + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.24 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.8 + movup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.2 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1"::rust_sdk_output_note_set_array_attachment_binding::miden_base_sys::bindings::output_note::set_array_attachment + trace.252 + nop + push.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop +end + +@locals("1") +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1"::rust_sdk_output_note_set_array_attachment_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@locals("3") +@callconv("C") +proc miden_base_sys::bindings::output_note::set_array_attachment( + felt, + felt, + i32 +) + movup.2 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movup.2 + swap.3 + movdn.2 + swap.5 + swap.1 + swap.4 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1"::rust_sdk_output_note_set_array_attachment_binding::"miden::protocol::output_note::set_array_attachment" + trace.252 + nop +end + +@callconv("C") +proc miden::protocol::output_note::set_array_attachment( + felt, + felt, + felt, + felt, + felt, + felt +) + trace.240 + nop + exec.::miden::protocol::output_note::set_array_attachment + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_array_attachment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_array_attachment_binding.wat new file mode 100644 index 000000000..616067e98 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_array_attachment_binding.wat @@ -0,0 +1,148 @@ +(component + (type $ty-miden:base/core-types@1.0.0 (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) + (core module $main (;0;) + (type (;0;) (func)) + (type (;1;) (func (result f32))) + (type (;2;) (func (param f32 f32 i32))) + (type (;3;) (func (param i32) (result f32))) + (type (;4;) (func (param f32 f32 f32 f32 f32 f32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1#binding" (func $miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_output_note_set_array_attachment_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_output_note_set_array_attachment_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1#binding (;2;) (type 1) (result f32) + (local i32 i32 f32 f32 f32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + i32.const 0 + local.set 1 + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 2 + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 3 + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 4 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 16 + i32.eq + br_if 1 (;@1;) + local.get 0 + i32.const 16 + i32.add + local.get 1 + i32.add + local.get 4 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 0 (;@2;) + end + end + local.get 0 + local.get 0 + i64.load offset=24 align=4 + i64.store offset=8 + local.get 0 + local.get 0 + i64.load offset=16 align=4 + i64.store + local.get 2 + local.get 3 + local.get 0 + call $miden_base_sys::bindings::output_note::set_array_attachment + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 4 + local.get 0 + i32.const 32 + i32.add + global.set $__stack_pointer + local.get 4 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::output_note::set_array_attachment (;4;) (type 2) (param f32 f32 i32) + local.get 0 + local.get 1 + local.get 2 + f32.load offset=12 + local.get 2 + f32.load offset=8 + local.get 2 + f32.load offset=4 + local.get 2 + f32.load + call $miden::protocol::output_note::set_array_attachment + ) + (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + unreachable + ) + (func $miden::protocol::output_note::set_array_attachment (;6;) (type 4) (param f32 f32 f32 f32 f32 f32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "crust_sdk_output_note_set_array_attachment_binding\01\0b0.0.1\03\01\00\00\00\00\00") + ) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $felt))) + (alias core export $main "miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1#binding" (core func $miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1#binding))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $"#type3 felt" (@name "felt") (;3;))) + (component $miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1-shim-component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (import "import-type-felt0" (type (;2;) (eq 1))) + (type (;3;) (func (result 2))) + (import "import-func-binding" (func (;0;) (type 3))) + (export (;4;) "felt" (type 1)) + (type (;5;) (func (result 4))) + (export (;1;) "binding" (func 0) (func (type 5))) + ) + (instance $miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $"#type3 felt")) + (with "import-type-felt0" (type $felt)) + ) + ) + (export $miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1 (;2;) "miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1" (instance $miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1-shim-instance)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_attachment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_attachment_binding.hir new file mode 100644 index 000000000..358ca46ab --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_attachment_binding.hir @@ -0,0 +1,224 @@ +builtin.component miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1 { + builtin.module public @rust_sdk_output_note_set_attachment_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_output_note_set_attachment_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1#binding() -> felt { + ^block9: + v1 = builtin.global_symbol @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v158 = arith.constant 32 : i32; + v5 = arith.sub v3, v158 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; + hir.exec @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/wit_bindgen::rt::run_ctors_once() + v157 = arith.constant 0 : i32; + hir.store_local v157 #[local = lv1]; + v150 = arith.constant 0 : felt; + hir.store_local v150 #[local = lv2]; + v190 = arith.constant 0 : felt; + hir.store_local v190 #[local = lv3]; + v189 = arith.constant 0 : felt; + hir.store_local v189 #[local = lv4]; + v188 = arith.constant 0 : felt; + hir.store_local v188 #[local = lv5]; + scf.while { + ^block12: + v17 = hir.load_local : i32 #[local = lv1]; + v187 = arith.constant 0 : i32; + v152 = arith.constant 16 : i32; + v19 = arith.eq v17, v152 : i1; + v20 = arith.zext v19 : u32; + v21 = hir.bitcast v20 : i32; + v23 = arith.neq v21, v187 : i1; + scf.if v23{ + ^block34: + scf.yield ; + } else { + ^block14: + v24 = hir.load_local : i32 #[local = lv0]; + v27 = hir.load_local : i32 #[local = lv1]; + v29 = hir.load_local : felt #[local = lv5]; + v186 = arith.constant 16 : i32; + v26 = arith.add v24, v186 : i32 #[overflow = wrapping]; + v28 = arith.add v26, v27 : i32 #[overflow = wrapping]; + v30 = hir.bitcast v28 : u32; + v159 = arith.constant 4 : u32; + v32 = arith.mod v30, v159 : u32; + hir.assertz v32 #[code = 250]; + v33 = hir.int_to_ptr v30 : ptr; + hir.store v33, v29; + v34 = hir.load_local : i32 #[local = lv1]; + v151 = arith.constant 4 : i32; + v36 = arith.add v34, v151 : i32 #[overflow = wrapping]; + hir.store_local v36 #[local = lv1]; + scf.yield ; + }; + v174 = arith.constant 1 : u32; + v171 = arith.constant 0 : u32; + v179 = cf.select v23, v171, v174 : u32; + v175 = arith.trunc v179 : i1; + scf.condition v175; + } do { + ^block33: + scf.yield ; + }; + v37 = hir.load_local : i32 #[local = lv0]; + v156 = arith.constant 24 : u32; + v39 = hir.bitcast v37 : u32; + v41 = arith.add v39, v156 : u32 #[overflow = checked]; + v185 = arith.constant 4 : u32; + v43 = arith.mod v41, v185 : u32; + hir.assertz v43 #[code = 250]; + v44 = hir.int_to_ptr v41 : ptr; + v45 = hir.load v44 : i64; + v154 = arith.constant 8 : u32; + v46 = hir.bitcast v37 : u32; + v48 = arith.add v46, v154 : u32 #[overflow = checked]; + v184 = arith.constant 8 : u32; + v50 = arith.mod v48, v184 : u32; + hir.assertz v50 #[code = 250]; + v51 = hir.int_to_ptr v48 : ptr; + hir.store v51, v45; + v52 = hir.load_local : i32 #[local = lv0]; + v153 = arith.constant 16 : u32; + v54 = hir.bitcast v52 : u32; + v56 = arith.add v54, v153 : u32 #[overflow = checked]; + v183 = arith.constant 4 : u32; + v58 = arith.mod v56, v183 : u32; + hir.assertz v58 #[code = 250]; + v59 = hir.int_to_ptr v56 : ptr; + v60 = hir.load v59 : i64; + v61 = hir.bitcast v52 : u32; + v182 = arith.constant 8 : u32; + v63 = arith.mod v61, v182 : u32; + hir.assertz v63 #[code = 250]; + v64 = hir.int_to_ptr v61 : ptr; + hir.store v64, v60; + v65 = hir.load_local : felt #[local = lv2]; + v66 = hir.load_local : felt #[local = lv3]; + v67 = hir.load_local : felt #[local = lv4]; + v68 = hir.load_local : i32 #[local = lv0]; + hir.exec @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/miden_base_sys::bindings::output_note::set_attachment(v65, v66, v67, v68) + v181 = arith.constant 0 : felt; + hir.store_local v181 #[local = lv5]; + v71 = hir.load_local : i32 #[local = lv0]; + v180 = arith.constant 32 : i32; + v73 = arith.add v71, v180 : i32 #[overflow = wrapping]; + v74 = builtin.global_symbol @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/__stack_pointer : ptr + v75 = hir.bitcast v74 : ptr; + hir.store v75, v73; + v76 = hir.load_local : felt #[local = lv5]; + builtin.ret v76; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block15: + v77 = builtin.global_symbol @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/GOT.data.internal.__memory_base : ptr + v78 = hir.bitcast v77 : ptr; + v79 = hir.load v78 : i32; + v195 = arith.constant 1048584 : i32; + v81 = arith.add v79, v195 : i32 #[overflow = wrapping]; + v82 = hir.bitcast v81 : u32; + v83 = hir.int_to_ptr v82 : ptr; + v84 = hir.load v83 : u8; + v194 = arith.constant 0 : i32; + v85 = arith.zext v84 : u32; + v86 = hir.bitcast v85 : i32; + v88 = arith.neq v86, v194 : i1; + scf.if v88{ + ^block17: + scf.yield ; + } else { + ^block18: + v89 = builtin.global_symbol @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/GOT.data.internal.__memory_base : ptr + v90 = hir.bitcast v89 : ptr; + v91 = hir.load v90 : i32; + hir.store_local v91 #[local = lv0]; + hir.exec @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/__wasm_call_ctors() + v92 = hir.load_local : i32 #[local = lv0]; + v193 = arith.constant 1 : u8; + v198 = arith.constant 1048584 : i32; + v94 = arith.add v92, v198 : i32 #[overflow = wrapping]; + v98 = hir.bitcast v94 : u32; + v99 = hir.int_to_ptr v98 : ptr; + hir.store v99, v193; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::output_note::set_attachment(v100: felt, v101: felt, v102: felt, v103: i32) { + ^block19(v100: felt, v101: felt, v102: felt, v103: i32): + hir.store_local v103 #[local = lv3]; + v107 = hir.load_local : i32 #[local = lv3]; + v201 = arith.constant 12 : u32; + v108 = hir.bitcast v107 : u32; + v110 = arith.add v108, v201 : u32 #[overflow = checked]; + v200 = arith.constant 4 : u32; + v112 = arith.mod v110, v200 : u32; + hir.assertz v112 #[code = 250]; + v113 = hir.int_to_ptr v110 : ptr; + v114 = hir.load v113 : felt; + v115 = hir.load_local : i32 #[local = lv3]; + v199 = arith.constant 8 : u32; + v116 = hir.bitcast v115 : u32; + v118 = arith.add v116, v199 : u32 #[overflow = checked]; + v209 = arith.constant 4 : u32; + v120 = arith.mod v118, v209 : u32; + hir.assertz v120 #[code = 250]; + v121 = hir.int_to_ptr v118 : ptr; + v122 = hir.load v121 : felt; + v123 = hir.load_local : i32 #[local = lv3]; + v208 = arith.constant 4 : u32; + v124 = hir.bitcast v123 : u32; + v126 = arith.add v124, v208 : u32 #[overflow = checked]; + v207 = arith.constant 4 : u32; + v128 = arith.mod v126, v207 : u32; + hir.assertz v128 #[code = 250]; + v129 = hir.int_to_ptr v126 : ptr; + v130 = hir.load v129 : felt; + v131 = hir.load_local : i32 #[local = lv3]; + v132 = hir.bitcast v131 : u32; + v206 = arith.constant 4 : u32; + v134 = arith.mod v132, v206 : u32; + hir.assertz v134 #[code = 250]; + v135 = hir.int_to_ptr v132 : ptr; + v136 = hir.load v135 : felt; + hir.exec @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/miden::protocol::output_note::set_attachment(v100, v101, v102, v114, v122, v130, v136) + builtin.ret ; + }; + + private builtin.function @miden::protocol::output_note::set_attachment(v137: felt, v138: felt, v139: felt, v140: felt, v141: felt, v142: felt, v143: felt) { + ^block21(v137: felt, v138: felt, v139: felt, v140: felt, v141: felt, v142: felt, v143: felt): + hir.exec @miden/protocol/output_note/set_attachment(v137, v138, v139, v140, v141, v142, v143) + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt { + ^block26: + v144 = hir.exec @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1#binding() : felt + builtin.ret v144; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_attachment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_attachment_binding.masm new file mode 100644 index 000000000..b2a6601d1 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_attachment_binding.masm @@ -0,0 +1,623 @@ +# mod ::"miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1" + +@callconv("canon-lift") +pub proc binding( + +) -> felt + exec."miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1"::init + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1"::rust_sdk_output_note_set_attachment_binding::"miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1#binding" + trace.252 + nop + exec.::miden::core::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::miden::core::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod ::"miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1"::rust_sdk_output_note_set_attachment_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_output_note_set_attachment_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@locals("6") +@callconv("C") +proc miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1#binding( + +) -> felt + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + dup.0 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1"::rust_sdk_output_note_set_attachment_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.0 + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.1 + while.true + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.16 + movup.2 + eq + neq + dup.0 + if.true + nop + else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.16 + movup.3 + u32wrapping_add + movup.2 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + u32wrapping_add + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + push.1 + push.0 + movup.2 + cdrop + push.1 + u32and + if.true + push.1 + else + push.0 + end + end + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.24 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.8 + movup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movdn.3 + swap.2 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1"::rust_sdk_output_note_set_attachment_binding::miden_base_sys::bindings::output_note::set_attachment + trace.252 + nop + push.0 + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop +end + +@locals("1") +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1"::rust_sdk_output_note_set_attachment_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@locals("4") +@callconv("C") +proc miden_base_sys::bindings::output_note::set_attachment( + felt, + felt, + felt, + i32 +) + movup.3 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.1 + swap.5 + swap.1 + swap.6 + swap.2 + swap.4 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1"::rust_sdk_output_note_set_attachment_binding::"miden::protocol::output_note::set_attachment" + trace.252 + nop +end + +@callconv("C") +proc miden::protocol::output_note::set_attachment( + felt, + felt, + felt, + felt, + felt, + felt, + felt +) + trace.240 + nop + exec.::miden::protocol::output_note::set_attachment + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_attachment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_attachment_binding.wat new file mode 100644 index 000000000..edac2a1e7 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_attachment_binding.wat @@ -0,0 +1,153 @@ +(component + (type $ty-miden:base/core-types@1.0.0 (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) + (core module $main (;0;) + (type (;0;) (func)) + (type (;1;) (func (result f32))) + (type (;2;) (func (param f32 f32 f32 i32))) + (type (;3;) (func (param i32) (result f32))) + (type (;4;) (func (param f32 f32 f32 f32 f32 f32 f32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1#binding" (func $miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_output_note_set_attachment_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_output_note_set_attachment_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1#binding (;2;) (type 1) (result f32) + (local i32 i32 f32 f32 f32 f32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + i32.const 0 + local.set 1 + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 2 + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 3 + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 4 + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 5 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 16 + i32.eq + br_if 1 (;@1;) + local.get 0 + i32.const 16 + i32.add + local.get 1 + i32.add + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 0 (;@2;) + end + end + local.get 0 + local.get 0 + i64.load offset=24 align=4 + i64.store offset=8 + local.get 0 + local.get 0 + i64.load offset=16 align=4 + i64.store + local.get 2 + local.get 3 + local.get 4 + local.get 0 + call $miden_base_sys::bindings::output_note::set_attachment + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 5 + local.get 0 + i32.const 32 + i32.add + global.set $__stack_pointer + local.get 5 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::output_note::set_attachment (;4;) (type 2) (param f32 f32 f32 i32) + local.get 0 + local.get 1 + local.get 2 + local.get 3 + f32.load offset=12 + local.get 3 + f32.load offset=8 + local.get 3 + f32.load offset=4 + local.get 3 + f32.load + call $miden::protocol::output_note::set_attachment + ) + (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + unreachable + ) + (func $miden::protocol::output_note::set_attachment (;6;) (type 4) (param f32 f32 f32 f32 f32 f32 f32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "Wrust_sdk_output_note_set_attachment_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00\00") + ) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $felt))) + (alias core export $main "miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1#binding" (core func $miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1#binding))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $"#type3 felt" (@name "felt") (;3;))) + (component $miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1-shim-component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (import "import-type-felt0" (type (;2;) (eq 1))) + (type (;3;) (func (result 2))) + (import "import-func-binding" (func (;0;) (type 3))) + (export (;4;) "felt" (type 1)) + (type (;5;) (func (result 4))) + (export (;1;) "binding" (func 0) (func (type 5))) + ) + (instance $miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $"#type3 felt")) + (with "import-type-felt0" (type $felt)) + ) + ) + (export $miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1 (;2;) "miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1" (instance $miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1-shim-instance)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_word_attachment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_word_attachment_binding.hir new file mode 100644 index 000000000..b0d426bf7 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_word_attachment_binding.hir @@ -0,0 +1,221 @@ +builtin.component miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1 { + builtin.module public @rust_sdk_output_note_set_word_attachment_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_output_note_set_word_attachment_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1#binding() -> felt { + ^block9: + v1 = builtin.global_symbol @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v151 = arith.constant 32 : i32; + v5 = arith.sub v3, v151 : i32 #[overflow = wrapping]; + hir.store_local v5 #[local = lv0]; + v6 = builtin.global_symbol @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; + hir.exec @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/wit_bindgen::rt::run_ctors_once() + v150 = arith.constant 0 : i32; + hir.store_local v150 #[local = lv1]; + v143 = arith.constant 0 : felt; + hir.store_local v143 #[local = lv2]; + v181 = arith.constant 0 : felt; + hir.store_local v181 #[local = lv3]; + v180 = arith.constant 0 : felt; + hir.store_local v180 #[local = lv4]; + scf.while { + ^block12: + v15 = hir.load_local : i32 #[local = lv1]; + v179 = arith.constant 0 : i32; + v145 = arith.constant 16 : i32; + v17 = arith.eq v15, v145 : i1; + v18 = arith.zext v17 : u32; + v19 = hir.bitcast v18 : i32; + v21 = arith.neq v19, v179 : i1; + scf.if v21{ + ^block34: + scf.yield ; + } else { + ^block14: + v22 = hir.load_local : i32 #[local = lv0]; + v25 = hir.load_local : i32 #[local = lv1]; + v27 = hir.load_local : felt #[local = lv4]; + v178 = arith.constant 16 : i32; + v24 = arith.add v22, v178 : i32 #[overflow = wrapping]; + v26 = arith.add v24, v25 : i32 #[overflow = wrapping]; + v28 = hir.bitcast v26 : u32; + v152 = arith.constant 4 : u32; + v30 = arith.mod v28, v152 : u32; + hir.assertz v30 #[code = 250]; + v31 = hir.int_to_ptr v28 : ptr; + hir.store v31, v27; + v32 = hir.load_local : i32 #[local = lv1]; + v144 = arith.constant 4 : i32; + v34 = arith.add v32, v144 : i32 #[overflow = wrapping]; + hir.store_local v34 #[local = lv1]; + scf.yield ; + }; + v166 = arith.constant 1 : u32; + v163 = arith.constant 0 : u32; + v171 = cf.select v21, v163, v166 : u32; + v167 = arith.trunc v171 : i1; + scf.condition v167; + } do { + ^block33: + scf.yield ; + }; + v35 = hir.load_local : i32 #[local = lv0]; + v149 = arith.constant 24 : u32; + v37 = hir.bitcast v35 : u32; + v39 = arith.add v37, v149 : u32 #[overflow = checked]; + v177 = arith.constant 4 : u32; + v41 = arith.mod v39, v177 : u32; + hir.assertz v41 #[code = 250]; + v42 = hir.int_to_ptr v39 : ptr; + v43 = hir.load v42 : i64; + v147 = arith.constant 8 : u32; + v44 = hir.bitcast v35 : u32; + v46 = arith.add v44, v147 : u32 #[overflow = checked]; + v176 = arith.constant 8 : u32; + v48 = arith.mod v46, v176 : u32; + hir.assertz v48 #[code = 250]; + v49 = hir.int_to_ptr v46 : ptr; + hir.store v49, v43; + v50 = hir.load_local : i32 #[local = lv0]; + v146 = arith.constant 16 : u32; + v52 = hir.bitcast v50 : u32; + v54 = arith.add v52, v146 : u32 #[overflow = checked]; + v175 = arith.constant 4 : u32; + v56 = arith.mod v54, v175 : u32; + hir.assertz v56 #[code = 250]; + v57 = hir.int_to_ptr v54 : ptr; + v58 = hir.load v57 : i64; + v59 = hir.bitcast v50 : u32; + v174 = arith.constant 8 : u32; + v61 = arith.mod v59, v174 : u32; + hir.assertz v61 #[code = 250]; + v62 = hir.int_to_ptr v59 : ptr; + hir.store v62, v58; + v63 = hir.load_local : felt #[local = lv2]; + v64 = hir.load_local : felt #[local = lv3]; + v65 = hir.load_local : i32 #[local = lv0]; + hir.exec @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/miden_base_sys::bindings::output_note::set_word_attachment(v63, v64, v65) + v173 = arith.constant 0 : felt; + hir.store_local v173 #[local = lv4]; + v68 = hir.load_local : i32 #[local = lv0]; + v172 = arith.constant 32 : i32; + v70 = arith.add v68, v172 : i32 #[overflow = wrapping]; + v71 = builtin.global_symbol @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/__stack_pointer : ptr + v72 = hir.bitcast v71 : ptr; + hir.store v72, v70; + v73 = hir.load_local : felt #[local = lv4]; + builtin.ret v73; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block15: + v74 = builtin.global_symbol @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/GOT.data.internal.__memory_base : ptr + v75 = hir.bitcast v74 : ptr; + v76 = hir.load v75 : i32; + v186 = arith.constant 1048584 : i32; + v78 = arith.add v76, v186 : i32 #[overflow = wrapping]; + v79 = hir.bitcast v78 : u32; + v80 = hir.int_to_ptr v79 : ptr; + v81 = hir.load v80 : u8; + v185 = arith.constant 0 : i32; + v82 = arith.zext v81 : u32; + v83 = hir.bitcast v82 : i32; + v85 = arith.neq v83, v185 : i1; + scf.if v85{ + ^block17: + scf.yield ; + } else { + ^block18: + v86 = builtin.global_symbol @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/GOT.data.internal.__memory_base : ptr + v87 = hir.bitcast v86 : ptr; + v88 = hir.load v87 : i32; + hir.store_local v88 #[local = lv0]; + hir.exec @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/__wasm_call_ctors() + v89 = hir.load_local : i32 #[local = lv0]; + v184 = arith.constant 1 : u8; + v189 = arith.constant 1048584 : i32; + v91 = arith.add v89, v189 : i32 #[overflow = wrapping]; + v95 = hir.bitcast v91 : u32; + v96 = hir.int_to_ptr v95 : ptr; + hir.store v96, v184; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::output_note::set_word_attachment(v97: felt, v98: felt, v99: i32) { + ^block19(v97: felt, v98: felt, v99: i32): + hir.store_local v99 #[local = lv2]; + v102 = hir.load_local : i32 #[local = lv2]; + v192 = arith.constant 12 : u32; + v103 = hir.bitcast v102 : u32; + v105 = arith.add v103, v192 : u32 #[overflow = checked]; + v191 = arith.constant 4 : u32; + v107 = arith.mod v105, v191 : u32; + hir.assertz v107 #[code = 250]; + v108 = hir.int_to_ptr v105 : ptr; + v109 = hir.load v108 : felt; + v110 = hir.load_local : i32 #[local = lv2]; + v190 = arith.constant 8 : u32; + v111 = hir.bitcast v110 : u32; + v113 = arith.add v111, v190 : u32 #[overflow = checked]; + v200 = arith.constant 4 : u32; + v115 = arith.mod v113, v200 : u32; + hir.assertz v115 #[code = 250]; + v116 = hir.int_to_ptr v113 : ptr; + v117 = hir.load v116 : felt; + v118 = hir.load_local : i32 #[local = lv2]; + v199 = arith.constant 4 : u32; + v119 = hir.bitcast v118 : u32; + v121 = arith.add v119, v199 : u32 #[overflow = checked]; + v198 = arith.constant 4 : u32; + v123 = arith.mod v121, v198 : u32; + hir.assertz v123 #[code = 250]; + v124 = hir.int_to_ptr v121 : ptr; + v125 = hir.load v124 : felt; + v126 = hir.load_local : i32 #[local = lv2]; + v127 = hir.bitcast v126 : u32; + v197 = arith.constant 4 : u32; + v129 = arith.mod v127, v197 : u32; + hir.assertz v129 #[code = 250]; + v130 = hir.int_to_ptr v127 : ptr; + v131 = hir.load v130 : felt; + hir.exec @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/miden::protocol::output_note::set_word_attachment(v97, v98, v109, v117, v125, v131) + builtin.ret ; + }; + + private builtin.function @miden::protocol::output_note::set_word_attachment(v132: felt, v133: felt, v134: felt, v135: felt, v136: felt, v137: felt) { + ^block21(v132: felt, v133: felt, v134: felt, v135: felt, v136: felt, v137: felt): + hir.exec @miden/protocol/output_note/set_word_attachment(v132, v133, v134, v135, v136, v137) + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt { + ^block26: + v138 = hir.exec @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1#binding() : felt + builtin.ret v138; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_word_attachment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_word_attachment_binding.masm new file mode 100644 index 000000000..b08c47a44 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_word_attachment_binding.masm @@ -0,0 +1,603 @@ +# mod ::"miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1" + +@callconv("canon-lift") +pub proc binding( + +) -> felt + exec."miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1"::init + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1"::rust_sdk_output_note_set_word_attachment_binding::"miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1#binding" + trace.252 + nop + exec.::miden::core::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::miden::core::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod ::"miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1"::rust_sdk_output_note_set_word_attachment_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_output_note_set_word_attachment_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@locals("5") +@callconv("C") +proc miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1#binding( + +) -> felt + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + dup.0 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1"::rust_sdk_output_note_set_word_attachment_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.1 + while.true + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.16 + movup.2 + eq + neq + dup.0 + if.true + nop + else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.16 + movup.3 + u32wrapping_add + movup.2 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + u32wrapping_add + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + push.1 + push.0 + movup.2 + cdrop + push.1 + u32and + if.true + push.1 + else + push.0 + end + end + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.24 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.8 + movup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.2 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1"::rust_sdk_output_note_set_word_attachment_binding::miden_base_sys::bindings::output_note::set_word_attachment + trace.252 + nop + push.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop +end + +@locals("1") +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1"::rust_sdk_output_note_set_word_attachment_binding::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@locals("3") +@callconv("C") +proc miden_base_sys::bindings::output_note::set_word_attachment( + felt, + felt, + i32 +) + movup.2 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movup.2 + swap.3 + movdn.2 + swap.5 + swap.1 + swap.4 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1"::rust_sdk_output_note_set_word_attachment_binding::"miden::protocol::output_note::set_word_attachment" + trace.252 + nop +end + +@callconv("C") +proc miden::protocol::output_note::set_word_attachment( + felt, + felt, + felt, + felt, + felt, + felt +) + trace.240 + nop + exec.::miden::protocol::output_note::set_word_attachment + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_word_attachment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_word_attachment_binding.wat new file mode 100644 index 000000000..74b93f880 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_word_attachment_binding.wat @@ -0,0 +1,148 @@ +(component + (type $ty-miden:base/core-types@1.0.0 (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) + (core module $main (;0;) + (type (;0;) (func)) + (type (;1;) (func (result f32))) + (type (;2;) (func (param f32 f32 i32))) + (type (;3;) (func (param i32) (result f32))) + (type (;4;) (func (param f32 f32 f32 f32 f32 f32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1#binding" (func $miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_output_note_set_word_attachment_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_output_note_set_word_attachment_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1#binding (;2;) (type 1) (result f32) + (local i32 i32 f32 f32 f32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + i32.const 0 + local.set 1 + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 2 + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 3 + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 4 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 16 + i32.eq + br_if 1 (;@1;) + local.get 0 + i32.const 16 + i32.add + local.get 1 + i32.add + local.get 4 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 0 (;@2;) + end + end + local.get 0 + local.get 0 + i64.load offset=24 align=4 + i64.store offset=8 + local.get 0 + local.get 0 + i64.load offset=16 align=4 + i64.store + local.get 2 + local.get 3 + local.get 0 + call $miden_base_sys::bindings::output_note::set_word_attachment + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 4 + local.get 0 + i32.const 32 + i32.add + global.set $__stack_pointer + local.get 4 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::output_note::set_word_attachment (;4;) (type 2) (param f32 f32 i32) + local.get 0 + local.get 1 + local.get 2 + f32.load offset=12 + local.get 2 + f32.load offset=8 + local.get 2 + f32.load offset=4 + local.get 2 + f32.load + call $miden::protocol::output_note::set_word_attachment + ) + (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + unreachable + ) + (func $miden::protocol::output_note::set_word_attachment (;6;) (type 4) (param f32 f32 f32 f32 f32 f32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "arust_sdk_output_note_set_word_attachment_binding\01\0b0.0.1\03\01\00\00\00\00\00\00") + ) + (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) + (core instance $main (;0;) (instantiate $main)) + (alias core export $main "memory" (core memory $memory (;0;))) + (type (;2;) (func (result $felt))) + (alias core export $main "miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1#binding" (core func $miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1#binding (;0;))) + (func $binding (;0;) (type 2) (canon lift (core func $miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1#binding))) + (alias export $miden:base/core-types@1.0.0 "felt" (type $"#type3 felt" (@name "felt") (;3;))) + (component $miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1-shim-component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (import "import-type-felt0" (type (;2;) (eq 1))) + (type (;3;) (func (result 2))) + (import "import-func-binding" (func (;0;) (type 3))) + (export (;4;) "felt" (type 1)) + (type (;5;) (func (result 4))) + (export (;1;) "binding" (func 0) (func (type 5))) + ) + (instance $miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1-shim-component + (with "import-func-binding" (func $binding)) + (with "import-type-felt" (type $"#type3 felt")) + (with "import-type-felt0" (type $felt)) + ) + ) + (export $miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1 (;2;) "miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1" (instance $miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1-shim-instance)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.hir b/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.hir index f2a8679ec..3b2d5d7dc 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.hir @@ -12,626 +12,549 @@ builtin.component miden:base/note-script@1.0.0 { private builtin.function @::eq(v0: i32, v1: i32) -> i32 { ^block9(v0: i32, v1: i32): - v5 = hir.bitcast v0 : u32; - v6 = arith.constant 4 : u32; - v7 = arith.mod v5, v6 : u32; + hir.store_local v0 #[local = lv0]; + hir.store_local v1 #[local = lv1]; + v397 = arith.constant 0 : i32; + hir.store_local v397 #[local = lv2]; + v4 = hir.load_local : i32 #[local = lv0]; + v5 = hir.bitcast v4 : u32; + v396 = arith.constant 4 : u32; + v7 = arith.mod v5, v396 : u32; hir.assertz v7 #[code = 250]; v8 = hir.int_to_ptr v5 : ptr; v9 = hir.load v8 : felt; - v10 = hir.bitcast v1 : u32; - v463 = arith.constant 4 : u32; - v12 = arith.mod v10, v463 : u32; - hir.assertz v12 #[code = 250]; - v13 = hir.int_to_ptr v10 : ptr; - v14 = hir.load v13 : felt; - v15 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/intrinsics::felt::eq(v9, v14) : i32 - v3 = arith.constant 0 : i32; - v16 = arith.constant 1 : i32; - v17 = arith.neq v15, v16 : i1; - v18 = arith.zext v17 : u32; - v19 = hir.bitcast v18 : i32; - v21 = arith.neq v19, v3 : i1; - v441 = scf.if v21 : i32 { - ^block11: - v462 = arith.constant 0 : i32; - scf.yield v462; + v10 = hir.load_local : i32 #[local = lv1]; + v11 = hir.bitcast v10 : u32; + v433 = arith.constant 4 : u32; + v13 = arith.mod v11, v433 : u32; + hir.assertz v13 #[code = 250]; + v14 = hir.int_to_ptr v11 : ptr; + v15 = hir.load v14 : felt; + v432 = arith.constant 0 : i32; + v395 = arith.constant 1 : i32; + v16 = arith.eq v9, v15 : i1; + v17 = hir.cast v16 : i32; + v19 = arith.neq v17, v395 : i1; + v20 = arith.zext v19 : u32; + v21 = hir.bitcast v20 : i32; + v23 = arith.neq v21, v432 : i1; + scf.if v23{ + ^block51: + scf.yield ; } else { ^block12: - v461 = arith.constant 4 : u32; - v22 = hir.bitcast v0 : u32; - v24 = arith.add v22, v461 : u32 #[overflow = checked]; - v460 = arith.constant 4 : u32; - v26 = arith.mod v24, v460 : u32; - hir.assertz v26 #[code = 250]; - v27 = hir.int_to_ptr v24 : ptr; - v28 = hir.load v27 : felt; - v459 = arith.constant 4 : u32; - v29 = hir.bitcast v1 : u32; - v31 = arith.add v29, v459 : u32 #[overflow = checked]; - v458 = arith.constant 4 : u32; - v33 = arith.mod v31, v458 : u32; - hir.assertz v33 #[code = 250]; - v34 = hir.int_to_ptr v31 : ptr; - v35 = hir.load v34 : felt; - v36 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/intrinsics::felt::eq(v28, v35) : i32 - v456 = arith.constant 0 : i32; - v457 = arith.constant 1 : i32; - v38 = arith.neq v36, v457 : i1; - v39 = arith.zext v38 : u32; - v40 = hir.bitcast v39 : i32; - v42 = arith.neq v40, v456 : i1; - v443 = scf.if v42 : i32 { - ^block57: - v455 = arith.constant 0 : i32; - scf.yield v455; + v24 = hir.load_local : i32 #[local = lv0]; + v431 = arith.constant 4 : u32; + v25 = hir.bitcast v24 : u32; + v27 = arith.add v25, v431 : u32 #[overflow = checked]; + v430 = arith.constant 4 : u32; + v29 = arith.mod v27, v430 : u32; + hir.assertz v29 #[code = 250]; + v30 = hir.int_to_ptr v27 : ptr; + v31 = hir.load v30 : felt; + v32 = hir.load_local : i32 #[local = lv1]; + v429 = arith.constant 4 : u32; + v33 = hir.bitcast v32 : u32; + v35 = arith.add v33, v429 : u32 #[overflow = checked]; + v428 = arith.constant 4 : u32; + v37 = arith.mod v35, v428 : u32; + hir.assertz v37 #[code = 250]; + v38 = hir.int_to_ptr v35 : ptr; + v39 = hir.load v38 : felt; + v426 = arith.constant 0 : i32; + v427 = arith.constant 1 : i32; + v40 = arith.eq v31, v39 : i1; + v41 = hir.cast v40 : i32; + v43 = arith.neq v41, v427 : i1; + v44 = arith.zext v43 : u32; + v45 = hir.bitcast v44 : i32; + v47 = arith.neq v45, v426 : i1; + scf.if v47{ + ^block50: + scf.yield ; } else { ^block13: - v44 = arith.constant 8 : u32; - v43 = hir.bitcast v0 : u32; - v45 = arith.add v43, v44 : u32 #[overflow = checked]; - v454 = arith.constant 4 : u32; - v47 = arith.mod v45, v454 : u32; - hir.assertz v47 #[code = 250]; - v48 = hir.int_to_ptr v45 : ptr; - v49 = hir.load v48 : felt; - v453 = arith.constant 8 : u32; - v50 = hir.bitcast v1 : u32; - v52 = arith.add v50, v453 : u32 #[overflow = checked]; - v452 = arith.constant 4 : u32; - v54 = arith.mod v52, v452 : u32; - hir.assertz v54 #[code = 250]; - v55 = hir.int_to_ptr v52 : ptr; - v56 = hir.load v55 : felt; - v57 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/intrinsics::felt::eq(v49, v56) : i32 - v450 = arith.constant 0 : i32; - v451 = arith.constant 1 : i32; - v59 = arith.neq v57, v451 : i1; - v60 = arith.zext v59 : u32; - v61 = hir.bitcast v60 : i32; - v63 = arith.neq v61, v450 : i1; - v444 = scf.if v63 : i32 { - ^block56: - v449 = arith.constant 0 : i32; - scf.yield v449; + v48 = hir.load_local : i32 #[local = lv0]; + v394 = arith.constant 8 : u32; + v49 = hir.bitcast v48 : u32; + v51 = arith.add v49, v394 : u32 #[overflow = checked]; + v425 = arith.constant 4 : u32; + v53 = arith.mod v51, v425 : u32; + hir.assertz v53 #[code = 250]; + v54 = hir.int_to_ptr v51 : ptr; + v55 = hir.load v54 : felt; + v56 = hir.load_local : i32 #[local = lv1]; + v424 = arith.constant 8 : u32; + v57 = hir.bitcast v56 : u32; + v59 = arith.add v57, v424 : u32 #[overflow = checked]; + v423 = arith.constant 4 : u32; + v61 = arith.mod v59, v423 : u32; + hir.assertz v61 #[code = 250]; + v62 = hir.int_to_ptr v59 : ptr; + v63 = hir.load v62 : felt; + v421 = arith.constant 0 : i32; + v422 = arith.constant 1 : i32; + v64 = arith.eq v55, v63 : i1; + v65 = hir.cast v64 : i32; + v67 = arith.neq v65, v422 : i1; + v68 = arith.zext v67 : u32; + v69 = hir.bitcast v68 : i32; + v71 = arith.neq v69, v421 : i1; + scf.if v71{ + ^block49: + scf.yield ; } else { ^block14: - v65 = arith.constant 12 : u32; - v64 = hir.bitcast v0 : u32; - v66 = arith.add v64, v65 : u32 #[overflow = checked]; - v448 = arith.constant 4 : u32; - v68 = arith.mod v66, v448 : u32; - hir.assertz v68 #[code = 250]; - v69 = hir.int_to_ptr v66 : ptr; - v70 = hir.load v69 : felt; - v447 = arith.constant 12 : u32; - v71 = hir.bitcast v1 : u32; - v73 = arith.add v71, v447 : u32 #[overflow = checked]; - v446 = arith.constant 4 : u32; - v75 = arith.mod v73, v446 : u32; - hir.assertz v75 #[code = 250]; - v76 = hir.int_to_ptr v73 : ptr; - v77 = hir.load v76 : felt; - v78 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/intrinsics::felt::eq(v70, v77) : i32 - v445 = arith.constant 1 : i32; - v80 = arith.eq v78, v445 : i1; - v81 = arith.zext v80 : u32; - v82 = hir.bitcast v81 : i32; - scf.yield v82; + v72 = hir.load_local : i32 #[local = lv0]; + v393 = arith.constant 12 : u32; + v73 = hir.bitcast v72 : u32; + v75 = arith.add v73, v393 : u32 #[overflow = checked]; + v420 = arith.constant 4 : u32; + v77 = arith.mod v75, v420 : u32; + hir.assertz v77 #[code = 250]; + v78 = hir.int_to_ptr v75 : ptr; + v79 = hir.load v78 : felt; + v80 = hir.load_local : i32 #[local = lv1]; + v419 = arith.constant 12 : u32; + v81 = hir.bitcast v80 : u32; + v83 = arith.add v81, v419 : u32 #[overflow = checked]; + v418 = arith.constant 4 : u32; + v85 = arith.mod v83, v418 : u32; + hir.assertz v85 #[code = 250]; + v86 = hir.int_to_ptr v83 : ptr; + v87 = hir.load v86 : felt; + v417 = arith.constant 1 : i32; + v88 = arith.eq v79, v87 : i1; + v89 = hir.cast v88 : i32; + v91 = arith.eq v89, v417 : i1; + v92 = arith.zext v91 : u32; + v93 = hir.bitcast v92 : i32; + hir.store_local v93 #[local = lv2]; + scf.yield ; }; - scf.yield v444; + scf.yield ; }; - scf.yield v443; + scf.yield ; }; - builtin.ret v441; + v94 = hir.load_local : i32 #[local = lv2]; + builtin.ret v94; }; - private builtin.function @miden:base/note-script@1.0.0#run(v84: felt, v85: felt, v86: felt, v87: felt) { - ^block15(v84: felt, v85: felt, v86: felt, v87: felt): - v90 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr - v91 = hir.bitcast v90 : ptr; - v92 = hir.load v91 : i32; - v93 = arith.constant 48 : i32; - v94 = arith.sub v92, v93 : i32 #[overflow = wrapping]; - v95 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr - v96 = hir.bitcast v95 : ptr; - hir.store v96, v94; + private builtin.function @miden:base/note-script@1.0.0#run(v95: felt, v96: felt, v97: felt, v98: felt) { + ^block15(v95: felt, v96: felt, v97: felt, v98: felt): + v99 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr + v100 = hir.bitcast v99 : ptr; + v101 = hir.load v100 : i32; + v442 = arith.constant 48 : i32; + v103 = arith.sub v101, v442 : i32 #[overflow = wrapping]; + hir.store_local v103 #[local = lv4]; + v104 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr + v105 = hir.bitcast v104 : ptr; + hir.store v105, v103; hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/wit_bindgen::rt::run_ctors_once() - v97 = arith.constant 8 : i32; - v98 = arith.add v94, v97 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden_base_sys::bindings::active_note::get_sender(v98) - v100 = arith.constant 12 : u32; - v99 = hir.bitcast v94 : u32; - v101 = arith.add v99, v100 : u32 #[overflow = checked]; - v102 = arith.constant 4 : u32; - v103 = arith.mod v101, v102 : u32; - hir.assertz v103 #[code = 250]; - v104 = hir.int_to_ptr v101 : ptr; - v105 = hir.load v104 : felt; - v107 = arith.constant 8 : u32; - v106 = hir.bitcast v94 : u32; - v108 = arith.add v106, v107 : u32 #[overflow = checked]; - v497 = arith.constant 4 : u32; - v110 = arith.mod v108, v497 : u32; - hir.assertz v110 #[code = 250]; - v111 = hir.int_to_ptr v108 : ptr; - v112 = hir.load v111 : felt; - v113 = arith.constant 16 : i32; - v114 = arith.add v94, v113 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden_base_sys::bindings::active_note::get_script_root(v114) - v115 = arith.constant 32 : i32; - v116 = arith.add v94, v115 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden_base_sys::bindings::active_note::get_serial_number(v116) - v117 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden_base_sys::bindings::active_account::get_balance(v112, v105) : felt - v118 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/intrinsics::felt::eq(v112, v112) : i32 - v88 = arith.constant 0 : i32; - v119 = arith.constant 1 : i32; - v120 = arith.neq v118, v119 : i1; - v121 = arith.zext v120 : u32; - v122 = hir.bitcast v121 : i32; - v124 = arith.neq v122, v88 : i1; - v468 = scf.if v124 : u32 { - ^block65: - v464 = arith.constant 0 : u32; - scf.yield v464; + v106 = hir.load_local : i32 #[local = lv4]; + v441 = arith.constant 8 : i32; + v108 = arith.add v106, v441 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden_base_sys::bindings::active_note::get_sender(v108) + v109 = hir.load_local : i32 #[local = lv4]; + v440 = arith.constant 12 : u32; + v110 = hir.bitcast v109 : u32; + v112 = arith.add v110, v440 : u32 #[overflow = checked]; + v439 = arith.constant 4 : u32; + v114 = arith.mod v112, v439 : u32; + hir.assertz v114 #[code = 250]; + v115 = hir.int_to_ptr v112 : ptr; + v116 = hir.load v115 : felt; + hir.store_local v116 #[local = lv5]; + v117 = hir.load_local : i32 #[local = lv4]; + v438 = arith.constant 8 : u32; + v118 = hir.bitcast v117 : u32; + v120 = arith.add v118, v438 : u32 #[overflow = checked]; + v490 = arith.constant 4 : u32; + v122 = arith.mod v120, v490 : u32; + hir.assertz v122 #[code = 250]; + v123 = hir.int_to_ptr v120 : ptr; + v124 = hir.load v123 : felt; + hir.store_local v124 #[local = lv6]; + v125 = hir.load_local : i32 #[local = lv4]; + v437 = arith.constant 16 : i32; + v127 = arith.add v125, v437 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden_base_sys::bindings::active_note::get_script_root(v127) + v128 = hir.load_local : i32 #[local = lv4]; + v436 = arith.constant 32 : i32; + v130 = arith.add v128, v436 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden_base_sys::bindings::active_note::get_serial_number(v130) + v131 = hir.load_local : felt #[local = lv6]; + v132 = hir.load_local : felt #[local = lv5]; + v133 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden_base_sys::bindings::active_account::get_balance(v131, v132) : felt + hir.store_local v133 #[local = lv7]; + v134 = hir.load_local : felt #[local = lv6]; + v434 = arith.constant 0 : i32; + v435 = arith.constant 1 : i32; + v136 = arith.eq v134, v134 : i1; + v137 = hir.cast v136 : i32; + v139 = arith.neq v137, v435 : i1; + v140 = arith.zext v139 : u32; + v141 = hir.bitcast v140 : i32; + v143 = arith.neq v141, v434 : i1; + v461 = scf.if v143 : u32 { + ^block59: + v457 = arith.constant 0 : u32; + scf.yield v457; } else { ^block18: - v125 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/intrinsics::felt::eq(v105, v105) : i32 - v495 = arith.constant 0 : i32; - v496 = arith.constant 1 : i32; - v127 = arith.neq v125, v496 : i1; - v128 = arith.zext v127 : u32; - v129 = hir.bitcast v128 : i32; - v131 = arith.neq v129, v495 : i1; - v470 = scf.if v131 : u32 { - ^block64: - v494 = arith.constant 0 : u32; - scf.yield v494; + v144 = hir.load_local : felt #[local = lv5]; + v488 = arith.constant 0 : i32; + v489 = arith.constant 1 : i32; + v146 = arith.eq v144, v144 : i1; + v147 = hir.cast v146 : i32; + v149 = arith.neq v147, v489 : i1; + v150 = arith.zext v149 : u32; + v151 = hir.bitcast v150 : i32; + v153 = arith.neq v151, v488 : i1; + v463 = scf.if v153 : u32 { + ^block58: + v487 = arith.constant 0 : u32; + scf.yield v487; } else { ^block19: - v492 = arith.constant 16 : i32; - v135 = arith.add v94, v492 : i32 #[overflow = wrapping]; - v493 = arith.constant 16 : i32; - v133 = arith.add v94, v493 : i32 #[overflow = wrapping]; - v136 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/::eq(v133, v135) : i32 - v490 = arith.constant 0 : i32; - v491 = arith.constant 0 : i32; - v138 = arith.eq v136, v491 : i1; - v139 = arith.zext v138 : u32; - v140 = hir.bitcast v139 : i32; - v142 = arith.neq v140, v490 : i1; - v472 = scf.if v142 : u32 { - ^block63: - v489 = arith.constant 0 : u32; - scf.yield v489; + v154 = hir.load_local : i32 #[local = lv4]; + v485 = arith.constant 16 : i32; + v159 = arith.add v154, v485 : i32 #[overflow = wrapping]; + v486 = arith.constant 16 : i32; + v156 = arith.add v154, v486 : i32 #[overflow = wrapping]; + v160 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/::eq(v156, v159) : i32 + v483 = arith.constant 0 : i32; + v484 = arith.constant 0 : i32; + v162 = arith.eq v160, v484 : i1; + v163 = arith.zext v162 : u32; + v164 = hir.bitcast v163 : i32; + v166 = arith.neq v164, v483 : i1; + v465 = scf.if v166 : u32 { + ^block57: + v482 = arith.constant 0 : u32; + scf.yield v482; } else { ^block20: - v487 = arith.constant 32 : i32; - v146 = arith.add v94, v487 : i32 #[overflow = wrapping]; - v488 = arith.constant 32 : i32; - v144 = arith.add v94, v488 : i32 #[overflow = wrapping]; - v147 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/::eq(v144, v146) : i32 - v485 = arith.constant 0 : i32; - v486 = arith.constant 0 : i32; - v149 = arith.eq v147, v486 : i1; - v150 = arith.zext v149 : u32; - v151 = hir.bitcast v150 : i32; - v153 = arith.neq v151, v485 : i1; - v474 = scf.if v153 : u32 { - ^block62: - v484 = arith.constant 0 : u32; - scf.yield v484; + v167 = hir.load_local : i32 #[local = lv4]; + v480 = arith.constant 32 : i32; + v172 = arith.add v167, v480 : i32 #[overflow = wrapping]; + v481 = arith.constant 32 : i32; + v169 = arith.add v167, v481 : i32 #[overflow = wrapping]; + v173 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/::eq(v169, v172) : i32 + v478 = arith.constant 0 : i32; + v479 = arith.constant 0 : i32; + v175 = arith.eq v173, v479 : i1; + v176 = arith.zext v175 : u32; + v177 = hir.bitcast v176 : i32; + v179 = arith.neq v177, v478 : i1; + v467 = scf.if v179 : u32 { + ^block56: + v477 = arith.constant 0 : u32; + scf.yield v477; } else { ^block21: - v154 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/intrinsics::felt::eq(v117, v117) : i32 - v482 = arith.constant 0 : i32; - v483 = arith.constant 1 : i32; - v156 = arith.neq v154, v483 : i1; - v157 = arith.zext v156 : u32; - v158 = hir.bitcast v157 : i32; - v160 = arith.neq v158, v482 : i1; - scf.if v160{ - ^block61: + v180 = hir.load_local : felt #[local = lv7]; + v475 = arith.constant 0 : i32; + v476 = arith.constant 1 : i32; + v182 = arith.eq v180, v180 : i1; + v183 = hir.cast v182 : i32; + v185 = arith.neq v183, v476 : i1; + v186 = arith.zext v185 : u32; + v187 = hir.bitcast v186 : i32; + v189 = arith.neq v187, v475 : i1; + scf.if v189{ + ^block55: scf.yield ; } else { ^block22: - v481 = arith.constant 48 : i32; - v162 = arith.add v94, v481 : i32 #[overflow = wrapping]; - v163 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr - v164 = hir.bitcast v163 : ptr; - hir.store v164, v162; + v190 = hir.load_local : i32 #[local = lv4]; + v474 = arith.constant 48 : i32; + v192 = arith.add v190, v474 : i32 #[overflow = wrapping]; + v193 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr + v194 = hir.bitcast v193 : ptr; + hir.store v194, v192; scf.yield ; }; - v466 = arith.constant 1 : u32; - v480 = arith.constant 0 : u32; - v478 = cf.select v160, v480, v466 : u32; - scf.yield v478; + v459 = arith.constant 1 : u32; + v473 = arith.constant 0 : u32; + v471 = cf.select v189, v473, v459 : u32; + scf.yield v471; }; - scf.yield v474; + scf.yield v467; }; - scf.yield v472; + scf.yield v465; }; - scf.yield v470; + scf.yield v463; }; - v479 = arith.constant 0 : u32; - v477 = arith.eq v468, v479 : i1; - cf.cond_br v477 ^block17, ^block67; + v472 = arith.constant 0 : u32; + v470 = arith.eq v461, v472 : i1; + cf.cond_br v470 ^block17, ^block61; ^block17: ub.unreachable ; - ^block67: + ^block61: builtin.ret ; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block23: - v166 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/GOT.data.internal.__memory_base : ptr - v167 = hir.bitcast v166 : ptr; - v168 = hir.load v167 : i32; - v169 = arith.constant 1048584 : i32; - v170 = arith.add v168, v169 : i32 #[overflow = wrapping]; - v171 = hir.bitcast v170 : u32; - v172 = hir.int_to_ptr v171 : ptr; - v173 = hir.load v172 : u8; - v165 = arith.constant 0 : i32; - v174 = arith.zext v173 : u32; - v175 = hir.bitcast v174 : i32; - v177 = arith.neq v175, v165 : i1; - scf.if v177{ + v195 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/GOT.data.internal.__memory_base : ptr + v196 = hir.bitcast v195 : ptr; + v197 = hir.load v196 : i32; + v495 = arith.constant 1048584 : i32; + v199 = arith.add v197, v495 : i32 #[overflow = wrapping]; + v200 = hir.bitcast v199 : u32; + v201 = hir.int_to_ptr v200 : ptr; + v202 = hir.load v201 : u8; + v494 = arith.constant 0 : i32; + v203 = arith.zext v202 : u32; + v204 = hir.bitcast v203 : i32; + v206 = arith.neq v204, v494 : i1; + scf.if v206{ ^block25: scf.yield ; } else { ^block26: - v178 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/GOT.data.internal.__memory_base : ptr - v179 = hir.bitcast v178 : ptr; - v180 = hir.load v179 : i32; + v207 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/GOT.data.internal.__memory_base : ptr + v208 = hir.bitcast v207 : ptr; + v209 = hir.load v208 : i32; + hir.store_local v209 #[local = lv0]; hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__wasm_call_ctors() - v499 = arith.constant 1 : u8; - v501 = arith.constant 1048584 : i32; - v182 = arith.add v180, v501 : i32 #[overflow = wrapping]; - v186 = hir.bitcast v182 : u32; - v187 = hir.int_to_ptr v186 : ptr; - hir.store v187, v499; + v210 = hir.load_local : i32 #[local = lv0]; + v493 = arith.constant 1 : u8; + v498 = arith.constant 1048584 : i32; + v212 = arith.add v210, v498 : i32 #[overflow = wrapping]; + v216 = hir.bitcast v212 : u32; + v217 = hir.int_to_ptr v216 : ptr; + hir.store v217, v493; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::active_note::get_sender(v188: i32) { - ^block27(v188: i32): - v190 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr - v191 = hir.bitcast v190 : ptr; - v192 = hir.load v191 : i32; - v193 = arith.constant 16 : i32; - v194 = arith.sub v192, v193 : i32 #[overflow = wrapping]; - v195 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr - v196 = hir.bitcast v195 : ptr; - hir.store v196, v194; - v197 = arith.constant 8 : i32; - v198 = arith.add v194, v197 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden::active_note::get_sender(v198) - v200 = arith.constant 8 : u32; - v199 = hir.bitcast v194 : u32; - v201 = arith.add v199, v200 : u32 #[overflow = checked]; - v202 = arith.constant 4 : u32; - v203 = arith.mod v201, v202 : u32; - hir.assertz v203 #[code = 250]; - v204 = hir.int_to_ptr v201 : ptr; - v205 = hir.load v204 : i64; - v206 = hir.bitcast v188 : u32; - v503 = arith.constant 8 : u32; - v208 = arith.mod v206, v503 : u32; - hir.assertz v208 #[code = 250]; - v209 = hir.int_to_ptr v206 : ptr; - hir.store v209, v205; + private builtin.function @miden_base_sys::bindings::active_note::get_sender(v218: i32) { + ^block27(v218: i32): + hir.store_local v218 #[local = lv0]; + v219 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr + v220 = hir.bitcast v219 : ptr; + v221 = hir.load v220 : i32; v502 = arith.constant 16 : i32; - v211 = arith.add v194, v502 : i32 #[overflow = wrapping]; - v212 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr - v213 = hir.bitcast v212 : ptr; - hir.store v213, v211; - builtin.ret ; - }; - - private builtin.function @miden_base_sys::bindings::active_note::get_script_root(v214: i32) { - ^block29(v214: i32): - v216 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr - v217 = hir.bitcast v216 : ptr; - v218 = hir.load v217 : i32; - v219 = arith.constant 32 : i32; - v220 = arith.sub v218, v219 : i32 #[overflow = wrapping]; - v221 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr - v222 = hir.bitcast v221 : ptr; - hir.store v222, v220; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden::active_note::get_script_root(v220) - v224 = arith.constant 8 : u32; - v223 = hir.bitcast v220 : u32; - v225 = arith.add v223, v224 : u32 #[overflow = checked]; - v508 = arith.constant 8 : u32; - v227 = arith.mod v225, v508 : u32; - hir.assertz v227 #[code = 250]; - v228 = hir.int_to_ptr v225 : ptr; - v229 = hir.load v228 : i64; - v231 = arith.constant 24 : u32; - v230 = hir.bitcast v220 : u32; - v232 = arith.add v230, v231 : u32 #[overflow = checked]; - v507 = arith.constant 8 : u32; - v234 = arith.mod v232, v507 : u32; - hir.assertz v234 #[code = 250]; - v235 = hir.int_to_ptr v232 : ptr; - hir.store v235, v229; - v236 = hir.bitcast v220 : u32; + v223 = arith.sub v221, v502 : i32 #[overflow = wrapping]; + hir.store_local v223 #[local = lv1]; + v224 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr + v225 = hir.bitcast v224 : ptr; + hir.store v225, v223; + v226 = hir.load_local : i32 #[local = lv1]; + v501 = arith.constant 8 : i32; + v228 = arith.add v226, v501 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden::protocol::active_note::get_sender(v228) + v229 = hir.load_local : i32 #[local = lv0]; + v230 = hir.load_local : i32 #[local = lv1]; + v500 = arith.constant 8 : u32; + v231 = hir.bitcast v230 : u32; + v233 = arith.add v231, v500 : u32 #[overflow = checked]; + v499 = arith.constant 4 : u32; + v235 = arith.mod v233, v499 : u32; + hir.assertz v235 #[code = 250]; + v236 = hir.int_to_ptr v233 : ptr; + v237 = hir.load v236 : i64; + v238 = hir.bitcast v229 : u32; v506 = arith.constant 8 : u32; - v238 = arith.mod v236, v506 : u32; - hir.assertz v238 #[code = 250]; - v239 = hir.int_to_ptr v236 : ptr; - v240 = hir.load v239 : i64; - v242 = arith.constant 16 : u32; - v241 = hir.bitcast v220 : u32; - v243 = arith.add v241, v242 : u32 #[overflow = checked]; - v505 = arith.constant 8 : u32; - v245 = arith.mod v243, v505 : u32; - hir.assertz v245 #[code = 250]; - v246 = hir.int_to_ptr v243 : ptr; - hir.store v246, v240; - v247 = arith.constant 16 : i32; - v248 = arith.add v220, v247 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/::reverse(v214, v248) - v504 = arith.constant 32 : i32; - v250 = arith.add v220, v504 : i32 #[overflow = wrapping]; - v251 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr - v252 = hir.bitcast v251 : ptr; - hir.store v252, v250; + v240 = arith.mod v238, v506 : u32; + hir.assertz v240 #[code = 250]; + v241 = hir.int_to_ptr v238 : ptr; + hir.store v241, v237; + v242 = hir.load_local : i32 #[local = lv1]; + v505 = arith.constant 16 : i32; + v244 = arith.add v242, v505 : i32 #[overflow = wrapping]; + v245 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr + v246 = hir.bitcast v245 : ptr; + hir.store v246, v244; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::active_note::get_serial_number(v253: i32) { - ^block31(v253: i32): - v255 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr - v256 = hir.bitcast v255 : ptr; - v257 = hir.load v256 : i32; - v258 = arith.constant 32 : i32; - v259 = arith.sub v257, v258 : i32 #[overflow = wrapping]; - v260 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr - v261 = hir.bitcast v260 : ptr; - hir.store v261, v259; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden::active_note::get_serial_number(v259) - v263 = arith.constant 8 : u32; - v262 = hir.bitcast v259 : u32; - v264 = arith.add v262, v263 : u32 #[overflow = checked]; + private builtin.function @miden_base_sys::bindings::active_note::get_script_root(v247: i32) { + ^block29(v247: i32): + hir.store_local v247 #[local = lv0]; + v248 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr + v249 = hir.bitcast v248 : ptr; + v250 = hir.load v249 : i32; + v514 = arith.constant 16 : i32; + v252 = arith.sub v250, v514 : i32 #[overflow = wrapping]; + hir.store_local v252 #[local = lv1]; + v253 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr + v254 = hir.bitcast v253 : ptr; + hir.store v254, v252; + v255 = hir.load_local : i32 #[local = lv1]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden::protocol::active_note::get_script_root(v255) + v256 = hir.load_local : i32 #[local = lv0]; + v257 = hir.load_local : i32 #[local = lv1]; + v258 = hir.bitcast v257 : u32; v513 = arith.constant 8 : u32; - v266 = arith.mod v264, v513 : u32; - hir.assertz v266 #[code = 250]; - v267 = hir.int_to_ptr v264 : ptr; - v268 = hir.load v267 : i64; - v270 = arith.constant 24 : u32; - v269 = hir.bitcast v259 : u32; - v271 = arith.add v269, v270 : u32 #[overflow = checked]; - v512 = arith.constant 8 : u32; - v273 = arith.mod v271, v512 : u32; - hir.assertz v273 #[code = 250]; - v274 = hir.int_to_ptr v271 : ptr; - hir.store v274, v268; - v275 = hir.bitcast v259 : u32; - v511 = arith.constant 8 : u32; - v277 = arith.mod v275, v511 : u32; - hir.assertz v277 #[code = 250]; - v278 = hir.int_to_ptr v275 : ptr; - v279 = hir.load v278 : i64; - v281 = arith.constant 16 : u32; - v280 = hir.bitcast v259 : u32; - v282 = arith.add v280, v281 : u32 #[overflow = checked]; - v510 = arith.constant 8 : u32; - v284 = arith.mod v282, v510 : u32; - hir.assertz v284 #[code = 250]; - v285 = hir.int_to_ptr v282 : ptr; - hir.store v285, v279; - v286 = arith.constant 16 : i32; - v287 = arith.add v259, v286 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/::reverse(v253, v287) - v509 = arith.constant 32 : i32; - v289 = arith.add v259, v509 : i32 #[overflow = wrapping]; - v290 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr - v291 = hir.bitcast v290 : ptr; - hir.store v291, v289; + v260 = arith.mod v258, v513 : u32; + hir.assertz v260 #[code = 250]; + v261 = hir.int_to_ptr v258 : ptr; + v262 = hir.load v261 : i64; + v510, v511 = arith.split v262 : felt, felt; + v526 = arith.constant 8 : u32; + v266 = hir.bitcast v256 : u32; + v268 = arith.add v266, v526 : u32 #[overflow = checked]; + v525 = arith.constant 8 : u32; + v270 = arith.mod v268, v525 : u32; + hir.assertz v270 #[code = 250]; + v512 = arith.join v511, v510 : i64; + v271 = hir.int_to_ptr v268 : ptr; + hir.store v271, v512; + v272 = hir.load_local : i32 #[local = lv0]; + v273 = hir.load_local : i32 #[local = lv1]; + v524 = arith.constant 8 : u32; + v274 = hir.bitcast v273 : u32; + v276 = arith.add v274, v524 : u32 #[overflow = checked]; + v523 = arith.constant 8 : u32; + v278 = arith.mod v276, v523 : u32; + hir.assertz v278 #[code = 250]; + v279 = hir.int_to_ptr v276 : ptr; + v280 = hir.load v279 : i64; + v507, v508 = arith.split v280 : felt, felt; + v284 = hir.bitcast v272 : u32; + v522 = arith.constant 8 : u32; + v286 = arith.mod v284, v522 : u32; + hir.assertz v286 #[code = 250]; + v509 = arith.join v508, v507 : i64; + v287 = hir.int_to_ptr v284 : ptr; + hir.store v287, v509; + v288 = hir.load_local : i32 #[local = lv1]; + v521 = arith.constant 16 : i32; + v290 = arith.add v288, v521 : i32 #[overflow = wrapping]; + v291 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr + v292 = hir.bitcast v291 : ptr; + hir.store v292, v290; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::active_account::get_balance(v292: felt, v293: felt) -> felt { - ^block33(v292: felt, v293: felt): - v295 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden::active_account::get_balance(v292, v293) : felt - builtin.ret v295; - }; - - private builtin.function @::reverse(v296: i32, v297: i32) { - ^block35(v296: i32, v297: i32): - v300 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr - v301 = hir.bitcast v300 : ptr; - v302 = hir.load v301 : i32; - v303 = arith.constant 16 : i32; - v304 = arith.sub v302, v303 : i32 #[overflow = wrapping]; - v306 = arith.constant 8 : u32; - v305 = hir.bitcast v297 : u32; - v307 = arith.add v305, v306 : u32 #[overflow = checked]; - v600 = arith.constant 8 : u32; - v309 = arith.mod v307, v600 : u32; - hir.assertz v309 #[code = 250]; - v310 = hir.int_to_ptr v307 : ptr; - v311 = hir.load v310 : i64; - v599 = arith.constant 8 : u32; - v312 = hir.bitcast v304 : u32; - v314 = arith.add v312, v599 : u32 #[overflow = checked]; - v315 = arith.constant 4 : u32; - v316 = arith.mod v314, v315 : u32; + private builtin.function @miden_base_sys::bindings::active_note::get_serial_number(v293: i32) { + ^block31(v293: i32): + hir.store_local v293 #[local = lv0]; + v294 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr + v295 = hir.bitcast v294 : ptr; + v296 = hir.load v295 : i32; + v534 = arith.constant 16 : i32; + v298 = arith.sub v296, v534 : i32 #[overflow = wrapping]; + hir.store_local v298 #[local = lv1]; + v299 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr + v300 = hir.bitcast v299 : ptr; + hir.store v300, v298; + v301 = hir.load_local : i32 #[local = lv1]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden::protocol::active_note::get_serial_number(v301) + v302 = hir.load_local : i32 #[local = lv0]; + v303 = hir.load_local : i32 #[local = lv1]; + v304 = hir.bitcast v303 : u32; + v533 = arith.constant 8 : u32; + v306 = arith.mod v304, v533 : u32; + hir.assertz v306 #[code = 250]; + v307 = hir.int_to_ptr v304 : ptr; + v308 = hir.load v307 : i64; + v530, v531 = arith.split v308 : felt, felt; + v546 = arith.constant 8 : u32; + v312 = hir.bitcast v302 : u32; + v314 = arith.add v312, v546 : u32 #[overflow = checked]; + v545 = arith.constant 8 : u32; + v316 = arith.mod v314, v545 : u32; hir.assertz v316 #[code = 250]; + v532 = arith.join v531, v530 : i64; v317 = hir.int_to_ptr v314 : ptr; - hir.store v317, v311; - v318 = hir.bitcast v297 : u32; - v598 = arith.constant 8 : u32; - v320 = arith.mod v318, v598 : u32; - hir.assertz v320 #[code = 250]; - v321 = hir.int_to_ptr v318 : ptr; - v322 = hir.load v321 : i64; - v323 = hir.bitcast v304 : u32; - v597 = arith.constant 4 : u32; - v325 = arith.mod v323, v597 : u32; - hir.assertz v325 #[code = 250]; - v326 = hir.int_to_ptr v323 : ptr; - hir.store v326, v322; - v327 = arith.constant 12 : i32; - v328 = arith.add v304, v327 : i32 #[overflow = wrapping]; - v298 = arith.constant 0 : i32; - v568, v569, v570, v571, v572, v573 = scf.while v298, v304, v328, v296 : i32, i32, i32, i32, i32, i32 { - ^block81(v574: i32, v575: i32, v576: i32, v577: i32): - v596 = arith.constant 0 : i32; - v331 = arith.constant 8 : i32; - v332 = arith.eq v574, v331 : i1; - v333 = arith.zext v332 : u32; - v334 = hir.bitcast v333 : i32; - v336 = arith.neq v334, v596 : i1; - v562, v563 = scf.if v336 : i32, i32 { - ^block80: - v522 = ub.poison i32 : i32; - scf.yield v522, v522; - } else { - ^block40: - v338 = arith.add v575, v574 : i32 #[overflow = wrapping]; - v339 = hir.bitcast v338 : u32; - v595 = arith.constant 4 : u32; - v341 = arith.mod v339, v595 : u32; - hir.assertz v341 #[code = 250]; - v342 = hir.int_to_ptr v339 : ptr; - v343 = hir.load v342 : felt; - v345 = hir.bitcast v576 : u32; - v594 = arith.constant 4 : u32; - v347 = arith.mod v345, v594 : u32; - hir.assertz v347 #[code = 250]; - v348 = hir.int_to_ptr v345 : ptr; - v349 = hir.load v348 : i32; - v350 = hir.bitcast v338 : u32; - v593 = arith.constant 4 : u32; - v352 = arith.mod v350, v593 : u32; - hir.assertz v352 #[code = 250]; - v353 = hir.int_to_ptr v350 : ptr; - hir.store v353, v349; - v354 = hir.bitcast v576 : u32; - v592 = arith.constant 4 : u32; - v356 = arith.mod v354, v592 : u32; - hir.assertz v356 #[code = 250]; - v357 = hir.int_to_ptr v354 : ptr; - hir.store v357, v343; - v360 = arith.constant -4 : i32; - v361 = arith.add v576, v360 : i32 #[overflow = wrapping]; - v358 = arith.constant 4 : i32; - v359 = arith.add v574, v358 : i32 #[overflow = wrapping]; - scf.yield v359, v361; - }; - v590 = ub.poison i32 : i32; - v565 = cf.select v336, v590, v577 : i32; - v591 = ub.poison i32 : i32; - v564 = cf.select v336, v591, v575 : i32; - v521 = arith.constant 1 : u32; - v514 = arith.constant 0 : u32; - v567 = cf.select v336, v514, v521 : u32; - v555 = arith.trunc v567 : i1; - scf.condition v555, v562, v564, v563, v565, v575, v577; - } do { - ^block82(v578: i32, v579: i32, v580: i32, v581: i32, v582: i32, v583: i32): - scf.yield v578, v579, v580, v581; - }; - v589 = arith.constant 8 : u32; - v363 = hir.bitcast v572 : u32; - v365 = arith.add v363, v589 : u32 #[overflow = checked]; - v588 = arith.constant 4 : u32; - v367 = arith.mod v365, v588 : u32; - hir.assertz v367 #[code = 250]; - v368 = hir.int_to_ptr v365 : ptr; - v369 = hir.load v368 : i64; - v587 = arith.constant 8 : u32; - v370 = hir.bitcast v573 : u32; - v372 = arith.add v370, v587 : u32 #[overflow = checked]; - v586 = arith.constant 8 : u32; - v374 = arith.mod v372, v586 : u32; - hir.assertz v374 #[code = 250]; - v375 = hir.int_to_ptr v372 : ptr; - hir.store v375, v369; - v376 = hir.bitcast v572 : u32; - v585 = arith.constant 4 : u32; - v378 = arith.mod v376, v585 : u32; - hir.assertz v378 #[code = 250]; - v379 = hir.int_to_ptr v376 : ptr; - v380 = hir.load v379 : i64; - v381 = hir.bitcast v573 : u32; - v584 = arith.constant 8 : u32; - v383 = arith.mod v381, v584 : u32; - hir.assertz v383 #[code = 250]; - v384 = hir.int_to_ptr v381 : ptr; - hir.store v384, v380; + hir.store v317, v532; + v318 = hir.load_local : i32 #[local = lv0]; + v319 = hir.load_local : i32 #[local = lv1]; + v544 = arith.constant 8 : u32; + v320 = hir.bitcast v319 : u32; + v322 = arith.add v320, v544 : u32 #[overflow = checked]; + v543 = arith.constant 8 : u32; + v324 = arith.mod v322, v543 : u32; + hir.assertz v324 #[code = 250]; + v325 = hir.int_to_ptr v322 : ptr; + v326 = hir.load v325 : i64; + v527, v528 = arith.split v326 : felt, felt; + v330 = hir.bitcast v318 : u32; + v542 = arith.constant 8 : u32; + v332 = arith.mod v330, v542 : u32; + hir.assertz v332 #[code = 250]; + v529 = arith.join v528, v527 : i64; + v333 = hir.int_to_ptr v330 : ptr; + hir.store v333, v529; + v334 = hir.load_local : i32 #[local = lv1]; + v541 = arith.constant 16 : i32; + v336 = arith.add v334, v541 : i32 #[overflow = wrapping]; + v337 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr + v338 = hir.bitcast v337 : ptr; + hir.store v338, v336; builtin.ret ; }; - private builtin.function @intrinsics::felt::eq(v385: felt, v386: felt) -> i32 { - ^block41(v385: felt, v386: felt): - v387 = arith.eq v385, v386 : i1; - v388 = hir.cast v387 : i32; - builtin.ret v388; + private builtin.function @miden_base_sys::bindings::active_account::get_balance(v339: felt, v340: felt) -> felt { + ^block33(v339: felt, v340: felt): + v344 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden::protocol::active_account::get_balance(v339, v340) : felt + builtin.ret v344; }; - private builtin.function @miden::active_account::get_balance(v390: felt, v391: felt) -> felt { - ^block43(v390: felt, v391: felt): - v392 = hir.exec @miden/active_account/get_balance(v390, v391) : felt - builtin.ret v392; + private builtin.function @miden::protocol::active_account::get_balance(v345: felt, v346: felt) -> felt { + ^block35(v345: felt, v346: felt): + v347 = hir.exec @miden/protocol/active_account/get_balance(v345, v346) : felt + builtin.ret v347; }; - private builtin.function @miden::active_note::get_script_root(v394: i32) { - ^block47(v394: i32): - v395, v396, v397, v398 = hir.exec @miden/active_note/get_script_root() : felt, felt, felt, felt - v399 = hir.bitcast v394 : u32; - v400 = hir.int_to_ptr v399 : ptr; - hir.store v400, v395; - v401 = arith.constant 4 : u32; - v402 = arith.add v399, v401 : u32 #[overflow = checked]; - v403 = hir.int_to_ptr v402 : ptr; - hir.store v403, v396; - v404 = arith.constant 8 : u32; - v405 = arith.add v399, v404 : u32 #[overflow = checked]; - v406 = hir.int_to_ptr v405 : ptr; - hir.store v406, v397; - v407 = arith.constant 12 : u32; - v408 = arith.add v399, v407 : u32 #[overflow = checked]; - v409 = hir.int_to_ptr v408 : ptr; - hir.store v409, v398; + private builtin.function @miden::protocol::active_note::get_script_root(v349: i32) { + ^block40(v349: i32): + v350, v351, v352, v353 = hir.exec @miden/protocol/active_note/get_script_root() : felt, felt, felt, felt + v354 = hir.bitcast v349 : u32; + v355 = hir.int_to_ptr v354 : ptr; + hir.store v355, v350; + v549 = arith.constant 4 : u32; + v357 = arith.add v354, v549 : u32 #[overflow = checked]; + v358 = hir.int_to_ptr v357 : ptr; + hir.store v358, v351; + v548 = arith.constant 8 : u32; + v360 = arith.add v354, v548 : u32 #[overflow = checked]; + v361 = hir.int_to_ptr v360 : ptr; + hir.store v361, v352; + v547 = arith.constant 12 : u32; + v363 = arith.add v354, v547 : u32 #[overflow = checked]; + v364 = hir.int_to_ptr v363 : ptr; + hir.store v364, v353; builtin.ret ; }; - private builtin.function @miden::active_note::get_sender(v410: i32) { - ^block50(v410: i32): - v411, v412 = hir.exec @miden/active_note/get_sender() : felt, felt - v413 = hir.bitcast v410 : u32; - v414 = hir.int_to_ptr v413 : ptr; - hir.store v414, v411; - v415 = arith.constant 4 : u32; - v416 = arith.add v413, v415 : u32 #[overflow = checked]; - v417 = hir.int_to_ptr v416 : ptr; - hir.store v417, v412; + private builtin.function @miden::protocol::active_note::get_sender(v365: i32) { + ^block43(v365: i32): + v366, v367 = hir.exec @miden/protocol/active_note/get_sender() : felt, felt + v368 = hir.bitcast v365 : u32; + v369 = hir.int_to_ptr v368 : ptr; + hir.store v369, v366; + v550 = arith.constant 4 : u32; + v371 = arith.add v368, v550 : u32 #[overflow = checked]; + v372 = hir.int_to_ptr v371 : ptr; + hir.store v372, v367; builtin.ret ; }; - private builtin.function @miden::active_note::get_serial_number(v418: i32) { - ^block52(v418: i32): - v419, v420, v421, v422 = hir.exec @miden/active_note/get_serial_number() : felt, felt, felt, felt - v423 = hir.bitcast v418 : u32; - v424 = hir.int_to_ptr v423 : ptr; - hir.store v424, v419; - v425 = arith.constant 4 : u32; - v426 = arith.add v423, v425 : u32 #[overflow = checked]; - v427 = hir.int_to_ptr v426 : ptr; - hir.store v427, v420; - v428 = arith.constant 8 : u32; - v429 = arith.add v423, v428 : u32 #[overflow = checked]; - v430 = hir.int_to_ptr v429 : ptr; - hir.store v430, v421; - v431 = arith.constant 12 : u32; - v432 = arith.add v423, v431 : u32 #[overflow = checked]; - v433 = hir.int_to_ptr v432 : ptr; - hir.store v433, v422; + private builtin.function @miden::protocol::active_note::get_serial_number(v373: i32) { + ^block45(v373: i32): + v374, v375, v376, v377 = hir.exec @miden/protocol/active_note/get_serial_number() : felt, felt, felt, felt + v378 = hir.bitcast v373 : u32; + v379 = hir.int_to_ptr v378 : ptr; + hir.store v379, v374; + v553 = arith.constant 4 : u32; + v381 = arith.add v378, v553 : u32 #[overflow = checked]; + v382 = hir.int_to_ptr v381 : ptr; + hir.store v382, v375; + v552 = arith.constant 8 : u32; + v384 = arith.add v378, v552 : u32 #[overflow = checked]; + v385 = hir.int_to_ptr v384 : ptr; + hir.store v385, v376; + v551 = arith.constant 12 : u32; + v387 = arith.add v378, v551 : u32 #[overflow = checked]; + v388 = hir.int_to_ptr v387 : ptr; + hir.store v388, v377; builtin.ret ; }; @@ -646,9 +569,9 @@ builtin.component miden:base/note-script@1.0.0 { builtin.segment @1048576 = 0x0000000100000001; }; - public builtin.function @run(v434: felt, v435: felt, v436: felt, v437: felt) { - ^block54(v434: felt, v435: felt, v436: felt, v437: felt): - hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden:base/note-script@1.0.0#run(v434, v435, v436, v437) + public builtin.function @run(v389: felt, v390: felt, v391: felt, v392: felt) { + ^block47(v389: felt, v390: felt, v391: felt, v392: felt): + hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden:base/note-script@1.0.0#run(v389, v390, v391, v392) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.masm b/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.masm index 3c2a03122..3677903b4 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.masm @@ -1,14 +1,14 @@ -# mod miden:base/note-script@1.0.0 +# mod ::"miden:base/note-script@1.0.0" @callconv("canon-lift") pub proc run(felt, felt, felt, felt) - exec.::miden:base/note-script@1.0.0::init + exec."miden:base/note-script@1.0.0"::init trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden:base/note-script@1.0.0#run + exec.::"miden:base/note-script@1.0.0"::rust_sdk_swapp_note_bindings::"miden:base/note-script@1.0.0#run" trace.252 nop - exec.::std::sys::truncate_stack + exec.::miden::core::sys::truncate_stack end proc init @@ -21,7 +21,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -32,7 +32,7 @@ proc init mem_store.278537 end -# mod miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings +# mod ::"miden:base/note-script@1.0.0"::rust_sdk_swapp_note_bindings @callconv("C") proc __wasm_call_ctors( @@ -48,12 +48,45 @@ proc rust_sdk_swapp_note_bindings::bindings::__link_custom_section_describing_im nop end +@locals("3") @callconv("C") proc ::eq( i32, i32 ) -> i32 - dup.0 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -67,7 +100,14 @@ proc ::eq( exec.::intrinsics::mem::load_felt trace.252 nop - dup.2 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -81,24 +121,26 @@ proc ::eq( exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::intrinsics::felt::eq - trace.252 - nop push.0 push.1 - movup.2 + movup.3 + movup.3 + eq neq neq if.true - drop - drop - push.0 + nop else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + swap.1 add u32assert push.4 @@ -114,8 +156,16 @@ proc ::eq( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.3 + swap.1 add u32assert push.4 @@ -131,24 +181,26 @@ proc ::eq( exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::intrinsics::felt::eq - trace.252 - nop push.0 push.1 - movup.2 + movup.3 + movup.3 + eq neq neq if.true - drop - drop - push.0 + nop else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.1 + swap.1 add u32assert push.4 @@ -164,8 +216,16 @@ proc ::eq( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.3 + swap.1 add u32assert push.4 @@ -181,22 +241,24 @@ proc ::eq( exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::intrinsics::felt::eq - trace.252 - nop push.0 push.1 - movup.2 + movup.3 + movup.3 + eq neq neq if.true - drop - drop - push.0 + nop else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 swap.1 add @@ -214,8 +276,16 @@ proc ::eq( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - movup.2 + swap.1 add u32assert push.4 @@ -231,19 +301,32 @@ proc ::eq( exec.::intrinsics::mem::load_felt trace.252 nop + push.1 + movdn.2 + eq + eq + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::intrinsics::felt::eq + exec.::intrinsics::mem::store_sw trace.252 nop - push.1 - eq end end end + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("8") @callconv("C") proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop @@ -260,9 +343,16 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) nop push.48 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.4 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -272,19 +362,34 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) nop trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::wit_bindgen::rt::run_ctors_once + exec.::"miden:base/note-script@1.0.0"::rust_sdk_swapp_note_bindings::wit_bindgen::rt::run_ctors_once + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.1 u32wrapping_add trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden_base_sys::bindings::active_note::get_sender + exec.::"miden:base/note-script@1.0.0"::rust_sdk_swapp_note_bindings::miden_base_sys::bindings::active_note::get_sender + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.12 - dup.1 + swap.1 add u32assert push.4 @@ -300,8 +405,24 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.2 + swap.1 add u32assert push.4 @@ -317,73 +438,127 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - dup.3 u32wrapping_add trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden_base_sys::bindings::active_note::get_script_root + exec.::"miden:base/note-script@1.0.0"::rust_sdk_swapp_note_bindings::miden_base_sys::bindings::active_note::get_script_root + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.32 - dup.3 u32wrapping_add trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden_base_sys::bindings::active_note::get_serial_number + exec.::"miden:base/note-script@1.0.0"::rust_sdk_swapp_note_bindings::miden_base_sys::bindings::active_note::get_serial_number trace.252 nop - dup.1 - dup.1 + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.5 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden_base_sys::bindings::active_account::get_balance + exec.::intrinsics::mem::load_felt trace.252 nop swap.1 - dup.0 trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::intrinsics::felt::eq + exec.::"miden:base/note-script@1.0.0"::rust_sdk_swapp_note_bindings::miden_base_sys::bindings::active_account::get_balance + trace.252 + nop + locaddr.7 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt trace.252 nop push.0 push.1 movup.2 + dup.0 + eq neq neq if.true - drop - drop - drop push.0 else + locaddr.5 + push.0 swap.1 - dup.0 trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::intrinsics::felt::eq + exec.::intrinsics::mem::load_felt trace.252 nop push.0 push.1 movup.2 + dup.0 + eq neq neq if.true - drop - drop push.0 else + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - dup.2 + dup.1 u32wrapping_add push.16 - dup.3 + movup.2 u32wrapping_add trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::::eq + exec.::"miden:base/note-script@1.0.0"::rust_sdk_swapp_note_bindings::::eq trace.252 nop push.0 @@ -392,19 +567,25 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) eq neq if.true - drop - drop push.0 else + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.32 - dup.2 + dup.1 u32wrapping_add push.32 - dup.3 + movup.2 u32wrapping_add trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::::eq + exec.::"miden:base/note-script@1.0.0"::rust_sdk_swapp_note_bindings::::eq trace.252 nop push.0 @@ -413,28 +594,36 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) eq neq if.true - drop - drop push.0 else - dup.0 + locaddr.7 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::intrinsics::felt::eq + exec.::intrinsics::mem::load_felt trace.252 nop push.0 push.1 movup.2 + dup.0 + eq neq neq dup.0 if.true - swap.1 - drop + nop else + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.48 - movup.2 u32wrapping_add push.1114144 u32divmod.4 @@ -463,6 +652,7 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) end end +@locals("1") @callconv("C") proc wit_bindgen::rt::run_ctors_once( @@ -504,9 +694,25 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - trace.240 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::__wasm_call_ctors + exec.::"miden:base/note-script@1.0.0"::rust_sdk_swapp_note_bindings::__wasm_call_ctors + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.1 @@ -537,10 +743,19 @@ proc wit_bindgen::rt::run_ctors_once( end end +@locals("2") @callconv("C") proc miden_base_sys::bindings::active_note::get_sender( i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -551,9 +766,16 @@ proc miden_base_sys::bindings::active_note::get_sender( nop push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.1 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -561,16 +783,39 @@ proc miden_base_sys::bindings::active_note::get_sender( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.1 u32wrapping_add trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden::active_note::get_sender + exec.::"miden:base/note-script@1.0.0"::rust_sdk_swapp_note_bindings::"miden::protocol::active_note::get_sender" + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.1 + swap.1 add u32assert push.4 @@ -587,7 +832,7 @@ proc miden_base_sys::bindings::active_note::get_sender( trace.252 nop swap.1 - movup.3 + movup.2 push.8 dup.1 swap.1 @@ -603,6 +848,14 @@ proc miden_base_sys::bindings::active_note::get_sender( exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114144 @@ -615,10 +868,19 @@ proc miden_base_sys::bindings::active_note::get_sender( nop end +@locals("2") @callconv("C") proc miden_base_sys::bindings::active_note::get_script_root( i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114144 u32divmod.4 swap.1 @@ -627,11 +889,18 @@ proc miden_base_sys::bindings::active_note::get_script_root( exec.::intrinsics::mem::load_sw trace.252 nop - push.32 + push.16 u32wrapping_sub - push.1114144 - dup.1 + dup.0 + locaddr.1 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114144 u32divmod.4 swap.1 trace.240 @@ -639,16 +908,35 @@ proc miden_base_sys::bindings::active_note::get_script_root( exec.::intrinsics::mem::store_sw trace.252 nop - dup.0 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden::active_note::get_script_root + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_swapp_note_bindings::"miden::protocol::active_note::get_script_root" + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop - push.8 - dup.1 - add - u32assert push.8 dup.1 swap.1 @@ -663,8 +951,8 @@ proc miden_base_sys::bindings::active_note::get_script_root( trace.252 nop swap.1 - push.24 - dup.3 + push.8 + movup.3 add u32assert push.8 @@ -673,6 +961,8 @@ proc miden_base_sys::bindings::active_note::get_script_root( u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -682,7 +972,26 @@ proc miden_base_sys::bindings::active_note::get_script_root( exec.::intrinsics::mem::store_dw trace.252 nop - dup.0 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + swap.1 + add + u32assert push.8 dup.1 swap.1 @@ -697,16 +1006,15 @@ proc miden_base_sys::bindings::active_note::get_script_root( trace.252 nop swap.1 - push.16 - dup.3 - add - u32assert + movup.2 push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -716,16 +1024,15 @@ proc miden_base_sys::bindings::active_note::get_script_root( exec.::intrinsics::mem::store_dw trace.252 nop - push.16 - dup.1 - u32wrapping_add - movup.2 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::::reverse + exec.::intrinsics::mem::load_sw trace.252 nop - push.32 + push.16 u32wrapping_add push.1114144 u32divmod.4 @@ -737,159 +1044,75 @@ proc miden_base_sys::bindings::active_note::get_script_root( nop end +@locals("2") @callconv("C") proc miden_base_sys::bindings::active_note::get_serial_number( i32 ) - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::store_sw trace.252 nop - push.32 - u32wrapping_sub push.1114144 - dup.1 - swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop + push.16 + u32wrapping_sub dup.0 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden::active_note::get_serial_number - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.24 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.1 + push.0 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop - dup.0 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.1114144 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 swap.1 - push.16 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - dup.1 - u32wrapping_add - movup.2 trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::::reverse + exec.::"miden:base/note-script@1.0.0"::rust_sdk_swapp_note_bindings::"miden::protocol::active_note::get_serial_number" trace.252 nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc miden_base_sys::bindings::active_account::get_balance( - felt, - felt -) -> felt - trace.240 - nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden::active_account::get_balance + exec.::intrinsics::mem::load_sw trace.252 nop -end - -@callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114144 - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert push.8 dup.1 swap.1 @@ -905,15 +1128,17 @@ proc ::reverse( nop swap.1 push.8 - dup.3 + movup.3 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -923,167 +1148,27 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.1 + push.0 swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop push.8 - dup.1 + swap.1 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod @@ -1097,16 +1182,15 @@ proc ::reverse( trace.252 nop swap.1 - push.8 - dup.4 - add - u32assert + movup.2 push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -1116,57 +1200,53 @@ proc ::reverse( exec.::intrinsics::mem::store_dw trace.252 nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.1 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop - swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.16 + u32wrapping_add + push.1114144 u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_sw trace.252 nop end +@locals("2") @callconv("C") -proc intrinsics::felt::eq(felt, felt) -> i32 - eq +proc miden_base_sys::bindings::active_account::get_balance( + felt, + felt +) -> felt + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_swapp_note_bindings::"miden::protocol::active_account::get_balance" + trace.252 + nop end @callconv("C") -proc miden::active_account::get_balance(felt, felt) -> felt +proc miden::protocol::active_account::get_balance(felt, felt) -> felt trace.240 nop - exec.::miden::active_account::get_balance + exec.::miden::protocol::active_account::get_balance trace.252 nop end @callconv("C") -proc miden::active_note::get_script_root(i32) +proc miden::protocol::active_note::get_script_root(i32) trace.240 nop - exec.::miden::active_note::get_script_root + exec.::miden::protocol::active_note::get_script_root trace.252 nop movup.4 @@ -1219,10 +1299,10 @@ proc miden::active_note::get_script_root(i32) end @callconv("C") -proc miden::active_note::get_sender(i32) +proc miden::protocol::active_note::get_sender(i32) trace.240 nop - exec.::miden::active_note::get_sender + exec.::miden::protocol::active_note::get_sender trace.252 nop movup.2 @@ -1249,10 +1329,10 @@ proc miden::active_note::get_sender(i32) end @callconv("C") -proc miden::active_note::get_serial_number(i32) +proc miden::protocol::active_note::get_serial_number(i32) trace.240 nop - exec.::miden::active_note::get_serial_number + exec.::miden::protocol::active_note::get_serial_number trace.252 nop movup.4 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.wat b/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.wat index cd8a75d70..73413fad6 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.wat @@ -15,8 +15,7 @@ (type (;2;) (func (param f32 f32 f32 f32))) (type (;3;) (func (param i32))) (type (;4;) (func (param f32 f32) (result f32))) - (type (;5;) (func (param i32 i32))) - (type (;6;) (func (param f32 f32) (result i32))) + (type (;5;) (func (param f32 f32) (result i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -169,7 +168,7 @@ local.get 1 i32.const 8 i32.add - call $miden::active_note::get_sender + call $miden::protocol::active_note::get_sender local.get 0 local.get 1 i64.load offset=8 align=4 @@ -182,133 +181,73 @@ (func $miden_base_sys::bindings::active_note::get_script_root (;6;) (type 3) (param i32) (local i32) global.get $__stack_pointer - i32.const 32 + i32.const 16 i32.sub local.tee 1 global.set $__stack_pointer local.get 1 - call $miden::active_note::get_script_root - local.get 1 - local.get 1 - i64.load offset=8 - i64.store offset=24 - local.get 1 + call $miden::protocol::active_note::get_script_root + local.get 0 local.get 1 i64.load - i64.store offset=16 + i64.const 32 + i64.rotl + i64.store offset=8 local.get 0 local.get 1 - i32.const 16 - i32.add - call $::reverse + i64.load offset=8 + i64.const 32 + i64.rotl + i64.store local.get 1 - i32.const 32 + i32.const 16 i32.add global.set $__stack_pointer ) (func $miden_base_sys::bindings::active_note::get_serial_number (;7;) (type 3) (param i32) (local i32) global.get $__stack_pointer - i32.const 32 + i32.const 16 i32.sub local.tee 1 global.set $__stack_pointer local.get 1 - call $miden::active_note::get_serial_number - local.get 1 - local.get 1 - i64.load offset=8 - i64.store offset=24 - local.get 1 + call $miden::protocol::active_note::get_serial_number + local.get 0 local.get 1 i64.load - i64.store offset=16 + i64.const 32 + i64.rotl + i64.store offset=8 local.get 0 local.get 1 - i32.const 16 - i32.add - call $::reverse + i64.load offset=8 + i64.const 32 + i64.rotl + i64.store local.get 1 - i32.const 32 + i32.const 16 i32.add global.set $__stack_pointer ) (func $miden_base_sys::bindings::active_account::get_balance (;8;) (type 4) (param f32 f32) (result f32) local.get 0 local.get 1 - call $miden::active_account::get_balance - ) - (func $::reverse (;9;) (type 5) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store + call $miden::protocol::active_account::get_balance ) - (func $intrinsics::felt::eq (;10;) (type 6) (param f32 f32) (result i32) + (func $intrinsics::felt::eq (;9;) (type 5) (param f32 f32) (result i32) unreachable ) - (func $miden::active_account::get_balance (;11;) (type 4) (param f32 f32) (result f32) + (func $miden::protocol::active_account::get_balance (;10;) (type 4) (param f32 f32) (result f32) unreachable ) - (func $miden::active_note::get_script_root (;12;) (type 3) (param i32) + (func $miden::protocol::active_note::get_script_root (;11;) (type 3) (param i32) unreachable ) - (func $miden::active_note::get_sender (;13;) (type 3) (param i32) + (func $miden::protocol::active_note::get_sender (;12;) (type 3) (param i32) unreachable ) - (func $miden::active_note::get_serial_number (;14;) (type 3) (param i32) + (func $miden::protocol::active_note::get_serial_number (;13;) (type 3) (param i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") diff --git a/tests/integration/expected/rust_sdk_stdlib_sha256_hash.hir b/tests/integration/expected/rust_sdk_stdlib_sha256_hash.hir index 989a17c15..949eb4067 100644 --- a/tests/integration/expected/rust_sdk_stdlib_sha256_hash.hir +++ b/tests/integration/expected/rust_sdk_stdlib_sha256_hash.hir @@ -2,627 +2,706 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @rust_sdk_stdlib_sha256_hash { private builtin.function @<[u8]>::reverse(v0: i32, v1: i32) { ^block4(v0: i32, v1: i32): - v9 = arith.constant -1 : i32; - v8 = arith.add v1, v0 : i32 #[overflow = wrapping]; - v10 = arith.add v8, v9 : i32 #[overflow = wrapping]; - v484 = arith.constant 1 : u32; - v4 = hir.bitcast v1 : u32; - v6 = arith.shr v4, v484 : u32; + hir.store_local v0 #[local = lv0]; + hir.store_local v1 #[local = lv1]; + v2 = hir.load_local : i32 #[local = lv1]; + v557 = arith.constant 1 : u32; + v4 = hir.bitcast v2 : u32; + v6 = arith.shr v4, v557 : u32; v7 = hir.bitcast v6 : i32; - v492, v493, v494 = scf.while v7, v0, v10 : i32, i32, i32 { - ^block7(v11: i32, v18: i32, v24: i32): - v515 = arith.constant 0 : i32; - v2 = arith.constant 0 : i32; - v13 = arith.eq v11, v2 : i1; - v14 = arith.zext v13 : u32; - v15 = hir.bitcast v14 : i32; - v17 = arith.neq v15, v515 : i1; - v507, v508, v509 = scf.if v17 : i32, i32, i32 { - ^block38: - v485 = ub.poison i32 : i32; - scf.yield v485, v485, v485; + hir.store_local v7 #[local = lv2]; + v8 = hir.load_local : i32 #[local = lv1]; + v9 = hir.load_local : i32 #[local = lv0]; + v549 = arith.constant -1 : i32; + v10 = arith.add v8, v9 : i32 #[overflow = wrapping]; + v12 = arith.add v10, v549 : i32 #[overflow = wrapping]; + hir.store_local v12 #[local = lv1]; + scf.while { + ^block7: + v13 = hir.load_local : i32 #[local = lv2]; + v566 = arith.constant 0 : i32; + v553 = arith.constant 0 : i32; + v15 = arith.eq v13, v553 : i1; + v16 = arith.zext v15 : u32; + v17 = hir.bitcast v16 : i32; + v19 = arith.neq v17, v566 : i1; + scf.if v19{ + ^block39: + scf.yield ; } else { ^block9: - v19 = hir.bitcast v18 : u32; - v20 = hir.int_to_ptr v19 : ptr; - v21 = hir.load v20 : u8; - v25 = hir.bitcast v24 : u32; - v26 = hir.int_to_ptr v25 : ptr; - v27 = hir.load v26 : u8; - v28 = arith.zext v27 : u32; - v29 = hir.bitcast v28 : i32; - v30 = hir.bitcast v29 : u32; - v31 = arith.trunc v30 : u8; - v32 = hir.bitcast v18 : u32; - v33 = hir.int_to_ptr v32 : ptr; - hir.store v33, v31; - v22 = arith.zext v21 : u32; - v23 = hir.bitcast v22 : i32; - v34 = hir.bitcast v23 : u32; - v35 = arith.trunc v34 : u8; - v36 = hir.bitcast v24 : u32; - v37 = hir.int_to_ptr v36 : ptr; - hir.store v37, v35; - v513 = arith.constant -1 : i32; - v43 = arith.add v24, v513 : i32 #[overflow = wrapping]; - v3 = arith.constant 1 : i32; - v41 = arith.add v18, v3 : i32 #[overflow = wrapping]; - v514 = arith.constant -1 : i32; - v39 = arith.add v11, v514 : i32 #[overflow = wrapping]; - scf.yield v39, v41, v43; + v20 = hir.load_local : i32 #[local = lv0]; + v21 = hir.bitcast v20 : u32; + v22 = hir.int_to_ptr v21 : ptr; + v23 = hir.load v22 : u8; + v26 = hir.load_local : i32 #[local = lv0]; + v27 = hir.load_local : i32 #[local = lv1]; + v28 = hir.bitcast v27 : u32; + v29 = hir.int_to_ptr v28 : ptr; + v30 = hir.load v29 : u8; + v31 = arith.zext v30 : u32; + v32 = hir.bitcast v31 : i32; + v33 = hir.bitcast v32 : u32; + v34 = arith.trunc v33 : u8; + v35 = hir.bitcast v26 : u32; + v36 = hir.int_to_ptr v35 : ptr; + hir.store v36, v34; + v37 = hir.load_local : i32 #[local = lv1]; + v24 = arith.zext v23 : u32; + v25 = hir.bitcast v24 : i32; + v39 = hir.bitcast v25 : u32; + v40 = arith.trunc v39 : u8; + v41 = hir.bitcast v37 : u32; + v42 = hir.int_to_ptr v41 : ptr; + hir.store v42, v40; + v43 = hir.load_local : i32 #[local = lv2]; + v565 = arith.constant -1 : i32; + v45 = arith.add v43, v565 : i32 #[overflow = wrapping]; + hir.store_local v45 #[local = lv2]; + v46 = hir.load_local : i32 #[local = lv0]; + v550 = arith.constant 1 : i32; + v48 = arith.add v46, v550 : i32 #[overflow = wrapping]; + hir.store_local v48 #[local = lv0]; + v49 = hir.load_local : i32 #[local = lv1]; + v564 = arith.constant -1 : i32; + v51 = arith.add v49, v564 : i32 #[overflow = wrapping]; + hir.store_local v51 #[local = lv1]; + scf.yield ; }; - v512 = arith.constant 1 : u32; - v478 = arith.constant 0 : u32; - v511 = cf.select v17, v478, v512 : u32; - v501 = arith.trunc v511 : i1; - scf.condition v501, v507, v508, v509; + v563 = arith.constant 1 : u32; + v554 = arith.constant 0 : u32; + v562 = cf.select v19, v554, v563 : u32; + v558 = arith.trunc v562 : i1; + scf.condition v558; } do { - ^block37(v498: i32, v499: i32, v500: i32): - scf.yield v498, v499, v500; + ^block38: + scf.yield ; }; builtin.ret ; }; - private builtin.function @ as core::iter::traits::iterator::Iterator>::next(v44: i32, v45: i32) { - ^block10(v44: i32, v45: i32): - v48 = arith.constant 16 : u32; - v47 = hir.bitcast v45 : u32; - v49 = arith.add v47, v48 : u32 #[overflow = checked]; - v50 = arith.constant 4 : u32; - v51 = arith.mod v49, v50 : u32; - hir.assertz v51 #[code = 250]; - v52 = hir.int_to_ptr v49 : ptr; - v53 = hir.load v52 : i32; - v56 = arith.constant 8 : u32; - v55 = hir.bitcast v45 : u32; - v57 = arith.add v55, v56 : u32 #[overflow = checked]; - v540 = arith.constant 4 : u32; - v59 = arith.mod v57, v540 : u32; + private builtin.function @ as core::iter::traits::iterator::Iterator>::next(v52: i32, v53: i32) { + ^block10(v52: i32, v53: i32): + hir.store_local v52 #[local = lv0]; + hir.store_local v53 #[local = lv1]; + v54 = hir.load_local : i32 #[local = lv1]; + v571 = arith.constant 16 : u32; + v55 = hir.bitcast v54 : u32; + v57 = arith.add v55, v571 : u32 #[overflow = checked]; + v570 = arith.constant 4 : u32; + v59 = arith.mod v57, v570 : u32; hir.assertz v59 #[code = 250]; v60 = hir.int_to_ptr v57 : ptr; v61 = hir.load v60 : i32; - v539 = arith.constant 0 : i32; - v46 = arith.constant 0 : i32; - v63 = arith.eq v61, v46 : i1; - v64 = arith.zext v63 : u32; - v65 = hir.bitcast v64 : i32; - v67 = arith.neq v65, v539 : i1; - v527 = scf.if v67 : i32 { - ^block40: - v538 = arith.constant 0 : i32; - scf.yield v538; + hir.store_local v61 #[local = lv2]; + v569 = arith.constant 0 : i32; + hir.store_local v569 #[local = lv3]; + v63 = hir.load_local : i32 #[local = lv1]; + v568 = arith.constant 8 : u32; + v64 = hir.bitcast v63 : u32; + v66 = arith.add v64, v568 : u32 #[overflow = checked]; + v596 = arith.constant 4 : u32; + v68 = arith.mod v66, v596 : u32; + hir.assertz v68 #[code = 250]; + v69 = hir.int_to_ptr v66 : ptr; + v70 = hir.load v69 : i32; + hir.store_local v70 #[local = lv4]; + v594 = arith.constant 0 : i32; + v595 = arith.constant 0 : i32; + v72 = arith.eq v70, v595 : i1; + v73 = arith.zext v72 : u32; + v74 = hir.bitcast v73 : i32; + v76 = arith.neq v74, v594 : i1; + scf.if v76{ + ^block41: + scf.yield ; } else { ^block13: - v69 = arith.constant 12 : u32; - v68 = hir.bitcast v45 : u32; - v70 = arith.add v68, v69 : u32 #[overflow = checked]; - v537 = arith.constant 4 : u32; - v72 = arith.mod v70, v537 : u32; - hir.assertz v72 #[code = 250]; - v73 = hir.int_to_ptr v70 : ptr; - v74 = hir.load v73 : i32; - v536 = arith.constant 0 : i32; - v76 = hir.bitcast v53 : u32; - v75 = hir.bitcast v74 : u32; - v77 = arith.lt v75, v76 : i1; - v78 = arith.zext v77 : u32; - v79 = hir.bitcast v78 : i32; - v81 = arith.neq v79, v536 : i1; - scf.if v81{ - ^block39: + v77 = hir.load_local : i32 #[local = lv1]; + v567 = arith.constant 12 : u32; + v78 = hir.bitcast v77 : u32; + v80 = arith.add v78, v567 : u32 #[overflow = checked]; + v593 = arith.constant 4 : u32; + v82 = arith.mod v80, v593 : u32; + hir.assertz v82 #[code = 250]; + v83 = hir.int_to_ptr v80 : ptr; + v84 = hir.load v83 : i32; + hir.store_local v84 #[local = lv5]; + v85 = hir.load_local : i32 #[local = lv2]; + v592 = arith.constant 0 : i32; + v87 = hir.bitcast v85 : u32; + v86 = hir.bitcast v84 : u32; + v88 = arith.lt v86, v87 : i1; + v89 = arith.zext v88 : u32; + v90 = hir.bitcast v89 : i32; + v92 = arith.neq v90, v592 : i1; + scf.if v92{ + ^block40: scf.yield ; } else { ^block14: - v535 = arith.constant 12 : u32; - v83 = hir.bitcast v45 : u32; - v85 = arith.add v83, v535 : u32 #[overflow = checked]; - v534 = arith.constant 4 : u32; - v87 = arith.mod v85, v534 : u32; - hir.assertz v87 #[code = 250]; - v82 = arith.sub v74, v53 : i32 #[overflow = wrapping]; - v88 = hir.int_to_ptr v85 : ptr; - hir.store v88, v82; - v533 = arith.constant 8 : u32; - v90 = hir.bitcast v45 : u32; - v92 = arith.add v90, v533 : u32 #[overflow = checked]; - v532 = arith.constant 4 : u32; - v94 = arith.mod v92, v532 : u32; - hir.assertz v94 #[code = 250]; - v89 = arith.add v61, v53 : i32 #[overflow = wrapping]; - v95 = hir.int_to_ptr v92 : ptr; - hir.store v95, v89; + v93 = hir.load_local : i32 #[local = lv1]; + v94 = hir.load_local : i32 #[local = lv5]; + v95 = hir.load_local : i32 #[local = lv2]; + v591 = arith.constant 12 : u32; + v97 = hir.bitcast v93 : u32; + v99 = arith.add v97, v591 : u32 #[overflow = checked]; + v590 = arith.constant 4 : u32; + v101 = arith.mod v99, v590 : u32; + hir.assertz v101 #[code = 250]; + v96 = arith.sub v94, v95 : i32 #[overflow = wrapping]; + v102 = hir.int_to_ptr v99 : ptr; + hir.store v102, v96; + v103 = hir.load_local : i32 #[local = lv1]; + v104 = hir.load_local : i32 #[local = lv4]; + v105 = hir.load_local : i32 #[local = lv2]; + v589 = arith.constant 8 : u32; + v107 = hir.bitcast v103 : u32; + v109 = arith.add v107, v589 : u32 #[overflow = checked]; + v588 = arith.constant 4 : u32; + v111 = arith.mod v109, v588 : u32; + hir.assertz v111 #[code = 250]; + v106 = arith.add v104, v105 : i32 #[overflow = wrapping]; + v112 = hir.int_to_ptr v109 : ptr; + hir.store v112, v106; + v113 = hir.load_local : i32 #[local = lv4]; + hir.store_local v113 #[local = lv3]; scf.yield ; }; - v531 = arith.constant 0 : i32; - v526 = cf.select v81, v531, v61 : i32; - scf.yield v526; + scf.yield ; }; - v530 = arith.constant 4 : u32; - v98 = hir.bitcast v44 : u32; - v100 = arith.add v98, v530 : u32 #[overflow = checked]; - v529 = arith.constant 4 : u32; - v102 = arith.mod v100, v529 : u32; - hir.assertz v102 #[code = 250]; - v103 = hir.int_to_ptr v100 : ptr; - hir.store v103, v53; - v105 = hir.bitcast v44 : u32; - v528 = arith.constant 4 : u32; - v107 = arith.mod v105, v528 : u32; - hir.assertz v107 #[code = 250]; - v108 = hir.int_to_ptr v105 : ptr; - hir.store v108, v527; + v114 = hir.load_local : i32 #[local = lv0]; + v115 = hir.load_local : i32 #[local = lv2]; + v587 = arith.constant 4 : u32; + v116 = hir.bitcast v114 : u32; + v118 = arith.add v116, v587 : u32 #[overflow = checked]; + v586 = arith.constant 4 : u32; + v120 = arith.mod v118, v586 : u32; + hir.assertz v120 #[code = 250]; + v121 = hir.int_to_ptr v118 : ptr; + hir.store v121, v115; + v122 = hir.load_local : i32 #[local = lv0]; + v123 = hir.load_local : i32 #[local = lv3]; + v124 = hir.bitcast v122 : u32; + v585 = arith.constant 4 : u32; + v126 = arith.mod v124, v585 : u32; + hir.assertz v126 #[code = 250]; + v127 = hir.int_to_ptr v124 : ptr; + hir.store v127, v123; builtin.ret ; }; - public builtin.function @entrypoint(v109: i32, v110: i32) { - ^block15(v109: i32, v110: i32): - v112 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/__stack_pointer : ptr - v113 = hir.bitcast v112 : ptr; - v114 = hir.load v113 : i32; - v117 = arith.constant -32 : i32; - v115 = arith.constant 128 : i32; - v116 = arith.sub v114, v115 : i32 #[overflow = wrapping]; - v118 = arith.band v116, v117 : i32; - v119 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/__stack_pointer : ptr - v120 = hir.bitcast v119 : ptr; - hir.store v120, v118; - v123 = arith.constant 24 : i32; - v126 = arith.add v110, v123 : i32 #[overflow = wrapping]; - v127 = hir.bitcast v126 : u32; - v128 = hir.int_to_ptr v127 : ptr; - v129 = hir.load v128 : i64; - v743 = arith.constant 24 : i32; - v121 = arith.constant 64 : i32; - v122 = arith.add v118, v121 : i32 #[overflow = wrapping]; - v124 = arith.add v122, v743 : i32 #[overflow = wrapping]; - v130 = hir.bitcast v124 : u32; - v131 = arith.constant 8 : u32; - v132 = arith.mod v130, v131 : u32; - hir.assertz v132 #[code = 250]; - v133 = hir.int_to_ptr v130 : ptr; - hir.store v133, v129; - v136 = arith.constant 16 : i32; - v139 = arith.add v110, v136 : i32 #[overflow = wrapping]; - v140 = hir.bitcast v139 : u32; - v141 = hir.int_to_ptr v140 : ptr; - v142 = hir.load v141 : i64; - v741 = arith.constant 16 : i32; - v742 = arith.constant 64 : i32; - v135 = arith.add v118, v742 : i32 #[overflow = wrapping]; - v137 = arith.add v135, v741 : i32 #[overflow = wrapping]; - v143 = hir.bitcast v137 : u32; - v740 = arith.constant 8 : u32; - v145 = arith.mod v143, v740 : u32; - hir.assertz v145 #[code = 250]; - v146 = hir.int_to_ptr v143 : ptr; - hir.store v146, v142; - v149 = arith.constant 8 : i32; - v152 = arith.add v110, v149 : i32 #[overflow = wrapping]; - v153 = hir.bitcast v152 : u32; - v154 = hir.int_to_ptr v153 : ptr; - v155 = hir.load v154 : i64; - v738 = arith.constant 8 : i32; - v739 = arith.constant 64 : i32; - v148 = arith.add v118, v739 : i32 #[overflow = wrapping]; - v150 = arith.add v148, v738 : i32 #[overflow = wrapping]; - v156 = hir.bitcast v150 : u32; - v737 = arith.constant 8 : u32; - v158 = arith.mod v156, v737 : u32; - hir.assertz v158 #[code = 250]; - v159 = hir.int_to_ptr v156 : ptr; - hir.store v159, v155; - v160 = hir.bitcast v110 : u32; - v161 = hir.int_to_ptr v160 : ptr; - v162 = hir.load v161 : i64; - v164 = arith.constant 64 : u32; - v163 = hir.bitcast v118 : u32; - v165 = arith.add v163, v164 : u32 #[overflow = checked]; - v736 = arith.constant 8 : u32; - v167 = arith.mod v165, v736 : u32; - hir.assertz v167 #[code = 250]; - v168 = hir.int_to_ptr v165 : ptr; - hir.store v168, v162; - v171 = arith.constant 44 : u32; - v170 = hir.bitcast v118 : u32; - v172 = arith.add v170, v171 : u32 #[overflow = checked]; - v173 = arith.constant 4 : u32; - v174 = arith.mod v172, v173 : u32; - hir.assertz v174 #[code = 250]; - v169 = arith.constant 17179869216 : i64; - v175 = hir.int_to_ptr v172 : ptr; - hir.store v175, v169; - v178 = arith.constant 36 : u32; - v177 = hir.bitcast v118 : u32; - v179 = arith.add v177, v178 : u32 #[overflow = checked]; - v735 = arith.constant 4 : u32; - v181 = arith.mod v179, v735 : u32; - hir.assertz v181 #[code = 250]; - v111 = arith.constant 0 : i32; - v182 = hir.int_to_ptr v179 : ptr; - hir.store v182, v111; - v186 = arith.constant 32 : u32; - v185 = hir.bitcast v118 : u32; - v187 = arith.add v185, v186 : u32 #[overflow = checked]; - v734 = arith.constant 4 : u32; - v189 = arith.mod v187, v734 : u32; - hir.assertz v189 #[code = 250]; - v183 = arith.constant 96 : i32; - v184 = arith.add v118, v183 : i32 #[overflow = wrapping]; - v190 = hir.int_to_ptr v187 : ptr; - hir.store v190, v184; - v194 = arith.constant 40 : u32; - v193 = hir.bitcast v118 : u32; - v195 = arith.add v193, v194 : u32 #[overflow = checked]; - v733 = arith.constant 4 : u32; - v197 = arith.mod v195, v733 : u32; - hir.assertz v197 #[code = 250]; - v732 = arith.constant 64 : i32; - v192 = arith.add v118, v732 : i32 #[overflow = wrapping]; - v198 = hir.int_to_ptr v195 : ptr; - hir.store v198, v192; - v657, v658, v659, v660, v661, v662 = scf.while v118, v109, v114 : i32, i32, i32, i32, i32, i32 { - ^block58(v663: i32, v664: i32, v665: i32): - v280 = arith.constant 32 : i32; - v203 = arith.add v663, v280 : i32 #[overflow = wrapping]; - v731 = arith.constant 24 : i32; - v201 = arith.add v663, v731 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/ as core::iter::traits::iterator::Iterator>::next(v201, v203) - v205 = arith.constant 24 : u32; - v204 = hir.bitcast v663 : u32; - v206 = arith.add v204, v205 : u32 #[overflow = checked]; - v730 = arith.constant 4 : u32; - v208 = arith.mod v206, v730 : u32; - hir.assertz v208 #[code = 250]; - v209 = hir.int_to_ptr v206 : ptr; - v210 = hir.load v209 : i32; - v728 = arith.constant 0 : i32; - v729 = arith.constant 0 : i32; - v212 = arith.eq v210, v729 : i1; - v213 = arith.zext v212 : u32; - v214 = hir.bitcast v213 : i32; - v216 = arith.neq v214, v728 : i1; - scf.if v216{ - ^block54: + public builtin.function @entrypoint(v128: i32, v129: i32) { + ^block15(v128: i32, v129: i32): + hir.store_local v128 #[local = lv0]; + hir.store_local v129 #[local = lv1]; + v130 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/__stack_pointer : ptr + v131 = hir.bitcast v130 : ptr; + v132 = hir.load v131 : i32; + hir.store_local v132 #[local = lv2]; + hir.store_local v132 #[local = lv3]; + v133 = hir.load_local : i32 #[local = lv2]; + v630 = arith.constant -32 : i32; + v631 = arith.constant 128 : i32; + v135 = arith.sub v133, v631 : i32 #[overflow = wrapping]; + v137 = arith.band v135, v630 : i32; + hir.store_local v137 #[local = lv2]; + v138 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/__stack_pointer : ptr + v139 = hir.bitcast v138 : ptr; + hir.store v139, v137; + v140 = hir.load_local : i32 #[local = lv2]; + v145 = hir.load_local : i32 #[local = lv1]; + v628 = arith.constant 24 : i32; + v147 = arith.add v145, v628 : i32 #[overflow = wrapping]; + v148 = hir.bitcast v147 : u32; + v149 = hir.int_to_ptr v148 : ptr; + v150 = hir.load v149 : i64; + v779 = arith.constant 24 : i32; + v629 = arith.constant 64 : i32; + v142 = arith.add v140, v629 : i32 #[overflow = wrapping]; + v144 = arith.add v142, v779 : i32 #[overflow = wrapping]; + v151 = hir.bitcast v144 : u32; + v627 = arith.constant 8 : u32; + v153 = arith.mod v151, v627 : u32; + hir.assertz v153 #[code = 250]; + v154 = hir.int_to_ptr v151 : ptr; + hir.store v154, v150; + v155 = hir.load_local : i32 #[local = lv2]; + v160 = hir.load_local : i32 #[local = lv1]; + v626 = arith.constant 16 : i32; + v162 = arith.add v160, v626 : i32 #[overflow = wrapping]; + v163 = hir.bitcast v162 : u32; + v164 = hir.int_to_ptr v163 : ptr; + v165 = hir.load v164 : i64; + v777 = arith.constant 16 : i32; + v778 = arith.constant 64 : i32; + v157 = arith.add v155, v778 : i32 #[overflow = wrapping]; + v159 = arith.add v157, v777 : i32 #[overflow = wrapping]; + v166 = hir.bitcast v159 : u32; + v776 = arith.constant 8 : u32; + v168 = arith.mod v166, v776 : u32; + hir.assertz v168 #[code = 250]; + v169 = hir.int_to_ptr v166 : ptr; + hir.store v169, v165; + v170 = hir.load_local : i32 #[local = lv2]; + v175 = hir.load_local : i32 #[local = lv1]; + v625 = arith.constant 8 : i32; + v177 = arith.add v175, v625 : i32 #[overflow = wrapping]; + v178 = hir.bitcast v177 : u32; + v179 = hir.int_to_ptr v178 : ptr; + v180 = hir.load v179 : i64; + v774 = arith.constant 8 : i32; + v775 = arith.constant 64 : i32; + v172 = arith.add v170, v775 : i32 #[overflow = wrapping]; + v174 = arith.add v172, v774 : i32 #[overflow = wrapping]; + v181 = hir.bitcast v174 : u32; + v773 = arith.constant 8 : u32; + v183 = arith.mod v181, v773 : u32; + hir.assertz v183 #[code = 250]; + v184 = hir.int_to_ptr v181 : ptr; + hir.store v184, v180; + v185 = hir.load_local : i32 #[local = lv2]; + v186 = hir.load_local : i32 #[local = lv1]; + v187 = hir.bitcast v186 : u32; + v188 = hir.int_to_ptr v187 : ptr; + v189 = hir.load v188 : i64; + v624 = arith.constant 64 : u32; + v190 = hir.bitcast v185 : u32; + v192 = arith.add v190, v624 : u32 #[overflow = checked]; + v772 = arith.constant 8 : u32; + v194 = arith.mod v192, v772 : u32; + hir.assertz v194 #[code = 250]; + v195 = hir.int_to_ptr v192 : ptr; + hir.store v195, v189; + v196 = hir.load_local : i32 #[local = lv2]; + v622 = arith.constant 44 : u32; + v198 = hir.bitcast v196 : u32; + v200 = arith.add v198, v622 : u32 #[overflow = checked]; + v621 = arith.constant 4 : u32; + v202 = arith.mod v200, v621 : u32; + hir.assertz v202 #[code = 250]; + v623 = arith.constant 17179869216 : i64; + v203 = hir.int_to_ptr v200 : ptr; + hir.store v203, v623; + v204 = hir.load_local : i32 #[local = lv2]; + v619 = arith.constant 36 : u32; + v206 = hir.bitcast v204 : u32; + v208 = arith.add v206, v619 : u32 #[overflow = checked]; + v771 = arith.constant 4 : u32; + v210 = arith.mod v208, v771 : u32; + hir.assertz v210 #[code = 250]; + v620 = arith.constant 0 : i32; + v211 = hir.int_to_ptr v208 : ptr; + hir.store v211, v620; + v212 = hir.load_local : i32 #[local = lv2]; + v617 = arith.constant 32 : u32; + v216 = hir.bitcast v212 : u32; + v218 = arith.add v216, v617 : u32 #[overflow = checked]; + v770 = arith.constant 4 : u32; + v220 = arith.mod v218, v770 : u32; + hir.assertz v220 #[code = 250]; + v618 = arith.constant 96 : i32; + v215 = arith.add v212, v618 : i32 #[overflow = wrapping]; + v221 = hir.int_to_ptr v218 : ptr; + hir.store v221, v215; + v222 = hir.load_local : i32 #[local = lv2]; + v616 = arith.constant 40 : u32; + v226 = hir.bitcast v222 : u32; + v228 = arith.add v226, v616 : u32 #[overflow = checked]; + v769 = arith.constant 4 : u32; + v230 = arith.mod v228, v769 : u32; + hir.assertz v230 #[code = 250]; + v768 = arith.constant 64 : i32; + v225 = arith.add v222, v768 : i32 #[overflow = wrapping]; + v231 = hir.int_to_ptr v228 : ptr; + hir.store v231, v225; + scf.while { + ^block18: + v232 = hir.load_local : i32 #[local = lv2]; + v652 = arith.constant 32 : i32; + v237 = arith.add v232, v652 : i32 #[overflow = wrapping]; + v767 = arith.constant 24 : i32; + v234 = arith.add v232, v767 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/ as core::iter::traits::iterator::Iterator>::next(v234, v237) + v238 = hir.load_local : i32 #[local = lv2]; + v601 = arith.constant 24 : u32; + v239 = hir.bitcast v238 : u32; + v241 = arith.add v239, v601 : u32 #[overflow = checked]; + v766 = arith.constant 4 : u32; + v243 = arith.mod v241, v766 : u32; + hir.assertz v243 #[code = 250]; + v244 = hir.int_to_ptr v241 : ptr; + v245 = hir.load v244 : i32; + hir.store_local v245 #[local = lv1]; + v764 = arith.constant 0 : i32; + v765 = arith.constant 0 : i32; + v247 = arith.eq v245, v765 : i1; + v248 = arith.zext v247 : u32; + v249 = hir.bitcast v248 : i32; + v251 = arith.neq v249, v764 : i1; + scf.if v251{ + ^block55: scf.yield ; } else { ^block20: - v218 = arith.constant 28 : u32; - v217 = hir.bitcast v663 : u32; - v219 = arith.add v217, v218 : u32 #[overflow = checked]; - v727 = arith.constant 4 : u32; - v221 = arith.mod v219, v727 : u32; - hir.assertz v221 #[code = 250]; - v222 = hir.int_to_ptr v219 : ptr; - v223 = hir.load v222 : i32; - hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/<[u8]>::reverse(v210, v223) + v252 = hir.load_local : i32 #[local = lv1]; + v253 = hir.load_local : i32 #[local = lv2]; + v600 = arith.constant 28 : u32; + v254 = hir.bitcast v253 : u32; + v256 = arith.add v254, v600 : u32 #[overflow = checked]; + v763 = arith.constant 4 : u32; + v258 = arith.mod v256, v763 : u32; + hir.assertz v258 #[code = 250]; + v259 = hir.int_to_ptr v256 : ptr; + v260 = hir.load v259 : i32; + hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/<[u8]>::reverse(v252, v260) scf.yield ; }; - v725 = ub.poison i32 : i32; - v654 = cf.select v216, v725, v665 : i32; - v726 = ub.poison i32 : i32; - v653 = cf.select v216, v726, v664 : i32; - v548 = ub.poison i32 : i32; - v652 = cf.select v216, v548, v663 : i32; - v547 = arith.constant 1 : u32; - v541 = arith.constant 0 : u32; - v656 = cf.select v216, v541, v547 : u32; - v621 = arith.trunc v656 : i1; - scf.condition v621, v652, v653, v654, v663, v664, v665; + v700 = arith.constant 1 : u32; + v697 = arith.constant 0 : u32; + v712 = cf.select v251, v697, v700 : u32; + v704 = arith.trunc v712 : i1; + scf.condition v704; } do { - ^block59(v666: i32, v667: i32, v668: i32, v669: i32, v670: i32, v671: i32): - scf.yield v666, v667, v668; + ^block54: + scf.yield ; }; - v724 = arith.constant 64 : u32; - v224 = hir.bitcast v660 : u32; - v226 = arith.add v224, v724 : u32 #[overflow = checked]; - v723 = arith.constant 4 : u32; - v228 = arith.mod v226, v723 : u32; - hir.assertz v228 #[code = 250]; - v229 = hir.int_to_ptr v226 : ptr; - v230 = hir.load v229 : i32; - v232 = arith.constant 68 : u32; - v231 = hir.bitcast v660 : u32; - v233 = arith.add v231, v232 : u32 #[overflow = checked]; - v722 = arith.constant 4 : u32; - v235 = arith.mod v233, v722 : u32; - hir.assertz v235 #[code = 250]; - v236 = hir.int_to_ptr v233 : ptr; - v237 = hir.load v236 : i32; - v239 = arith.constant 72 : u32; - v238 = hir.bitcast v660 : u32; - v240 = arith.add v238, v239 : u32 #[overflow = checked]; - v721 = arith.constant 4 : u32; - v242 = arith.mod v240, v721 : u32; - hir.assertz v242 #[code = 250]; - v243 = hir.int_to_ptr v240 : ptr; - v244 = hir.load v243 : i32; - v246 = arith.constant 76 : u32; - v245 = hir.bitcast v660 : u32; - v247 = arith.add v245, v246 : u32 #[overflow = checked]; - v720 = arith.constant 4 : u32; - v249 = arith.mod v247, v720 : u32; - hir.assertz v249 #[code = 250]; - v250 = hir.int_to_ptr v247 : ptr; - v251 = hir.load v250 : i32; - v253 = arith.constant 80 : u32; - v252 = hir.bitcast v660 : u32; - v254 = arith.add v252, v253 : u32 #[overflow = checked]; - v719 = arith.constant 4 : u32; - v256 = arith.mod v254, v719 : u32; - hir.assertz v256 #[code = 250]; - v257 = hir.int_to_ptr v254 : ptr; - v258 = hir.load v257 : i32; - v260 = arith.constant 84 : u32; - v259 = hir.bitcast v660 : u32; - v261 = arith.add v259, v260 : u32 #[overflow = checked]; - v718 = arith.constant 4 : u32; - v263 = arith.mod v261, v718 : u32; - hir.assertz v263 #[code = 250]; - v264 = hir.int_to_ptr v261 : ptr; - v265 = hir.load v264 : i32; - v267 = arith.constant 88 : u32; - v266 = hir.bitcast v660 : u32; - v268 = arith.add v266, v267 : u32 #[overflow = checked]; - v717 = arith.constant 4 : u32; - v270 = arith.mod v268, v717 : u32; - hir.assertz v270 #[code = 250]; - v271 = hir.int_to_ptr v268 : ptr; - v272 = hir.load v271 : i32; - v274 = arith.constant 92 : u32; - v273 = hir.bitcast v660 : u32; - v275 = arith.add v273, v274 : u32 #[overflow = checked]; - v716 = arith.constant 4 : u32; - v277 = arith.mod v275, v716 : u32; - hir.assertz v277 #[code = 250]; - v278 = hir.int_to_ptr v275 : ptr; - v279 = hir.load v278 : i32; - v715 = arith.constant 32 : i32; - v281 = arith.add v660, v715 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/std::crypto::hashes::sha256::hash_1to1(v230, v237, v244, v251, v258, v265, v272, v279, v281) - v283 = arith.constant 56 : u32; - v282 = hir.bitcast v660 : u32; - v284 = arith.add v282, v283 : u32 #[overflow = checked]; - v714 = arith.constant 8 : u32; - v286 = arith.mod v284, v714 : u32; - hir.assertz v286 #[code = 250]; - v287 = hir.int_to_ptr v284 : ptr; - v288 = hir.load v287 : i64; - v713 = arith.constant 88 : u32; - v289 = hir.bitcast v660 : u32; - v291 = arith.add v289, v713 : u32 #[overflow = checked]; - v712 = arith.constant 8 : u32; - v293 = arith.mod v291, v712 : u32; - hir.assertz v293 #[code = 250]; - v294 = hir.int_to_ptr v291 : ptr; - hir.store v294, v288; - v296 = arith.constant 48 : u32; - v295 = hir.bitcast v660 : u32; - v297 = arith.add v295, v296 : u32 #[overflow = checked]; - v711 = arith.constant 8 : u32; - v299 = arith.mod v297, v711 : u32; - hir.assertz v299 #[code = 250]; - v300 = hir.int_to_ptr v297 : ptr; - v301 = hir.load v300 : i64; - v710 = arith.constant 80 : u32; - v302 = hir.bitcast v660 : u32; - v304 = arith.add v302, v710 : u32 #[overflow = checked]; - v709 = arith.constant 8 : u32; - v306 = arith.mod v304, v709 : u32; + v261 = hir.load_local : i32 #[local = lv2]; + v762 = arith.constant 64 : u32; + v262 = hir.bitcast v261 : u32; + v264 = arith.add v262, v762 : u32 #[overflow = checked]; + v761 = arith.constant 4 : u32; + v266 = arith.mod v264, v761 : u32; + hir.assertz v266 #[code = 250]; + v267 = hir.int_to_ptr v264 : ptr; + v268 = hir.load v267 : i32; + v269 = hir.load_local : i32 #[local = lv2]; + v615 = arith.constant 68 : u32; + v270 = hir.bitcast v269 : u32; + v272 = arith.add v270, v615 : u32 #[overflow = checked]; + v760 = arith.constant 4 : u32; + v274 = arith.mod v272, v760 : u32; + hir.assertz v274 #[code = 250]; + v275 = hir.int_to_ptr v272 : ptr; + v276 = hir.load v275 : i32; + v277 = hir.load_local : i32 #[local = lv2]; + v614 = arith.constant 72 : u32; + v278 = hir.bitcast v277 : u32; + v280 = arith.add v278, v614 : u32 #[overflow = checked]; + v759 = arith.constant 4 : u32; + v282 = arith.mod v280, v759 : u32; + hir.assertz v282 #[code = 250]; + v283 = hir.int_to_ptr v280 : ptr; + v284 = hir.load v283 : i32; + v285 = hir.load_local : i32 #[local = lv2]; + v613 = arith.constant 76 : u32; + v286 = hir.bitcast v285 : u32; + v288 = arith.add v286, v613 : u32 #[overflow = checked]; + v758 = arith.constant 4 : u32; + v290 = arith.mod v288, v758 : u32; + hir.assertz v290 #[code = 250]; + v291 = hir.int_to_ptr v288 : ptr; + v292 = hir.load v291 : i32; + v293 = hir.load_local : i32 #[local = lv2]; + v612 = arith.constant 80 : u32; + v294 = hir.bitcast v293 : u32; + v296 = arith.add v294, v612 : u32 #[overflow = checked]; + v757 = arith.constant 4 : u32; + v298 = arith.mod v296, v757 : u32; + hir.assertz v298 #[code = 250]; + v299 = hir.int_to_ptr v296 : ptr; + v300 = hir.load v299 : i32; + v301 = hir.load_local : i32 #[local = lv2]; + v611 = arith.constant 84 : u32; + v302 = hir.bitcast v301 : u32; + v304 = arith.add v302, v611 : u32 #[overflow = checked]; + v756 = arith.constant 4 : u32; + v306 = arith.mod v304, v756 : u32; hir.assertz v306 #[code = 250]; - v307 = hir.int_to_ptr v304 : ptr; - hir.store v307, v301; - v708 = arith.constant 40 : u32; - v308 = hir.bitcast v660 : u32; - v310 = arith.add v308, v708 : u32 #[overflow = checked]; - v707 = arith.constant 8 : u32; - v312 = arith.mod v310, v707 : u32; - hir.assertz v312 #[code = 250]; - v313 = hir.int_to_ptr v310 : ptr; - v314 = hir.load v313 : i64; - v706 = arith.constant 72 : u32; - v315 = hir.bitcast v660 : u32; - v317 = arith.add v315, v706 : u32 #[overflow = checked]; - v705 = arith.constant 8 : u32; - v319 = arith.mod v317, v705 : u32; - hir.assertz v319 #[code = 250]; - v320 = hir.int_to_ptr v317 : ptr; - hir.store v320, v314; - v704 = arith.constant 32 : u32; - v321 = hir.bitcast v660 : u32; - v323 = arith.add v321, v704 : u32 #[overflow = checked]; - v703 = arith.constant 8 : u32; - v325 = arith.mod v323, v703 : u32; - hir.assertz v325 #[code = 250]; - v326 = hir.int_to_ptr v323 : ptr; - v327 = hir.load v326 : i64; - v702 = arith.constant 64 : u32; - v328 = hir.bitcast v660 : u32; - v330 = arith.add v328, v702 : u32 #[overflow = checked]; - v701 = arith.constant 8 : u32; - v332 = arith.mod v330, v701 : u32; - hir.assertz v332 #[code = 250]; - v333 = hir.int_to_ptr v330 : ptr; - hir.store v333, v327; - v336 = arith.constant 120 : u32; - v335 = hir.bitcast v660 : u32; - v337 = arith.add v335, v336 : u32 #[overflow = checked]; - v700 = arith.constant 4 : u32; - v339 = arith.mod v337, v700 : u32; - hir.assertz v339 #[code = 250]; - v699 = arith.constant 17179869216 : i64; - v340 = hir.int_to_ptr v337 : ptr; - hir.store v340, v699; - v343 = arith.constant 112 : u32; - v342 = hir.bitcast v660 : u32; - v344 = arith.add v342, v343 : u32 #[overflow = checked]; - v698 = arith.constant 4 : u32; - v346 = arith.mod v344, v698 : u32; - hir.assertz v346 #[code = 250]; - v697 = arith.constant 0 : i32; - v347 = hir.int_to_ptr v344 : ptr; - hir.store v347, v697; - v351 = arith.constant 108 : u32; - v350 = hir.bitcast v660 : u32; - v352 = arith.add v350, v351 : u32 #[overflow = checked]; - v696 = arith.constant 4 : u32; - v354 = arith.mod v352, v696 : u32; - hir.assertz v354 #[code = 250]; - v695 = arith.constant 96 : i32; - v349 = arith.add v660, v695 : i32 #[overflow = wrapping]; - v355 = hir.int_to_ptr v352 : ptr; - hir.store v355, v349; - v359 = arith.constant 116 : u32; - v358 = hir.bitcast v660 : u32; - v360 = arith.add v358, v359 : u32 #[overflow = checked]; - v694 = arith.constant 4 : u32; - v362 = arith.mod v360, v694 : u32; - hir.assertz v362 #[code = 250]; - v693 = arith.constant 64 : i32; - v357 = arith.add v660, v693 : i32 #[overflow = wrapping]; - v363 = hir.int_to_ptr v360 : ptr; - hir.store v363, v357; - v637, v638, v639, v640, v641, v642 = scf.while v660, v661, v662 : i32, i32, i32, i32, i32, i32 { - ^block56(v643: i32, v644: i32, v645: i32): - v367 = arith.constant 108 : i32; - v368 = arith.add v643, v367 : i32 #[overflow = wrapping]; - v692 = arith.constant 16 : i32; - v366 = arith.add v643, v692 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/ as core::iter::traits::iterator::Iterator>::next(v366, v368) - v370 = arith.constant 16 : u32; - v369 = hir.bitcast v643 : u32; - v371 = arith.add v369, v370 : u32 #[overflow = checked]; - v691 = arith.constant 4 : u32; - v373 = arith.mod v371, v691 : u32; - hir.assertz v373 #[code = 250]; - v374 = hir.int_to_ptr v371 : ptr; - v375 = hir.load v374 : i32; - v689 = arith.constant 0 : i32; - v690 = arith.constant 0 : i32; - v377 = arith.eq v375, v690 : i1; - v378 = arith.zext v377 : u32; - v379 = hir.bitcast v378 : i32; - v381 = arith.neq v379, v689 : i1; - scf.if v381{ - ^block55: + v307 = hir.int_to_ptr v304 : ptr; + v308 = hir.load v307 : i32; + v309 = hir.load_local : i32 #[local = lv2]; + v610 = arith.constant 88 : u32; + v310 = hir.bitcast v309 : u32; + v312 = arith.add v310, v610 : u32 #[overflow = checked]; + v755 = arith.constant 4 : u32; + v314 = arith.mod v312, v755 : u32; + hir.assertz v314 #[code = 250]; + v315 = hir.int_to_ptr v312 : ptr; + v316 = hir.load v315 : i32; + v317 = hir.load_local : i32 #[local = lv2]; + v609 = arith.constant 92 : u32; + v318 = hir.bitcast v317 : u32; + v320 = arith.add v318, v609 : u32 #[overflow = checked]; + v754 = arith.constant 4 : u32; + v322 = arith.mod v320, v754 : u32; + hir.assertz v322 #[code = 250]; + v323 = hir.int_to_ptr v320 : ptr; + v324 = hir.load v323 : i32; + v325 = hir.load_local : i32 #[local = lv2]; + v753 = arith.constant 32 : i32; + v327 = arith.add v325, v753 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/miden::core::crypto::hashes::sha256::hash(v268, v276, v284, v292, v300, v308, v316, v324, v327) + v328 = hir.load_local : i32 #[local = lv2]; + v607 = arith.constant 56 : u32; + v330 = hir.bitcast v328 : u32; + v332 = arith.add v330, v607 : u32 #[overflow = checked]; + v752 = arith.constant 8 : u32; + v334 = arith.mod v332, v752 : u32; + hir.assertz v334 #[code = 250]; + v335 = hir.int_to_ptr v332 : ptr; + v336 = hir.load v335 : i64; + v751 = arith.constant 88 : u32; + v337 = hir.bitcast v328 : u32; + v339 = arith.add v337, v751 : u32 #[overflow = checked]; + v750 = arith.constant 8 : u32; + v341 = arith.mod v339, v750 : u32; + hir.assertz v341 #[code = 250]; + v342 = hir.int_to_ptr v339 : ptr; + hir.store v342, v336; + v343 = hir.load_local : i32 #[local = lv2]; + v606 = arith.constant 48 : u32; + v345 = hir.bitcast v343 : u32; + v347 = arith.add v345, v606 : u32 #[overflow = checked]; + v749 = arith.constant 8 : u32; + v349 = arith.mod v347, v749 : u32; + hir.assertz v349 #[code = 250]; + v350 = hir.int_to_ptr v347 : ptr; + v351 = hir.load v350 : i64; + v748 = arith.constant 80 : u32; + v352 = hir.bitcast v343 : u32; + v354 = arith.add v352, v748 : u32 #[overflow = checked]; + v747 = arith.constant 8 : u32; + v356 = arith.mod v354, v747 : u32; + hir.assertz v356 #[code = 250]; + v357 = hir.int_to_ptr v354 : ptr; + hir.store v357, v351; + v358 = hir.load_local : i32 #[local = lv2]; + v746 = arith.constant 40 : u32; + v360 = hir.bitcast v358 : u32; + v362 = arith.add v360, v746 : u32 #[overflow = checked]; + v745 = arith.constant 8 : u32; + v364 = arith.mod v362, v745 : u32; + hir.assertz v364 #[code = 250]; + v365 = hir.int_to_ptr v362 : ptr; + v366 = hir.load v365 : i64; + v744 = arith.constant 72 : u32; + v367 = hir.bitcast v358 : u32; + v369 = arith.add v367, v744 : u32 #[overflow = checked]; + v743 = arith.constant 8 : u32; + v371 = arith.mod v369, v743 : u32; + hir.assertz v371 #[code = 250]; + v372 = hir.int_to_ptr v369 : ptr; + hir.store v372, v366; + v373 = hir.load_local : i32 #[local = lv2]; + v742 = arith.constant 32 : u32; + v375 = hir.bitcast v373 : u32; + v377 = arith.add v375, v742 : u32 #[overflow = checked]; + v741 = arith.constant 8 : u32; + v379 = arith.mod v377, v741 : u32; + hir.assertz v379 #[code = 250]; + v380 = hir.int_to_ptr v377 : ptr; + v381 = hir.load v380 : i64; + v740 = arith.constant 64 : u32; + v382 = hir.bitcast v373 : u32; + v384 = arith.add v382, v740 : u32 #[overflow = checked]; + v739 = arith.constant 8 : u32; + v386 = arith.mod v384, v739 : u32; + hir.assertz v386 #[code = 250]; + v387 = hir.int_to_ptr v384 : ptr; + hir.store v387, v381; + v388 = hir.load_local : i32 #[local = lv2]; + v605 = arith.constant 120 : u32; + v390 = hir.bitcast v388 : u32; + v392 = arith.add v390, v605 : u32 #[overflow = checked]; + v738 = arith.constant 4 : u32; + v394 = arith.mod v392, v738 : u32; + hir.assertz v394 #[code = 250]; + v737 = arith.constant 17179869216 : i64; + v395 = hir.int_to_ptr v392 : ptr; + hir.store v395, v737; + v396 = hir.load_local : i32 #[local = lv2]; + v604 = arith.constant 112 : u32; + v398 = hir.bitcast v396 : u32; + v400 = arith.add v398, v604 : u32 #[overflow = checked]; + v736 = arith.constant 4 : u32; + v402 = arith.mod v400, v736 : u32; + hir.assertz v402 #[code = 250]; + v735 = arith.constant 0 : i32; + v403 = hir.int_to_ptr v400 : ptr; + hir.store v403, v735; + v404 = hir.load_local : i32 #[local = lv2]; + v603 = arith.constant 108 : u32; + v408 = hir.bitcast v404 : u32; + v410 = arith.add v408, v603 : u32 #[overflow = checked]; + v734 = arith.constant 4 : u32; + v412 = arith.mod v410, v734 : u32; + hir.assertz v412 #[code = 250]; + v733 = arith.constant 96 : i32; + v407 = arith.add v404, v733 : i32 #[overflow = wrapping]; + v413 = hir.int_to_ptr v410 : ptr; + hir.store v413, v407; + v414 = hir.load_local : i32 #[local = lv2]; + v602 = arith.constant 116 : u32; + v418 = hir.bitcast v414 : u32; + v420 = arith.add v418, v602 : u32 #[overflow = checked]; + v732 = arith.constant 4 : u32; + v422 = arith.mod v420, v732 : u32; + hir.assertz v422 #[code = 250]; + v731 = arith.constant 64 : i32; + v417 = arith.add v414, v731 : i32 #[overflow = wrapping]; + v423 = hir.int_to_ptr v420 : ptr; + hir.store v423, v417; + scf.while { + ^block22: + v424 = hir.load_local : i32 #[local = lv2]; + v599 = arith.constant 108 : i32; + v429 = arith.add v424, v599 : i32 #[overflow = wrapping]; + v730 = arith.constant 16 : i32; + v426 = arith.add v424, v730 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/ as core::iter::traits::iterator::Iterator>::next(v426, v429) + v430 = hir.load_local : i32 #[local = lv2]; + v598 = arith.constant 16 : u32; + v431 = hir.bitcast v430 : u32; + v433 = arith.add v431, v598 : u32 #[overflow = checked]; + v729 = arith.constant 4 : u32; + v435 = arith.mod v433, v729 : u32; + hir.assertz v435 #[code = 250]; + v436 = hir.int_to_ptr v433 : ptr; + v437 = hir.load v436 : i32; + hir.store_local v437 #[local = lv1]; + v727 = arith.constant 0 : i32; + v728 = arith.constant 0 : i32; + v439 = arith.eq v437, v728 : i1; + v440 = arith.zext v439 : u32; + v441 = hir.bitcast v440 : i32; + v443 = arith.neq v441, v727 : i1; + scf.if v443{ + ^block56: scf.yield ; } else { ^block24: - v383 = arith.constant 20 : u32; - v382 = hir.bitcast v643 : u32; - v384 = arith.add v382, v383 : u32 #[overflow = checked]; - v688 = arith.constant 4 : u32; - v386 = arith.mod v384, v688 : u32; - hir.assertz v386 #[code = 250]; - v387 = hir.int_to_ptr v384 : ptr; - v388 = hir.load v387 : i32; - hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/<[u8]>::reverse(v375, v388) + v444 = hir.load_local : i32 #[local = lv1]; + v445 = hir.load_local : i32 #[local = lv2]; + v597 = arith.constant 20 : u32; + v446 = hir.bitcast v445 : u32; + v448 = arith.add v446, v597 : u32 #[overflow = checked]; + v726 = arith.constant 4 : u32; + v450 = arith.mod v448, v726 : u32; + hir.assertz v450 #[code = 250]; + v451 = hir.int_to_ptr v448 : ptr; + v452 = hir.load v451 : i32; + hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/<[u8]>::reverse(v444, v452) scf.yield ; }; - v683 = ub.poison i32 : i32; - v634 = cf.select v381, v683, v645 : i32; - v684 = ub.poison i32 : i32; - v633 = cf.select v381, v684, v644 : i32; - v685 = ub.poison i32 : i32; - v632 = cf.select v381, v685, v643 : i32; - v686 = arith.constant 1 : u32; - v687 = arith.constant 0 : u32; - v636 = cf.select v381, v687, v686 : u32; - v582 = arith.trunc v636 : i1; - scf.condition v582, v632, v633, v634, v643, v644, v645; + v724 = arith.constant 1 : u32; + v725 = arith.constant 0 : u32; + v710 = cf.select v443, v725, v724 : u32; + v701 = arith.trunc v710 : i1; + scf.condition v701; } do { - ^block57(v646: i32, v647: i32, v648: i32, v649: i32, v650: i32, v651: i32): - scf.yield v646, v647, v648; + ^block49: + scf.yield ; }; - v682 = arith.constant 64 : u32; - v391 = hir.bitcast v640 : u32; - v393 = arith.add v391, v682 : u32 #[overflow = checked]; - v681 = arith.constant 8 : u32; - v395 = arith.mod v393, v681 : u32; - hir.assertz v395 #[code = 250]; - v396 = hir.int_to_ptr v393 : ptr; - v397 = hir.load v396 : i64; - v398 = hir.bitcast v641 : u32; - v399 = hir.int_to_ptr v398 : ptr; - hir.store v399, v397; - v680 = arith.constant 88 : u32; - v402 = hir.bitcast v640 : u32; - v404 = arith.add v402, v680 : u32 #[overflow = checked]; - v679 = arith.constant 8 : u32; - v406 = arith.mod v404, v679 : u32; - hir.assertz v406 #[code = 250]; - v407 = hir.int_to_ptr v404 : ptr; - v408 = hir.load v407 : i64; - v678 = arith.constant 24 : i32; - v401 = arith.add v641, v678 : i32 #[overflow = wrapping]; - v409 = hir.bitcast v401 : u32; - v410 = hir.int_to_ptr v409 : ptr; - hir.store v410, v408; - v677 = arith.constant 80 : u32; - v413 = hir.bitcast v640 : u32; - v415 = arith.add v413, v677 : u32 #[overflow = checked]; - v676 = arith.constant 8 : u32; - v417 = arith.mod v415, v676 : u32; - hir.assertz v417 #[code = 250]; - v418 = hir.int_to_ptr v415 : ptr; - v419 = hir.load v418 : i64; - v675 = arith.constant 16 : i32; - v412 = arith.add v641, v675 : i32 #[overflow = wrapping]; - v420 = hir.bitcast v412 : u32; - v421 = hir.int_to_ptr v420 : ptr; - hir.store v421, v419; - v674 = arith.constant 72 : u32; - v424 = hir.bitcast v640 : u32; - v426 = arith.add v424, v674 : u32 #[overflow = checked]; - v673 = arith.constant 8 : u32; - v428 = arith.mod v426, v673 : u32; - hir.assertz v428 #[code = 250]; - v429 = hir.int_to_ptr v426 : ptr; - v430 = hir.load v429 : i64; - v672 = arith.constant 8 : i32; - v423 = arith.add v641, v672 : i32 #[overflow = wrapping]; - v431 = hir.bitcast v423 : u32; - v432 = hir.int_to_ptr v431 : ptr; - hir.store v432, v430; - v435 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/__stack_pointer : ptr - v436 = hir.bitcast v435 : ptr; - hir.store v436, v642; + v453 = hir.load_local : i32 #[local = lv0]; + v454 = hir.load_local : i32 #[local = lv2]; + v723 = arith.constant 64 : u32; + v455 = hir.bitcast v454 : u32; + v457 = arith.add v455, v723 : u32 #[overflow = checked]; + v722 = arith.constant 8 : u32; + v459 = arith.mod v457, v722 : u32; + hir.assertz v459 #[code = 250]; + v460 = hir.int_to_ptr v457 : ptr; + v461 = hir.load v460 : i64; + v462 = hir.bitcast v453 : u32; + v463 = hir.int_to_ptr v462 : ptr; + hir.store v463, v461; + v464 = hir.load_local : i32 #[local = lv0]; + v467 = hir.load_local : i32 #[local = lv2]; + v721 = arith.constant 88 : u32; + v468 = hir.bitcast v467 : u32; + v470 = arith.add v468, v721 : u32 #[overflow = checked]; + v720 = arith.constant 8 : u32; + v472 = arith.mod v470, v720 : u32; + hir.assertz v472 #[code = 250]; + v473 = hir.int_to_ptr v470 : ptr; + v474 = hir.load v473 : i64; + v719 = arith.constant 24 : i32; + v466 = arith.add v464, v719 : i32 #[overflow = wrapping]; + v475 = hir.bitcast v466 : u32; + v476 = hir.int_to_ptr v475 : ptr; + hir.store v476, v474; + v477 = hir.load_local : i32 #[local = lv0]; + v480 = hir.load_local : i32 #[local = lv2]; + v718 = arith.constant 80 : u32; + v481 = hir.bitcast v480 : u32; + v483 = arith.add v481, v718 : u32 #[overflow = checked]; + v717 = arith.constant 8 : u32; + v485 = arith.mod v483, v717 : u32; + hir.assertz v485 #[code = 250]; + v486 = hir.int_to_ptr v483 : ptr; + v487 = hir.load v486 : i64; + v716 = arith.constant 16 : i32; + v479 = arith.add v477, v716 : i32 #[overflow = wrapping]; + v488 = hir.bitcast v479 : u32; + v489 = hir.int_to_ptr v488 : ptr; + hir.store v489, v487; + v490 = hir.load_local : i32 #[local = lv0]; + v493 = hir.load_local : i32 #[local = lv2]; + v715 = arith.constant 72 : u32; + v494 = hir.bitcast v493 : u32; + v496 = arith.add v494, v715 : u32 #[overflow = checked]; + v714 = arith.constant 8 : u32; + v498 = arith.mod v496, v714 : u32; + hir.assertz v498 #[code = 250]; + v499 = hir.int_to_ptr v496 : ptr; + v500 = hir.load v499 : i64; + v713 = arith.constant 8 : i32; + v492 = arith.add v490, v713 : i32 #[overflow = wrapping]; + v501 = hir.bitcast v492 : u32; + v502 = hir.int_to_ptr v501 : ptr; + hir.store v502, v500; + v503 = hir.load_local : i32 #[local = lv3]; + v504 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/__stack_pointer : ptr + v505 = hir.bitcast v504 : ptr; + hir.store v505, v503; builtin.ret ; }; - private builtin.function @std::crypto::hashes::sha256::hash_1to1(v437: i32, v438: i32, v439: i32, v440: i32, v441: i32, v442: i32, v443: i32, v444: i32, v445: i32) { - ^block25(v437: i32, v438: i32, v439: i32, v440: i32, v441: i32, v442: i32, v443: i32, v444: i32, v445: i32): - v446, v447, v448, v449, v450, v451, v452, v453 = hir.exec @std/crypto/hashes/sha256/hash_1to1(v437, v438, v439, v440, v441, v442, v443, v444) : i32, i32, i32, i32, i32, i32, i32, i32 - v454 = hir.bitcast v445 : u32; - v455 = hir.int_to_ptr v454 : ptr; - hir.store v455, v446; - v456 = arith.constant 4 : u32; - v457 = arith.add v454, v456 : u32 #[overflow = checked]; - v458 = hir.int_to_ptr v457 : ptr; - hir.store v458, v447; - v459 = arith.constant 8 : u32; - v460 = arith.add v454, v459 : u32 #[overflow = checked]; - v461 = hir.int_to_ptr v460 : ptr; - hir.store v461, v448; - v462 = arith.constant 12 : u32; - v463 = arith.add v454, v462 : u32 #[overflow = checked]; - v464 = hir.int_to_ptr v463 : ptr; - hir.store v464, v449; - v465 = arith.constant 16 : u32; - v466 = arith.add v454, v465 : u32 #[overflow = checked]; - v467 = hir.int_to_ptr v466 : ptr; - hir.store v467, v450; - v468 = arith.constant 20 : u32; - v469 = arith.add v454, v468 : u32 #[overflow = checked]; - v470 = hir.int_to_ptr v469 : ptr; - hir.store v470, v451; - v471 = arith.constant 24 : u32; - v472 = arith.add v454, v471 : u32 #[overflow = checked]; - v473 = hir.int_to_ptr v472 : ptr; - hir.store v473, v452; - v474 = arith.constant 28 : u32; - v475 = arith.add v454, v474 : u32 #[overflow = checked]; - v476 = hir.int_to_ptr v475 : ptr; - hir.store v476, v453; + private builtin.function @miden::core::crypto::hashes::sha256::hash(v506: i32, v507: i32, v508: i32, v509: i32, v510: i32, v511: i32, v512: i32, v513: i32, v514: i32) { + ^block25(v506: i32, v507: i32, v508: i32, v509: i32, v510: i32, v511: i32, v512: i32, v513: i32, v514: i32): + v515, v516, v517, v518, v519, v520, v521, v522 = hir.exec @miden/core/crypto/hashes/sha256/hash(v506, v507, v508, v509, v510, v511, v512, v513) : i32, i32, i32, i32, i32, i32, i32, i32 + v523 = hir.bitcast v514 : u32; + v524 = hir.int_to_ptr v523 : ptr; + hir.store v524, v515; + v786 = arith.constant 4 : u32; + v526 = arith.add v523, v786 : u32 #[overflow = checked]; + v527 = hir.int_to_ptr v526 : ptr; + hir.store v527, v516; + v785 = arith.constant 8 : u32; + v529 = arith.add v523, v785 : u32 #[overflow = checked]; + v530 = hir.int_to_ptr v529 : ptr; + hir.store v530, v517; + v784 = arith.constant 12 : u32; + v532 = arith.add v523, v784 : u32 #[overflow = checked]; + v533 = hir.int_to_ptr v532 : ptr; + hir.store v533, v518; + v783 = arith.constant 16 : u32; + v535 = arith.add v523, v783 : u32 #[overflow = checked]; + v536 = hir.int_to_ptr v535 : ptr; + hir.store v536, v519; + v782 = arith.constant 20 : u32; + v538 = arith.add v523, v782 : u32 #[overflow = checked]; + v539 = hir.int_to_ptr v538 : ptr; + hir.store v539, v520; + v781 = arith.constant 24 : u32; + v541 = arith.add v523, v781 : u32 #[overflow = checked]; + v542 = hir.int_to_ptr v541 : ptr; + hir.store v542, v521; + v780 = arith.constant 28 : u32; + v544 = arith.add v523, v780 : u32 #[overflow = checked]; + v545 = hir.int_to_ptr v544 : ptr; + hir.store v545, v522; builtin.ret ; }; diff --git a/tests/integration/expected/rust_sdk_stdlib_sha256_hash.masm b/tests/integration/expected/rust_sdk_stdlib_sha256_hash.masm index 90430e448..0caa74aca 100644 --- a/tests/integration/expected/rust_sdk_stdlib_sha256_hash.masm +++ b/tests/integration/expected/rust_sdk_stdlib_sha256_hash.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,43 +10,105 @@ proc init mem_store.278528 end -# mod root_ns:root@1.0.0::rust_sdk_stdlib_sha256_hash +# mod ::"root_ns:root@1.0.0"::rust_sdk_stdlib_sha256_hash +@locals("4") @callconv("C") proc <[u8]>::reverse( i32, i32 ) - push.4294967295 - dup.2 - dup.2 - u32wrapping_add - u32wrapping_add + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.1 - movup.3 + swap.1 swap.1 u32shr - movup.2 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4294967295 + movdn.2 + u32wrapping_add + u32wrapping_add + locaddr.1 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1 while.true + locaddr.2 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 - dup.2 + push.0 + movup.2 eq neq dup.0 if.true - movdn.3 - drop - drop - drop - push.3735929054 - dup.0 - dup.1 - swap.2 + nop else - dup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop u32divmod.4 swap.1 swap.1 @@ -60,7 +122,22 @@ proc <[u8]>::reverse( drop push.255 u32and - dup.4 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop u32divmod.4 swap.1 swap.1 @@ -76,7 +153,7 @@ proc <[u8]>::reverse( u32and push.255 u32and - dup.4 + swap.1 u32divmod.4 swap.1 dup.0 @@ -98,9 +175,18 @@ proc <[u8]>::reverse( u32or swap.1 mem_store + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 push.255 u32and - dup.4 + swap.1 u32divmod.4 swap.1 dup.0 @@ -122,19 +208,64 @@ proc <[u8]>::reverse( u32or swap.1 mem_store + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4294967295 - movup.4 u32wrapping_add + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.1 - movup.4 u32wrapping_add + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4294967295 - movup.4 u32wrapping_add + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end push.1 push.0 - movup.5 + movup.2 cdrop push.1 u32and @@ -144,18 +275,40 @@ proc <[u8]>::reverse( push.0 end end - drop - drop - drop end +@locals("6") @callconv("C") proc as core::iter::traits::iterator::Iterator>::next( i32, i32 ) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - dup.2 + swap.1 add u32assert push.4 @@ -171,8 +324,33 @@ proc as core::iter::traits::iterator::Ite exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.3 + swap.1 add u32assert push.4 @@ -188,20 +366,33 @@ proc as core::iter::traits::iterator::Ite exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 push.0 - dup.2 + movup.2 eq neq if.true - movup.3 - swap.1 - drop - drop - push.0 + nop else + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.4 + swap.1 add u32assert push.4 @@ -217,21 +408,58 @@ proc as core::iter::traits::iterator::Ite exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 - dup.3 - dup.2 + swap.1 + movup.2 swap.1 u32lt neq - dup.0 if.true - movup.5 - movup.2 - drop - drop + nop else + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.6 + movup.3 add u32assert push.4 @@ -240,8 +468,7 @@ proc as core::iter::traits::iterator::Ite u32mod u32assert assertz - movup.2 - dup.4 + movdn.2 u32wrapping_sub swap.1 u32divmod.4 @@ -251,8 +478,32 @@ proc as core::iter::traits::iterator::Ite exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - movup.5 + movup.3 add u32assert push.4 @@ -261,8 +512,7 @@ proc as core::iter::traits::iterator::Ite u32mod u32assert assertz - dup.2 - dup.4 + movdn.2 u32wrapping_add swap.1 u32divmod.4 @@ -272,13 +522,42 @@ proc as core::iter::traits::iterator::Ite exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.0 - swap.1 - cdrop end + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.3 + movup.2 add u32assert push.4 @@ -287,8 +566,6 @@ proc as core::iter::traits::iterator::Ite u32mod u32assert assertz - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -296,6 +573,22 @@ proc as core::iter::traits::iterator::Ite exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop swap.1 push.4 dup.1 @@ -312,8 +605,25 @@ proc as core::iter::traits::iterator::Ite nop end +@locals("4") @callconv("C") pub proc entrypoint(i32, i32) + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114112 u32divmod.4 swap.1 @@ -322,15 +632,47 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4294967264 push.128 - dup.2 + movup.2 swap.1 u32wrapping_sub u32and - push.1114112 - dup.1 + dup.0 + locaddr.2 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114112 u32divmod.4 swap.1 trace.240 @@ -338,8 +680,23 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.24 - dup.4 u32wrapping_add u32divmod.4 swap.1 @@ -351,7 +708,7 @@ pub proc entrypoint(i32, i32) swap.1 push.24 push.64 - dup.4 + movup.4 u32wrapping_add u32wrapping_add push.8 @@ -369,8 +726,23 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - dup.4 u32wrapping_add u32divmod.4 swap.1 @@ -382,7 +754,7 @@ pub proc entrypoint(i32, i32) swap.1 push.16 push.64 - dup.4 + movup.4 u32wrapping_add u32wrapping_add push.8 @@ -400,8 +772,23 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.4 u32wrapping_add u32divmod.4 swap.1 @@ -413,7 +800,7 @@ pub proc entrypoint(i32, i32) swap.1 push.8 push.64 - dup.4 + movup.4 u32wrapping_add u32wrapping_add push.8 @@ -431,7 +818,22 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop - movup.3 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop u32divmod.4 swap.1 trace.240 @@ -441,7 +843,7 @@ pub proc entrypoint(i32, i32) nop swap.1 push.64 - dup.3 + movup.3 add u32assert push.8 @@ -459,8 +861,16 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.44 - dup.1 + swap.1 add u32assert push.4 @@ -481,8 +891,16 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.36 - dup.1 + swap.1 add u32assert push.4 @@ -500,6 +918,14 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.32 dup.1 add @@ -511,7 +937,7 @@ pub proc entrypoint(i32, i32) u32assert assertz push.96 - dup.2 + movup.2 u32wrapping_add swap.1 u32divmod.4 @@ -521,6 +947,14 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.40 dup.1 add @@ -532,7 +966,7 @@ pub proc entrypoint(i32, i32) u32assert assertz push.64 - dup.2 + movup.2 u32wrapping_add swap.1 u32divmod.4 @@ -542,23 +976,37 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_sw trace.252 nop - movup.2 - swap.1 push.1 while.true + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.32 dup.1 u32wrapping_add push.24 - dup.2 + movup.2 u32wrapping_add trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_sha256_hash:: as core::iter::traits::iterator::Iterator>::next + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_sha256_hash:: as core::iter::traits::iterator::Iterator>::next + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.24 - dup.1 + swap.1 add u32assert push.4 @@ -574,18 +1022,42 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 push.0 - dup.2 + movup.2 eq neq dup.0 if.true - swap.1 - drop + nop else + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.28 - dup.3 + swap.1 add u32assert push.4 @@ -601,54 +1073,35 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop - movup.2 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_sha256_hash::<[u8]>::reverse + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_sha256_hash::<[u8]>::reverse trace.252 nop end - push.3735929054 - dup.1 - dup.5 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.2 - dup.5 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.3 - dup.5 - swap.2 - swap.1 - cdrop push.1 push.0 - movup.5 + movup.2 cdrop push.1 u32and if.true - movup.3 - drop - movup.3 - drop - movup.3 - drop push.1 else push.0 end end - drop - drop - drop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.64 - dup.1 + swap.1 add u32assert push.4 @@ -664,8 +1117,16 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.68 - dup.2 + swap.1 add u32assert push.4 @@ -681,8 +1142,16 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.72 - dup.3 + swap.1 add u32assert push.4 @@ -698,8 +1167,16 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.76 - dup.4 + swap.1 add u32assert push.4 @@ -715,8 +1192,16 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.80 - dup.5 + swap.1 add u32assert push.4 @@ -732,8 +1217,16 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.84 - dup.6 + swap.1 add u32assert push.4 @@ -749,8 +1242,16 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.88 - dup.7 + swap.1 add u32assert push.4 @@ -766,8 +1267,16 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.92 - dup.8 + swap.1 add u32assert push.4 @@ -783,8 +1292,15 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.32 - dup.9 u32wrapping_add movup.3 swap.5 @@ -798,7 +1314,15 @@ pub proc entrypoint(i32, i32) swap.8 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_sha256_hash::std::crypto::hashes::sha256::hash_1to1 + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_sha256_hash::"miden::core::crypto::hashes::sha256::hash" + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.56 @@ -820,7 +1344,7 @@ pub proc entrypoint(i32, i32) nop swap.1 push.88 - dup.3 + movup.3 add u32assert push.8 @@ -838,6 +1362,14 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.48 dup.1 add @@ -857,7 +1389,7 @@ pub proc entrypoint(i32, i32) nop swap.1 push.80 - dup.3 + movup.3 add u32assert push.8 @@ -875,6 +1407,14 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.40 dup.1 add @@ -894,7 +1434,7 @@ pub proc entrypoint(i32, i32) nop swap.1 push.72 - dup.3 + movup.3 add u32assert push.8 @@ -912,6 +1452,14 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.32 dup.1 add @@ -931,7 +1479,7 @@ pub proc entrypoint(i32, i32) nop swap.1 push.64 - dup.3 + movup.3 add u32assert push.8 @@ -949,8 +1497,16 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.120 - dup.1 + swap.1 add u32assert push.4 @@ -971,8 +1527,16 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.112 - dup.1 + swap.1 add u32assert push.4 @@ -990,6 +1554,14 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.108 dup.1 add @@ -1001,7 +1573,7 @@ pub proc entrypoint(i32, i32) u32assert assertz push.96 - dup.2 + movup.2 u32wrapping_add swap.1 u32divmod.4 @@ -1011,6 +1583,14 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.116 dup.1 add @@ -1022,7 +1602,7 @@ pub proc entrypoint(i32, i32) u32assert assertz push.64 - dup.2 + movup.2 u32wrapping_add swap.1 u32divmod.4 @@ -1034,19 +1614,35 @@ pub proc entrypoint(i32, i32) nop push.1 while.true + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.108 dup.1 u32wrapping_add push.16 - dup.2 + movup.2 u32wrapping_add trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_sha256_hash:: as core::iter::traits::iterator::Iterator>::next + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_sha256_hash:: as core::iter::traits::iterator::Iterator>::next + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.16 - dup.1 + swap.1 add u32assert push.4 @@ -1062,18 +1658,42 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 push.0 - dup.2 + movup.2 eq neq dup.0 if.true - swap.1 - drop + nop else + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.20 - dup.3 + swap.1 add u32assert push.4 @@ -1089,54 +1709,43 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop - movup.2 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_sha256_hash::<[u8]>::reverse + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_sha256_hash::<[u8]>::reverse trace.252 nop end - push.3735929054 - dup.1 - dup.5 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.2 - dup.5 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.3 - dup.5 - swap.2 - swap.1 - cdrop push.1 push.0 - movup.5 + movup.2 cdrop push.1 u32and if.true - movup.3 - drop - movup.3 - drop - movup.3 - drop push.1 else push.0 end end - drop - drop - drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.64 - dup.1 + swap.1 add u32assert push.8 @@ -1153,7 +1762,7 @@ pub proc entrypoint(i32, i32) trace.252 nop swap.1 - dup.3 + movup.2 u32divmod.4 swap.1 movup.2 @@ -1163,8 +1772,24 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.88 - dup.1 + swap.1 add u32assert push.8 @@ -1182,7 +1807,7 @@ pub proc entrypoint(i32, i32) nop swap.1 push.24 - dup.4 + movup.3 u32wrapping_add u32divmod.4 swap.1 @@ -1193,8 +1818,24 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.80 - dup.1 + swap.1 add u32assert push.8 @@ -1212,7 +1853,7 @@ pub proc entrypoint(i32, i32) nop swap.1 push.16 - dup.4 + movup.3 u32wrapping_add u32divmod.4 swap.1 @@ -1223,6 +1864,22 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.72 swap.1 add @@ -1253,6 +1910,14 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.1114112 u32divmod.4 swap.1 @@ -1264,7 +1929,7 @@ pub proc entrypoint(i32, i32) end @callconv("C") -proc std::crypto::hashes::sha256::hash_1to1( +proc miden::core::crypto::hashes::sha256::hash( i32, i32, i32, @@ -1277,7 +1942,7 @@ proc std::crypto::hashes::sha256::hash_1to1( ) trace.240 nop - exec.::std::crypto::hashes::sha256::hash_1to1 + exec.::miden::core::crypto::hashes::sha256::hash trace.252 nop movup.8 diff --git a/tests/integration/expected/rust_sdk_stdlib_sha256_hash.wat b/tests/integration/expected/rust_sdk_stdlib_sha256_hash.wat index 10c5962e1..2dba911f0 100644 --- a/tests/integration/expected/rust_sdk_stdlib_sha256_hash.wat +++ b/tests/integration/expected/rust_sdk_stdlib_sha256_hash.wat @@ -190,7 +190,7 @@ local.get 2 i32.const 32 i32.add - call $std::crypto::hashes::sha256::hash_1to1 + call $miden::core::crypto::hashes::sha256::hash local.get 2 local.get 2 i64.load offset=56 @@ -269,7 +269,7 @@ local.get 3 global.set $__stack_pointer ) - (func $std::crypto::hashes::sha256::hash_1to1 (;3;) (type 1) (param i32 i32 i32 i32 i32 i32 i32 i32 i32) + (func $miden::core::crypto::hashes::sha256::hash (;3;) (type 1) (param i32 i32 i32 i32 i32 i32 i32 i32 i32) unreachable ) ) diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_get.hir b/tests/integration/expected/rust_sdk_stdlib_smt_get.hir index c375d59cc..0a92e4254 100644 --- a/tests/integration/expected/rust_sdk_stdlib_smt_get.hir +++ b/tests/integration/expected/rust_sdk_stdlib_smt_get.hir @@ -2,538 +2,420 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @rust_sdk_stdlib_smt_get { private builtin.function @::eq(v0: i32, v1: i32) -> i32 { ^block4(v0: i32, v1: i32): - v5 = hir.bitcast v0 : u32; - v6 = arith.constant 4 : u32; - v7 = arith.mod v5, v6 : u32; + hir.store_local v0 #[local = lv0]; + hir.store_local v1 #[local = lv1]; + v343 = arith.constant 0 : i32; + hir.store_local v343 #[local = lv2]; + v4 = hir.load_local : i32 #[local = lv0]; + v5 = hir.bitcast v4 : u32; + v342 = arith.constant 4 : u32; + v7 = arith.mod v5, v342 : u32; hir.assertz v7 #[code = 250]; v8 = hir.int_to_ptr v5 : ptr; v9 = hir.load v8 : felt; - v10 = hir.bitcast v1 : u32; - v432 = arith.constant 4 : u32; - v12 = arith.mod v10, v432 : u32; - hir.assertz v12 #[code = 250]; - v13 = hir.int_to_ptr v10 : ptr; - v14 = hir.load v13 : felt; - v15 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/intrinsics::felt::eq(v9, v14) : i32 - v3 = arith.constant 0 : i32; - v16 = arith.constant 1 : i32; - v17 = arith.neq v15, v16 : i1; - v18 = arith.zext v17 : u32; - v19 = hir.bitcast v18 : i32; - v21 = arith.neq v19, v3 : i1; - v410 = scf.if v21 : i32 { - ^block6: - v431 = arith.constant 0 : i32; - scf.yield v431; + v10 = hir.load_local : i32 #[local = lv1]; + v11 = hir.bitcast v10 : u32; + v379 = arith.constant 4 : u32; + v13 = arith.mod v11, v379 : u32; + hir.assertz v13 #[code = 250]; + v14 = hir.int_to_ptr v11 : ptr; + v15 = hir.load v14 : felt; + v378 = arith.constant 0 : i32; + v341 = arith.constant 1 : i32; + v16 = arith.eq v9, v15 : i1; + v17 = hir.cast v16 : i32; + v19 = arith.neq v17, v341 : i1; + v20 = arith.zext v19 : u32; + v21 = hir.bitcast v20 : i32; + v23 = arith.neq v21, v378 : i1; + scf.if v23{ + ^block23: + scf.yield ; } else { ^block7: - v430 = arith.constant 4 : u32; - v22 = hir.bitcast v0 : u32; - v24 = arith.add v22, v430 : u32 #[overflow = checked]; - v429 = arith.constant 4 : u32; - v26 = arith.mod v24, v429 : u32; - hir.assertz v26 #[code = 250]; - v27 = hir.int_to_ptr v24 : ptr; - v28 = hir.load v27 : felt; - v428 = arith.constant 4 : u32; - v29 = hir.bitcast v1 : u32; - v31 = arith.add v29, v428 : u32 #[overflow = checked]; - v427 = arith.constant 4 : u32; - v33 = arith.mod v31, v427 : u32; - hir.assertz v33 #[code = 250]; - v34 = hir.int_to_ptr v31 : ptr; - v35 = hir.load v34 : felt; - v36 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/intrinsics::felt::eq(v28, v35) : i32 - v425 = arith.constant 0 : i32; - v426 = arith.constant 1 : i32; - v38 = arith.neq v36, v426 : i1; - v39 = arith.zext v38 : u32; - v40 = hir.bitcast v39 : i32; - v42 = arith.neq v40, v425 : i1; - v412 = scf.if v42 : i32 { - ^block31: - v424 = arith.constant 0 : i32; - scf.yield v424; + v24 = hir.load_local : i32 #[local = lv0]; + v377 = arith.constant 4 : u32; + v25 = hir.bitcast v24 : u32; + v27 = arith.add v25, v377 : u32 #[overflow = checked]; + v376 = arith.constant 4 : u32; + v29 = arith.mod v27, v376 : u32; + hir.assertz v29 #[code = 250]; + v30 = hir.int_to_ptr v27 : ptr; + v31 = hir.load v30 : felt; + v32 = hir.load_local : i32 #[local = lv1]; + v375 = arith.constant 4 : u32; + v33 = hir.bitcast v32 : u32; + v35 = arith.add v33, v375 : u32 #[overflow = checked]; + v374 = arith.constant 4 : u32; + v37 = arith.mod v35, v374 : u32; + hir.assertz v37 #[code = 250]; + v38 = hir.int_to_ptr v35 : ptr; + v39 = hir.load v38 : felt; + v372 = arith.constant 0 : i32; + v373 = arith.constant 1 : i32; + v40 = arith.eq v31, v39 : i1; + v41 = hir.cast v40 : i32; + v43 = arith.neq v41, v373 : i1; + v44 = arith.zext v43 : u32; + v45 = hir.bitcast v44 : i32; + v47 = arith.neq v45, v372 : i1; + scf.if v47{ + ^block22: + scf.yield ; } else { ^block8: - v44 = arith.constant 8 : u32; - v43 = hir.bitcast v0 : u32; - v45 = arith.add v43, v44 : u32 #[overflow = checked]; - v423 = arith.constant 4 : u32; - v47 = arith.mod v45, v423 : u32; - hir.assertz v47 #[code = 250]; - v48 = hir.int_to_ptr v45 : ptr; - v49 = hir.load v48 : felt; - v422 = arith.constant 8 : u32; - v50 = hir.bitcast v1 : u32; - v52 = arith.add v50, v422 : u32 #[overflow = checked]; - v421 = arith.constant 4 : u32; - v54 = arith.mod v52, v421 : u32; - hir.assertz v54 #[code = 250]; - v55 = hir.int_to_ptr v52 : ptr; - v56 = hir.load v55 : felt; - v57 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/intrinsics::felt::eq(v49, v56) : i32 - v419 = arith.constant 0 : i32; - v420 = arith.constant 1 : i32; - v59 = arith.neq v57, v420 : i1; - v60 = arith.zext v59 : u32; - v61 = hir.bitcast v60 : i32; - v63 = arith.neq v61, v419 : i1; - v413 = scf.if v63 : i32 { - ^block30: - v418 = arith.constant 0 : i32; - scf.yield v418; + v48 = hir.load_local : i32 #[local = lv0]; + v340 = arith.constant 8 : u32; + v49 = hir.bitcast v48 : u32; + v51 = arith.add v49, v340 : u32 #[overflow = checked]; + v371 = arith.constant 4 : u32; + v53 = arith.mod v51, v371 : u32; + hir.assertz v53 #[code = 250]; + v54 = hir.int_to_ptr v51 : ptr; + v55 = hir.load v54 : felt; + v56 = hir.load_local : i32 #[local = lv1]; + v370 = arith.constant 8 : u32; + v57 = hir.bitcast v56 : u32; + v59 = arith.add v57, v370 : u32 #[overflow = checked]; + v369 = arith.constant 4 : u32; + v61 = arith.mod v59, v369 : u32; + hir.assertz v61 #[code = 250]; + v62 = hir.int_to_ptr v59 : ptr; + v63 = hir.load v62 : felt; + v367 = arith.constant 0 : i32; + v368 = arith.constant 1 : i32; + v64 = arith.eq v55, v63 : i1; + v65 = hir.cast v64 : i32; + v67 = arith.neq v65, v368 : i1; + v68 = arith.zext v67 : u32; + v69 = hir.bitcast v68 : i32; + v71 = arith.neq v69, v367 : i1; + scf.if v71{ + ^block21: + scf.yield ; } else { ^block9: - v65 = arith.constant 12 : u32; - v64 = hir.bitcast v0 : u32; - v66 = arith.add v64, v65 : u32 #[overflow = checked]; - v417 = arith.constant 4 : u32; - v68 = arith.mod v66, v417 : u32; - hir.assertz v68 #[code = 250]; - v69 = hir.int_to_ptr v66 : ptr; - v70 = hir.load v69 : felt; - v416 = arith.constant 12 : u32; - v71 = hir.bitcast v1 : u32; - v73 = arith.add v71, v416 : u32 #[overflow = checked]; - v415 = arith.constant 4 : u32; - v75 = arith.mod v73, v415 : u32; - hir.assertz v75 #[code = 250]; - v76 = hir.int_to_ptr v73 : ptr; - v77 = hir.load v76 : felt; - v78 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/intrinsics::felt::eq(v70, v77) : i32 - v414 = arith.constant 1 : i32; - v80 = arith.eq v78, v414 : i1; - v81 = arith.zext v80 : u32; - v82 = hir.bitcast v81 : i32; - scf.yield v82; + v72 = hir.load_local : i32 #[local = lv0]; + v339 = arith.constant 12 : u32; + v73 = hir.bitcast v72 : u32; + v75 = arith.add v73, v339 : u32 #[overflow = checked]; + v366 = arith.constant 4 : u32; + v77 = arith.mod v75, v366 : u32; + hir.assertz v77 #[code = 250]; + v78 = hir.int_to_ptr v75 : ptr; + v79 = hir.load v78 : felt; + v80 = hir.load_local : i32 #[local = lv1]; + v365 = arith.constant 12 : u32; + v81 = hir.bitcast v80 : u32; + v83 = arith.add v81, v365 : u32 #[overflow = checked]; + v364 = arith.constant 4 : u32; + v85 = arith.mod v83, v364 : u32; + hir.assertz v85 #[code = 250]; + v86 = hir.int_to_ptr v83 : ptr; + v87 = hir.load v86 : felt; + v363 = arith.constant 1 : i32; + v88 = arith.eq v79, v87 : i1; + v89 = hir.cast v88 : i32; + v91 = arith.eq v89, v363 : i1; + v92 = arith.zext v91 : u32; + v93 = hir.bitcast v92 : i32; + hir.store_local v93 #[local = lv2]; + scf.yield ; }; - scf.yield v413; + scf.yield ; }; - scf.yield v412; + scf.yield ; }; - builtin.ret v410; + v94 = hir.load_local : i32 #[local = lv2]; + builtin.ret v94; }; - public builtin.function @entrypoint(v84: felt, v85: felt, v86: felt, v87: felt, v88: felt, v89: felt, v90: felt, v91: felt) { - ^block10(v84: felt, v85: felt, v86: felt, v87: felt, v88: felt, v89: felt, v90: felt, v91: felt): - v93 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/__stack_pointer : ptr - v94 = hir.bitcast v93 : ptr; - v95 = hir.load v94 : i32; - v98 = arith.constant -32 : i32; - v96 = arith.constant 160 : i32; - v97 = arith.sub v95, v96 : i32 #[overflow = wrapping]; - v99 = arith.band v97, v98 : i32; - v100 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/__stack_pointer : ptr - v101 = hir.bitcast v100 : ptr; - hir.store v101, v99; - v103 = arith.constant 28 : u32; - v102 = hir.bitcast v99 : u32; - v104 = arith.add v102, v103 : u32 #[overflow = checked]; - v105 = arith.constant 4 : u32; - v106 = arith.mod v104, v105 : u32; - hir.assertz v106 #[code = 250]; - v107 = hir.int_to_ptr v104 : ptr; - hir.store v107, v91; - v109 = arith.constant 24 : u32; - v108 = hir.bitcast v99 : u32; - v110 = arith.add v108, v109 : u32 #[overflow = checked]; + public builtin.function @entrypoint(v95: felt, v96: felt, v97: felt, v98: felt, v99: felt, v100: felt, v101: felt, v102: felt) { + ^block10(v95: felt, v96: felt, v97: felt, v98: felt, v99: felt, v100: felt, v101: felt, v102: felt): + hir.store_local v99 #[local = lv4]; + hir.store_local v100 #[local = lv5]; + hir.store_local v101 #[local = lv6]; + hir.store_local v102 #[local = lv7]; + v103 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/__stack_pointer : ptr + v104 = hir.bitcast v103 : ptr; + v105 = hir.load v104 : i32; + hir.store_local v105 #[local = lv8]; + hir.store_local v105 #[local = lv9]; + v106 = hir.load_local : i32 #[local = lv8]; + v417 = arith.constant -32 : i32; + v418 = arith.constant 96 : i32; + v108 = arith.sub v106, v418 : i32 #[overflow = wrapping]; + v110 = arith.band v108, v417 : i32; + hir.store_local v110 #[local = lv8]; + v111 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/__stack_pointer : ptr + v112 = hir.bitcast v111 : ptr; + hir.store v112, v110; + v113 = hir.load_local : i32 #[local = lv8]; + v114 = hir.load_local : felt #[local = lv7]; + v416 = arith.constant 28 : u32; + v115 = hir.bitcast v113 : u32; + v117 = arith.add v115, v416 : u32 #[overflow = checked]; + v415 = arith.constant 4 : u32; + v119 = arith.mod v117, v415 : u32; + hir.assertz v119 #[code = 250]; + v120 = hir.int_to_ptr v117 : ptr; + hir.store v120, v114; + v121 = hir.load_local : i32 #[local = lv8]; + v122 = hir.load_local : felt #[local = lv6]; + v414 = arith.constant 24 : u32; + v123 = hir.bitcast v121 : u32; + v125 = arith.add v123, v414 : u32 #[overflow = checked]; + v469 = arith.constant 4 : u32; + v127 = arith.mod v125, v469 : u32; + hir.assertz v127 #[code = 250]; + v128 = hir.int_to_ptr v125 : ptr; + hir.store v128, v122; + v129 = hir.load_local : i32 #[local = lv8]; + v130 = hir.load_local : felt #[local = lv5]; + v413 = arith.constant 20 : u32; + v131 = hir.bitcast v129 : u32; + v133 = arith.add v131, v413 : u32 #[overflow = checked]; v468 = arith.constant 4 : u32; - v112 = arith.mod v110, v468 : u32; - hir.assertz v112 #[code = 250]; - v113 = hir.int_to_ptr v110 : ptr; - hir.store v113, v90; - v115 = arith.constant 20 : u32; - v114 = hir.bitcast v99 : u32; - v116 = arith.add v114, v115 : u32 #[overflow = checked]; + v135 = arith.mod v133, v468 : u32; + hir.assertz v135 #[code = 250]; + v136 = hir.int_to_ptr v133 : ptr; + hir.store v136, v130; + v137 = hir.load_local : i32 #[local = lv8]; + v138 = hir.load_local : felt #[local = lv4]; + v412 = arith.constant 16 : u32; + v139 = hir.bitcast v137 : u32; + v141 = arith.add v139, v412 : u32 #[overflow = checked]; v467 = arith.constant 4 : u32; - v118 = arith.mod v116, v467 : u32; - hir.assertz v118 #[code = 250]; - v119 = hir.int_to_ptr v116 : ptr; - hir.store v119, v89; - v121 = arith.constant 16 : u32; - v120 = hir.bitcast v99 : u32; - v122 = arith.add v120, v121 : u32 #[overflow = checked]; - v466 = arith.constant 4 : u32; - v124 = arith.mod v122, v466 : u32; - hir.assertz v124 #[code = 250]; - v125 = hir.int_to_ptr v122 : ptr; - hir.store v125, v88; - v126 = arith.constant 64 : i32; - v127 = arith.add v99, v126 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/std::collections::smt::get(v87, v86, v85, v84, v91, v90, v89, v88, v127) - v129 = arith.constant 72 : u32; - v128 = hir.bitcast v99 : u32; - v130 = arith.add v128, v129 : u32 #[overflow = checked]; - v131 = arith.constant 8 : u32; - v132 = arith.mod v130, v131 : u32; - hir.assertz v132 #[code = 250]; - v133 = hir.int_to_ptr v130 : ptr; - v134 = hir.load v133 : i64; - v136 = arith.constant 120 : u32; - v135 = hir.bitcast v99 : u32; - v137 = arith.add v135, v136 : u32 #[overflow = checked]; + v143 = arith.mod v141, v467 : u32; + hir.assertz v143 #[code = 250]; + v144 = hir.int_to_ptr v141 : ptr; + hir.store v144, v138; + v149 = hir.load_local : felt #[local = lv7]; + v150 = hir.load_local : felt #[local = lv6]; + v151 = hir.load_local : felt #[local = lv5]; + v152 = hir.load_local : felt #[local = lv4]; + v153 = hir.load_local : i32 #[local = lv8]; + v411 = arith.constant 64 : i32; + v155 = arith.add v153, v411 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/miden::core::collections::smt::get(v98, v97, v96, v95, v149, v150, v151, v152, v155) + v156 = hir.load_local : i32 #[local = lv8]; + v410 = arith.constant 88 : u32; + v157 = hir.bitcast v156 : u32; + v159 = arith.add v157, v410 : u32 #[overflow = checked]; + v409 = arith.constant 8 : u32; + v161 = arith.mod v159, v409 : u32; + hir.assertz v161 #[code = 250]; + v162 = hir.int_to_ptr v159 : ptr; + v163 = hir.load v162 : i64; + v164 = hir.load_local : i32 #[local = lv8]; + v408 = arith.constant 80 : u32; + v165 = hir.bitcast v164 : u32; + v167 = arith.add v165, v408 : u32 #[overflow = checked]; + v466 = arith.constant 8 : u32; + v169 = arith.mod v167, v466 : u32; + hir.assertz v169 #[code = 250]; + v170 = hir.int_to_ptr v167 : ptr; + v171 = hir.load v170 : i64; + v172 = hir.load_local : i32 #[local = lv8]; + v407 = arith.constant 72 : u32; + v173 = hir.bitcast v172 : u32; + v175 = arith.add v173, v407 : u32 #[overflow = checked]; v465 = arith.constant 8 : u32; - v139 = arith.mod v137, v465 : u32; - hir.assertz v139 #[code = 250]; - v140 = hir.int_to_ptr v137 : ptr; - hir.store v140, v134; - v142 = arith.constant 64 : u32; - v141 = hir.bitcast v99 : u32; - v143 = arith.add v141, v142 : u32 #[overflow = checked]; + v177 = arith.mod v175, v465 : u32; + hir.assertz v177 #[code = 250]; + v178 = hir.int_to_ptr v175 : ptr; + v179 = hir.load v178 : i64; + v180 = hir.load_local : i32 #[local = lv8]; + v406 = arith.constant 64 : u32; + v182 = hir.bitcast v180 : u32; + v184 = arith.add v182, v406 : u32 #[overflow = checked]; v464 = arith.constant 8 : u32; - v145 = arith.mod v143, v464 : u32; - hir.assertz v145 #[code = 250]; - v146 = hir.int_to_ptr v143 : ptr; - v147 = hir.load v146 : i64; - v149 = arith.constant 112 : u32; - v148 = hir.bitcast v99 : u32; - v150 = arith.add v148, v149 : u32 #[overflow = checked]; + v186 = arith.mod v184, v464 : u32; + hir.assertz v186 #[code = 250]; + v187 = hir.int_to_ptr v184 : ptr; + v188 = hir.load v187 : i64; + v389, v390 = arith.split v188 : felt, felt; + v405 = arith.constant 40 : u32; + v192 = hir.bitcast v180 : u32; + v194 = arith.add v192, v405 : u32 #[overflow = checked]; v463 = arith.constant 8 : u32; - v152 = arith.mod v150, v463 : u32; - hir.assertz v152 #[code = 250]; - v153 = hir.int_to_ptr v150 : ptr; - hir.store v153, v147; - v155 = arith.constant 88 : u32; - v154 = hir.bitcast v99 : u32; - v156 = arith.add v154, v155 : u32 #[overflow = checked]; + v196 = arith.mod v194, v463 : u32; + hir.assertz v196 #[code = 250]; + v391 = arith.join v390, v389 : i64; + v197 = hir.int_to_ptr v194 : ptr; + hir.store v197, v391; + v198 = hir.load_local : i32 #[local = lv8]; + v386, v387 = arith.split v179 : felt, felt; + v404 = arith.constant 32 : u32; + v203 = hir.bitcast v198 : u32; + v205 = arith.add v203, v404 : u32 #[overflow = checked]; v462 = arith.constant 8 : u32; - v158 = arith.mod v156, v462 : u32; - hir.assertz v158 #[code = 250]; - v159 = hir.int_to_ptr v156 : ptr; - v160 = hir.load v159 : i64; - v162 = arith.constant 136 : u32; - v161 = hir.bitcast v99 : u32; - v163 = arith.add v161, v162 : u32 #[overflow = checked]; + v207 = arith.mod v205, v462 : u32; + hir.assertz v207 #[code = 250]; + v388 = arith.join v387, v386 : i64; + v208 = hir.int_to_ptr v205 : ptr; + hir.store v208, v388; + v209 = hir.load_local : i32 #[local = lv8]; + v383, v384 = arith.split v171 : felt, felt; + v403 = arith.constant 56 : u32; + v214 = hir.bitcast v209 : u32; + v216 = arith.add v214, v403 : u32 #[overflow = checked]; v461 = arith.constant 8 : u32; - v165 = arith.mod v163, v461 : u32; - hir.assertz v165 #[code = 250]; - v166 = hir.int_to_ptr v163 : ptr; - hir.store v166, v160; - v168 = arith.constant 80 : u32; - v167 = hir.bitcast v99 : u32; - v169 = arith.add v167, v168 : u32 #[overflow = checked]; + v218 = arith.mod v216, v461 : u32; + hir.assertz v218 #[code = 250]; + v385 = arith.join v384, v383 : i64; + v219 = hir.int_to_ptr v216 : ptr; + hir.store v219, v385; + v220 = hir.load_local : i32 #[local = lv8]; + v380, v381 = arith.split v163 : felt, felt; + v402 = arith.constant 48 : u32; + v225 = hir.bitcast v220 : u32; + v227 = arith.add v225, v402 : u32 #[overflow = checked]; v460 = arith.constant 8 : u32; - v171 = arith.mod v169, v460 : u32; - hir.assertz v171 #[code = 250]; - v172 = hir.int_to_ptr v169 : ptr; - v173 = hir.load v172 : i64; - v175 = arith.constant 128 : u32; - v174 = hir.bitcast v99 : u32; - v176 = arith.add v174, v175 : u32 #[overflow = checked]; - v459 = arith.constant 8 : u32; - v178 = arith.mod v176, v459 : u32; - hir.assertz v178 #[code = 250]; - v179 = hir.int_to_ptr v176 : ptr; - hir.store v179, v173; - v182 = arith.constant 112 : i32; - v183 = arith.add v99, v182 : i32 #[overflow = wrapping]; - v180 = arith.constant 32 : i32; - v181 = arith.add v99, v180 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/::reverse(v181, v183) - v186 = arith.constant 128 : i32; - v187 = arith.add v99, v186 : i32 #[overflow = wrapping]; - v184 = arith.constant 144 : i32; - v185 = arith.add v99, v184 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/::reverse(v185, v187) - v191 = arith.constant 152 : u32; - v190 = hir.bitcast v99 : u32; - v192 = arith.add v190, v191 : u32 #[overflow = checked]; - v458 = arith.constant 8 : u32; - v194 = arith.mod v192, v458 : u32; - hir.assertz v194 #[code = 250]; - v195 = hir.int_to_ptr v192 : ptr; - v196 = hir.load v195 : i64; - v188 = arith.constant 56 : i32; - v189 = arith.add v99, v188 : i32 #[overflow = wrapping]; - v197 = hir.bitcast v189 : u32; - v457 = arith.constant 8 : u32; - v199 = arith.mod v197, v457 : u32; - hir.assertz v199 #[code = 250]; - v200 = hir.int_to_ptr v197 : ptr; - hir.store v200, v196; - v202 = arith.constant 144 : u32; - v201 = hir.bitcast v99 : u32; - v203 = arith.add v201, v202 : u32 #[overflow = checked]; - v456 = arith.constant 8 : u32; - v205 = arith.mod v203, v456 : u32; - hir.assertz v205 #[code = 250]; - v206 = hir.int_to_ptr v203 : ptr; - v207 = hir.load v206 : i64; - v209 = arith.constant 48 : u32; - v208 = hir.bitcast v99 : u32; - v210 = arith.add v208, v209 : u32 #[overflow = checked]; - v455 = arith.constant 8 : u32; - v212 = arith.mod v210, v455 : u32; - hir.assertz v212 #[code = 250]; - v213 = hir.int_to_ptr v210 : ptr; - hir.store v213, v207; - v214 = arith.constant 10 : i64; - v215 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/intrinsics::felt::from_u64_unchecked(v214) : felt - v216 = arith.constant 11 : i64; - v217 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/intrinsics::felt::from_u64_unchecked(v216) : felt - v218 = arith.constant 12 : i64; - v219 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/intrinsics::felt::from_u64_unchecked(v218) : felt - v220 = arith.constant 13 : i64; - v221 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/intrinsics::felt::from_u64_unchecked(v220) : felt - v223 = arith.constant 76 : u32; - v222 = hir.bitcast v99 : u32; - v224 = arith.add v222, v223 : u32 #[overflow = checked]; - v454 = arith.constant 4 : u32; - v226 = arith.mod v224, v454 : u32; - hir.assertz v226 #[code = 250]; - v227 = hir.int_to_ptr v224 : ptr; - hir.store v227, v221; - v453 = arith.constant 72 : u32; - v228 = hir.bitcast v99 : u32; - v230 = arith.add v228, v453 : u32 #[overflow = checked]; - v452 = arith.constant 4 : u32; - v232 = arith.mod v230, v452 : u32; - hir.assertz v232 #[code = 250]; - v233 = hir.int_to_ptr v230 : ptr; - hir.store v233, v219; - v235 = arith.constant 68 : u32; - v234 = hir.bitcast v99 : u32; - v236 = arith.add v234, v235 : u32 #[overflow = checked]; - v451 = arith.constant 4 : u32; - v238 = arith.mod v236, v451 : u32; - hir.assertz v238 #[code = 250]; - v239 = hir.int_to_ptr v236 : ptr; - hir.store v239, v217; - v450 = arith.constant 64 : u32; - v240 = hir.bitcast v99 : u32; - v242 = arith.add v240, v450 : u32 #[overflow = checked]; - v449 = arith.constant 4 : u32; - v244 = arith.mod v242, v449 : u32; + v229 = arith.mod v227, v460 : u32; + hir.assertz v229 #[code = 250]; + v382 = arith.join v381, v380 : i64; + v230 = hir.int_to_ptr v227 : ptr; + hir.store v230, v382; + v401 = arith.constant 10 : i64; + v232 = arith.trunc v401 : felt; + hir.store_local v232 #[local = lv7]; + v400 = arith.constant 11 : i64; + v234 = arith.trunc v400 : felt; + hir.store_local v234 #[local = lv6]; + v399 = arith.constant 12 : i64; + v236 = arith.trunc v399 : felt; + hir.store_local v236 #[local = lv5]; + v237 = hir.load_local : i32 #[local = lv8]; + v397 = arith.constant 76 : u32; + v240 = hir.bitcast v237 : u32; + v242 = arith.add v240, v397 : u32 #[overflow = checked]; + v459 = arith.constant 4 : u32; + v244 = arith.mod v242, v459 : u32; hir.assertz v244 #[code = 250]; + v398 = arith.constant 13 : i64; + v239 = arith.trunc v398 : felt; v245 = hir.int_to_ptr v242 : ptr; - hir.store v245, v215; - v447 = arith.constant 64 : i32; - v249 = arith.add v99, v447 : i32 #[overflow = wrapping]; - v448 = arith.constant 32 : i32; - v247 = arith.add v99, v448 : i32 #[overflow = wrapping]; - v250 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/::eq(v247, v249) : i32 - v446 = arith.constant 0 : i32; - v92 = arith.constant 0 : i32; - v252 = arith.eq v250, v92 : i1; - v253 = arith.zext v252 : u32; - v254 = hir.bitcast v253 : i32; - v256 = arith.neq v254, v446 : i1; - v437 = scf.if v256 : u32 { - ^block36: - v433 = arith.constant 0 : u32; - scf.yield v433; + hir.store v245, v239; + v246 = hir.load_local : i32 #[local = lv8]; + v247 = hir.load_local : felt #[local = lv5]; + v458 = arith.constant 72 : u32; + v248 = hir.bitcast v246 : u32; + v250 = arith.add v248, v458 : u32 #[overflow = checked]; + v457 = arith.constant 4 : u32; + v252 = arith.mod v250, v457 : u32; + hir.assertz v252 #[code = 250]; + v253 = hir.int_to_ptr v250 : ptr; + hir.store v253, v247; + v254 = hir.load_local : i32 #[local = lv8]; + v255 = hir.load_local : felt #[local = lv6]; + v396 = arith.constant 68 : u32; + v256 = hir.bitcast v254 : u32; + v258 = arith.add v256, v396 : u32 #[overflow = checked]; + v456 = arith.constant 4 : u32; + v260 = arith.mod v258, v456 : u32; + hir.assertz v260 #[code = 250]; + v261 = hir.int_to_ptr v258 : ptr; + hir.store v261, v255; + v262 = hir.load_local : i32 #[local = lv8]; + v263 = hir.load_local : felt #[local = lv7]; + v455 = arith.constant 64 : u32; + v264 = hir.bitcast v262 : u32; + v266 = arith.add v264, v455 : u32 #[overflow = checked]; + v454 = arith.constant 4 : u32; + v268 = arith.mod v266, v454 : u32; + hir.assertz v268 #[code = 250]; + v269 = hir.int_to_ptr v266 : ptr; + hir.store v269, v263; + v270 = hir.load_local : i32 #[local = lv8]; + v453 = arith.constant 64 : i32; + v275 = arith.add v270, v453 : i32 #[overflow = wrapping]; + v395 = arith.constant 32 : i32; + v272 = arith.add v270, v395 : i32 #[overflow = wrapping]; + v276 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/::eq(v272, v275) : i32 + v452 = arith.constant 0 : i32; + v421 = arith.constant 0 : i32; + v278 = arith.eq v276, v421 : i1; + v279 = arith.zext v278 : u32; + v280 = hir.bitcast v279 : i32; + v282 = arith.neq v280, v452 : i1; + v443 = scf.if v282 : u32 { + ^block28: + v439 = arith.constant 0 : u32; + scf.yield v439; } else { ^block13: - v259 = arith.constant 16 : i32; - v260 = arith.add v99, v259 : i32 #[overflow = wrapping]; - v257 = arith.constant 48 : i32; - v258 = arith.add v99, v257 : i32 #[overflow = wrapping]; - v261 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/::eq(v258, v260) : i32 - v444 = arith.constant 0 : i32; - v445 = arith.constant 0 : i32; - v263 = arith.eq v261, v445 : i1; - v264 = arith.zext v263 : u32; - v265 = hir.bitcast v264 : i32; - v267 = arith.neq v265, v444 : i1; - scf.if v267{ - ^block35: + v283 = hir.load_local : i32 #[local = lv8]; + v392 = arith.constant 16 : i32; + v288 = arith.add v283, v392 : i32 #[overflow = wrapping]; + v393 = arith.constant 48 : i32; + v285 = arith.add v283, v393 : i32 #[overflow = wrapping]; + v289 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/::eq(v285, v288) : i32 + v450 = arith.constant 0 : i32; + v451 = arith.constant 0 : i32; + v291 = arith.eq v289, v451 : i1; + v292 = arith.zext v291 : u32; + v293 = hir.bitcast v292 : i32; + v295 = arith.neq v293, v450 : i1; + scf.if v295{ + ^block27: scf.yield ; } else { ^block14: - v268 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/__stack_pointer : ptr - v269 = hir.bitcast v268 : ptr; - hir.store v269, v95; + v296 = hir.load_local : i32 #[local = lv9]; + v297 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/__stack_pointer : ptr + v298 = hir.bitcast v297 : ptr; + hir.store v298, v296; scf.yield ; }; - v435 = arith.constant 1 : u32; - v443 = arith.constant 0 : u32; - v441 = cf.select v267, v443, v435 : u32; - scf.yield v441; + v441 = arith.constant 1 : u32; + v449 = arith.constant 0 : u32; + v447 = cf.select v295, v449, v441 : u32; + scf.yield v447; }; - v442 = arith.constant 0 : u32; - v440 = arith.eq v437, v442 : i1; - cf.cond_br v440 ^block12, ^block38; + v448 = arith.constant 0 : u32; + v446 = arith.eq v443, v448 : i1; + cf.cond_br v446 ^block12, ^block30; ^block12: ub.unreachable ; - ^block38: - builtin.ret ; - }; - - private builtin.function @::reverse(v270: i32, v271: i32) { - ^block15(v270: i32, v271: i32): - v274 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/__stack_pointer : ptr - v275 = hir.bitcast v274 : ptr; - v276 = hir.load v275 : i32; - v277 = arith.constant 16 : i32; - v278 = arith.sub v276, v277 : i32 #[overflow = wrapping]; - v280 = arith.constant 8 : u32; - v279 = hir.bitcast v271 : u32; - v281 = arith.add v279, v280 : u32 #[overflow = checked]; - v555 = arith.constant 8 : u32; - v283 = arith.mod v281, v555 : u32; - hir.assertz v283 #[code = 250]; - v284 = hir.int_to_ptr v281 : ptr; - v285 = hir.load v284 : i64; - v554 = arith.constant 8 : u32; - v286 = hir.bitcast v278 : u32; - v288 = arith.add v286, v554 : u32 #[overflow = checked]; - v289 = arith.constant 4 : u32; - v290 = arith.mod v288, v289 : u32; - hir.assertz v290 #[code = 250]; - v291 = hir.int_to_ptr v288 : ptr; - hir.store v291, v285; - v292 = hir.bitcast v271 : u32; - v553 = arith.constant 8 : u32; - v294 = arith.mod v292, v553 : u32; - hir.assertz v294 #[code = 250]; - v295 = hir.int_to_ptr v292 : ptr; - v296 = hir.load v295 : i64; - v297 = hir.bitcast v278 : u32; - v552 = arith.constant 4 : u32; - v299 = arith.mod v297, v552 : u32; - hir.assertz v299 #[code = 250]; - v300 = hir.int_to_ptr v297 : ptr; - hir.store v300, v296; - v301 = arith.constant 12 : i32; - v302 = arith.add v278, v301 : i32 #[overflow = wrapping]; - v272 = arith.constant 0 : i32; - v523, v524, v525, v526, v527, v528 = scf.while v272, v278, v302, v270 : i32, i32, i32, i32, i32, i32 { - ^block48(v529: i32, v530: i32, v531: i32, v532: i32): - v551 = arith.constant 0 : i32; - v305 = arith.constant 8 : i32; - v306 = arith.eq v529, v305 : i1; - v307 = arith.zext v306 : u32; - v308 = hir.bitcast v307 : i32; - v310 = arith.neq v308, v551 : i1; - v517, v518 = scf.if v310 : i32, i32 { - ^block47: - v477 = ub.poison i32 : i32; - scf.yield v477, v477; - } else { - ^block20: - v312 = arith.add v530, v529 : i32 #[overflow = wrapping]; - v313 = hir.bitcast v312 : u32; - v550 = arith.constant 4 : u32; - v315 = arith.mod v313, v550 : u32; - hir.assertz v315 #[code = 250]; - v316 = hir.int_to_ptr v313 : ptr; - v317 = hir.load v316 : felt; - v319 = hir.bitcast v531 : u32; - v549 = arith.constant 4 : u32; - v321 = arith.mod v319, v549 : u32; - hir.assertz v321 #[code = 250]; - v322 = hir.int_to_ptr v319 : ptr; - v323 = hir.load v322 : i32; - v324 = hir.bitcast v312 : u32; - v548 = arith.constant 4 : u32; - v326 = arith.mod v324, v548 : u32; - hir.assertz v326 #[code = 250]; - v327 = hir.int_to_ptr v324 : ptr; - hir.store v327, v323; - v328 = hir.bitcast v531 : u32; - v547 = arith.constant 4 : u32; - v330 = arith.mod v328, v547 : u32; - hir.assertz v330 #[code = 250]; - v331 = hir.int_to_ptr v328 : ptr; - hir.store v331, v317; - v334 = arith.constant -4 : i32; - v335 = arith.add v531, v334 : i32 #[overflow = wrapping]; - v332 = arith.constant 4 : i32; - v333 = arith.add v529, v332 : i32 #[overflow = wrapping]; - scf.yield v333, v335; - }; - v545 = ub.poison i32 : i32; - v520 = cf.select v310, v545, v532 : i32; - v546 = ub.poison i32 : i32; - v519 = cf.select v310, v546, v530 : i32; - v476 = arith.constant 1 : u32; - v469 = arith.constant 0 : u32; - v522 = cf.select v310, v469, v476 : u32; - v510 = arith.trunc v522 : i1; - scf.condition v510, v517, v519, v518, v520, v530, v532; - } do { - ^block49(v533: i32, v534: i32, v535: i32, v536: i32, v537: i32, v538: i32): - scf.yield v533, v534, v535, v536; - }; - v544 = arith.constant 8 : u32; - v337 = hir.bitcast v527 : u32; - v339 = arith.add v337, v544 : u32 #[overflow = checked]; - v543 = arith.constant 4 : u32; - v341 = arith.mod v339, v543 : u32; - hir.assertz v341 #[code = 250]; - v342 = hir.int_to_ptr v339 : ptr; - v343 = hir.load v342 : i64; - v542 = arith.constant 8 : u32; - v344 = hir.bitcast v528 : u32; - v346 = arith.add v344, v542 : u32 #[overflow = checked]; - v541 = arith.constant 8 : u32; - v348 = arith.mod v346, v541 : u32; - hir.assertz v348 #[code = 250]; - v349 = hir.int_to_ptr v346 : ptr; - hir.store v349, v343; - v350 = hir.bitcast v527 : u32; - v540 = arith.constant 4 : u32; - v352 = arith.mod v350, v540 : u32; - hir.assertz v352 #[code = 250]; - v353 = hir.int_to_ptr v350 : ptr; - v354 = hir.load v353 : i64; - v355 = hir.bitcast v528 : u32; - v539 = arith.constant 8 : u32; - v357 = arith.mod v355, v539 : u32; - hir.assertz v357 #[code = 250]; - v358 = hir.int_to_ptr v355 : ptr; - hir.store v358, v354; + ^block30: builtin.ret ; }; - private builtin.function @intrinsics::felt::eq(v359: felt, v360: felt) -> i32 { - ^block21(v359: felt, v360: felt): - v361 = arith.eq v359, v360 : i1; - v362 = hir.cast v361 : i32; - builtin.ret v362; - }; - - private builtin.function @intrinsics::felt::from_u64_unchecked(v364: i64) -> felt { - ^block23(v364: i64): - v365 = hir.cast v364 : felt; - builtin.ret v365; - }; - - private builtin.function @std::collections::smt::get(v367: felt, v368: felt, v369: felt, v370: felt, v371: felt, v372: felt, v373: felt, v374: felt, v375: i32) { - ^block25(v367: felt, v368: felt, v369: felt, v370: felt, v371: felt, v372: felt, v373: felt, v374: felt, v375: i32): - v376, v377, v378, v379, v380, v381, v382, v383 = hir.exec @std/collections/smt/get(v367, v368, v369, v370, v371, v372, v373, v374) : felt, felt, felt, felt, felt, felt, felt, felt - v384 = hir.bitcast v375 : u32; - v385 = hir.int_to_ptr v384 : ptr; - hir.store v385, v376; - v386 = arith.constant 4 : u32; - v387 = arith.add v384, v386 : u32 #[overflow = checked]; - v388 = hir.int_to_ptr v387 : ptr; - hir.store v388, v377; - v389 = arith.constant 8 : u32; - v390 = arith.add v384, v389 : u32 #[overflow = checked]; - v391 = hir.int_to_ptr v390 : ptr; - hir.store v391, v378; - v392 = arith.constant 12 : u32; - v393 = arith.add v384, v392 : u32 #[overflow = checked]; - v394 = hir.int_to_ptr v393 : ptr; - hir.store v394, v379; - v395 = arith.constant 16 : u32; - v396 = arith.add v384, v395 : u32 #[overflow = checked]; - v397 = hir.int_to_ptr v396 : ptr; - hir.store v397, v380; - v398 = arith.constant 20 : u32; - v399 = arith.add v384, v398 : u32 #[overflow = checked]; - v400 = hir.int_to_ptr v399 : ptr; - hir.store v400, v381; - v401 = arith.constant 24 : u32; - v402 = arith.add v384, v401 : u32 #[overflow = checked]; - v403 = hir.int_to_ptr v402 : ptr; - hir.store v403, v382; - v404 = arith.constant 28 : u32; - v405 = arith.add v384, v404 : u32 #[overflow = checked]; - v406 = hir.int_to_ptr v405 : ptr; - hir.store v406, v383; + private builtin.function @miden::core::collections::smt::get(v299: felt, v300: felt, v301: felt, v302: felt, v303: felt, v304: felt, v305: felt, v306: felt, v307: i32) { + ^block15(v299: felt, v300: felt, v301: felt, v302: felt, v303: felt, v304: felt, v305: felt, v306: felt, v307: i32): + v308, v309, v310, v311, v312, v313, v314, v315 = hir.exec @miden/core/collections/smt/get(v299, v300, v301, v302, v303, v304, v305, v306) : felt, felt, felt, felt, felt, felt, felt, felt + v316 = hir.bitcast v307 : u32; + v317 = hir.int_to_ptr v316 : ptr; + hir.store v317, v308; + v476 = arith.constant 4 : u32; + v319 = arith.add v316, v476 : u32 #[overflow = checked]; + v320 = hir.int_to_ptr v319 : ptr; + hir.store v320, v309; + v475 = arith.constant 8 : u32; + v322 = arith.add v316, v475 : u32 #[overflow = checked]; + v323 = hir.int_to_ptr v322 : ptr; + hir.store v323, v310; + v474 = arith.constant 12 : u32; + v325 = arith.add v316, v474 : u32 #[overflow = checked]; + v326 = hir.int_to_ptr v325 : ptr; + hir.store v326, v311; + v473 = arith.constant 16 : u32; + v328 = arith.add v316, v473 : u32 #[overflow = checked]; + v329 = hir.int_to_ptr v328 : ptr; + hir.store v329, v312; + v472 = arith.constant 20 : u32; + v331 = arith.add v316, v472 : u32 #[overflow = checked]; + v332 = hir.int_to_ptr v331 : ptr; + hir.store v332, v313; + v471 = arith.constant 24 : u32; + v334 = arith.add v316, v471 : u32 #[overflow = checked]; + v335 = hir.int_to_ptr v334 : ptr; + hir.store v335, v314; + v470 = arith.constant 28 : u32; + v337 = arith.add v316, v470 : u32 #[overflow = checked]; + v338 = hir.int_to_ptr v337 : ptr; + hir.store v338, v315; builtin.ret ; }; diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_get.masm b/tests/integration/expected/rust_sdk_stdlib_smt_get.masm index 2e3674c2a..51a13258f 100644 --- a/tests/integration/expected/rust_sdk_stdlib_smt_get.masm +++ b/tests/integration/expected/rust_sdk_stdlib_smt_get.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,14 +10,47 @@ proc init mem_store.278528 end -# mod root_ns:root@1.0.0::rust_sdk_stdlib_smt_get +# mod ::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_get +@locals("3") @callconv("C") proc ::eq( i32, i32 ) -> i32 - dup.0 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -31,7 +64,14 @@ proc ::eq( exec.::intrinsics::mem::load_felt trace.252 nop - dup.2 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -45,24 +85,26 @@ proc ::eq( exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::intrinsics::felt::eq - trace.252 - nop push.0 push.1 - movup.2 + movup.3 + movup.3 + eq neq neq if.true - drop - drop - push.0 + nop else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + swap.1 add u32assert push.4 @@ -78,8 +120,16 @@ proc ::eq( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.3 + swap.1 add u32assert push.4 @@ -95,24 +145,26 @@ proc ::eq( exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::intrinsics::felt::eq - trace.252 - nop push.0 push.1 - movup.2 + movup.3 + movup.3 + eq neq neq if.true - drop - drop - push.0 + nop else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.1 + swap.1 add u32assert push.4 @@ -128,8 +180,16 @@ proc ::eq( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.3 + swap.1 add u32assert push.4 @@ -145,22 +205,24 @@ proc ::eq( exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::intrinsics::felt::eq - trace.252 - nop push.0 push.1 - movup.2 + movup.3 + movup.3 + eq neq neq if.true - drop - drop - push.0 + nop else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 swap.1 add @@ -178,8 +240,16 @@ proc ::eq( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - movup.2 + swap.1 add u32assert push.4 @@ -195,21 +265,70 @@ proc ::eq( exec.::intrinsics::mem::load_felt trace.252 nop + push.1 + movdn.2 + eq + eq + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::intrinsics::felt::eq + exec.::intrinsics::mem::store_sw trace.252 nop - push.1 - eq end end end + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("16") @callconv("C") pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) + movup.4 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + movup.4 + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + movup.4 + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + movup.4 + locaddr.7 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1114112 u32divmod.4 swap.1 @@ -218,15 +337,47 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4294967264 - push.160 - dup.2 + push.96 + movup.2 swap.1 u32wrapping_sub u32and - push.1114112 - dup.1 + dup.0 + locaddr.8 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114112 u32divmod.4 swap.1 trace.240 @@ -234,8 +385,24 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.7 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.28 - dup.1 + movup.2 add u32assert push.4 @@ -244,8 +411,6 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) u32mod u32assert assertz - dup.10 - swap.1 u32divmod.4 swap.1 trace.240 @@ -253,8 +418,24 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.24 - dup.1 + movup.2 add u32assert push.4 @@ -263,8 +444,6 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) u32mod u32assert assertz - dup.9 - swap.1 u32divmod.4 swap.1 trace.240 @@ -272,8 +451,24 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.20 - dup.1 + movup.2 add u32assert push.4 @@ -282,8 +477,6 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) u32mod u32assert assertz - dup.8 - swap.1 u32divmod.4 swap.1 trace.240 @@ -291,8 +484,24 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.16 - dup.1 + movup.2 add u32assert push.4 @@ -301,8 +510,6 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) u32mod u32assert assertz - dup.7 - swap.1 u32divmod.4 swap.1 trace.240 @@ -310,26 +517,73 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) exec.::intrinsics::mem::store_felt trace.252 nop - push.64 - dup.1 - u32wrapping_add - movup.2 - swap.10 - swap.4 - movdn.2 + locaddr.7 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.6 + push.0 swap.1 - swap.9 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.64 + u32wrapping_add + movup.3 swap.5 + movdn.3 + movup.2 + swap.6 + movdn.2 + swap.1 + swap.7 swap.1 swap.8 - swap.6 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::std::collections::smt::get + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_get::"miden::core::collections::smt::get" trace.252 nop - push.72 - dup.1 + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.88 + swap.1 add u32assert push.8 @@ -346,27 +600,16 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) trace.252 nop swap.1 - push.120 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.8 + push.0 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.64 - dup.1 + push.80 + swap.1 add u32assert push.8 @@ -383,27 +626,16 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) trace.252 nop swap.1 - push.112 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.8 + push.0 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.88 - dup.1 + push.72 + swap.1 add u32assert push.8 @@ -420,26 +652,15 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) trace.252 nop swap.1 - push.136 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.8 + push.0 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.80 + push.64 dup.1 add u32assert @@ -457,8 +678,8 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) trace.252 nop swap.1 - push.128 - dup.3 + push.40 + movup.3 add u32assert push.8 @@ -467,6 +688,8 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -476,30 +699,17 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) exec.::intrinsics::mem::store_dw trace.252 nop - push.112 - dup.1 - u32wrapping_add - push.32 - dup.2 - u32wrapping_add - trace.240 - nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::::reverse - trace.252 - nop - push.128 - dup.1 - u32wrapping_add - push.144 - dup.2 - u32wrapping_add + locaddr.8 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::::reverse + exec.::intrinsics::mem::load_sw trace.252 nop - push.152 - dup.1 + movdn.2 + push.32 + movup.3 add u32assert push.8 @@ -508,23 +718,38 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.8 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movdn.2 push.56 - dup.3 - u32wrapping_add + movup.3 + add + u32assert push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -534,26 +759,17 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) exec.::intrinsics::mem::store_dw trace.252 nop - push.144 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.8 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop - swap.1 + movdn.2 push.48 - dup.3 + movup.3 add u32assert push.8 @@ -562,6 +778,8 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -573,34 +791,50 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) nop push.10 push.0 + mul.4294967296 + add + locaddr.7 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::intrinsics::felt::from_u64_unchecked + exec.::intrinsics::mem::store_felt trace.252 nop push.11 push.0 + mul.4294967296 + add + locaddr.6 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::intrinsics::felt::from_u64_unchecked + exec.::intrinsics::mem::store_felt trace.252 nop push.12 push.0 + mul.4294967296 + add + locaddr.5 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::intrinsics::felt::from_u64_unchecked + exec.::intrinsics::mem::store_felt trace.252 nop - push.13 + locaddr.8 push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::intrinsics::felt::from_u64_unchecked + exec.::intrinsics::mem::load_sw trace.252 nop push.76 - dup.5 + swap.1 add u32assert push.4 @@ -609,6 +843,11 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) u32mod u32assert assertz + push.13 + push.0 + mul.4294967296 + add + swap.1 u32divmod.4 swap.1 trace.240 @@ -616,8 +855,24 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.72 - dup.4 + movup.2 add u32assert push.4 @@ -633,8 +888,24 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.68 - dup.3 + movup.2 add u32assert push.4 @@ -650,8 +921,24 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.7 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.64 - dup.2 + movup.2 add u32assert push.4 @@ -667,15 +954,23 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.64 dup.1 u32wrapping_add push.32 - dup.2 + movup.2 u32wrapping_add trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::::eq + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_get::::eq trace.252 nop push.0 @@ -684,10 +979,16 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) eq neq if.true - drop - drop push.0 else + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 dup.1 u32wrapping_add @@ -696,7 +997,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) u32wrapping_add trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::::eq + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_get::::eq trace.252 nop push.0 @@ -706,12 +1007,17 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) neq dup.0 if.true - swap.1 - drop + nop else - push.1114112 - movup.2 + locaddr.9 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1114112 u32divmod.4 swap.1 trace.240 @@ -736,305 +1042,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) end @callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114112 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.8 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.12 - dup.1 - u32wrapping_add - push.0 - movup.2 - swap.1 - push.1 - while.true - push.0 - push.8 - dup.2 - eq - neq - dup.0 - if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add - end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.4 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop -end - -@callconv("C") -proc intrinsics::felt::eq(felt, felt) -> i32 - eq -end - -@callconv("C") -proc intrinsics::felt::from_u64_unchecked([u32; 2]) -> felt - dup.1 - dup.1 - push.1 - push.4294967295 - trace.240 - nop - exec.::std::math::u64::lt - trace.252 - nop - assert - mul.4294967296 - add -end - -@callconv("C") -proc std::collections::smt::get( +proc miden::core::collections::smt::get( felt, felt, felt, @@ -1047,7 +1055,7 @@ proc std::collections::smt::get( ) trace.240 nop - exec.::std::collections::smt::get + exec.::miden::core::collections::smt::get trace.252 nop movup.8 diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_get.wat b/tests/integration/expected/rust_sdk_stdlib_smt_get.wat index e6dfe33a4..197b04989 100644 --- a/tests/integration/expected/rust_sdk_stdlib_smt_get.wat +++ b/tests/integration/expected/rust_sdk_stdlib_smt_get.wat @@ -1,10 +1,9 @@ (module $rust_sdk_stdlib_smt_get.wasm (type (;0;) (func (param i32 i32) (result i32))) (type (;1;) (func (param f32 f32 f32 f32 f32 f32 f32 f32))) - (type (;2;) (func (param i32 i32))) - (type (;3;) (func (param f32 f32) (result i32))) - (type (;4;) (func (param i64) (result f32))) - (type (;5;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 i32))) + (type (;2;) (func (param f32 f32) (result i32))) + (type (;3;) (func (param i64) (result f32))) + (type (;4;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 i32))) (table (;0;) 1 1 funcref) (memory (;0;) 16) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -51,12 +50,12 @@ local.get 2 ) (func $entrypoint (;1;) (type 1) (param f32 f32 f32 f32 f32 f32 f32 f32) - (local i32 i32) + (local i32 i32 i64 i64 i64) global.get $__stack_pointer local.tee 8 local.set 9 local.get 8 - i32.const 160 + i32.const 96 i32.sub i32.const -32 i32.and @@ -85,46 +84,36 @@ local.get 8 i32.const 64 i32.add - call $std::collections::smt::get - local.get 8 - local.get 8 - i64.load offset=72 - i64.store offset=120 - local.get 8 - local.get 8 - i64.load offset=64 - i64.store offset=112 - local.get 8 + call $miden::core::collections::smt::get local.get 8 i64.load offset=88 - i64.store offset=136 - local.get 8 + local.set 10 local.get 8 i64.load offset=80 - i64.store offset=128 - local.get 8 - i32.const 32 - i32.add - local.get 8 - i32.const 112 - i32.add - call $::reverse - local.get 8 - i32.const 144 - i32.add - local.get 8 - i32.const 128 - i32.add - call $::reverse - local.get 8 - i32.const 56 - i32.add + local.set 11 local.get 8 - i64.load offset=152 - i64.store + i64.load offset=72 + local.set 12 local.get 8 local.get 8 - i64.load offset=144 + i64.load offset=64 + i64.const 32 + i64.rotl + i64.store offset=40 + local.get 8 + local.get 12 + i64.const 32 + i64.rotl + i64.store offset=32 + local.get 8 + local.get 11 + i64.const 32 + i64.rotl + i64.store offset=56 + local.get 8 + local.get 10 + i64.const 32 + i64.rotl i64.store offset=48 i64.const 10 call $intrinsics::felt::from_u64_unchecked @@ -173,71 +162,13 @@ end unreachable ) - (func $::reverse (;2;) (type 2) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store - ) - (func $intrinsics::felt::eq (;3;) (type 3) (param f32 f32) (result i32) + (func $intrinsics::felt::eq (;2;) (type 2) (param f32 f32) (result i32) unreachable ) - (func $intrinsics::felt::from_u64_unchecked (;4;) (type 4) (param i64) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;3;) (type 3) (param i64) (result f32) unreachable ) - (func $std::collections::smt::get (;5;) (type 5) (param f32 f32 f32 f32 f32 f32 f32 f32 i32) + (func $miden::core::collections::smt::get (;4;) (type 4) (param f32 f32 f32 f32 f32 f32 f32 f32 i32) unreachable ) ) diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_set.hir b/tests/integration/expected/rust_sdk_stdlib_smt_set.hir index b6acd4d09..ecc4fc47d 100644 --- a/tests/integration/expected/rust_sdk_stdlib_smt_set.hir +++ b/tests/integration/expected/rust_sdk_stdlib_smt_set.hir @@ -2,542 +2,424 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @rust_sdk_stdlib_smt_set { private builtin.function @::eq(v0: i32, v1: i32) -> i32 { ^block4(v0: i32, v1: i32): - v5 = hir.bitcast v0 : u32; - v6 = arith.constant 4 : u32; - v7 = arith.mod v5, v6 : u32; + hir.store_local v0 #[local = lv0]; + hir.store_local v1 #[local = lv1]; + v362 = arith.constant 0 : i32; + hir.store_local v362 #[local = lv2]; + v4 = hir.load_local : i32 #[local = lv0]; + v5 = hir.bitcast v4 : u32; + v361 = arith.constant 4 : u32; + v7 = arith.mod v5, v361 : u32; hir.assertz v7 #[code = 250]; v8 = hir.int_to_ptr v5 : ptr; v9 = hir.load v8 : felt; - v10 = hir.bitcast v1 : u32; - v444 = arith.constant 4 : u32; - v12 = arith.mod v10, v444 : u32; - hir.assertz v12 #[code = 250]; - v13 = hir.int_to_ptr v10 : ptr; - v14 = hir.load v13 : felt; - v15 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::eq(v9, v14) : i32 - v3 = arith.constant 0 : i32; - v16 = arith.constant 1 : i32; - v17 = arith.neq v15, v16 : i1; - v18 = arith.zext v17 : u32; - v19 = hir.bitcast v18 : i32; - v21 = arith.neq v19, v3 : i1; - v422 = scf.if v21 : i32 { - ^block6: - v443 = arith.constant 0 : i32; - scf.yield v443; + v10 = hir.load_local : i32 #[local = lv1]; + v11 = hir.bitcast v10 : u32; + v398 = arith.constant 4 : u32; + v13 = arith.mod v11, v398 : u32; + hir.assertz v13 #[code = 250]; + v14 = hir.int_to_ptr v11 : ptr; + v15 = hir.load v14 : felt; + v397 = arith.constant 0 : i32; + v360 = arith.constant 1 : i32; + v16 = arith.eq v9, v15 : i1; + v17 = hir.cast v16 : i32; + v19 = arith.neq v17, v360 : i1; + v20 = arith.zext v19 : u32; + v21 = hir.bitcast v20 : i32; + v23 = arith.neq v21, v397 : i1; + scf.if v23{ + ^block23: + scf.yield ; } else { ^block7: - v442 = arith.constant 4 : u32; - v22 = hir.bitcast v0 : u32; - v24 = arith.add v22, v442 : u32 #[overflow = checked]; - v441 = arith.constant 4 : u32; - v26 = arith.mod v24, v441 : u32; - hir.assertz v26 #[code = 250]; - v27 = hir.int_to_ptr v24 : ptr; - v28 = hir.load v27 : felt; - v440 = arith.constant 4 : u32; - v29 = hir.bitcast v1 : u32; - v31 = arith.add v29, v440 : u32 #[overflow = checked]; - v439 = arith.constant 4 : u32; - v33 = arith.mod v31, v439 : u32; - hir.assertz v33 #[code = 250]; - v34 = hir.int_to_ptr v31 : ptr; - v35 = hir.load v34 : felt; - v36 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::eq(v28, v35) : i32 - v437 = arith.constant 0 : i32; - v438 = arith.constant 1 : i32; - v38 = arith.neq v36, v438 : i1; - v39 = arith.zext v38 : u32; - v40 = hir.bitcast v39 : i32; - v42 = arith.neq v40, v437 : i1; - v424 = scf.if v42 : i32 { - ^block31: - v436 = arith.constant 0 : i32; - scf.yield v436; + v24 = hir.load_local : i32 #[local = lv0]; + v396 = arith.constant 4 : u32; + v25 = hir.bitcast v24 : u32; + v27 = arith.add v25, v396 : u32 #[overflow = checked]; + v395 = arith.constant 4 : u32; + v29 = arith.mod v27, v395 : u32; + hir.assertz v29 #[code = 250]; + v30 = hir.int_to_ptr v27 : ptr; + v31 = hir.load v30 : felt; + v32 = hir.load_local : i32 #[local = lv1]; + v394 = arith.constant 4 : u32; + v33 = hir.bitcast v32 : u32; + v35 = arith.add v33, v394 : u32 #[overflow = checked]; + v393 = arith.constant 4 : u32; + v37 = arith.mod v35, v393 : u32; + hir.assertz v37 #[code = 250]; + v38 = hir.int_to_ptr v35 : ptr; + v39 = hir.load v38 : felt; + v391 = arith.constant 0 : i32; + v392 = arith.constant 1 : i32; + v40 = arith.eq v31, v39 : i1; + v41 = hir.cast v40 : i32; + v43 = arith.neq v41, v392 : i1; + v44 = arith.zext v43 : u32; + v45 = hir.bitcast v44 : i32; + v47 = arith.neq v45, v391 : i1; + scf.if v47{ + ^block22: + scf.yield ; } else { ^block8: - v44 = arith.constant 8 : u32; - v43 = hir.bitcast v0 : u32; - v45 = arith.add v43, v44 : u32 #[overflow = checked]; - v435 = arith.constant 4 : u32; - v47 = arith.mod v45, v435 : u32; - hir.assertz v47 #[code = 250]; - v48 = hir.int_to_ptr v45 : ptr; - v49 = hir.load v48 : felt; - v434 = arith.constant 8 : u32; - v50 = hir.bitcast v1 : u32; - v52 = arith.add v50, v434 : u32 #[overflow = checked]; - v433 = arith.constant 4 : u32; - v54 = arith.mod v52, v433 : u32; - hir.assertz v54 #[code = 250]; - v55 = hir.int_to_ptr v52 : ptr; - v56 = hir.load v55 : felt; - v57 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::eq(v49, v56) : i32 - v431 = arith.constant 0 : i32; - v432 = arith.constant 1 : i32; - v59 = arith.neq v57, v432 : i1; - v60 = arith.zext v59 : u32; - v61 = hir.bitcast v60 : i32; - v63 = arith.neq v61, v431 : i1; - v425 = scf.if v63 : i32 { - ^block30: - v430 = arith.constant 0 : i32; - scf.yield v430; + v48 = hir.load_local : i32 #[local = lv0]; + v359 = arith.constant 8 : u32; + v49 = hir.bitcast v48 : u32; + v51 = arith.add v49, v359 : u32 #[overflow = checked]; + v390 = arith.constant 4 : u32; + v53 = arith.mod v51, v390 : u32; + hir.assertz v53 #[code = 250]; + v54 = hir.int_to_ptr v51 : ptr; + v55 = hir.load v54 : felt; + v56 = hir.load_local : i32 #[local = lv1]; + v389 = arith.constant 8 : u32; + v57 = hir.bitcast v56 : u32; + v59 = arith.add v57, v389 : u32 #[overflow = checked]; + v388 = arith.constant 4 : u32; + v61 = arith.mod v59, v388 : u32; + hir.assertz v61 #[code = 250]; + v62 = hir.int_to_ptr v59 : ptr; + v63 = hir.load v62 : felt; + v386 = arith.constant 0 : i32; + v387 = arith.constant 1 : i32; + v64 = arith.eq v55, v63 : i1; + v65 = hir.cast v64 : i32; + v67 = arith.neq v65, v387 : i1; + v68 = arith.zext v67 : u32; + v69 = hir.bitcast v68 : i32; + v71 = arith.neq v69, v386 : i1; + scf.if v71{ + ^block21: + scf.yield ; } else { ^block9: - v65 = arith.constant 12 : u32; - v64 = hir.bitcast v0 : u32; - v66 = arith.add v64, v65 : u32 #[overflow = checked]; - v429 = arith.constant 4 : u32; - v68 = arith.mod v66, v429 : u32; - hir.assertz v68 #[code = 250]; - v69 = hir.int_to_ptr v66 : ptr; - v70 = hir.load v69 : felt; - v428 = arith.constant 12 : u32; - v71 = hir.bitcast v1 : u32; - v73 = arith.add v71, v428 : u32 #[overflow = checked]; - v427 = arith.constant 4 : u32; - v75 = arith.mod v73, v427 : u32; - hir.assertz v75 #[code = 250]; - v76 = hir.int_to_ptr v73 : ptr; - v77 = hir.load v76 : felt; - v78 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::eq(v70, v77) : i32 - v426 = arith.constant 1 : i32; - v80 = arith.eq v78, v426 : i1; - v81 = arith.zext v80 : u32; - v82 = hir.bitcast v81 : i32; - scf.yield v82; + v72 = hir.load_local : i32 #[local = lv0]; + v358 = arith.constant 12 : u32; + v73 = hir.bitcast v72 : u32; + v75 = arith.add v73, v358 : u32 #[overflow = checked]; + v385 = arith.constant 4 : u32; + v77 = arith.mod v75, v385 : u32; + hir.assertz v77 #[code = 250]; + v78 = hir.int_to_ptr v75 : ptr; + v79 = hir.load v78 : felt; + v80 = hir.load_local : i32 #[local = lv1]; + v384 = arith.constant 12 : u32; + v81 = hir.bitcast v80 : u32; + v83 = arith.add v81, v384 : u32 #[overflow = checked]; + v383 = arith.constant 4 : u32; + v85 = arith.mod v83, v383 : u32; + hir.assertz v85 #[code = 250]; + v86 = hir.int_to_ptr v83 : ptr; + v87 = hir.load v86 : felt; + v382 = arith.constant 1 : i32; + v88 = arith.eq v79, v87 : i1; + v89 = hir.cast v88 : i32; + v91 = arith.eq v89, v382 : i1; + v92 = arith.zext v91 : u32; + v93 = hir.bitcast v92 : i32; + hir.store_local v93 #[local = lv2]; + scf.yield ; }; - scf.yield v425; + scf.yield ; }; - scf.yield v424; + scf.yield ; }; - builtin.ret v422; + v94 = hir.load_local : i32 #[local = lv2]; + builtin.ret v94; }; - public builtin.function @entrypoint(v84: felt, v85: felt, v86: felt, v87: felt, v88: felt, v89: felt, v90: felt, v91: felt, v92: felt, v93: felt, v94: felt, v95: felt) { - ^block10(v84: felt, v85: felt, v86: felt, v87: felt, v88: felt, v89: felt, v90: felt, v91: felt, v92: felt, v93: felt, v94: felt, v95: felt): - v97 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/__stack_pointer : ptr - v98 = hir.bitcast v97 : ptr; - v99 = hir.load v98 : i32; - v102 = arith.constant -32 : i32; - v100 = arith.constant 128 : i32; - v101 = arith.sub v99, v100 : i32 #[overflow = wrapping]; - v103 = arith.band v101, v102 : i32; - v104 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/__stack_pointer : ptr - v105 = hir.bitcast v104 : ptr; - hir.store v105, v103; - v106 = arith.constant 32 : i32; - v107 = arith.add v103, v106 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/std::collections::smt::set(v87, v86, v85, v84, v91, v90, v89, v88, v95, v94, v93, v92, v107) - v109 = arith.constant 40 : u32; - v108 = hir.bitcast v103 : u32; - v110 = arith.add v108, v109 : u32 #[overflow = checked]; - v111 = arith.constant 8 : u32; - v112 = arith.mod v110, v111 : u32; - hir.assertz v112 #[code = 250]; - v113 = hir.int_to_ptr v110 : ptr; - v114 = hir.load v113 : i64; - v116 = arith.constant 88 : u32; - v115 = hir.bitcast v103 : u32; - v117 = arith.add v115, v116 : u32 #[overflow = checked]; - v485 = arith.constant 8 : u32; - v119 = arith.mod v117, v485 : u32; - hir.assertz v119 #[code = 250]; - v120 = hir.int_to_ptr v117 : ptr; - hir.store v120, v114; - v122 = arith.constant 32 : u32; - v121 = hir.bitcast v103 : u32; - v123 = arith.add v121, v122 : u32 #[overflow = checked]; - v484 = arith.constant 8 : u32; - v125 = arith.mod v123, v484 : u32; - hir.assertz v125 #[code = 250]; - v126 = hir.int_to_ptr v123 : ptr; - v127 = hir.load v126 : i64; - v129 = arith.constant 80 : u32; - v128 = hir.bitcast v103 : u32; - v130 = arith.add v128, v129 : u32 #[overflow = checked]; - v483 = arith.constant 8 : u32; - v132 = arith.mod v130, v483 : u32; - hir.assertz v132 #[code = 250]; - v133 = hir.int_to_ptr v130 : ptr; - hir.store v133, v127; - v135 = arith.constant 56 : u32; - v134 = hir.bitcast v103 : u32; - v136 = arith.add v134, v135 : u32 #[overflow = checked]; - v482 = arith.constant 8 : u32; - v138 = arith.mod v136, v482 : u32; - hir.assertz v138 #[code = 250]; - v139 = hir.int_to_ptr v136 : ptr; - v140 = hir.load v139 : i64; - v142 = arith.constant 104 : u32; - v141 = hir.bitcast v103 : u32; - v143 = arith.add v141, v142 : u32 #[overflow = checked]; - v481 = arith.constant 8 : u32; - v145 = arith.mod v143, v481 : u32; + public builtin.function @entrypoint(v95: felt, v96: felt, v97: felt, v98: felt, v99: felt, v100: felt, v101: felt, v102: felt, v103: felt, v104: felt, v105: felt, v106: felt) { + ^block10(v95: felt, v96: felt, v97: felt, v98: felt, v99: felt, v100: felt, v101: felt, v102: felt, v103: felt, v104: felt, v105: felt, v106: felt): + hir.store_local v103 #[local = lv8]; + hir.store_local v104 #[local = lv9]; + hir.store_local v105 #[local = lv10]; + v107 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/__stack_pointer : ptr + v108 = hir.bitcast v107 : ptr; + v109 = hir.load v108 : i32; + hir.store_local v109 #[local = lv12]; + hir.store_local v109 #[local = lv13]; + v110 = hir.load_local : i32 #[local = lv12]; + v437 = arith.constant -32 : i32; + v438 = arith.constant 96 : i32; + v112 = arith.sub v110, v438 : i32 #[overflow = wrapping]; + v114 = arith.band v112, v437 : i32; + hir.store_local v114 #[local = lv12]; + v115 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/__stack_pointer : ptr + v116 = hir.bitcast v115 : ptr; + hir.store v116, v114; + v126 = hir.load_local : felt #[local = lv10]; + v127 = hir.load_local : felt #[local = lv9]; + v128 = hir.load_local : felt #[local = lv8]; + v129 = hir.load_local : i32 #[local = lv12]; + v436 = arith.constant 64 : i32; + v131 = arith.add v129, v436 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/miden::core::collections::smt::set(v98, v97, v96, v95, v102, v101, v100, v99, v106, v126, v127, v128, v131) + v132 = hir.load_local : i32 #[local = lv12]; + v435 = arith.constant 88 : u32; + v133 = hir.bitcast v132 : u32; + v135 = arith.add v133, v435 : u32 #[overflow = checked]; + v434 = arith.constant 8 : u32; + v137 = arith.mod v135, v434 : u32; + hir.assertz v137 #[code = 250]; + v138 = hir.int_to_ptr v135 : ptr; + v139 = hir.load v138 : i64; + v140 = hir.load_local : i32 #[local = lv12]; + v433 = arith.constant 80 : u32; + v141 = hir.bitcast v140 : u32; + v143 = arith.add v141, v433 : u32 #[overflow = checked]; + v491 = arith.constant 8 : u32; + v145 = arith.mod v143, v491 : u32; hir.assertz v145 #[code = 250]; v146 = hir.int_to_ptr v143 : ptr; - hir.store v146, v140; - v148 = arith.constant 48 : u32; - v147 = hir.bitcast v103 : u32; - v149 = arith.add v147, v148 : u32 #[overflow = checked]; - v480 = arith.constant 8 : u32; - v151 = arith.mod v149, v480 : u32; - hir.assertz v151 #[code = 250]; - v152 = hir.int_to_ptr v149 : ptr; - v153 = hir.load v152 : i64; - v155 = arith.constant 96 : u32; - v154 = hir.bitcast v103 : u32; - v156 = arith.add v154, v155 : u32 #[overflow = checked]; - v479 = arith.constant 8 : u32; - v158 = arith.mod v156, v479 : u32; - hir.assertz v158 #[code = 250]; - v159 = hir.int_to_ptr v156 : ptr; - hir.store v159, v153; - v160 = arith.constant 80 : i32; - v161 = arith.add v103, v160 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/::reverse(v103, v161) - v164 = arith.constant 96 : i32; - v165 = arith.add v103, v164 : i32 #[overflow = wrapping]; - v162 = arith.constant 112 : i32; - v163 = arith.add v103, v162 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/::reverse(v163, v165) - v169 = arith.constant 120 : u32; - v168 = hir.bitcast v103 : u32; - v170 = arith.add v168, v169 : u32 #[overflow = checked]; - v478 = arith.constant 8 : u32; - v172 = arith.mod v170, v478 : u32; + v147 = hir.load v146 : i64; + v148 = hir.load_local : i32 #[local = lv12]; + v432 = arith.constant 72 : u32; + v149 = hir.bitcast v148 : u32; + v151 = arith.add v149, v432 : u32 #[overflow = checked]; + v490 = arith.constant 8 : u32; + v153 = arith.mod v151, v490 : u32; + hir.assertz v153 #[code = 250]; + v154 = hir.int_to_ptr v151 : ptr; + v155 = hir.load v154 : i64; + v156 = hir.load_local : i32 #[local = lv12]; + v431 = arith.constant 64 : u32; + v158 = hir.bitcast v156 : u32; + v160 = arith.add v158, v431 : u32 #[overflow = checked]; + v489 = arith.constant 8 : u32; + v162 = arith.mod v160, v489 : u32; + hir.assertz v162 #[code = 250]; + v163 = hir.int_to_ptr v160 : ptr; + v164 = hir.load v163 : i64; + v408, v409 = arith.split v164 : felt, felt; + v430 = arith.constant 24 : u32; + v168 = hir.bitcast v156 : u32; + v170 = arith.add v168, v430 : u32 #[overflow = checked]; + v488 = arith.constant 8 : u32; + v172 = arith.mod v170, v488 : u32; hir.assertz v172 #[code = 250]; + v410 = arith.join v409, v408 : i64; v173 = hir.int_to_ptr v170 : ptr; - v174 = hir.load v173 : i64; - v166 = arith.constant 24 : i32; - v167 = arith.add v103, v166 : i32 #[overflow = wrapping]; - v175 = hir.bitcast v167 : u32; - v477 = arith.constant 8 : u32; - v177 = arith.mod v175, v477 : u32; - hir.assertz v177 #[code = 250]; - v178 = hir.int_to_ptr v175 : ptr; - hir.store v178, v174; - v180 = arith.constant 112 : u32; - v179 = hir.bitcast v103 : u32; - v181 = arith.add v179, v180 : u32 #[overflow = checked]; - v476 = arith.constant 8 : u32; - v183 = arith.mod v181, v476 : u32; + hir.store v173, v410; + v174 = hir.load_local : i32 #[local = lv12]; + v405, v406 = arith.split v155 : felt, felt; + v429 = arith.constant 16 : u32; + v179 = hir.bitcast v174 : u32; + v181 = arith.add v179, v429 : u32 #[overflow = checked]; + v487 = arith.constant 8 : u32; + v183 = arith.mod v181, v487 : u32; hir.assertz v183 #[code = 250]; + v407 = arith.join v406, v405 : i64; v184 = hir.int_to_ptr v181 : ptr; - v185 = hir.load v184 : i64; - v187 = arith.constant 16 : u32; - v186 = hir.bitcast v103 : u32; - v188 = arith.add v186, v187 : u32 #[overflow = checked]; - v475 = arith.constant 8 : u32; - v190 = arith.mod v188, v475 : u32; - hir.assertz v190 #[code = 250]; - v191 = hir.int_to_ptr v188 : ptr; - hir.store v191, v185; - v192 = arith.constant 0 : i64; - v193 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::from_u64_unchecked(v192) : felt - v474 = arith.constant 0 : i64; - v195 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::from_u64_unchecked(v474) : felt - v473 = arith.constant 0 : i64; - v197 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::from_u64_unchecked(v473) : felt - v472 = arith.constant 0 : i64; - v199 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::from_u64_unchecked(v472) : felt - v201 = arith.constant 124 : u32; - v200 = hir.bitcast v103 : u32; - v202 = arith.add v200, v201 : u32 #[overflow = checked]; - v203 = arith.constant 4 : u32; - v204 = arith.mod v202, v203 : u32; - hir.assertz v204 #[code = 250]; - v205 = hir.int_to_ptr v202 : ptr; - hir.store v205, v199; - v471 = arith.constant 120 : u32; - v206 = hir.bitcast v103 : u32; - v208 = arith.add v206, v471 : u32 #[overflow = checked]; - v470 = arith.constant 4 : u32; - v210 = arith.mod v208, v470 : u32; - hir.assertz v210 #[code = 250]; - v211 = hir.int_to_ptr v208 : ptr; - hir.store v211, v197; - v213 = arith.constant 116 : u32; - v212 = hir.bitcast v103 : u32; - v214 = arith.add v212, v213 : u32 #[overflow = checked]; - v469 = arith.constant 4 : u32; - v216 = arith.mod v214, v469 : u32; - hir.assertz v216 #[code = 250]; - v217 = hir.int_to_ptr v214 : ptr; - hir.store v217, v195; - v468 = arith.constant 112 : u32; - v218 = hir.bitcast v103 : u32; - v220 = arith.add v218, v468 : u32 #[overflow = checked]; - v467 = arith.constant 4 : u32; - v222 = arith.mod v220, v467 : u32; - hir.assertz v222 #[code = 250]; - v223 = hir.int_to_ptr v220 : ptr; - hir.store v223, v193; - v224 = arith.constant -8162549007765693629 : i64; - v225 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::from_u64_unchecked(v224) : felt - v226 = arith.constant 2968936853898945160 : i64; - v227 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::from_u64_unchecked(v226) : felt - v228 = arith.constant 4556576161526575002 : i64; - v229 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::from_u64_unchecked(v228) : felt - v230 = arith.constant 900237903234600995 : i64; - v231 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::from_u64_unchecked(v230) : felt - v233 = arith.constant 44 : u32; - v232 = hir.bitcast v103 : u32; - v234 = arith.add v232, v233 : u32 #[overflow = checked]; - v466 = arith.constant 4 : u32; - v236 = arith.mod v234, v466 : u32; + hir.store v184, v407; + v185 = hir.load_local : i32 #[local = lv12]; + v402, v403 = arith.split v147 : felt, felt; + v428 = arith.constant 40 : u32; + v190 = hir.bitcast v185 : u32; + v192 = arith.add v190, v428 : u32 #[overflow = checked]; + v486 = arith.constant 8 : u32; + v194 = arith.mod v192, v486 : u32; + hir.assertz v194 #[code = 250]; + v404 = arith.join v403, v402 : i64; + v195 = hir.int_to_ptr v192 : ptr; + hir.store v195, v404; + v196 = hir.load_local : i32 #[local = lv12]; + v399, v400 = arith.split v139 : felt, felt; + v427 = arith.constant 32 : u32; + v201 = hir.bitcast v196 : u32; + v203 = arith.add v201, v427 : u32 #[overflow = checked]; + v485 = arith.constant 8 : u32; + v205 = arith.mod v203, v485 : u32; + hir.assertz v205 #[code = 250]; + v401 = arith.join v400, v399 : i64; + v206 = hir.int_to_ptr v203 : ptr; + hir.store v206, v401; + v426 = arith.constant 0 : i64; + v208 = arith.trunc v426 : felt; + hir.store_local v208 #[local = lv8]; + v484 = arith.constant 0 : i64; + v210 = arith.trunc v484 : felt; + hir.store_local v210 #[local = lv9]; + hir.store_local v210 #[local = lv10]; + v213 = hir.load_local : i32 #[local = lv12]; + v425 = arith.constant 60 : u32; + v216 = hir.bitcast v213 : u32; + v218 = arith.add v216, v425 : u32 #[overflow = checked]; + v424 = arith.constant 4 : u32; + v220 = arith.mod v218, v424 : u32; + hir.assertz v220 #[code = 250]; + v221 = hir.int_to_ptr v218 : ptr; + hir.store v221, v210; + v222 = hir.load_local : i32 #[local = lv12]; + v223 = hir.load_local : felt #[local = lv10]; + v423 = arith.constant 56 : u32; + v224 = hir.bitcast v222 : u32; + v226 = arith.add v224, v423 : u32 #[overflow = checked]; + v483 = arith.constant 4 : u32; + v228 = arith.mod v226, v483 : u32; + hir.assertz v228 #[code = 250]; + v229 = hir.int_to_ptr v226 : ptr; + hir.store v229, v223; + v230 = hir.load_local : i32 #[local = lv12]; + v231 = hir.load_local : felt #[local = lv9]; + v422 = arith.constant 52 : u32; + v232 = hir.bitcast v230 : u32; + v234 = arith.add v232, v422 : u32 #[overflow = checked]; + v482 = arith.constant 4 : u32; + v236 = arith.mod v234, v482 : u32; hir.assertz v236 #[code = 250]; v237 = hir.int_to_ptr v234 : ptr; hir.store v237, v231; - v465 = arith.constant 40 : u32; - v238 = hir.bitcast v103 : u32; - v240 = arith.add v238, v465 : u32 #[overflow = checked]; - v464 = arith.constant 4 : u32; - v242 = arith.mod v240, v464 : u32; - hir.assertz v242 #[code = 250]; - v243 = hir.int_to_ptr v240 : ptr; - hir.store v243, v229; - v245 = arith.constant 36 : u32; - v244 = hir.bitcast v103 : u32; - v246 = arith.add v244, v245 : u32 #[overflow = checked]; - v463 = arith.constant 4 : u32; - v248 = arith.mod v246, v463 : u32; - hir.assertz v248 #[code = 250]; - v249 = hir.int_to_ptr v246 : ptr; - hir.store v249, v227; - v462 = arith.constant 32 : u32; - v250 = hir.bitcast v103 : u32; - v252 = arith.add v250, v462 : u32 #[overflow = checked]; - v461 = arith.constant 4 : u32; - v254 = arith.mod v252, v461 : u32; - hir.assertz v254 #[code = 250]; - v255 = hir.int_to_ptr v252 : ptr; - hir.store v255, v225; - v460 = arith.constant 112 : i32; - v257 = arith.add v103, v460 : i32 #[overflow = wrapping]; - v258 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/::eq(v103, v257) : i32 - v459 = arith.constant 0 : i32; - v96 = arith.constant 0 : i32; - v260 = arith.eq v258, v96 : i1; - v261 = arith.zext v260 : u32; - v262 = hir.bitcast v261 : i32; - v264 = arith.neq v262, v459 : i1; - v449 = scf.if v264 : u32 { - ^block36: - v445 = arith.constant 0 : u32; - scf.yield v445; + v238 = hir.load_local : i32 #[local = lv12]; + v239 = hir.load_local : felt #[local = lv8]; + v421 = arith.constant 48 : u32; + v240 = hir.bitcast v238 : u32; + v242 = arith.add v240, v421 : u32 #[overflow = checked]; + v481 = arith.constant 4 : u32; + v244 = arith.mod v242, v481 : u32; + hir.assertz v244 #[code = 250]; + v245 = hir.int_to_ptr v242 : ptr; + hir.store v245, v239; + v420 = arith.constant -8162549007765693629 : i64; + v247 = arith.trunc v420 : felt; + hir.store_local v247 #[local = lv8]; + v419 = arith.constant 2968936853898945160 : i64; + v249 = arith.trunc v419 : felt; + hir.store_local v249 #[local = lv9]; + v418 = arith.constant 4556576161526575002 : i64; + v251 = arith.trunc v418 : felt; + hir.store_local v251 #[local = lv10]; + v252 = hir.load_local : i32 #[local = lv12]; + v416 = arith.constant 76 : u32; + v255 = hir.bitcast v252 : u32; + v257 = arith.add v255, v416 : u32 #[overflow = checked]; + v480 = arith.constant 4 : u32; + v259 = arith.mod v257, v480 : u32; + hir.assertz v259 #[code = 250]; + v417 = arith.constant 900237903234600995 : i64; + v254 = arith.trunc v417 : felt; + v260 = hir.int_to_ptr v257 : ptr; + hir.store v260, v254; + v261 = hir.load_local : i32 #[local = lv12]; + v262 = hir.load_local : felt #[local = lv10]; + v479 = arith.constant 72 : u32; + v263 = hir.bitcast v261 : u32; + v265 = arith.add v263, v479 : u32 #[overflow = checked]; + v478 = arith.constant 4 : u32; + v267 = arith.mod v265, v478 : u32; + hir.assertz v267 #[code = 250]; + v268 = hir.int_to_ptr v265 : ptr; + hir.store v268, v262; + v269 = hir.load_local : i32 #[local = lv12]; + v270 = hir.load_local : felt #[local = lv9]; + v415 = arith.constant 68 : u32; + v271 = hir.bitcast v269 : u32; + v273 = arith.add v271, v415 : u32 #[overflow = checked]; + v477 = arith.constant 4 : u32; + v275 = arith.mod v273, v477 : u32; + hir.assertz v275 #[code = 250]; + v276 = hir.int_to_ptr v273 : ptr; + hir.store v276, v270; + v277 = hir.load_local : i32 #[local = lv12]; + v278 = hir.load_local : felt #[local = lv8]; + v476 = arith.constant 64 : u32; + v279 = hir.bitcast v277 : u32; + v281 = arith.add v279, v476 : u32 #[overflow = checked]; + v475 = arith.constant 4 : u32; + v283 = arith.mod v281, v475 : u32; + hir.assertz v283 #[code = 250]; + v284 = hir.int_to_ptr v281 : ptr; + hir.store v284, v278; + v285 = hir.load_local : i32 #[local = lv12]; + v413 = arith.constant 48 : i32; + v290 = arith.add v285, v413 : i32 #[overflow = wrapping]; + v414 = arith.constant 16 : i32; + v287 = arith.add v285, v414 : i32 #[overflow = wrapping]; + v291 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/::eq(v287, v290) : i32 + v474 = arith.constant 0 : i32; + v442 = arith.constant 0 : i32; + v293 = arith.eq v291, v442 : i1; + v294 = arith.zext v293 : u32; + v295 = hir.bitcast v294 : i32; + v297 = arith.neq v295, v474 : i1; + v464 = scf.if v297 : u32 { + ^block28: + v460 = arith.constant 0 : u32; + scf.yield v460; } else { ^block13: - v458 = arith.constant 32 : i32; - v268 = arith.add v103, v458 : i32 #[overflow = wrapping]; - v265 = arith.constant 16 : i32; - v266 = arith.add v103, v265 : i32 #[overflow = wrapping]; - v269 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/::eq(v266, v268) : i32 - v456 = arith.constant 0 : i32; - v457 = arith.constant 0 : i32; - v271 = arith.eq v269, v457 : i1; - v272 = arith.zext v271 : u32; - v273 = hir.bitcast v272 : i32; - v275 = arith.neq v273, v456 : i1; - scf.if v275{ - ^block35: + v298 = hir.load_local : i32 #[local = lv12]; + v473 = arith.constant 64 : i32; + v303 = arith.add v298, v473 : i32 #[overflow = wrapping]; + v411 = arith.constant 32 : i32; + v300 = arith.add v298, v411 : i32 #[overflow = wrapping]; + v304 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/::eq(v300, v303) : i32 + v471 = arith.constant 0 : i32; + v472 = arith.constant 0 : i32; + v306 = arith.eq v304, v472 : i1; + v307 = arith.zext v306 : u32; + v308 = hir.bitcast v307 : i32; + v310 = arith.neq v308, v471 : i1; + scf.if v310{ + ^block27: scf.yield ; } else { ^block14: - v276 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/__stack_pointer : ptr - v277 = hir.bitcast v276 : ptr; - hir.store v277, v99; + v311 = hir.load_local : i32 #[local = lv13]; + v312 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/__stack_pointer : ptr + v313 = hir.bitcast v312 : ptr; + hir.store v313, v311; scf.yield ; }; - v447 = arith.constant 1 : u32; - v455 = arith.constant 0 : u32; - v453 = cf.select v275, v455, v447 : u32; - scf.yield v453; + v462 = arith.constant 1 : u32; + v470 = arith.constant 0 : u32; + v468 = cf.select v310, v470, v462 : u32; + scf.yield v468; }; - v454 = arith.constant 0 : u32; - v452 = arith.eq v449, v454 : i1; - cf.cond_br v452 ^block12, ^block38; + v469 = arith.constant 0 : u32; + v467 = arith.eq v464, v469 : i1; + cf.cond_br v467 ^block12, ^block30; ^block12: ub.unreachable ; - ^block38: - builtin.ret ; - }; - - private builtin.function @::reverse(v278: i32, v279: i32) { - ^block15(v278: i32, v279: i32): - v282 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/__stack_pointer : ptr - v283 = hir.bitcast v282 : ptr; - v284 = hir.load v283 : i32; - v285 = arith.constant 16 : i32; - v286 = arith.sub v284, v285 : i32 #[overflow = wrapping]; - v288 = arith.constant 8 : u32; - v287 = hir.bitcast v279 : u32; - v289 = arith.add v287, v288 : u32 #[overflow = checked]; - v572 = arith.constant 8 : u32; - v291 = arith.mod v289, v572 : u32; - hir.assertz v291 #[code = 250]; - v292 = hir.int_to_ptr v289 : ptr; - v293 = hir.load v292 : i64; - v571 = arith.constant 8 : u32; - v294 = hir.bitcast v286 : u32; - v296 = arith.add v294, v571 : u32 #[overflow = checked]; - v297 = arith.constant 4 : u32; - v298 = arith.mod v296, v297 : u32; - hir.assertz v298 #[code = 250]; - v299 = hir.int_to_ptr v296 : ptr; - hir.store v299, v293; - v300 = hir.bitcast v279 : u32; - v570 = arith.constant 8 : u32; - v302 = arith.mod v300, v570 : u32; - hir.assertz v302 #[code = 250]; - v303 = hir.int_to_ptr v300 : ptr; - v304 = hir.load v303 : i64; - v305 = hir.bitcast v286 : u32; - v569 = arith.constant 4 : u32; - v307 = arith.mod v305, v569 : u32; - hir.assertz v307 #[code = 250]; - v308 = hir.int_to_ptr v305 : ptr; - hir.store v308, v304; - v309 = arith.constant 12 : i32; - v310 = arith.add v286, v309 : i32 #[overflow = wrapping]; - v280 = arith.constant 0 : i32; - v540, v541, v542, v543, v544, v545 = scf.while v280, v286, v310, v278 : i32, i32, i32, i32, i32, i32 { - ^block48(v546: i32, v547: i32, v548: i32, v549: i32): - v568 = arith.constant 0 : i32; - v313 = arith.constant 8 : i32; - v314 = arith.eq v546, v313 : i1; - v315 = arith.zext v314 : u32; - v316 = hir.bitcast v315 : i32; - v318 = arith.neq v316, v568 : i1; - v534, v535 = scf.if v318 : i32, i32 { - ^block47: - v494 = ub.poison i32 : i32; - scf.yield v494, v494; - } else { - ^block20: - v320 = arith.add v547, v546 : i32 #[overflow = wrapping]; - v321 = hir.bitcast v320 : u32; - v567 = arith.constant 4 : u32; - v323 = arith.mod v321, v567 : u32; - hir.assertz v323 #[code = 250]; - v324 = hir.int_to_ptr v321 : ptr; - v325 = hir.load v324 : felt; - v327 = hir.bitcast v548 : u32; - v566 = arith.constant 4 : u32; - v329 = arith.mod v327, v566 : u32; - hir.assertz v329 #[code = 250]; - v330 = hir.int_to_ptr v327 : ptr; - v331 = hir.load v330 : i32; - v332 = hir.bitcast v320 : u32; - v565 = arith.constant 4 : u32; - v334 = arith.mod v332, v565 : u32; - hir.assertz v334 #[code = 250]; - v335 = hir.int_to_ptr v332 : ptr; - hir.store v335, v331; - v336 = hir.bitcast v548 : u32; - v564 = arith.constant 4 : u32; - v338 = arith.mod v336, v564 : u32; - hir.assertz v338 #[code = 250]; - v339 = hir.int_to_ptr v336 : ptr; - hir.store v339, v325; - v342 = arith.constant -4 : i32; - v343 = arith.add v548, v342 : i32 #[overflow = wrapping]; - v340 = arith.constant 4 : i32; - v341 = arith.add v546, v340 : i32 #[overflow = wrapping]; - scf.yield v341, v343; - }; - v562 = ub.poison i32 : i32; - v537 = cf.select v318, v562, v549 : i32; - v563 = ub.poison i32 : i32; - v536 = cf.select v318, v563, v547 : i32; - v493 = arith.constant 1 : u32; - v486 = arith.constant 0 : u32; - v539 = cf.select v318, v486, v493 : u32; - v527 = arith.trunc v539 : i1; - scf.condition v527, v534, v536, v535, v537, v547, v549; - } do { - ^block49(v550: i32, v551: i32, v552: i32, v553: i32, v554: i32, v555: i32): - scf.yield v550, v551, v552, v553; - }; - v561 = arith.constant 8 : u32; - v345 = hir.bitcast v544 : u32; - v347 = arith.add v345, v561 : u32 #[overflow = checked]; - v560 = arith.constant 4 : u32; - v349 = arith.mod v347, v560 : u32; - hir.assertz v349 #[code = 250]; - v350 = hir.int_to_ptr v347 : ptr; - v351 = hir.load v350 : i64; - v559 = arith.constant 8 : u32; - v352 = hir.bitcast v545 : u32; - v354 = arith.add v352, v559 : u32 #[overflow = checked]; - v558 = arith.constant 8 : u32; - v356 = arith.mod v354, v558 : u32; - hir.assertz v356 #[code = 250]; - v357 = hir.int_to_ptr v354 : ptr; - hir.store v357, v351; - v358 = hir.bitcast v544 : u32; - v557 = arith.constant 4 : u32; - v360 = arith.mod v358, v557 : u32; - hir.assertz v360 #[code = 250]; - v361 = hir.int_to_ptr v358 : ptr; - v362 = hir.load v361 : i64; - v363 = hir.bitcast v545 : u32; - v556 = arith.constant 8 : u32; - v365 = arith.mod v363, v556 : u32; - hir.assertz v365 #[code = 250]; - v366 = hir.int_to_ptr v363 : ptr; - hir.store v366, v362; + ^block30: builtin.ret ; }; - private builtin.function @intrinsics::felt::eq(v367: felt, v368: felt) -> i32 { - ^block21(v367: felt, v368: felt): - v369 = arith.eq v367, v368 : i1; - v370 = hir.cast v369 : i32; - builtin.ret v370; - }; - - private builtin.function @intrinsics::felt::from_u64_unchecked(v372: i64) -> felt { - ^block23(v372: i64): - v373 = hir.cast v372 : felt; - builtin.ret v373; - }; - - private builtin.function @std::collections::smt::set(v375: felt, v376: felt, v377: felt, v378: felt, v379: felt, v380: felt, v381: felt, v382: felt, v383: felt, v384: felt, v385: felt, v386: felt, v387: i32) { - ^block25(v375: felt, v376: felt, v377: felt, v378: felt, v379: felt, v380: felt, v381: felt, v382: felt, v383: felt, v384: felt, v385: felt, v386: felt, v387: i32): - v388, v389, v390, v391, v392, v393, v394, v395 = hir.exec @std/collections/smt/set(v375, v376, v377, v378, v379, v380, v381, v382, v383, v384, v385, v386) : felt, felt, felt, felt, felt, felt, felt, felt - v396 = hir.bitcast v387 : u32; - v397 = hir.int_to_ptr v396 : ptr; - hir.store v397, v388; - v398 = arith.constant 4 : u32; - v399 = arith.add v396, v398 : u32 #[overflow = checked]; - v400 = hir.int_to_ptr v399 : ptr; - hir.store v400, v389; - v401 = arith.constant 8 : u32; - v402 = arith.add v396, v401 : u32 #[overflow = checked]; - v403 = hir.int_to_ptr v402 : ptr; - hir.store v403, v390; - v404 = arith.constant 12 : u32; - v405 = arith.add v396, v404 : u32 #[overflow = checked]; - v406 = hir.int_to_ptr v405 : ptr; - hir.store v406, v391; - v407 = arith.constant 16 : u32; - v408 = arith.add v396, v407 : u32 #[overflow = checked]; - v409 = hir.int_to_ptr v408 : ptr; - hir.store v409, v392; - v410 = arith.constant 20 : u32; - v411 = arith.add v396, v410 : u32 #[overflow = checked]; - v412 = hir.int_to_ptr v411 : ptr; - hir.store v412, v393; - v413 = arith.constant 24 : u32; - v414 = arith.add v396, v413 : u32 #[overflow = checked]; - v415 = hir.int_to_ptr v414 : ptr; - hir.store v415, v394; - v416 = arith.constant 28 : u32; - v417 = arith.add v396, v416 : u32 #[overflow = checked]; - v418 = hir.int_to_ptr v417 : ptr; - hir.store v418, v395; + private builtin.function @miden::core::collections::smt::set(v314: felt, v315: felt, v316: felt, v317: felt, v318: felt, v319: felt, v320: felt, v321: felt, v322: felt, v323: felt, v324: felt, v325: felt, v326: i32) { + ^block15(v314: felt, v315: felt, v316: felt, v317: felt, v318: felt, v319: felt, v320: felt, v321: felt, v322: felt, v323: felt, v324: felt, v325: felt, v326: i32): + v327, v328, v329, v330, v331, v332, v333, v334 = hir.exec @miden/core/collections/smt/set(v314, v315, v316, v317, v318, v319, v320, v321, v322, v323, v324, v325) : felt, felt, felt, felt, felt, felt, felt, felt + v335 = hir.bitcast v326 : u32; + v336 = hir.int_to_ptr v335 : ptr; + hir.store v336, v327; + v498 = arith.constant 4 : u32; + v338 = arith.add v335, v498 : u32 #[overflow = checked]; + v339 = hir.int_to_ptr v338 : ptr; + hir.store v339, v328; + v497 = arith.constant 8 : u32; + v341 = arith.add v335, v497 : u32 #[overflow = checked]; + v342 = hir.int_to_ptr v341 : ptr; + hir.store v342, v329; + v496 = arith.constant 12 : u32; + v344 = arith.add v335, v496 : u32 #[overflow = checked]; + v345 = hir.int_to_ptr v344 : ptr; + hir.store v345, v330; + v495 = arith.constant 16 : u32; + v347 = arith.add v335, v495 : u32 #[overflow = checked]; + v348 = hir.int_to_ptr v347 : ptr; + hir.store v348, v331; + v494 = arith.constant 20 : u32; + v350 = arith.add v335, v494 : u32 #[overflow = checked]; + v351 = hir.int_to_ptr v350 : ptr; + hir.store v351, v332; + v493 = arith.constant 24 : u32; + v353 = arith.add v335, v493 : u32 #[overflow = checked]; + v354 = hir.int_to_ptr v353 : ptr; + hir.store v354, v333; + v492 = arith.constant 28 : u32; + v356 = arith.add v335, v492 : u32 #[overflow = checked]; + v357 = hir.int_to_ptr v356 : ptr; + hir.store v357, v334; builtin.ret ; }; diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_set.masm b/tests/integration/expected/rust_sdk_stdlib_smt_set.masm index 3e8542d8a..d191b557d 100644 --- a/tests/integration/expected/rust_sdk_stdlib_smt_set.masm +++ b/tests/integration/expected/rust_sdk_stdlib_smt_set.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,14 +10,47 @@ proc init mem_store.278528 end -# mod root_ns:root@1.0.0::rust_sdk_stdlib_smt_set +# mod ::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_set +@locals("3") @callconv("C") proc ::eq( i32, i32 ) -> i32 - dup.0 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -31,7 +64,14 @@ proc ::eq( exec.::intrinsics::mem::load_felt trace.252 nop - dup.2 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -45,24 +85,26 @@ proc ::eq( exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::eq - trace.252 - nop push.0 push.1 - movup.2 + movup.3 + movup.3 + eq neq neq if.true - drop - drop - push.0 + nop else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + swap.1 add u32assert push.4 @@ -78,8 +120,16 @@ proc ::eq( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.3 + swap.1 add u32assert push.4 @@ -95,24 +145,26 @@ proc ::eq( exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::eq - trace.252 - nop push.0 push.1 - movup.2 + movup.3 + movup.3 + eq neq neq if.true - drop - drop - push.0 + nop else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.1 + swap.1 add u32assert push.4 @@ -128,8 +180,16 @@ proc ::eq( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.3 + swap.1 add u32assert push.4 @@ -145,22 +205,24 @@ proc ::eq( exec.::intrinsics::mem::load_felt trace.252 nop - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::eq - trace.252 - nop push.0 push.1 - movup.2 + movup.3 + movup.3 + eq neq neq if.true - drop - drop - push.0 + nop else + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 swap.1 add @@ -178,8 +240,16 @@ proc ::eq( exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - movup.2 + swap.1 add u32assert push.4 @@ -195,19 +265,32 @@ proc ::eq( exec.::intrinsics::mem::load_felt trace.252 nop + push.1 + movdn.2 + eq + eq + locaddr.2 + push.0 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::eq + exec.::intrinsics::mem::store_sw trace.252 nop - push.1 - eq end end end + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end +@locals("20") @callconv("C") pub proc entrypoint( felt, @@ -223,6 +306,33 @@ pub proc entrypoint( felt, felt ) + movup.8 + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + movup.8 + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + movup.8 + locaddr.10 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1114112 u32divmod.4 swap.1 @@ -231,15 +341,47 @@ pub proc entrypoint( exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.12 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.13 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.12 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4294967264 - push.128 - dup.2 + push.96 + movup.2 swap.1 u32wrapping_sub u32and - push.1114112 - dup.1 + dup.0 + locaddr.12 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114112 u32divmod.4 swap.1 trace.240 @@ -247,28 +389,69 @@ pub proc entrypoint( exec.::intrinsics::mem::store_sw trace.252 nop - push.32 - dup.1 + locaddr.10 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + locaddr.12 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.64 u32wrapping_add + movup.2 + swap.10 + swap.5 + movdn.2 swap.1 - swap.13 + swap.11 + swap.4 + swap.3 swap.9 - swap.5 + swap.6 swap.1 swap.12 - swap.10 - swap.4 - swap.2 - swap.14 swap.8 - swap.6 + swap.7 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::std::collections::smt::set + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_set::"miden::core::collections::smt::set" trace.252 nop - push.40 - dup.1 + locaddr.12 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.88 + swap.1 add u32assert push.8 @@ -285,8 +468,16 @@ pub proc entrypoint( trace.252 nop swap.1 - push.88 - dup.3 + locaddr.12 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.80 + swap.1 add u32assert push.8 @@ -297,15 +488,22 @@ pub proc entrypoint( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_dw trace.252 nop - push.32 - dup.1 + swap.1 + locaddr.12 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.72 + swap.1 add u32assert push.8 @@ -322,26 +520,15 @@ pub proc entrypoint( trace.252 nop swap.1 - push.80 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.12 + push.0 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop - push.56 + push.64 dup.1 add u32assert @@ -359,8 +546,8 @@ pub proc entrypoint( trace.252 nop swap.1 - push.104 - dup.3 + push.24 + movup.3 add u32assert push.8 @@ -369,6 +556,8 @@ pub proc entrypoint( u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -378,26 +567,17 @@ pub proc entrypoint( exec.::intrinsics::mem::store_dw trace.252 nop - push.48 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.12 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop - swap.1 - push.96 - dup.3 + movdn.2 + push.16 + movup.3 add u32assert push.8 @@ -406,6 +586,8 @@ pub proc entrypoint( u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -415,28 +597,17 @@ pub proc entrypoint( exec.::intrinsics::mem::store_dw trace.252 nop - push.80 - dup.1 - u32wrapping_add - dup.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::::reverse - trace.252 - nop - push.96 - dup.1 - u32wrapping_add - push.112 - dup.2 - u32wrapping_add + locaddr.12 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::::reverse + exec.::intrinsics::mem::load_sw trace.252 nop - push.120 - dup.1 + movdn.2 + push.40 + movup.3 add u32assert push.8 @@ -445,23 +616,8 @@ pub proc entrypoint( u32mod u32assert assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.24 - dup.3 - u32wrapping_add - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -471,26 +627,17 @@ pub proc entrypoint( exec.::intrinsics::mem::store_dw trace.252 nop - push.112 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.12 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop - swap.1 - push.16 - dup.3 + movdn.2 + push.32 + movup.3 add u32assert push.8 @@ -499,6 +646,8 @@ pub proc entrypoint( u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 movup.2 @@ -510,34 +659,48 @@ pub proc entrypoint( nop push.0 push.0 + mul.4294967296 + add + locaddr.8 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::from_u64_unchecked + exec.::intrinsics::mem::store_felt trace.252 nop push.0 push.0 + mul.4294967296 + add + dup.0 + locaddr.9 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::from_u64_unchecked + exec.::intrinsics::mem::store_felt trace.252 nop + dup.0 + locaddr.10 push.0 - push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::from_u64_unchecked + exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.12 push.0 - push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::from_u64_unchecked + exec.::intrinsics::mem::load_sw trace.252 nop - push.124 - dup.5 + push.60 + swap.1 add u32assert push.4 @@ -553,8 +716,24 @@ pub proc entrypoint( exec.::intrinsics::mem::store_felt trace.252 nop - push.120 - dup.4 + locaddr.12 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.10 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.56 + movup.2 add u32assert push.4 @@ -570,8 +749,24 @@ pub proc entrypoint( exec.::intrinsics::mem::store_felt trace.252 nop - push.116 - dup.3 + locaddr.12 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.9 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.52 + movup.2 add u32assert push.4 @@ -587,8 +782,24 @@ pub proc entrypoint( exec.::intrinsics::mem::store_felt trace.252 nop - push.112 - dup.2 + locaddr.12 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.48 + movup.2 add u32assert push.4 @@ -606,34 +817,50 @@ pub proc entrypoint( nop push.2858982211 push.2394475756 + mul.4294967296 + add + locaddr.8 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::from_u64_unchecked + exec.::intrinsics::mem::store_felt trace.252 nop push.2838913672 push.691259478 + mul.4294967296 + add + locaddr.9 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::from_u64_unchecked + exec.::intrinsics::mem::store_felt trace.252 nop push.2345529242 push.1060910560 + mul.4294967296 + add + locaddr.10 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::from_u64_unchecked + exec.::intrinsics::mem::store_felt trace.252 nop - push.1940131875 - push.209602970 + locaddr.12 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::from_u64_unchecked + exec.::intrinsics::mem::load_sw trace.252 nop - push.44 - dup.5 + push.76 + swap.1 add u32assert push.4 @@ -642,6 +869,11 @@ pub proc entrypoint( u32mod u32assert assertz + push.1940131875 + push.209602970 + mul.4294967296 + add + swap.1 u32divmod.4 swap.1 trace.240 @@ -649,42 +881,24 @@ pub proc entrypoint( exec.::intrinsics::mem::store_felt trace.252 nop - push.40 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.12 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_sw trace.252 nop - push.36 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.10 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_felt trace.252 nop - push.32 - dup.2 + push.72 + movup.2 add u32assert push.4 @@ -700,92 +914,27 @@ pub proc entrypoint( exec.::intrinsics::mem::store_felt trace.252 nop - push.112 - dup.1 - u32wrapping_add - dup.1 + locaddr.12 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::::eq + exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.9 push.0 - push.0 - movup.2 - eq - neq - if.true - drop - drop - push.0 - else - push.32 - dup.1 - u32wrapping_add - push.16 - movup.2 - u32wrapping_add - trace.240 - nop - exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::::eq - trace.252 - nop - push.0 - push.0 - movup.2 - eq - neq - dup.0 - if.true - swap.1 - drop - else - push.1114112 - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - end - push.1 - push.0 - movup.2 - cdrop - end - push.0 - eq - if.true - push.0 - assert - else - nop - end -end - -@callconv("C") -proc ::reverse( - i32, - i32 -) - push.1114112 - u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::load_felt trace.252 nop - push.16 - u32wrapping_sub - push.8 - dup.3 + push.68 + movup.2 add u32assert - push.8 + push.4 dup.1 swap.1 u32mod @@ -795,12 +944,27 @@ proc ::reverse( swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.12 + push.0 swap.1 - push.8 - dup.3 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.8 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.64 + movup.2 add u32assert push.4 @@ -811,104 +975,75 @@ proc ::reverse( assertz u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::store_felt trace.252 nop - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + locaddr.12 + push.0 swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop - swap.1 - dup.2 - push.4 + push.48 dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 + u32wrapping_add + push.16 movup.2 - movdn.3 + u32wrapping_add trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_set::::eq trace.252 nop - push.12 - dup.1 - u32wrapping_add + push.0 push.0 movup.2 - swap.1 - push.1 - while.true + eq + neq + if.true + push.0 + else + locaddr.12 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.64 + dup.1 + u32wrapping_add + push.32 + movup.2 + u32wrapping_add + trace.240 + nop + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_set::::eq + trace.252 + nop push.0 - push.8 - dup.2 + push.0 + movup.2 eq neq dup.0 if.true - movup.3 - movup.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - dup.2 - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + else + locaddr.13 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.1114112 u32divmod.4 swap.1 trace.240 @@ -916,156 +1051,24 @@ proc ::reverse( exec.::intrinsics::mem::store_sw trace.252 nop - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4294967292 - movup.4 - u32wrapping_add - push.4 - movup.3 - u32wrapping_add end - push.3735929054 - dup.3 - dup.6 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.6 - swap.2 - swap.1 - cdrop push.1 push.0 - movup.6 + movup.2 cdrop - push.1 - u32and - swap.1 - swap.2 - swap.4 - swap.3 - swap.1 - if.true - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end end - drop - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.4 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - movup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop -end - -@callconv("C") -proc intrinsics::felt::eq(felt, felt) -> i32 + push.0 eq + if.true + push.0 + assert + else + nop + end end @callconv("C") -proc intrinsics::felt::from_u64_unchecked([u32; 2]) -> felt - dup.1 - dup.1 - push.1 - push.4294967295 - trace.240 - nop - exec.::std::math::u64::lt - trace.252 - nop - assert - mul.4294967296 - add -end - -@callconv("C") -proc std::collections::smt::set( +proc miden::core::collections::smt::set( felt, felt, felt, @@ -1082,7 +1085,7 @@ proc std::collections::smt::set( ) trace.240 nop - exec.::std::collections::smt::set + exec.::miden::core::collections::smt::set trace.252 nop movup.8 diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_set.wat b/tests/integration/expected/rust_sdk_stdlib_smt_set.wat index ef2dfdf4e..9322933a8 100644 --- a/tests/integration/expected/rust_sdk_stdlib_smt_set.wat +++ b/tests/integration/expected/rust_sdk_stdlib_smt_set.wat @@ -1,10 +1,9 @@ (module $rust_sdk_stdlib_smt_set.wasm (type (;0;) (func (param i32 i32) (result i32))) (type (;1;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32))) - (type (;2;) (func (param i32 i32))) - (type (;3;) (func (param f32 f32) (result i32))) - (type (;4;) (func (param i64) (result f32))) - (type (;5;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32))) + (type (;2;) (func (param f32 f32) (result i32))) + (type (;3;) (func (param i64) (result f32))) + (type (;4;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32))) (table (;0;) 1 1 funcref) (memory (;0;) 16) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -51,12 +50,12 @@ local.get 2 ) (func $entrypoint (;1;) (type 1) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32) - (local i32 i32) + (local i32 i32 i64 i64 i64) global.get $__stack_pointer local.tee 12 local.set 13 local.get 12 - i32.const 128 + i32.const 96 i32.sub i32.const -32 i32.and @@ -75,47 +74,39 @@ local.get 9 local.get 8 local.get 12 - i32.const 32 + i32.const 64 i32.add - call $std::collections::smt::set - local.get 12 - local.get 12 - i64.load offset=40 - i64.store offset=88 - local.get 12 - local.get 12 - i64.load offset=32 - i64.store offset=80 - local.get 12 - local.get 12 - i64.load offset=56 - i64.store offset=104 - local.get 12 - local.get 12 - i64.load offset=48 - i64.store offset=96 + call $miden::core::collections::smt::set local.get 12 + i64.load offset=88 + local.set 14 local.get 12 - i32.const 80 - i32.add - call $::reverse + i64.load offset=80 + local.set 15 local.get 12 - i32.const 112 - i32.add + i64.load offset=72 + local.set 16 local.get 12 - i32.const 96 - i32.add - call $::reverse local.get 12 - i32.const 24 - i32.add + i64.load offset=64 + i64.const 32 + i64.rotl + i64.store offset=24 local.get 12 - i64.load offset=120 - i64.store + local.get 16 + i64.const 32 + i64.rotl + i64.store offset=16 local.get 12 + local.get 15 + i64.const 32 + i64.rotl + i64.store offset=40 local.get 12 - i64.load offset=112 - i64.store offset=16 + local.get 14 + i64.const 32 + i64.rotl + i64.store offset=32 i64.const 0 call $intrinsics::felt::from_u64_unchecked local.set 8 @@ -128,16 +119,16 @@ local.get 12 i64.const 0 call $intrinsics::felt::from_u64_unchecked - f32.store offset=124 + f32.store offset=60 local.get 12 local.get 10 - f32.store offset=120 + f32.store offset=56 local.get 12 local.get 9 - f32.store offset=116 + f32.store offset=52 local.get 12 local.get 8 - f32.store offset=112 + f32.store offset=48 i64.const -8162549007765693629 call $intrinsics::felt::from_u64_unchecked local.set 8 @@ -150,29 +141,31 @@ local.get 12 i64.const 900237903234600995 call $intrinsics::felt::from_u64_unchecked - f32.store offset=44 + f32.store offset=76 local.get 12 local.get 10 - f32.store offset=40 + f32.store offset=72 local.get 12 local.get 9 - f32.store offset=36 + f32.store offset=68 local.get 12 local.get 8 - f32.store offset=32 + f32.store offset=64 block ;; label = @1 local.get 12 + i32.const 16 + i32.add local.get 12 - i32.const 112 + i32.const 48 i32.add call $::eq i32.eqz br_if 0 (;@1;) local.get 12 - i32.const 16 + i32.const 32 i32.add local.get 12 - i32.const 32 + i32.const 64 i32.add call $::eq i32.eqz @@ -183,71 +176,13 @@ end unreachable ) - (func $::reverse (;2;) (type 2) (param i32 i32) - (local i32 i32 i32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - local.get 1 - i64.load offset=8 - i64.store offset=8 align=4 - local.get 2 - local.get 1 - i64.load - i64.store align=4 - local.get 2 - i32.const 12 - i32.add - local.set 3 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 1 - i32.const 8 - i32.eq - br_if 1 (;@1;) - local.get 2 - local.get 1 - i32.add - local.tee 4 - f32.load - local.set 5 - local.get 4 - local.get 3 - i32.load - i32.store - local.get 3 - local.get 5 - f32.store - local.get 1 - i32.const 4 - i32.add - local.set 1 - local.get 3 - i32.const -4 - i32.add - local.set 3 - br 0 (;@2;) - end - end - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 2 - i64.load align=4 - i64.store - ) - (func $intrinsics::felt::eq (;3;) (type 3) (param f32 f32) (result i32) + (func $intrinsics::felt::eq (;2;) (type 2) (param f32 f32) (result i32) unreachable ) - (func $intrinsics::felt::from_u64_unchecked (;4;) (type 4) (param i64) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;3;) (type 3) (param i64) (result f32) unreachable ) - (func $std::collections::smt::set (;5;) (type 5) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32) + (func $miden::core::collections::smt::set (;4;) (type 4) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32) unreachable ) ) diff --git a/tests/integration/expected/shl_i16.hir b/tests/integration/expected/shl_i16.hir index 2f10c1a0c..fc8025723 100644 --- a/tests/integration/expected/shl_i16.hir +++ b/tests/integration/expected/shl_i16.hir @@ -2,12 +2,12 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_c3eed17236100365f8c1660de046d9d6663a7b82697275884d4fcb6fa25a7447 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.constant 15 : i32; - v4 = arith.band v1, v3 : i32; - v5 = hir.bitcast v4 : u32; - v6 = arith.shl v0, v5 : i32; - v7 = arith.sext v6 : i32; - builtin.ret v7; + v10 = arith.constant 15 : i32; + v6 = arith.band v1, v10 : i32; + v7 = hir.bitcast v6 : u32; + v8 = arith.shl v0, v7 : i32; + v9 = arith.sext v8 : i32; + builtin.ret v9; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/shl_i16.masm b/tests/integration/expected/shl_i16.masm index 5f133ba84..cc2d71cb7 100644 --- a/tests/integration/expected/shl_i16.masm +++ b/tests/integration/expected/shl_i16.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_c3eed17236100365f8c1660de046d9d6663a7b82697275884d4fcb6fa25a7447 +# mod ::"root_ns:root@1.0.0"::test_rust_c3eed17236100365f8c1660de046d9d6663a7b82697275884d4fcb6fa25a7447 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 push.15 diff --git a/tests/integration/expected/shl_i32.hir b/tests/integration/expected/shl_i32.hir index b9c3ebe15..db59a4686 100644 --- a/tests/integration/expected/shl_i32.hir +++ b/tests/integration/expected/shl_i32.hir @@ -2,9 +2,9 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_bb1e5acff11c647800da7bb67237f59cfa6dcc846fe64b76bfdce3d151cb1de9 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = hir.bitcast v1 : u32; - v4 = arith.shl v0, v3 : i32; - builtin.ret v4; + v5 = hir.bitcast v1 : u32; + v6 = arith.shl v0, v5 : i32; + builtin.ret v6; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/shl_i32.masm b/tests/integration/expected/shl_i32.masm index 9587d334a..a48a04b03 100644 --- a/tests/integration/expected/shl_i32.masm +++ b/tests/integration/expected/shl_i32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_bb1e5acff11c647800da7bb67237f59cfa6dcc846fe64b76bfdce3d151cb1de9 +# mod ::"root_ns:root@1.0.0"::test_rust_bb1e5acff11c647800da7bb67237f59cfa6dcc846fe64b76bfdce3d151cb1de9 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 swap.1 diff --git a/tests/integration/expected/shl_i64.hir b/tests/integration/expected/shl_i64.hir index f8f7381a7..d190bdddf 100644 --- a/tests/integration/expected/shl_i64.hir +++ b/tests/integration/expected/shl_i64.hir @@ -2,9 +2,9 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_9d7fa5c817c0e8ad40aeb12756fb108047ae365f6bc8c673617a6bc264b3917a { public builtin.function @entrypoint(v0: i64, v1: i64) -> i64 { ^block6(v0: i64, v1: i64): - v3 = hir.cast v1 : u32; - v4 = arith.shl v0, v3 : i64; - builtin.ret v4; + v5 = hir.cast v1 : u32; + v6 = arith.shl v0, v5 : i64; + builtin.ret v6; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/shl_i64.masm b/tests/integration/expected/shl_i64.masm index 383e7e303..86ee35439 100644 --- a/tests/integration/expected/shl_i64.masm +++ b/tests/integration/expected/shl_i64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_9d7fa5c817c0e8ad40aeb12756fb108047ae365f6bc8c673617a6bc264b3917a +# mod ::"root_ns:root@1.0.0"::test_rust_9d7fa5c817c0e8ad40aeb12756fb108047ae365f6bc8c673617a6bc264b3917a +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] movdn.3 @@ -34,7 +35,7 @@ pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] assert trace.240 nop - exec.::std::math::u64::shl + exec.::miden::core::math::u64::shl trace.252 nop end diff --git a/tests/integration/expected/shl_i8.hir b/tests/integration/expected/shl_i8.hir index 597268256..bdc582a63 100644 --- a/tests/integration/expected/shl_i8.hir +++ b/tests/integration/expected/shl_i8.hir @@ -2,12 +2,12 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_64d9b2f2c2b5e80b282b2d87195903012daf88be2507d12d0bc75d869a811922 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.constant 7 : i32; - v4 = arith.band v1, v3 : i32; - v5 = hir.bitcast v4 : u32; - v6 = arith.shl v0, v5 : i32; - v7 = arith.sext v6 : i32; - builtin.ret v7; + v10 = arith.constant 7 : i32; + v6 = arith.band v1, v10 : i32; + v7 = hir.bitcast v6 : u32; + v8 = arith.shl v0, v7 : i32; + v9 = arith.sext v8 : i32; + builtin.ret v9; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/shl_i8.masm b/tests/integration/expected/shl_i8.masm index 534fb8730..9eb91e97a 100644 --- a/tests/integration/expected/shl_i8.masm +++ b/tests/integration/expected/shl_i8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_64d9b2f2c2b5e80b282b2d87195903012daf88be2507d12d0bc75d869a811922 +# mod ::"root_ns:root@1.0.0"::test_rust_64d9b2f2c2b5e80b282b2d87195903012daf88be2507d12d0bc75d869a811922 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 push.7 diff --git a/tests/integration/expected/shl_u16.hir b/tests/integration/expected/shl_u16.hir index 83f458f76..bab4b16f2 100644 --- a/tests/integration/expected/shl_u16.hir +++ b/tests/integration/expected/shl_u16.hir @@ -2,13 +2,13 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_3ab387e5fafe4f8316074728a13b9c62413b6215a11492c80aa3e1d10383e008 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v7 = arith.constant 65535 : i32; - v3 = arith.constant 15 : i32; - v4 = arith.band v1, v3 : i32; - v5 = hir.bitcast v4 : u32; - v6 = arith.shl v0, v5 : i32; - v8 = arith.band v6, v7 : i32; - builtin.ret v8; + v11 = arith.constant 65535 : i32; + v12 = arith.constant 15 : i32; + v6 = arith.band v1, v12 : i32; + v7 = hir.bitcast v6 : u32; + v8 = arith.shl v0, v7 : i32; + v10 = arith.band v8, v11 : i32; + builtin.ret v10; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/shl_u16.masm b/tests/integration/expected/shl_u16.masm index 377ab516e..232fd04d4 100644 --- a/tests/integration/expected/shl_u16.masm +++ b/tests/integration/expected/shl_u16.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_3ab387e5fafe4f8316074728a13b9c62413b6215a11492c80aa3e1d10383e008 +# mod ::"root_ns:root@1.0.0"::test_rust_3ab387e5fafe4f8316074728a13b9c62413b6215a11492c80aa3e1d10383e008 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 push.65535 diff --git a/tests/integration/expected/shl_u32.hir b/tests/integration/expected/shl_u32.hir index d8ea8e040..2c8c3948a 100644 --- a/tests/integration/expected/shl_u32.hir +++ b/tests/integration/expected/shl_u32.hir @@ -2,9 +2,9 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_3618ee9a49fe14195a2097b20a230da5249d5b99ab7da35b402a7c16f4fa5609 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = hir.bitcast v1 : u32; - v4 = arith.shl v0, v3 : i32; - builtin.ret v4; + v5 = hir.bitcast v1 : u32; + v6 = arith.shl v0, v5 : i32; + builtin.ret v6; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/shl_u32.masm b/tests/integration/expected/shl_u32.masm index 13b9fb519..1c37d446a 100644 --- a/tests/integration/expected/shl_u32.masm +++ b/tests/integration/expected/shl_u32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_3618ee9a49fe14195a2097b20a230da5249d5b99ab7da35b402a7c16f4fa5609 +# mod ::"root_ns:root@1.0.0"::test_rust_3618ee9a49fe14195a2097b20a230da5249d5b99ab7da35b402a7c16f4fa5609 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 swap.1 diff --git a/tests/integration/expected/shl_u64.hir b/tests/integration/expected/shl_u64.hir index b45b98052..77b80819f 100644 --- a/tests/integration/expected/shl_u64.hir +++ b/tests/integration/expected/shl_u64.hir @@ -2,9 +2,9 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_ef9c837ab7c2bd11aacdf5ad41eb9264c0daecd169f2b4cfe73fd928059744bb { public builtin.function @entrypoint(v0: i64, v1: i64) -> i64 { ^block6(v0: i64, v1: i64): - v3 = hir.cast v1 : u32; - v4 = arith.shl v0, v3 : i64; - builtin.ret v4; + v5 = hir.cast v1 : u32; + v6 = arith.shl v0, v5 : i64; + builtin.ret v6; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/shl_u64.masm b/tests/integration/expected/shl_u64.masm index 1ca888e39..b5b9d6f98 100644 --- a/tests/integration/expected/shl_u64.masm +++ b/tests/integration/expected/shl_u64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_ef9c837ab7c2bd11aacdf5ad41eb9264c0daecd169f2b4cfe73fd928059744bb +# mod ::"root_ns:root@1.0.0"::test_rust_ef9c837ab7c2bd11aacdf5ad41eb9264c0daecd169f2b4cfe73fd928059744bb +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] movdn.3 @@ -34,7 +35,7 @@ pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] assert trace.240 nop - exec.::std::math::u64::shl + exec.::miden::core::math::u64::shl trace.252 nop end diff --git a/tests/integration/expected/shl_u8.hir b/tests/integration/expected/shl_u8.hir index b805ed217..02d37a19b 100644 --- a/tests/integration/expected/shl_u8.hir +++ b/tests/integration/expected/shl_u8.hir @@ -2,13 +2,13 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_b211bf2251e0ca4732fe0f4b9390e5838c61a0ef97c8b47f099f8c5ab3657e7f { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v7 = arith.constant 255 : i32; - v3 = arith.constant 7 : i32; - v4 = arith.band v1, v3 : i32; - v5 = hir.bitcast v4 : u32; - v6 = arith.shl v0, v5 : i32; - v8 = arith.band v6, v7 : i32; - builtin.ret v8; + v11 = arith.constant 255 : i32; + v12 = arith.constant 7 : i32; + v6 = arith.band v1, v12 : i32; + v7 = hir.bitcast v6 : u32; + v8 = arith.shl v0, v7 : i32; + v10 = arith.band v8, v11 : i32; + builtin.ret v10; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/shl_u8.masm b/tests/integration/expected/shl_u8.masm index cb093478d..59f7865ef 100644 --- a/tests/integration/expected/shl_u8.masm +++ b/tests/integration/expected/shl_u8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_b211bf2251e0ca4732fe0f4b9390e5838c61a0ef97c8b47f099f8c5ab3657e7f +# mod ::"root_ns:root@1.0.0"::test_rust_b211bf2251e0ca4732fe0f4b9390e5838c61a0ef97c8b47f099f8c5ab3657e7f +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 push.255 diff --git a/tests/integration/expected/shr_i64.hir b/tests/integration/expected/shr_i64.hir index c9084b593..4e8450008 100644 --- a/tests/integration/expected/shr_i64.hir +++ b/tests/integration/expected/shr_i64.hir @@ -2,9 +2,9 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_186d93d83b74a241eb99ffa0ead88d2435a288695c19f22c9c35eecfda978717 { public builtin.function @entrypoint(v0: i64, v1: i64) -> i64 { ^block6(v0: i64, v1: i64): - v3 = hir.cast v1 : u32; - v4 = arith.shr v0, v3 : i64; - builtin.ret v4; + v5 = hir.cast v1 : u32; + v6 = arith.shr v0, v5 : i64; + builtin.ret v6; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/shr_i64.masm b/tests/integration/expected/shr_i64.masm index dd6b6591c..4fd6f12db 100644 --- a/tests/integration/expected/shr_i64.masm +++ b/tests/integration/expected/shr_i64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_186d93d83b74a241eb99ffa0ead88d2435a288695c19f22c9c35eecfda978717 +# mod ::"root_ns:root@1.0.0"::test_rust_186d93d83b74a241eb99ffa0ead88d2435a288695c19f22c9c35eecfda978717 +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] movdn.3 diff --git a/tests/integration/expected/shr_u16.hir b/tests/integration/expected/shr_u16.hir index 5177f0eab..3d9c56344 100644 --- a/tests/integration/expected/shr_u16.hir +++ b/tests/integration/expected/shr_u16.hir @@ -2,13 +2,13 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_96d61f728452f9b581e6c765749adb51e9f48ad7e7527bde3c25a5943fa1a541 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.constant 15 : i32; - v4 = arith.band v1, v3 : i32; - v6 = hir.bitcast v4 : u32; - v5 = hir.bitcast v0 : u32; - v7 = arith.shr v5, v6 : u32; - v8 = hir.bitcast v7 : i32; - builtin.ret v8; + v11 = arith.constant 15 : i32; + v6 = arith.band v1, v11 : i32; + v8 = hir.bitcast v6 : u32; + v7 = hir.bitcast v0 : u32; + v9 = arith.shr v7, v8 : u32; + v10 = hir.bitcast v9 : i32; + builtin.ret v10; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/shr_u16.masm b/tests/integration/expected/shr_u16.masm index b18746e71..9aac62f5e 100644 --- a/tests/integration/expected/shr_u16.masm +++ b/tests/integration/expected/shr_u16.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_96d61f728452f9b581e6c765749adb51e9f48ad7e7527bde3c25a5943fa1a541 +# mod ::"root_ns:root@1.0.0"::test_rust_96d61f728452f9b581e6c765749adb51e9f48ad7e7527bde3c25a5943fa1a541 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 push.15 diff --git a/tests/integration/expected/shr_u32.hir b/tests/integration/expected/shr_u32.hir index f7a1f57f0..2a3498901 100644 --- a/tests/integration/expected/shr_u32.hir +++ b/tests/integration/expected/shr_u32.hir @@ -2,11 +2,11 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_98363f37c9b0fb3dc27cafaa81c0eb63c6a764c82cbedfc0da3e37a43e1d2331 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v4 = hir.bitcast v1 : u32; - v3 = hir.bitcast v0 : u32; - v5 = arith.shr v3, v4 : u32; - v6 = hir.bitcast v5 : i32; - builtin.ret v6; + v6 = hir.bitcast v1 : u32; + v5 = hir.bitcast v0 : u32; + v7 = arith.shr v5, v6 : u32; + v8 = hir.bitcast v7 : i32; + builtin.ret v8; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/shr_u32.masm b/tests/integration/expected/shr_u32.masm index fde213fff..72756ae28 100644 --- a/tests/integration/expected/shr_u32.masm +++ b/tests/integration/expected/shr_u32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_98363f37c9b0fb3dc27cafaa81c0eb63c6a764c82cbedfc0da3e37a43e1d2331 +# mod ::"root_ns:root@1.0.0"::test_rust_98363f37c9b0fb3dc27cafaa81c0eb63c6a764c82cbedfc0da3e37a43e1d2331 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 swap.1 diff --git a/tests/integration/expected/shr_u64.hir b/tests/integration/expected/shr_u64.hir index e4940cde7..bccac591f 100644 --- a/tests/integration/expected/shr_u64.hir +++ b/tests/integration/expected/shr_u64.hir @@ -2,11 +2,11 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_9efc7a825f7a743a5fc284e5d1f0d3fc1bb239f780841274be29a84565e75592 { public builtin.function @entrypoint(v0: i64, v1: i64) -> i64 { ^block6(v0: i64, v1: i64): - v4 = hir.cast v1 : u32; - v3 = hir.bitcast v0 : u64; - v5 = arith.shr v3, v4 : u64; - v6 = hir.bitcast v5 : i64; - builtin.ret v6; + v6 = hir.cast v1 : u32; + v5 = hir.bitcast v0 : u64; + v7 = arith.shr v5, v6 : u64; + v8 = hir.bitcast v7 : i64; + builtin.ret v8; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/shr_u64.masm b/tests/integration/expected/shr_u64.masm index dd252fb40..586f300ba 100644 --- a/tests/integration/expected/shr_u64.masm +++ b/tests/integration/expected/shr_u64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_9efc7a825f7a743a5fc284e5d1f0d3fc1bb239f780841274be29a84565e75592 +# mod ::"root_ns:root@1.0.0"::test_rust_9efc7a825f7a743a5fc284e5d1f0d3fc1bb239f780841274be29a84565e75592 +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] movdn.3 @@ -36,7 +37,7 @@ pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] movup.2 trace.240 nop - exec.::std::math::u64::shr + exec.::miden::core::math::u64::shr trace.252 nop end diff --git a/tests/integration/expected/shr_u8.hir b/tests/integration/expected/shr_u8.hir index c7b5676a6..cb026ab54 100644 --- a/tests/integration/expected/shr_u8.hir +++ b/tests/integration/expected/shr_u8.hir @@ -2,13 +2,13 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_04fd0cb7f25bc890cc2570ad64142734f4731c48e1507938bd1b769f028cf2c4 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.constant 7 : i32; - v4 = arith.band v1, v3 : i32; - v6 = hir.bitcast v4 : u32; - v5 = hir.bitcast v0 : u32; - v7 = arith.shr v5, v6 : u32; - v8 = hir.bitcast v7 : i32; - builtin.ret v8; + v11 = arith.constant 7 : i32; + v6 = arith.band v1, v11 : i32; + v8 = hir.bitcast v6 : u32; + v7 = hir.bitcast v0 : u32; + v9 = arith.shr v7, v8 : u32; + v10 = hir.bitcast v9 : i32; + builtin.ret v10; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/shr_u8.masm b/tests/integration/expected/shr_u8.masm index f9ca0cf01..7a64ea971 100644 --- a/tests/integration/expected/shr_u8.masm +++ b/tests/integration/expected/shr_u8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_04fd0cb7f25bc890cc2570ad64142734f4731c48e1507938bd1b769f028cf2c4 +# mod ::"root_ns:root@1.0.0"::test_rust_04fd0cb7f25bc890cc2570ad64142734f4731c48e1507938bd1b769f028cf2c4 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 push.7 diff --git a/tests/integration/expected/sub_felt.hir b/tests/integration/expected/sub_felt.hir index fd06f6d21..f03e74ca1 100644 --- a/tests/integration/expected/sub_felt.hir +++ b/tests/integration/expected/sub_felt.hir @@ -2,14 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @sub_felt { public builtin.function @entrypoint(v0: felt, v1: felt) -> felt { ^block4(v0: felt, v1: felt): - v3 = hir.exec @root_ns:root@1.0.0/sub_felt/intrinsics::felt::sub(v0, v1) : felt - builtin.ret v3; - }; - - private builtin.function @intrinsics::felt::sub(v4: felt, v5: felt) -> felt { - ^block6(v4: felt, v5: felt): - v6 = arith.sub v4, v5 : felt #[overflow = unchecked]; - builtin.ret v6; + v5 = arith.sub v0, v1 : felt #[overflow = unchecked]; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/sub_felt.masm b/tests/integration/expected/sub_felt.masm index 8675fb86b..5a9434697 100644 --- a/tests/integration/expected/sub_felt.masm +++ b/tests/integration/expected/sub_felt.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,19 +10,11 @@ proc init mem_store.278528 end -# mod root_ns:root@1.0.0::sub_felt +# mod ::"root_ns:root@1.0.0"::sub_felt +@locals("2") @callconv("C") pub proc entrypoint(felt, felt) -> felt - trace.240 - nop - exec.::root_ns:root@1.0.0::sub_felt::intrinsics::felt::sub - trace.252 - nop -end - -@callconv("C") -proc intrinsics::felt::sub(felt, felt) -> felt swap.1 sub end diff --git a/tests/integration/expected/sub_i128.hir b/tests/integration/expected/sub_i128.hir index 305b185cc..1dba2683d 100644 --- a/tests/integration/expected/sub_i128.hir +++ b/tests/integration/expected/sub_i128.hir @@ -2,24 +2,35 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_e91108ee147c81774f718f1c0531bff5bc1cdc56c047c1e0475e4e94badee2c8 { public builtin.function @entrypoint(v0: i32, v1: i64, v2: i64, v3: i64, v4: i64) { ^block6(v0: i32, v1: i64, v2: i64, v3: i64, v4: i64): - v6 = arith.join v3, v4 : i128; - v5 = arith.join v1, v2 : i128; - v7 = arith.sub v5, v6 : i128 #[overflow = wrapping]; - v8, v9 = arith.split v7 : i64, i64; - v11 = arith.constant 8 : u32; - v10 = hir.bitcast v0 : u32; - v12 = arith.add v10, v11 : u32 #[overflow = checked]; - v21 = arith.constant 8 : u32; - v14 = arith.mod v12, v21 : u32; - hir.assertz v14 #[code = 250]; - v15 = hir.int_to_ptr v12 : ptr; - hir.store v15, v8; - v16 = hir.bitcast v0 : u32; - v20 = arith.constant 8 : u32; - v18 = arith.mod v16, v20 : u32; - hir.assertz v18 #[code = 250]; - v19 = hir.int_to_ptr v16 : ptr; - hir.store v19, v9; + hir.store_local v0 #[local = lv0]; + hir.store_local v3 #[local = lv3]; + hir.store_local v4 #[local = lv4]; + v7 = hir.load_local : i64 #[local = lv3]; + v8 = hir.load_local : i64 #[local = lv4]; + v10 = arith.join v7, v8 : i128; + v9 = arith.join v1, v2 : i128; + v11 = arith.sub v9, v10 : i128 #[overflow = wrapping]; + v12, v13 = arith.split v11 : i64, i64; + hir.store_local v12 #[local = lv3]; + hir.store_local v13 #[local = lv4]; + v14 = hir.load_local : i32 #[local = lv0]; + v15 = hir.load_local : i64 #[local = lv3]; + v28 = arith.constant 8 : u32; + v16 = hir.bitcast v14 : u32; + v18 = arith.add v16, v28 : u32 #[overflow = checked]; + v32 = arith.constant 8 : u32; + v20 = arith.mod v18, v32 : u32; + hir.assertz v20 #[code = 250]; + v21 = hir.int_to_ptr v18 : ptr; + hir.store v21, v15; + v22 = hir.load_local : i32 #[local = lv0]; + v23 = hir.load_local : i64 #[local = lv4]; + v24 = hir.bitcast v22 : u32; + v31 = arith.constant 8 : u32; + v26 = arith.mod v24, v31 : u32; + hir.assertz v26 #[code = 250]; + v27 = hir.int_to_ptr v24 : ptr; + hir.store v27, v23; builtin.ret ; }; diff --git a/tests/integration/expected/sub_i128.masm b/tests/integration/expected/sub_i128.masm index 026ca4557..6c486aac3 100644 --- a/tests/integration/expected/sub_i128.masm +++ b/tests/integration/expected/sub_i128.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,18 +16,67 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_e91108ee147c81774f718f1c0531bff5bc1cdc56c047c1e0475e4e94badee2c8 +# mod ::"root_ns:root@1.0.0"::test_rust_e91108ee147c81774f718f1c0531bff5bc1cdc56c047c1e0475e4e94badee2c8 +@locals("9") @callconv("C") pub proc entrypoint(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) - movup.6 - movup.6 - movup.8 - movup.8 - movup.6 - movup.6 - movup.8 - movup.8 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.5 + movup.5 + locaddr.5 + push.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.5 + movup.5 + locaddr.7 + push.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + locaddr.7 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + movdn.7 + movdn.7 + movdn.7 + movdn.7 + movup.3 + movup.3 movdn.7 movdn.7 movdn.7 @@ -37,8 +86,45 @@ pub proc entrypoint(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) exec.::intrinsics::i128::sub trace.252 nop + locaddr.5 + push.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.7 + push.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 push.8 - dup.5 + movup.3 add u32assert push.8 @@ -56,6 +142,23 @@ pub proc entrypoint(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.7 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 movup.2 push.8 dup.1 diff --git a/tests/integration/expected/sub_i16.hir b/tests/integration/expected/sub_i16.hir index 8dccf79a3..c16fcc341 100644 --- a/tests/integration/expected/sub_i16.hir +++ b/tests/integration/expected/sub_i16.hir @@ -2,9 +2,9 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_b6360a7c4709c8e140b5433c6b25904ac7efbab248a7f37933a33b31d5f40c49 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.sub v0, v1 : i32 #[overflow = wrapping]; - v4 = arith.sext v3 : i32; - builtin.ret v4; + v5 = arith.sub v0, v1 : i32 #[overflow = wrapping]; + v6 = arith.sext v5 : i32; + builtin.ret v6; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/sub_i16.masm b/tests/integration/expected/sub_i16.masm index cb1dc2cd8..60aec8756 100644 --- a/tests/integration/expected/sub_i16.masm +++ b/tests/integration/expected/sub_i16.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_b6360a7c4709c8e140b5433c6b25904ac7efbab248a7f37933a33b31d5f40c49 +# mod ::"root_ns:root@1.0.0"::test_rust_b6360a7c4709c8e140b5433c6b25904ac7efbab248a7f37933a33b31d5f40c49 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 swap.1 diff --git a/tests/integration/expected/sub_i32.hir b/tests/integration/expected/sub_i32.hir index af1862ac8..784fd0bb1 100644 --- a/tests/integration/expected/sub_i32.hir +++ b/tests/integration/expected/sub_i32.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_6fc6fd0b2e86628d32094545ba25215329fcd62cd1f981d0dbdd2c989eed3a52 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.sub v0, v1 : i32 #[overflow = wrapping]; - builtin.ret v3; + v5 = arith.sub v0, v1 : i32 #[overflow = wrapping]; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/sub_i32.masm b/tests/integration/expected/sub_i32.masm index 67b689eb8..b85c3c6f4 100644 --- a/tests/integration/expected/sub_i32.masm +++ b/tests/integration/expected/sub_i32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_6fc6fd0b2e86628d32094545ba25215329fcd62cd1f981d0dbdd2c989eed3a52 +# mod ::"root_ns:root@1.0.0"::test_rust_6fc6fd0b2e86628d32094545ba25215329fcd62cd1f981d0dbdd2c989eed3a52 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 swap.1 diff --git a/tests/integration/expected/sub_i64.hir b/tests/integration/expected/sub_i64.hir index bc70b8fda..0e27fc710 100644 --- a/tests/integration/expected/sub_i64.hir +++ b/tests/integration/expected/sub_i64.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_c2e6cec606b20447e4c5accdc801c32098f0d7cda3811f8c4e38f16911210b8f { public builtin.function @entrypoint(v0: i64, v1: i64) -> i64 { ^block6(v0: i64, v1: i64): - v3 = arith.sub v0, v1 : i64 #[overflow = wrapping]; - builtin.ret v3; + v5 = arith.sub v0, v1 : i64 #[overflow = wrapping]; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/sub_i64.masm b/tests/integration/expected/sub_i64.masm index e15703a9a..e692cdc1c 100644 --- a/tests/integration/expected/sub_i64.masm +++ b/tests/integration/expected/sub_i64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,15 +16,16 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_c2e6cec606b20447e4c5accdc801c32098f0d7cda3811f8c4e38f16911210b8f +# mod ::"root_ns:root@1.0.0"::test_rust_c2e6cec606b20447e4c5accdc801c32098f0d7cda3811f8c4e38f16911210b8f +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] movdn.3 movdn.3 trace.240 nop - exec.::std::math::u64::wrapping_sub + exec.::miden::core::math::u64::wrapping_sub trace.252 nop end diff --git a/tests/integration/expected/sub_i8.hir b/tests/integration/expected/sub_i8.hir index 1ff039382..a7d64c844 100644 --- a/tests/integration/expected/sub_i8.hir +++ b/tests/integration/expected/sub_i8.hir @@ -2,9 +2,9 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_c22e1496a88c74570b0e64374e0cf2e7a89efbbc6ead48d3e0471d8654d2afdc { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.sub v0, v1 : i32 #[overflow = wrapping]; - v4 = arith.sext v3 : i32; - builtin.ret v4; + v5 = arith.sub v0, v1 : i32 #[overflow = wrapping]; + v6 = arith.sext v5 : i32; + builtin.ret v6; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/sub_i8.masm b/tests/integration/expected/sub_i8.masm index 614ba7277..11c83459c 100644 --- a/tests/integration/expected/sub_i8.masm +++ b/tests/integration/expected/sub_i8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_c22e1496a88c74570b0e64374e0cf2e7a89efbbc6ead48d3e0471d8654d2afdc +# mod ::"root_ns:root@1.0.0"::test_rust_c22e1496a88c74570b0e64374e0cf2e7a89efbbc6ead48d3e0471d8654d2afdc +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 swap.1 diff --git a/tests/integration/expected/sub_u128.hir b/tests/integration/expected/sub_u128.hir index 230087f8a..c7d8fe8b2 100644 --- a/tests/integration/expected/sub_u128.hir +++ b/tests/integration/expected/sub_u128.hir @@ -2,24 +2,35 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_db478c28ad80aa271563ad7738787d5589cd21f31f7c92248f7f1de9cb727546 { public builtin.function @entrypoint(v0: i32, v1: i64, v2: i64, v3: i64, v4: i64) { ^block6(v0: i32, v1: i64, v2: i64, v3: i64, v4: i64): - v6 = arith.join v3, v4 : i128; - v5 = arith.join v1, v2 : i128; - v7 = arith.sub v5, v6 : i128 #[overflow = wrapping]; - v8, v9 = arith.split v7 : i64, i64; - v11 = arith.constant 8 : u32; - v10 = hir.bitcast v0 : u32; - v12 = arith.add v10, v11 : u32 #[overflow = checked]; - v21 = arith.constant 8 : u32; - v14 = arith.mod v12, v21 : u32; - hir.assertz v14 #[code = 250]; - v15 = hir.int_to_ptr v12 : ptr; - hir.store v15, v8; - v16 = hir.bitcast v0 : u32; - v20 = arith.constant 8 : u32; - v18 = arith.mod v16, v20 : u32; - hir.assertz v18 #[code = 250]; - v19 = hir.int_to_ptr v16 : ptr; - hir.store v19, v9; + hir.store_local v0 #[local = lv0]; + hir.store_local v3 #[local = lv3]; + hir.store_local v4 #[local = lv4]; + v7 = hir.load_local : i64 #[local = lv3]; + v8 = hir.load_local : i64 #[local = lv4]; + v10 = arith.join v7, v8 : i128; + v9 = arith.join v1, v2 : i128; + v11 = arith.sub v9, v10 : i128 #[overflow = wrapping]; + v12, v13 = arith.split v11 : i64, i64; + hir.store_local v12 #[local = lv3]; + hir.store_local v13 #[local = lv4]; + v14 = hir.load_local : i32 #[local = lv0]; + v15 = hir.load_local : i64 #[local = lv3]; + v28 = arith.constant 8 : u32; + v16 = hir.bitcast v14 : u32; + v18 = arith.add v16, v28 : u32 #[overflow = checked]; + v32 = arith.constant 8 : u32; + v20 = arith.mod v18, v32 : u32; + hir.assertz v20 #[code = 250]; + v21 = hir.int_to_ptr v18 : ptr; + hir.store v21, v15; + v22 = hir.load_local : i32 #[local = lv0]; + v23 = hir.load_local : i64 #[local = lv4]; + v24 = hir.bitcast v22 : u32; + v31 = arith.constant 8 : u32; + v26 = arith.mod v24, v31 : u32; + hir.assertz v26 #[code = 250]; + v27 = hir.int_to_ptr v24 : ptr; + hir.store v27, v23; builtin.ret ; }; diff --git a/tests/integration/expected/sub_u128.masm b/tests/integration/expected/sub_u128.masm index 7ec20ec87..a70774ce4 100644 --- a/tests/integration/expected/sub_u128.masm +++ b/tests/integration/expected/sub_u128.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,18 +16,67 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_db478c28ad80aa271563ad7738787d5589cd21f31f7c92248f7f1de9cb727546 +# mod ::"root_ns:root@1.0.0"::test_rust_db478c28ad80aa271563ad7738787d5589cd21f31f7c92248f7f1de9cb727546 +@locals("9") @callconv("C") pub proc entrypoint(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) - movup.6 - movup.6 - movup.8 - movup.8 - movup.6 - movup.6 - movup.8 - movup.8 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.5 + movup.5 + locaddr.5 + push.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.5 + movup.5 + locaddr.7 + push.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + locaddr.7 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + movdn.7 + movdn.7 + movdn.7 + movdn.7 + movup.3 + movup.3 movdn.7 movdn.7 movdn.7 @@ -37,8 +86,45 @@ pub proc entrypoint(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) exec.::intrinsics::i128::sub trace.252 nop + locaddr.5 + push.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.7 + push.0 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 push.8 - dup.5 + movup.3 add u32assert push.8 @@ -56,6 +142,23 @@ pub proc entrypoint(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) exec.::intrinsics::mem::store_dw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.7 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 movup.2 push.8 dup.1 diff --git a/tests/integration/expected/sub_u16.hir b/tests/integration/expected/sub_u16.hir index e6d6dae6d..5aeb89cce 100644 --- a/tests/integration/expected/sub_u16.hir +++ b/tests/integration/expected/sub_u16.hir @@ -2,10 +2,10 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_d8aa82f0674d72cf16435a3b3f6c248ab8b08b77539ac08b01e393fd53f96cb7 { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v4 = arith.constant 65535 : i32; - v3 = arith.sub v0, v1 : i32 #[overflow = wrapping]; - v5 = arith.band v3, v4 : i32; - builtin.ret v5; + v8 = arith.constant 65535 : i32; + v5 = arith.sub v0, v1 : i32 #[overflow = wrapping]; + v7 = arith.band v5, v8 : i32; + builtin.ret v7; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/sub_u16.masm b/tests/integration/expected/sub_u16.masm index c9b802868..29ec6b5d8 100644 --- a/tests/integration/expected/sub_u16.masm +++ b/tests/integration/expected/sub_u16.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_d8aa82f0674d72cf16435a3b3f6c248ab8b08b77539ac08b01e393fd53f96cb7 +# mod ::"root_ns:root@1.0.0"::test_rust_d8aa82f0674d72cf16435a3b3f6c248ab8b08b77539ac08b01e393fd53f96cb7 +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 push.65535 diff --git a/tests/integration/expected/sub_u32.hir b/tests/integration/expected/sub_u32.hir index 86edc4982..85911a64b 100644 --- a/tests/integration/expected/sub_u32.hir +++ b/tests/integration/expected/sub_u32.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_19bb93ff4625e8bdb6a3470a0b61a142a94458a4ee602822cb8360bf1f07368f { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.sub v0, v1 : i32 #[overflow = wrapping]; - builtin.ret v3; + v5 = arith.sub v0, v1 : i32 #[overflow = wrapping]; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/sub_u32.masm b/tests/integration/expected/sub_u32.masm index 6e62bb069..7b31e0a8d 100644 --- a/tests/integration/expected/sub_u32.masm +++ b/tests/integration/expected/sub_u32.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_19bb93ff4625e8bdb6a3470a0b61a142a94458a4ee602822cb8360bf1f07368f +# mod ::"root_ns:root@1.0.0"::test_rust_19bb93ff4625e8bdb6a3470a0b61a142a94458a4ee602822cb8360bf1f07368f +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 swap.1 diff --git a/tests/integration/expected/sub_u64.hir b/tests/integration/expected/sub_u64.hir index 73adec476..09ea84655 100644 --- a/tests/integration/expected/sub_u64.hir +++ b/tests/integration/expected/sub_u64.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_07a967cd239987abbfb9236f41c9268dd55be09bc1efb30f1e4684134ef772b0 { public builtin.function @entrypoint(v0: i64, v1: i64) -> i64 { ^block6(v0: i64, v1: i64): - v3 = arith.sub v0, v1 : i64 #[overflow = wrapping]; - builtin.ret v3; + v5 = arith.sub v0, v1 : i64 #[overflow = wrapping]; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/sub_u64.masm b/tests/integration/expected/sub_u64.masm index 3ce89deb3..2d52abdcd 100644 --- a/tests/integration/expected/sub_u64.masm +++ b/tests/integration/expected/sub_u64.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,15 +16,16 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_07a967cd239987abbfb9236f41c9268dd55be09bc1efb30f1e4684134ef772b0 +# mod ::"root_ns:root@1.0.0"::test_rust_07a967cd239987abbfb9236f41c9268dd55be09bc1efb30f1e4684134ef772b0 +@locals("4") @callconv("C") pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] movdn.3 movdn.3 trace.240 nop - exec.::std::math::u64::wrapping_sub + exec.::miden::core::math::u64::wrapping_sub trace.252 nop end diff --git a/tests/integration/expected/sub_u8.hir b/tests/integration/expected/sub_u8.hir index 339ce6d53..f39cc4555 100644 --- a/tests/integration/expected/sub_u8.hir +++ b/tests/integration/expected/sub_u8.hir @@ -2,10 +2,10 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_be0120d0a160e710cbd53bd6dc4ac525bbb3596615ae6ec2d5f88c74c069aabe { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v4 = arith.constant 255 : i32; - v3 = arith.sub v0, v1 : i32 #[overflow = wrapping]; - v5 = arith.band v3, v4 : i32; - builtin.ret v5; + v8 = arith.constant 255 : i32; + v5 = arith.sub v0, v1 : i32 #[overflow = wrapping]; + v7 = arith.band v5, v8 : i32; + builtin.ret v7; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/sub_u8.masm b/tests/integration/expected/sub_u8.masm index 86e0552ac..24a7c0076 100644 --- a/tests/integration/expected/sub_u8.masm +++ b/tests/integration/expected/sub_u8.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_be0120d0a160e710cbd53bd6dc4ac525bbb3596615ae6ec2d5f88c74c069aabe +# mod ::"root_ns:root@1.0.0"::test_rust_be0120d0a160e710cbd53bd6dc4ac525bbb3596615ae6ec2d5f88c74c069aabe +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 push.255 diff --git a/tests/integration/expected/types/array.hir b/tests/integration/expected/types/array.hir index 05eeab077..2fe3ca15e 100644 --- a/tests/integration/expected/types/array.hir +++ b/tests/integration/expected/types/array.hir @@ -2,64 +2,69 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_cb39dafa72dff125238b7a3ed9e652b134e1b6c8b56777106a49349224402a6d { public builtin.function @__main() -> i32 { ^block6: - v2 = arith.constant 5 : i32; - v1 = arith.constant 1048576 : i32; - v3 = hir.exec @root_ns:root@1.0.0/test_rust_cb39dafa72dff125238b7a3ed9e652b134e1b6c8b56777106a49349224402a6d/sum_arr(v1, v2) : i32 - v35 = arith.constant 5 : i32; - v4 = arith.constant 1048596 : i32; - v6 = hir.exec @root_ns:root@1.0.0/test_rust_cb39dafa72dff125238b7a3ed9e652b134e1b6c8b56777106a49349224402a6d/sum_arr(v4, v35) : i32 + v38 = arith.constant 5 : i32; + v37 = arith.constant 1048576 : i32; + v3 = hir.exec @root_ns:root@1.0.0/test_rust_cb39dafa72dff125238b7a3ed9e652b134e1b6c8b56777106a49349224402a6d/sum_arr(v37, v38) : i32 + v40 = arith.constant 5 : i32; + v36 = arith.constant 1048596 : i32; + v6 = hir.exec @root_ns:root@1.0.0/test_rust_cb39dafa72dff125238b7a3ed9e652b134e1b6c8b56777106a49349224402a6d/sum_arr(v36, v40) : i32 v7 = arith.add v3, v6 : i32 #[overflow = wrapping]; builtin.ret v7; }; public builtin.function @sum_arr(v8: i32, v9: i32) -> i32 { ^block8(v8: i32, v9: i32): - v94 = arith.constant 0 : i32; - v11 = arith.constant 0 : i32; - v14 = arith.eq v9, v11 : i1; + hir.store_local v8 #[local = lv0]; + hir.store_local v9 #[local = lv1]; + v44 = arith.constant 0 : i32; + hir.store_local v44 #[local = lv2]; + v12 = hir.load_local : i32 #[local = lv1]; + v59 = arith.constant 0 : i32; + v60 = arith.constant 0 : i32; + v14 = arith.eq v12, v60 : i1; v15 = arith.zext v14 : u32; v16 = hir.bitcast v15 : i32; - v18 = arith.neq v16, v94 : i1; - v67 = scf.if v18 : i32 { - ^block10: - v93 = arith.constant 0 : i32; - scf.yield v93; + v18 = arith.neq v16, v59 : i1; + scf.if v18{ + ^block16: + scf.yield ; } else { ^block11: - v92 = arith.constant 0 : i32; - v78, v79, v80, v81 = scf.while v8, v92, v9 : i32, i32, i32, i32 { - ^block23(v82: i32, v83: i32, v84: i32): - v20 = hir.bitcast v82 : u32; - v21 = arith.constant 4 : u32; - v22 = arith.mod v20, v21 : u32; + scf.while { + ^block12: + v19 = hir.load_local : i32 #[local = lv0]; + v20 = hir.bitcast v19 : u32; + v43 = arith.constant 4 : u32; + v22 = arith.mod v20, v43 : u32; hir.assertz v22 #[code = 250]; v23 = hir.int_to_ptr v20 : ptr; v24 = hir.load v23 : i32; - v26 = arith.add v24, v83 : i32 #[overflow = wrapping]; - v30 = arith.constant -1 : i32; - v31 = arith.add v84, v30 : i32 #[overflow = wrapping]; - v91 = arith.constant 0 : i32; - v33 = arith.neq v31, v91 : i1; - v89 = ub.poison i32 : i32; - v75 = cf.select v33, v31, v89 : i32; - v90 = ub.poison i32 : i32; - v74 = cf.select v33, v26, v90 : i32; - v44 = ub.poison i32 : i32; - v27 = arith.constant 4 : i32; - v28 = arith.add v82, v27 : i32 #[overflow = wrapping]; - v73 = cf.select v33, v28, v44 : i32; - v37 = arith.constant 0 : u32; - v43 = arith.constant 1 : u32; - v77 = cf.select v33, v43, v37 : u32; - v66 = arith.trunc v77 : i1; - scf.condition v66, v73, v74, v75, v26; + v25 = hir.load_local : i32 #[local = lv2]; + v26 = arith.add v24, v25 : i32 #[overflow = wrapping]; + hir.store_local v26 #[local = lv2]; + v27 = hir.load_local : i32 #[local = lv0]; + v42 = arith.constant 4 : i32; + v29 = arith.add v27, v42 : i32 #[overflow = wrapping]; + hir.store_local v29 #[local = lv0]; + v30 = hir.load_local : i32 #[local = lv1]; + v41 = arith.constant -1 : i32; + v32 = arith.add v30, v41 : i32 #[overflow = wrapping]; + hir.store_local v32 #[local = lv1]; + v49 = arith.constant 0 : u32; + v52 = arith.constant 1 : u32; + v58 = arith.constant 0 : i32; + v34 = arith.neq v32, v58 : i1; + v57 = cf.select v34, v52, v49 : u32; + v53 = arith.trunc v57 : i1; + scf.condition v53; } do { - ^block24(v85: i32, v86: i32, v87: i32, v88: i32): - scf.yield v85, v86, v87; + ^block22: + scf.yield ; }; - scf.yield v81; + scf.yield ; }; - builtin.ret v67; + v35 = hir.load_local : i32 #[local = lv2]; + builtin.ret v35; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/types/array.masm b/tests/integration/expected/types/array.masm index 18c28ac3c..088729d4e 100644 --- a/tests/integration/expected/types/array.masm +++ b/tests/integration/expected/types/array.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,7 +10,7 @@ proc init push.262144 push.3 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -24,7 +24,7 @@ proc init mem_store.278546 end -# mod root_ns:root@1.0.0::test_rust_cb39dafa72dff125238b7a3ed9e652b134e1b6c8b56777106a49349224402a6d +# mod ::"root_ns:root@1.0.0"::test_rust_cb39dafa72dff125238b7a3ed9e652b134e1b6c8b56777106a49349224402a6d @callconv("C") pub proc __main( @@ -34,36 +34,73 @@ pub proc __main( push.1048576 trace.240 nop - exec.::root_ns:root@1.0.0::test_rust_cb39dafa72dff125238b7a3ed9e652b134e1b6c8b56777106a49349224402a6d::sum_arr + exec.::"root_ns:root@1.0.0"::test_rust_cb39dafa72dff125238b7a3ed9e652b134e1b6c8b56777106a49349224402a6d::sum_arr trace.252 nop push.5 push.1048596 trace.240 nop - exec.::root_ns:root@1.0.0::test_rust_cb39dafa72dff125238b7a3ed9e652b134e1b6c8b56777106a49349224402a6d::sum_arr + exec.::"root_ns:root@1.0.0"::test_rust_cb39dafa72dff125238b7a3ed9e652b134e1b6c8b56777106a49349224402a6d::sum_arr trace.252 nop u32wrapping_add end +@locals("3") @callconv("C") pub proc sum_arr(i32, i32) -> i32 + locaddr.0 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 push.0 - dup.3 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 eq neq if.true - drop - drop - push.0 + nop else - push.0 - swap.1 push.1 while.true - dup.0 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -77,49 +114,82 @@ pub proc sum_arr(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop - movup.2 - u32wrapping_add - push.4294967295 - movup.3 - u32wrapping_add + locaddr.2 push.0 - dup.1 - neq - push.3735929054 - dup.1 swap.1 - swap.2 - swap.3 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + u32wrapping_add + locaddr.2 + push.0 swap.1 - cdrop - push.3735929054 - dup.2 - dup.4 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 swap.1 - cdrop - push.3735929054 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - movup.6 u32wrapping_add - dup.4 - cdrop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4294967295 + u32wrapping_add + dup.0 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 push.1 - movup.5 + push.0 + movup.3 + neq cdrop push.1 u32and if.true - movup.3 - drop push.1 else push.0 end end - drop - drop - drop end + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end diff --git a/tests/integration/expected/types/enum.hir b/tests/integration/expected/types/enum.hir index 9a5da3fae..3e23020e8 100644 --- a/tests/integration/expected/types/enum.hir +++ b/tests/integration/expected/types/enum.hir @@ -2,18 +2,18 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_dd1732f1cb2cdf8742b13cf624a182a3893ee7d1f0d94b11ef6b10382dffd79c { public builtin.function @__main() -> i32 { ^block6: - v3 = arith.constant 0 : i32; - v2 = arith.constant 5 : i32; - v1 = arith.constant 3 : i32; - v4 = hir.exec @root_ns:root@1.0.0/test_rust_dd1732f1cb2cdf8742b13cf624a182a3893ee7d1f0d94b11ef6b10382dffd79c/match_enum(v1, v2, v3) : i32 - v7 = arith.constant 1 : i32; - v27 = arith.constant 5 : i32; - v28 = arith.constant 3 : i32; - v8 = hir.exec @root_ns:root@1.0.0/test_rust_dd1732f1cb2cdf8742b13cf624a182a3893ee7d1f0d94b11ef6b10382dffd79c/match_enum(v28, v27, v7) : i32 - v12 = arith.constant 2 : i32; - v25 = arith.constant 5 : i32; - v26 = arith.constant 3 : i32; - v13 = hir.exec @root_ns:root@1.0.0/test_rust_dd1732f1cb2cdf8742b13cf624a182a3893ee7d1f0d94b11ef6b10382dffd79c/match_enum(v26, v25, v12) : i32 + v36 = arith.constant 0 : i32; + v35 = arith.constant 5 : i32; + v34 = arith.constant 3 : i32; + v4 = hir.exec @root_ns:root@1.0.0/test_rust_dd1732f1cb2cdf8742b13cf624a182a3893ee7d1f0d94b11ef6b10382dffd79c/match_enum(v34, v35, v36) : i32 + v33 = arith.constant 1 : i32; + v43 = arith.constant 5 : i32; + v44 = arith.constant 3 : i32; + v8 = hir.exec @root_ns:root@1.0.0/test_rust_dd1732f1cb2cdf8742b13cf624a182a3893ee7d1f0d94b11ef6b10382dffd79c/match_enum(v44, v43, v33) : i32 + v32 = arith.constant 2 : i32; + v41 = arith.constant 5 : i32; + v42 = arith.constant 3 : i32; + v13 = hir.exec @root_ns:root@1.0.0/test_rust_dd1732f1cb2cdf8742b13cf624a182a3893ee7d1f0d94b11ef6b10382dffd79c/match_enum(v42, v41, v32) : i32 v9 = arith.add v4, v8 : i32 #[overflow = wrapping]; v14 = arith.add v9, v13 : i32 #[overflow = wrapping]; builtin.ret v14; @@ -21,26 +21,34 @@ builtin.component root_ns:root@1.0.0 { public builtin.function @match_enum(v15: i32, v16: i32, v17: i32) -> i32 { ^block8(v15: i32, v16: i32, v17: i32): - v19 = arith.constant 255 : i32; - v20 = arith.band v17, v19 : i32; - v21 = hir.cast v20 : u32; - v31 = scf.index_switch v21 : i32 + hir.store_local v15 #[local = lv0]; + hir.store_local v16 #[local = lv1]; + v45 = arith.constant 255 : i32; + v21 = arith.band v17, v45 : i32; + v22 = hir.cast v21 : u32; + v48 = scf.index_switch v22 : i32 case 1 { ^block11: - v23 = arith.sub v15, v16 : i32 #[overflow = wrapping]; - scf.yield v23; + v26 = hir.load_local : i32 #[local = lv0]; + v27 = hir.load_local : i32 #[local = lv1]; + v28 = arith.sub v26, v27 : i32 #[overflow = wrapping]; + scf.yield v28; } case 2 { ^block10: - v24 = arith.mul v16, v15 : i32 #[overflow = wrapping]; - scf.yield v24; + v29 = hir.load_local : i32 #[local = lv1]; + v30 = hir.load_local : i32 #[local = lv0]; + v31 = arith.mul v29, v30 : i32 #[overflow = wrapping]; + scf.yield v31; } default { ^block12: - v22 = arith.add v16, v15 : i32 #[overflow = wrapping]; - scf.yield v22; + v23 = hir.load_local : i32 #[local = lv1]; + v24 = hir.load_local : i32 #[local = lv0]; + v25 = arith.add v23, v24 : i32 #[overflow = wrapping]; + scf.yield v25; }; - builtin.ret v31; + builtin.ret v48; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/types/enum.masm b/tests/integration/expected/types/enum.masm index 819b5472d..60b2235fd 100644 --- a/tests/integration/expected/types/enum.masm +++ b/tests/integration/expected/types/enum.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,7 +16,7 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_dd1732f1cb2cdf8742b13cf624a182a3893ee7d1f0d94b11ef6b10382dffd79c +# mod ::"root_ns:root@1.0.0"::test_rust_dd1732f1cb2cdf8742b13cf624a182a3893ee7d1f0d94b11ef6b10382dffd79c @callconv("C") pub proc __main( @@ -27,7 +27,7 @@ pub proc __main( push.3 trace.240 nop - exec.::root_ns:root@1.0.0::test_rust_dd1732f1cb2cdf8742b13cf624a182a3893ee7d1f0d94b11ef6b10382dffd79c::match_enum + exec.::"root_ns:root@1.0.0"::test_rust_dd1732f1cb2cdf8742b13cf624a182a3893ee7d1f0d94b11ef6b10382dffd79c::match_enum trace.252 nop push.1 @@ -35,7 +35,7 @@ pub proc __main( push.3 trace.240 nop - exec.::root_ns:root@1.0.0::test_rust_dd1732f1cb2cdf8742b13cf624a182a3893ee7d1f0d94b11ef6b10382dffd79c::match_enum + exec.::"root_ns:root@1.0.0"::test_rust_dd1732f1cb2cdf8742b13cf624a182a3893ee7d1f0d94b11ef6b10382dffd79c::match_enum trace.252 nop push.2 @@ -43,7 +43,7 @@ pub proc __main( push.3 trace.240 nop - exec.::root_ns:root@1.0.0::test_rust_dd1732f1cb2cdf8742b13cf624a182a3893ee7d1f0d94b11ef6b10382dffd79c::match_enum + exec.::"root_ns:root@1.0.0"::test_rust_dd1732f1cb2cdf8742b13cf624a182a3893ee7d1f0d94b11ef6b10382dffd79c::match_enum trace.252 nop movdn.2 @@ -51,10 +51,26 @@ pub proc __main( u32wrapping_add end +@locals("3") @callconv("C") pub proc match_enum(i32, i32, i32) -> i32 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.255 - movup.3 u32and dup.0 push.2147483648 @@ -66,9 +82,40 @@ pub proc match_enum(i32, i32, i32) -> i32 if.true eq.1 if.true + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop u32wrapping_sub else + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop trace.240 nop exec.::intrinsics::i32::wrapping_mul @@ -77,6 +124,22 @@ pub proc match_enum(i32, i32, i32) -> i32 end else drop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop u32wrapping_add end end diff --git a/tests/integration/expected/types/static_mut.hir b/tests/integration/expected/types/static_mut.hir index 082148801..2076b8a6f 100644 --- a/tests/integration/expected/types/static_mut.hir +++ b/tests/integration/expected/types/static_mut.hir @@ -3,58 +3,62 @@ builtin.component root_ns:root@1.0.0 { public builtin.function @__main() -> i32 { ^block6: hir.exec @root_ns:root@1.0.0/test_rust_2512f26a084edd4aa11742f4c2ef0985a5681361fee42216136cb00d26224778/global_var_update() - v1 = arith.constant 0 : i32; - v3 = arith.constant -9 : i32; - v70, v71, v72 = scf.while v3, v1 : i32, i32, i32 { - ^block21(v73: i32, v74: i32): - v5 = arith.constant 1048585 : i32; - v6 = arith.add v73, v5 : i32 #[overflow = wrapping]; - v7 = hir.bitcast v6 : u32; - v8 = hir.int_to_ptr v7 : ptr; - v9 = hir.load v8 : u8; - v10 = arith.zext v9 : u32; - v11 = hir.bitcast v10 : i32; - v13 = arith.add v11, v74 : i32 #[overflow = wrapping]; - v14 = arith.constant 1 : i32; - v15 = arith.add v73, v14 : i32 #[overflow = wrapping]; - v79 = arith.constant 0 : i32; - v17 = arith.neq v15, v79 : i1; - v78 = ub.poison i32 : i32; - v67 = cf.select v17, v13, v78 : i32; - v44 = ub.poison i32 : i32; - v66 = cf.select v17, v15, v44 : i32; - v38 = arith.constant 0 : u32; - v43 = arith.constant 1 : u32; - v69 = cf.select v17, v43, v38 : u32; - v61 = arith.trunc v69 : i1; - scf.condition v61, v66, v67, v13; + v43 = arith.constant 0 : i32; + hir.store_local v43 #[local = lv0]; + v42 = arith.constant -9 : i32; + hir.store_local v42 #[local = lv1]; + scf.while { + ^block8: + v3 = hir.load_local : i32 #[local = lv1]; + v41 = arith.constant 1048585 : i32; + v5 = arith.add v3, v41 : i32 #[overflow = wrapping]; + v6 = hir.bitcast v5 : u32; + v7 = hir.int_to_ptr v6 : ptr; + v8 = hir.load v7 : u8; + v11 = hir.load_local : i32 #[local = lv0]; + v9 = arith.zext v8 : u32; + v10 = hir.bitcast v9 : i32; + v12 = arith.add v10, v11 : i32 #[overflow = wrapping]; + hir.store_local v12 #[local = lv0]; + v13 = hir.load_local : i32 #[local = lv1]; + v40 = arith.constant 1 : i32; + v15 = arith.add v13, v40 : i32 #[overflow = wrapping]; + hir.store_local v15 #[local = lv1]; + v46 = arith.constant 0 : u32; + v49 = arith.constant 1 : u32; + v55 = arith.constant 0 : i32; + v18 = arith.neq v15, v55 : i1; + v54 = cf.select v18, v49, v46 : u32; + v50 = arith.trunc v54 : i1; + scf.condition v50; } do { - ^block22(v75: i32, v76: i32, v77: i32): - scf.yield v75, v76; + ^block19: + scf.yield ; }; - v18 = arith.constant 255 : i32; - v19 = arith.band v72, v18 : i32; - builtin.ret v19; + v19 = hir.load_local : i32 #[local = lv0]; + v39 = arith.constant 255 : i32; + v21 = arith.band v19, v39 : i32; + builtin.ret v21; }; public builtin.function @global_var_update() { ^block11: - v23 = arith.constant 1048577 : u32; - v81 = arith.constant 0 : u32; - v24 = arith.add v81, v23 : u32 #[overflow = checked]; - v25 = hir.int_to_ptr v24 : ptr; - v26 = hir.load v25 : u8; - v29 = arith.constant 1 : i32; - v27 = arith.zext v26 : u32; - v28 = hir.bitcast v27 : i32; - v30 = arith.add v28, v29 : i32 #[overflow = wrapping]; - v31 = hir.bitcast v30 : u32; - v32 = arith.trunc v31 : u8; - v34 = arith.constant 1048576 : u32; - v82 = arith.constant 0 : u32; - v35 = arith.add v82, v34 : u32 #[overflow = checked]; - v36 = hir.int_to_ptr v35 : ptr; - hir.store v36, v32; + v60 = arith.constant 1048577 : u32; + v61 = arith.constant 0 : u32; + v26 = arith.add v61, v60 : u32 #[overflow = checked]; + v27 = hir.int_to_ptr v26 : ptr; + v28 = hir.load v27 : u8; + v59 = arith.constant 1 : i32; + v29 = arith.zext v28 : u32; + v30 = hir.bitcast v29 : i32; + v32 = arith.add v30, v59 : i32 #[overflow = wrapping]; + v33 = hir.bitcast v32 : u32; + v34 = arith.trunc v33 : u8; + v58 = arith.constant 1048576 : u32; + v63 = arith.constant 0 : u32; + v37 = arith.add v63, v58 : u32 #[overflow = checked]; + v38 = hir.int_to_ptr v37 : ptr; + hir.store v38, v34; builtin.ret ; }; diff --git a/tests/integration/expected/types/static_mut.masm b/tests/integration/expected/types/static_mut.masm index 039d52033..c41a0cd95 100644 --- a/tests/integration/expected/types/static_mut.masm +++ b/tests/integration/expected/types/static_mut.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,7 +10,7 @@ proc init push.262144 push.1 trace.240 - exec.::std::mem::pipe_preimage_to_memory + exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 @@ -24,23 +24,47 @@ proc init mem_store.278538 end -# mod root_ns:root@1.0.0::test_rust_2512f26a084edd4aa11742f4c2ef0985a5681361fee42216136cb00d26224778 +# mod ::"root_ns:root@1.0.0"::test_rust_2512f26a084edd4aa11742f4c2ef0985a5681361fee42216136cb00d26224778 +@locals("3") @callconv("C") pub proc __main( ) -> i32 trace.240 nop - exec.::root_ns:root@1.0.0::test_rust_2512f26a084edd4aa11742f4c2ef0985a5681361fee42216136cb00d26224778::global_var_update + exec.::"root_ns:root@1.0.0"::test_rust_2512f26a084edd4aa11742f4c2ef0985a5681361fee42216136cb00d26224778::global_var_update trace.252 nop push.0 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.4294967287 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1 while.true + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.1048585 - dup.1 u32wrapping_add u32divmod.4 swap.1 @@ -55,42 +79,65 @@ pub proc __main( drop push.255 u32and - movup.2 - u32wrapping_add - push.1 - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 u32wrapping_add + locaddr.0 push.0 - dup.1 - neq - push.3735929054 - dup.1 - dup.4 swap.1 - cdrop - push.3735929054 - dup.2 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 swap.1 - swap.2 - swap.4 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1 + u32wrapping_add + dup.0 + locaddr.1 + push.0 swap.1 - cdrop + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 push.1 + push.0 movup.3 + neq cdrop push.1 u32and if.true - movup.2 - drop push.1 else push.0 end end - drop - drop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.255 u32and end diff --git a/tests/integration/expected/vec_alloc_vec.hir b/tests/integration/expected/vec_alloc_vec.hir index 682461400..c996b8e59 100644 --- a/tests/integration/expected/vec_alloc_vec.hir +++ b/tests/integration/expected/vec_alloc_vec.hir @@ -2,145 +2,161 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @vec_alloc_vec { private builtin.function @__rustc::__rust_alloc(v0: i32, v1: i32) -> i32 { ^block4(v0: i32, v1: i32): - v3 = arith.constant 1048576 : i32; - v4 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/::alloc(v3, v1, v0) : i32 - builtin.ret v4; + v347 = arith.constant 1048576 : i32; + v6 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/::alloc(v347, v1, v0) : i32 + builtin.ret v6; }; - private builtin.function @__rustc::__rust_dealloc(v5: i32, v6: i32, v7: i32) { - ^block6(v5: i32, v6: i32, v7: i32): + private builtin.function @__rustc::__rust_dealloc(v7: i32, v8: i32, v9: i32) { + ^block6(v7: i32, v8: i32, v9: i32): builtin.ret ; }; - public builtin.function @entrypoint(v8: i32) -> felt { - ^block8(v8: i32): + public builtin.function @entrypoint(v10: i32) -> felt { + ^block8(v10: i32): + hir.store_local v10 #[local = lv0]; v12 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__stack_pointer : ptr v13 = hir.bitcast v12 : ptr; v14 = hir.load v13 : i32; - v15 = arith.constant 16 : i32; - v16 = arith.sub v14, v15 : i32 #[overflow = wrapping]; + v365 = arith.constant 16 : i32; + v16 = arith.sub v14, v365 : i32 #[overflow = wrapping]; + hir.store_local v16 #[local = lv1]; v17 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__stack_pointer : ptr v18 = hir.bitcast v17 : ptr; hir.store v18, v16; hir.exec @root_ns:root@1.0.0/vec_alloc_vec/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v20 = arith.constant 4 : i32; - v19 = arith.constant 12 : i32; - v21 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/__rustc::__rust_alloc(v19, v20) : i32 - v338 = arith.constant 0 : i32; - v10 = arith.constant 0 : i32; - v23 = arith.eq v21, v10 : i1; + v363 = arith.constant 4 : i32; + v364 = arith.constant 12 : i32; + v21 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/__rustc::__rust_alloc(v364, v363) : i32 + hir.store_local v21 #[local = lv2]; + v418 = arith.constant 0 : i32; + v382 = arith.constant 0 : i32; + v23 = arith.eq v21, v382 : i1; v24 = arith.zext v23 : u32; v25 = hir.bitcast v24 : i32; - v27 = arith.neq v25, v338 : i1; - v310, v311 = scf.if v27 : felt, u32 { + v27 = arith.neq v25, v418 : i1; + v391, v392 = scf.if v27 : felt, u32 { ^block11: - v336 = arith.constant 12 : i32; - v337 = arith.constant 4 : i32; - hir.exec @root_ns:root@1.0.0/vec_alloc_vec/alloc::alloc::handle_alloc_error(v337, v336) - v302 = arith.constant 0 : u32; - v306 = ub.poison felt : felt; - scf.yield v306, v302; + v416 = arith.constant 12 : i32; + v417 = arith.constant 4 : i32; + hir.exec @root_ns:root@1.0.0/vec_alloc_vec/alloc::alloc::handle_alloc_error(v417, v416) + v383 = arith.constant 0 : u32; + v387 = ub.poison felt : felt; + scf.yield v387, v383; } else { ^block12: - v28 = arith.constant 1 : i32; - v29 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/intrinsics::felt::from_u32(v28) : felt - v30 = arith.constant 2 : i32; - v31 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/intrinsics::felt::from_u32(v30) : felt - v32 = arith.constant 3 : i32; - v33 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/intrinsics::felt::from_u32(v32) : felt - v35 = arith.constant 8 : u32; - v34 = hir.bitcast v21 : u32; - v36 = arith.add v34, v35 : u32 #[overflow = checked]; - v37 = arith.constant 4 : u32; - v38 = arith.mod v36, v37 : u32; - hir.assertz v38 #[code = 250]; - v39 = hir.int_to_ptr v36 : ptr; - hir.store v39, v33; - v335 = arith.constant 4 : u32; - v40 = hir.bitcast v21 : u32; - v42 = arith.add v40, v335 : u32 #[overflow = checked]; - v334 = arith.constant 4 : u32; - v44 = arith.mod v42, v334 : u32; - hir.assertz v44 #[code = 250]; - v45 = hir.int_to_ptr v42 : ptr; - hir.store v45, v31; - v46 = hir.bitcast v21 : u32; - v333 = arith.constant 4 : u32; - v48 = arith.mod v46, v333 : u32; - hir.assertz v48 #[code = 250]; - v49 = hir.int_to_ptr v46 : ptr; - hir.store v49, v29; - v52 = arith.constant 12 : u32; - v51 = hir.bitcast v16 : u32; - v53 = arith.add v51, v52 : u32 #[overflow = checked]; - v332 = arith.constant 4 : u32; - v55 = arith.mod v53, v332 : u32; - hir.assertz v55 #[code = 250]; - v331 = arith.constant 3 : i32; - v56 = hir.int_to_ptr v53 : ptr; - hir.store v56, v331; - v330 = arith.constant 8 : u32; - v57 = hir.bitcast v16 : u32; - v59 = arith.add v57, v330 : u32 #[overflow = checked]; - v329 = arith.constant 4 : u32; - v61 = arith.mod v59, v329 : u32; + v357 = arith.constant 1 : felt; + hir.store_local v357 #[local = lv3]; + v32 = hir.load_local : i32 #[local = lv2]; + v360 = arith.constant 8 : u32; + v35 = hir.bitcast v32 : u32; + v37 = arith.add v35, v360 : u32 #[overflow = checked]; + v359 = arith.constant 4 : u32; + v39 = arith.mod v37, v359 : u32; + hir.assertz v39 #[code = 250]; + v355 = arith.constant 3 : felt; + v40 = hir.int_to_ptr v37 : ptr; + hir.store v40, v355; + v41 = hir.load_local : i32 #[local = lv2]; + v415 = arith.constant 4 : u32; + v43 = hir.bitcast v41 : u32; + v45 = arith.add v43, v415 : u32 #[overflow = checked]; + v414 = arith.constant 4 : u32; + v47 = arith.mod v45, v414 : u32; + hir.assertz v47 #[code = 250]; + v356 = arith.constant 2 : felt; + v48 = hir.int_to_ptr v45 : ptr; + hir.store v48, v356; + v49 = hir.load_local : i32 #[local = lv2]; + v50 = hir.load_local : felt #[local = lv3]; + v51 = hir.bitcast v49 : u32; + v413 = arith.constant 4 : u32; + v53 = arith.mod v51, v413 : u32; + hir.assertz v53 #[code = 250]; + v54 = hir.int_to_ptr v51 : ptr; + hir.store v54, v50; + v55 = hir.load_local : i32 #[local = lv1]; + v358 = arith.constant 12 : u32; + v57 = hir.bitcast v55 : u32; + v59 = arith.add v57, v358 : u32 #[overflow = checked]; + v412 = arith.constant 4 : u32; + v61 = arith.mod v59, v412 : u32; hir.assertz v61 #[code = 250]; + v361 = arith.constant 3 : i32; v62 = hir.int_to_ptr v59 : ptr; - hir.store v62, v21; - v328 = arith.constant 4 : u32; - v64 = hir.bitcast v16 : u32; - v66 = arith.add v64, v328 : u32 #[overflow = checked]; - v327 = arith.constant 4 : u32; - v68 = arith.mod v66, v327 : u32; - hir.assertz v68 #[code = 250]; - v326 = arith.constant 3 : i32; - v69 = hir.int_to_ptr v66 : ptr; - hir.store v69, v326; - v325 = arith.constant 0 : i32; - v301 = arith.constant 3 : u32; - v71 = hir.bitcast v8 : u32; - v73 = arith.gte v71, v301 : i1; - v74 = arith.zext v73 : u32; - v75 = hir.bitcast v74 : i32; - v77 = arith.neq v75, v325 : i1; - v316 = scf.if v77 : felt { - ^block48: - v324 = ub.poison felt : felt; - scf.yield v324; + hir.store v62, v361; + v63 = hir.load_local : i32 #[local = lv1]; + v64 = hir.load_local : i32 #[local = lv2]; + v411 = arith.constant 8 : u32; + v65 = hir.bitcast v63 : u32; + v67 = arith.add v65, v411 : u32 #[overflow = checked]; + v410 = arith.constant 4 : u32; + v69 = arith.mod v67, v410 : u32; + hir.assertz v69 #[code = 250]; + v70 = hir.int_to_ptr v67 : ptr; + hir.store v70, v64; + v71 = hir.load_local : i32 #[local = lv1]; + v409 = arith.constant 4 : u32; + v73 = hir.bitcast v71 : u32; + v75 = arith.add v73, v409 : u32 #[overflow = checked]; + v408 = arith.constant 4 : u32; + v77 = arith.mod v75, v408 : u32; + hir.assertz v77 #[code = 250]; + v407 = arith.constant 3 : i32; + v78 = hir.int_to_ptr v75 : ptr; + hir.store v78, v407; + v79 = hir.load_local : i32 #[local = lv0]; + v406 = arith.constant 0 : i32; + v354 = arith.constant 3 : u32; + v81 = hir.bitcast v79 : u32; + v83 = arith.gte v81, v354 : i1; + v84 = arith.zext v83 : u32; + v85 = hir.bitcast v84 : i32; + v87 = arith.neq v85, v406 : i1; + v397 = scf.if v87 : felt { + ^block46: + v405 = ub.poison felt : felt; + scf.yield v405; } else { ^block13: - v300 = arith.constant 2 : u32; - v80 = arith.shl v8, v300 : i32; - v81 = arith.add v21, v80 : i32 #[overflow = wrapping]; - v82 = hir.bitcast v81 : u32; - v323 = arith.constant 4 : u32; - v84 = arith.mod v82, v323 : u32; - hir.assertz v84 #[code = 250]; - v85 = hir.int_to_ptr v82 : ptr; - v86 = hir.load v85 : felt; - v321 = arith.constant 4 : i32; - v322 = arith.constant 4 : i32; - v88 = arith.add v16, v322 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/vec_alloc_vec/::deallocate(v88, v321, v321) - v320 = arith.constant 16 : i32; - v92 = arith.add v16, v320 : i32 #[overflow = wrapping]; - v93 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__stack_pointer : ptr - v94 = hir.bitcast v93 : ptr; - hir.store v94, v92; - scf.yield v86; + v88 = hir.load_local : i32 #[local = lv2]; + v89 = hir.load_local : i32 #[local = lv0]; + v353 = arith.constant 2 : u32; + v92 = arith.shl v89, v353 : i32; + v93 = arith.add v88, v92 : i32 #[overflow = wrapping]; + v94 = hir.bitcast v93 : u32; + v404 = arith.constant 4 : u32; + v96 = arith.mod v94, v404 : u32; + hir.assertz v96 #[code = 250]; + v97 = hir.int_to_ptr v94 : ptr; + v98 = hir.load v97 : felt; + hir.store_local v98 #[local = lv3]; + v99 = hir.load_local : i32 #[local = lv1]; + v402 = arith.constant 4 : i32; + v403 = arith.constant 4 : i32; + v101 = arith.add v99, v403 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/vec_alloc_vec/::deallocate(v101, v402, v402) + v104 = hir.load_local : i32 #[local = lv1]; + v401 = arith.constant 16 : i32; + v106 = arith.add v104, v401 : i32 #[overflow = wrapping]; + v107 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__stack_pointer : ptr + v108 = hir.bitcast v107 : ptr; + hir.store v108, v106; + v109 = hir.load_local : felt #[local = lv3]; + scf.yield v109; }; - v307 = arith.constant 1 : u32; - v319 = arith.constant 0 : u32; - v317 = cf.select v77, v319, v307 : u32; - scf.yield v316, v317; + v388 = arith.constant 1 : u32; + v400 = arith.constant 0 : u32; + v398 = cf.select v87, v400, v388 : u32; + scf.yield v397, v398; }; - v318 = arith.constant 0 : u32; - v315 = arith.eq v311, v318 : i1; - cf.cond_br v315 ^block10, ^block50(v310); + v399 = arith.constant 0 : u32; + v396 = arith.eq v392, v399 : i1; + cf.cond_br v396 ^block10, ^block48(v391); ^block10: ub.unreachable ; - ^block50(v303: felt): - builtin.ret v303; + ^block48(v384: felt): + builtin.ret v384; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { @@ -148,304 +164,358 @@ builtin.component root_ns:root@1.0.0 { builtin.ret ; }; - private builtin.function @::alloc(v97: i32, v98: i32, v99: i32) -> i32 { - ^block16(v97: i32, v98: i32, v99: i32): - v102 = arith.constant 16 : i32; - v101 = arith.constant 0 : i32; - v340 = arith.constant 16 : u32; - v104 = hir.bitcast v98 : u32; - v106 = arith.gt v104, v340 : i1; - v107 = arith.zext v106 : u32; - v108 = hir.bitcast v107 : i32; - v110 = arith.neq v108, v101 : i1; - v111 = cf.select v110, v98, v102 : i32; - v380 = arith.constant 0 : i32; - v112 = arith.constant -1 : i32; - v113 = arith.add v111, v112 : i32 #[overflow = wrapping]; - v114 = arith.band v111, v113 : i32; - v116 = arith.neq v114, v380 : i1; - v349, v350 = scf.if v116 : i32, u32 { - ^block55: - v341 = arith.constant 0 : u32; - v345 = ub.poison i32 : i32; - scf.yield v345, v341; + private builtin.function @::alloc(v112: i32, v113: i32, v114: i32) -> i32 { + ^block16(v112: i32, v113: i32, v114: i32): + hir.store_local v112 #[local = lv0]; + hir.store_local v113 #[local = lv1]; + hir.store_local v114 #[local = lv2]; + v116 = hir.load_local : i32 #[local = lv1]; + v426 = arith.constant 16 : i32; + v425 = arith.constant 0 : i32; + v421 = arith.constant 16 : u32; + v120 = hir.bitcast v116 : u32; + v122 = arith.gt v120, v421 : i1; + v123 = arith.zext v122 : u32; + v124 = hir.bitcast v123 : i32; + v126 = arith.neq v124, v425 : i1; + v127 = cf.select v126, v116, v426 : i32; + hir.store_local v127 #[local = lv3]; + v128 = hir.load_local : i32 #[local = lv3]; + v469 = arith.constant 0 : i32; + v424 = arith.constant -1 : i32; + v130 = arith.add v128, v424 : i32 #[overflow = wrapping]; + v131 = arith.band v127, v130 : i32; + v133 = arith.neq v131, v469 : i1; + v447, v448 = scf.if v133 : i32, u32 { + ^block54: + v439 = arith.constant 0 : u32; + v443 = ub.poison i32 : i32; + scf.yield v443, v439; } else { ^block19: - v118 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/::max(v98, v111) : i32 - v379 = arith.constant 0 : i32; - v117 = arith.constant -2147483648 : i32; - v119 = arith.sub v117, v118 : i32 #[overflow = wrapping]; - v121 = hir.bitcast v119 : u32; - v120 = hir.bitcast v99 : u32; - v122 = arith.gt v120, v121 : i1; - v123 = arith.zext v122 : u32; - v124 = hir.bitcast v123 : i32; - v126 = arith.neq v124, v379 : i1; - v364 = scf.if v126 : i32 { - ^block54: - v378 = ub.poison i32 : i32; - scf.yield v378; + v134 = hir.load_local : i32 #[local = lv2]; + v136 = hir.load_local : i32 #[local = lv1]; + v137 = hir.load_local : i32 #[local = lv3]; + v138 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/::max(v136, v137) : i32 + hir.store_local v138 #[local = lv1]; + v468 = arith.constant 0 : i32; + v423 = arith.constant -2147483648 : i32; + v139 = arith.sub v423, v138 : i32 #[overflow = wrapping]; + v141 = hir.bitcast v139 : u32; + v140 = hir.bitcast v134 : u32; + v142 = arith.gt v140, v141 : i1; + v143 = arith.zext v142 : u32; + v144 = hir.bitcast v143 : i32; + v146 = arith.neq v144, v468 : i1; + v453 = scf.if v146 : i32 { + ^block53: + v467 = ub.poison i32 : i32; + scf.yield v467; } else { ^block20: - v376 = arith.constant 0 : i32; - v132 = arith.sub v376, v118 : i32 #[overflow = wrapping]; - v377 = arith.constant -1 : i32; - v128 = arith.add v99, v118 : i32 #[overflow = wrapping]; - v130 = arith.add v128, v377 : i32 #[overflow = wrapping]; - v133 = arith.band v130, v132 : i32; - v134 = hir.bitcast v97 : u32; - v135 = arith.constant 4 : u32; - v136 = arith.mod v134, v135 : u32; - hir.assertz v136 #[code = 250]; - v137 = hir.int_to_ptr v134 : ptr; - v138 = hir.load v137 : i32; - v375 = arith.constant 0 : i32; - v140 = arith.neq v138, v375 : i1; - scf.if v140{ - ^block53: + v466 = arith.constant 0 : i32; + hir.store_local v466 #[local = lv3]; + v148 = hir.load_local : i32 #[local = lv2]; + v149 = hir.load_local : i32 #[local = lv1]; + v464 = arith.constant 0 : i32; + v155 = arith.sub v464, v149 : i32 #[overflow = wrapping]; + v465 = arith.constant -1 : i32; + v150 = arith.add v148, v149 : i32 #[overflow = wrapping]; + v152 = arith.add v150, v465 : i32 #[overflow = wrapping]; + v156 = arith.band v152, v155 : i32; + hir.store_local v156 #[local = lv2]; + v157 = hir.load_local : i32 #[local = lv0]; + v158 = hir.bitcast v157 : u32; + v422 = arith.constant 4 : u32; + v160 = arith.mod v158, v422 : u32; + hir.assertz v160 #[code = 250]; + v161 = hir.int_to_ptr v158 : ptr; + v162 = hir.load v161 : i32; + v463 = arith.constant 0 : i32; + v164 = arith.neq v162, v463 : i1; + scf.if v164{ + ^block52: scf.yield ; } else { ^block22: - v141 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/intrinsics::mem::heap_base() : i32 - v142 = hir.mem_size : u32; - v148 = hir.bitcast v97 : u32; - v374 = arith.constant 4 : u32; - v150 = arith.mod v148, v374 : u32; - hir.assertz v150 #[code = 250]; - v373 = arith.constant 16 : u32; - v143 = hir.bitcast v142 : i32; - v146 = arith.shl v143, v373 : i32; - v147 = arith.add v141, v146 : i32 #[overflow = wrapping]; - v151 = hir.int_to_ptr v148 : ptr; - hir.store v151, v147; + v165 = hir.load_local : i32 #[local = lv0]; + v166 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/intrinsics::mem::heap_base() : i32 + v167 = hir.mem_size : u32; + v173 = hir.bitcast v165 : u32; + v462 = arith.constant 4 : u32; + v175 = arith.mod v173, v462 : u32; + hir.assertz v175 #[code = 250]; + v461 = arith.constant 16 : u32; + v168 = hir.bitcast v167 : i32; + v171 = arith.shl v168, v461 : i32; + v172 = arith.add v166, v171 : i32 #[overflow = wrapping]; + v176 = hir.int_to_ptr v173 : ptr; + hir.store v176, v172; scf.yield ; }; - v154 = hir.bitcast v97 : u32; - v372 = arith.constant 4 : u32; - v156 = arith.mod v154, v372 : u32; - hir.assertz v156 #[code = 250]; - v157 = hir.int_to_ptr v154 : ptr; - v158 = hir.load v157 : i32; - v370 = arith.constant 0 : i32; - v371 = arith.constant -1 : i32; - v160 = arith.bxor v158, v371 : i32; - v162 = hir.bitcast v160 : u32; - v161 = hir.bitcast v133 : u32; - v163 = arith.gt v161, v162 : i1; - v164 = arith.zext v163 : u32; - v165 = hir.bitcast v164 : i32; - v167 = arith.neq v165, v370 : i1; - v363 = scf.if v167 : i32 { - ^block23: - v369 = arith.constant 0 : i32; - scf.yield v369; + v177 = hir.load_local : i32 #[local = lv2]; + v178 = hir.load_local : i32 #[local = lv0]; + v179 = hir.bitcast v178 : u32; + v460 = arith.constant 4 : u32; + v181 = arith.mod v179, v460 : u32; + hir.assertz v181 #[code = 250]; + v182 = hir.int_to_ptr v179 : ptr; + v183 = hir.load v182 : i32; + hir.store_local v183 #[local = lv4]; + v458 = arith.constant 0 : i32; + v459 = arith.constant -1 : i32; + v185 = arith.bxor v183, v459 : i32; + v187 = hir.bitcast v185 : u32; + v186 = hir.bitcast v177 : u32; + v188 = arith.gt v186, v187 : i1; + v189 = arith.zext v188 : u32; + v190 = hir.bitcast v189 : i32; + v192 = arith.neq v190, v458 : i1; + scf.if v192{ + ^block51: + scf.yield ; } else { ^block24: - v169 = hir.bitcast v97 : u32; - v368 = arith.constant 4 : u32; - v171 = arith.mod v169, v368 : u32; - hir.assertz v171 #[code = 250]; - v168 = arith.add v158, v133 : i32 #[overflow = wrapping]; - v172 = hir.int_to_ptr v169 : ptr; - hir.store v172, v168; - v174 = arith.add v158, v118 : i32 #[overflow = wrapping]; - scf.yield v174; + v193 = hir.load_local : i32 #[local = lv0]; + v194 = hir.load_local : i32 #[local = lv4]; + v195 = hir.load_local : i32 #[local = lv2]; + v197 = hir.bitcast v193 : u32; + v457 = arith.constant 4 : u32; + v199 = arith.mod v197, v457 : u32; + hir.assertz v199 #[code = 250]; + v196 = arith.add v194, v195 : i32 #[overflow = wrapping]; + v200 = hir.int_to_ptr v197 : ptr; + hir.store v200, v196; + v201 = hir.load_local : i32 #[local = lv4]; + v202 = hir.load_local : i32 #[local = lv1]; + v203 = arith.add v201, v202 : i32 #[overflow = wrapping]; + hir.store_local v203 #[local = lv3]; + scf.yield ; }; - scf.yield v363; + v204 = hir.load_local : i32 #[local = lv3]; + scf.yield v204; }; - v346 = arith.constant 1 : u32; - v367 = arith.constant 0 : u32; - v365 = cf.select v126, v367, v346 : u32; - scf.yield v364, v365; + v444 = arith.constant 1 : u32; + v456 = arith.constant 0 : u32; + v454 = cf.select v146, v456, v444 : u32; + scf.yield v453, v454; }; - v366 = arith.constant 0 : u32; - v362 = arith.eq v350, v366 : i1; - cf.cond_br v362 ^block18, ^block57(v349); + v455 = arith.constant 0 : u32; + v452 = arith.eq v448, v455 : i1; + cf.cond_br v452 ^block18, ^block56(v447); ^block18: ub.unreachable ; - ^block57(v342: i32): - builtin.ret v342; + ^block56(v440: i32): + builtin.ret v440; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { ^block25: - v177 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v177; + v205 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v205; }; - private builtin.function @intrinsics::felt::from_u32(v179: i32) -> felt { - ^block29(v179: i32): - v180 = hir.bitcast v179 : felt; - builtin.ret v180; - }; - - private builtin.function @alloc::alloc::handle_alloc_error(v182: i32, v183: i32) { - ^block31(v182: i32, v183: i32): + private builtin.function @alloc::alloc::handle_alloc_error(v207: i32, v208: i32) { + ^block29(v207: i32, v208: i32): ub.unreachable ; }; - private builtin.function @::deallocate(v184: i32, v185: i32, v186: i32) { - ^block33(v184: i32, v185: i32, v186: i32): - v188 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__stack_pointer : ptr - v189 = hir.bitcast v188 : ptr; - v190 = hir.load v189 : i32; - v191 = arith.constant 16 : i32; - v192 = arith.sub v190, v191 : i32 #[overflow = wrapping]; - v193 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__stack_pointer : ptr - v194 = hir.bitcast v193 : ptr; - hir.store v194, v192; - v195 = arith.constant 4 : i32; - v196 = arith.add v192, v195 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/vec_alloc_vec/::current_memory(v196, v184, v185, v186) - v198 = arith.constant 8 : u32; - v197 = hir.bitcast v192 : u32; - v199 = arith.add v197, v198 : u32 #[overflow = checked]; - v200 = arith.constant 4 : u32; - v201 = arith.mod v199, v200 : u32; - hir.assertz v201 #[code = 250]; - v202 = hir.int_to_ptr v199 : ptr; - v203 = hir.load v202 : i32; - v387 = arith.constant 0 : i32; - v187 = arith.constant 0 : i32; - v205 = arith.eq v203, v187 : i1; - v206 = arith.zext v205 : u32; - v207 = hir.bitcast v206 : i32; - v209 = arith.neq v207, v387 : i1; - scf.if v209{ - ^block61: + private builtin.function @::deallocate(v209: i32, v210: i32, v211: i32) { + ^block31(v209: i32, v210: i32, v211: i32): + hir.store_local v211 #[local = lv2]; + v212 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__stack_pointer : ptr + v213 = hir.bitcast v212 : ptr; + v214 = hir.load v213 : i32; + v475 = arith.constant 16 : i32; + v216 = arith.sub v214, v475 : i32 #[overflow = wrapping]; + hir.store_local v216 #[local = lv3]; + v217 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__stack_pointer : ptr + v218 = hir.bitcast v217 : ptr; + hir.store v218, v216; + v219 = hir.load_local : i32 #[local = lv3]; + v224 = hir.load_local : i32 #[local = lv2]; + v474 = arith.constant 4 : i32; + v221 = arith.add v219, v474 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/vec_alloc_vec/::current_memory(v221, v209, v210, v224) + v225 = hir.load_local : i32 #[local = lv3]; + v473 = arith.constant 8 : u32; + v226 = hir.bitcast v225 : u32; + v228 = arith.add v226, v473 : u32 #[overflow = checked]; + v472 = arith.constant 4 : u32; + v230 = arith.mod v228, v472 : u32; + hir.assertz v230 #[code = 250]; + v231 = hir.int_to_ptr v228 : ptr; + v232 = hir.load v231 : i32; + hir.store_local v232 #[local = lv2]; + v486 = arith.constant 0 : i32; + v480 = arith.constant 0 : i32; + v234 = arith.eq v232, v480 : i1; + v235 = arith.zext v234 : u32; + v236 = hir.bitcast v235 : i32; + v238 = arith.neq v236, v486 : i1; + scf.if v238{ + ^block59: scf.yield ; } else { - ^block36: - v386 = arith.constant 4 : u32; - v210 = hir.bitcast v192 : u32; - v212 = arith.add v210, v386 : u32 #[overflow = checked]; - v385 = arith.constant 4 : u32; - v214 = arith.mod v212, v385 : u32; - hir.assertz v214 #[code = 250]; - v215 = hir.int_to_ptr v212 : ptr; - v216 = hir.load v215 : i32; - v218 = arith.constant 12 : u32; - v217 = hir.bitcast v192 : u32; - v219 = arith.add v217, v218 : u32 #[overflow = checked]; - v384 = arith.constant 4 : u32; - v221 = arith.mod v219, v384 : u32; - hir.assertz v221 #[code = 250]; - v222 = hir.int_to_ptr v219 : ptr; - v223 = hir.load v222 : i32; - hir.exec @root_ns:root@1.0.0/vec_alloc_vec/::deallocate(v216, v203, v223) + ^block34: + v239 = hir.load_local : i32 #[local = lv3]; + v485 = arith.constant 4 : u32; + v240 = hir.bitcast v239 : u32; + v242 = arith.add v240, v485 : u32 #[overflow = checked]; + v484 = arith.constant 4 : u32; + v244 = arith.mod v242, v484 : u32; + hir.assertz v244 #[code = 250]; + v245 = hir.int_to_ptr v242 : ptr; + v246 = hir.load v245 : i32; + v247 = hir.load_local : i32 #[local = lv2]; + v248 = hir.load_local : i32 #[local = lv3]; + v470 = arith.constant 12 : u32; + v249 = hir.bitcast v248 : u32; + v251 = arith.add v249, v470 : u32 #[overflow = checked]; + v483 = arith.constant 4 : u32; + v253 = arith.mod v251, v483 : u32; + hir.assertz v253 #[code = 250]; + v254 = hir.int_to_ptr v251 : ptr; + v255 = hir.load v254 : i32; + hir.exec @root_ns:root@1.0.0/vec_alloc_vec/::deallocate(v246, v247, v255) scf.yield ; }; - v383 = arith.constant 16 : i32; - v226 = arith.add v192, v383 : i32 #[overflow = wrapping]; - v227 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__stack_pointer : ptr - v228 = hir.bitcast v227 : ptr; - hir.store v228, v226; + v256 = hir.load_local : i32 #[local = lv3]; + v482 = arith.constant 16 : i32; + v258 = arith.add v256, v482 : i32 #[overflow = wrapping]; + v259 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__stack_pointer : ptr + v260 = hir.bitcast v259 : ptr; + hir.store v260, v258; builtin.ret ; }; - private builtin.function @::current_memory(v229: i32, v230: i32, v231: i32, v232: i32) { - ^block37(v229: i32, v230: i32, v231: i32, v232: i32): - v413 = arith.constant 0 : i32; - v233 = arith.constant 0 : i32; - v237 = arith.eq v232, v233 : i1; - v238 = arith.zext v237 : u32; - v239 = hir.bitcast v238 : i32; - v241 = arith.neq v239, v413 : i1; - v400, v401 = scf.if v241 : i32, i32 { - ^block64: - v412 = arith.constant 0 : i32; - v235 = arith.constant 4 : i32; - scf.yield v235, v412; + private builtin.function @::current_memory(v261: i32, v262: i32, v263: i32, v264: i32) { + ^block35(v261: i32, v262: i32, v263: i32, v264: i32): + hir.store_local v261 #[local = lv0]; + hir.store_local v262 #[local = lv1]; + hir.store_local v263 #[local = lv2]; + hir.store_local v264 #[local = lv3]; + v490 = arith.constant 0 : i32; + hir.store_local v490 #[local = lv4]; + v489 = arith.constant 4 : i32; + hir.store_local v489 #[local = lv5]; + v267 = hir.load_local : i32 #[local = lv3]; + v510 = arith.constant 0 : i32; + v511 = arith.constant 0 : i32; + v269 = arith.eq v267, v511 : i1; + v270 = arith.zext v269 : u32; + v271 = hir.bitcast v270 : i32; + v273 = arith.neq v271, v510 : i1; + scf.if v273{ + ^block62: + scf.yield ; } else { - ^block40: - v242 = hir.bitcast v230 : u32; - v277 = arith.constant 4 : u32; - v244 = arith.mod v242, v277 : u32; - hir.assertz v244 #[code = 250]; - v245 = hir.int_to_ptr v242 : ptr; - v246 = hir.load v245 : i32; - v410 = arith.constant 0 : i32; - v411 = arith.constant 0 : i32; - v248 = arith.eq v246, v411 : i1; - v249 = arith.zext v248 : u32; - v250 = hir.bitcast v249 : i32; - v252 = arith.neq v250, v410 : i1; - v398 = scf.if v252 : i32 { - ^block63: - v409 = arith.constant 0 : i32; - scf.yield v409; + ^block38: + v274 = hir.load_local : i32 #[local = lv1]; + v275 = hir.bitcast v274 : u32; + v498 = arith.constant 4 : u32; + v277 = arith.mod v275, v498 : u32; + hir.assertz v277 #[code = 250]; + v278 = hir.int_to_ptr v275 : ptr; + v279 = hir.load v278 : i32; + hir.store_local v279 #[local = lv6]; + v508 = arith.constant 0 : i32; + v509 = arith.constant 0 : i32; + v281 = arith.eq v279, v509 : i1; + v282 = arith.zext v281 : u32; + v283 = hir.bitcast v282 : i32; + v285 = arith.neq v283, v508 : i1; + scf.if v285{ + ^block61: + scf.yield ; } else { - ^block41: - v408 = arith.constant 4 : u32; - v253 = hir.bitcast v229 : u32; - v255 = arith.add v253, v408 : u32 #[overflow = checked]; - v407 = arith.constant 4 : u32; - v257 = arith.mod v255, v407 : u32; - hir.assertz v257 #[code = 250]; - v258 = hir.int_to_ptr v255 : ptr; - hir.store v258, v231; - v406 = arith.constant 4 : u32; - v259 = hir.bitcast v230 : u32; - v261 = arith.add v259, v406 : u32 #[overflow = checked]; - v405 = arith.constant 4 : u32; - v263 = arith.mod v261, v405 : u32; - hir.assertz v263 #[code = 250]; - v264 = hir.int_to_ptr v261 : ptr; - v265 = hir.load v264 : i32; - v266 = hir.bitcast v229 : u32; - v404 = arith.constant 4 : u32; - v268 = arith.mod v266, v404 : u32; - hir.assertz v268 #[code = 250]; - v269 = hir.int_to_ptr v266 : ptr; - hir.store v269, v265; - v270 = arith.mul v246, v232 : i32 #[overflow = wrapping]; - scf.yield v270; + ^block39: + v286 = hir.load_local : i32 #[local = lv0]; + v287 = hir.load_local : i32 #[local = lv2]; + v507 = arith.constant 4 : u32; + v288 = hir.bitcast v286 : u32; + v290 = arith.add v288, v507 : u32 #[overflow = checked]; + v506 = arith.constant 4 : u32; + v292 = arith.mod v290, v506 : u32; + hir.assertz v292 #[code = 250]; + v293 = hir.int_to_ptr v290 : ptr; + hir.store v293, v287; + v294 = hir.load_local : i32 #[local = lv0]; + v295 = hir.load_local : i32 #[local = lv1]; + v505 = arith.constant 4 : u32; + v296 = hir.bitcast v295 : u32; + v298 = arith.add v296, v505 : u32 #[overflow = checked]; + v504 = arith.constant 4 : u32; + v300 = arith.mod v298, v504 : u32; + hir.assertz v300 #[code = 250]; + v301 = hir.int_to_ptr v298 : ptr; + v302 = hir.load v301 : i32; + v303 = hir.bitcast v294 : u32; + v503 = arith.constant 4 : u32; + v305 = arith.mod v303, v503 : u32; + hir.assertz v305 #[code = 250]; + v306 = hir.int_to_ptr v303 : ptr; + hir.store v306, v302; + v307 = hir.load_local : i32 #[local = lv6]; + v308 = hir.load_local : i32 #[local = lv3]; + v309 = arith.mul v307, v308 : i32 #[overflow = wrapping]; + hir.store_local v309 #[local = lv4]; + v487 = arith.constant 8 : i32; + hir.store_local v487 #[local = lv5]; + scf.yield ; }; - v271 = arith.constant 8 : i32; - v403 = arith.constant 4 : i32; - v399 = cf.select v252, v403, v271 : i32; - scf.yield v399, v398; + scf.yield ; }; - v274 = arith.add v229, v400 : i32 #[overflow = wrapping]; - v276 = hir.bitcast v274 : u32; - v402 = arith.constant 4 : u32; - v278 = arith.mod v276, v402 : u32; - hir.assertz v278 #[code = 250]; - v279 = hir.int_to_ptr v276 : ptr; - hir.store v279, v401; + v311 = hir.load_local : i32 #[local = lv0]; + v312 = hir.load_local : i32 #[local = lv5]; + v314 = hir.load_local : i32 #[local = lv4]; + v313 = arith.add v311, v312 : i32 #[overflow = wrapping]; + v315 = hir.bitcast v313 : u32; + v502 = arith.constant 4 : u32; + v317 = arith.mod v315, v502 : u32; + hir.assertz v317 #[code = 250]; + v318 = hir.int_to_ptr v315 : ptr; + hir.store v318, v314; builtin.ret ; }; - private builtin.function @::deallocate(v280: i32, v281: i32, v282: i32) { - ^block42(v280: i32, v281: i32, v282: i32): - v415 = arith.constant 0 : i32; - v283 = arith.constant 0 : i32; - v284 = arith.eq v282, v283 : i1; - v285 = arith.zext v284 : u32; - v286 = hir.bitcast v285 : i32; - v288 = arith.neq v286, v415 : i1; - scf.if v288{ - ^block44: + private builtin.function @::deallocate(v319: i32, v320: i32, v321: i32) { + ^block40(v319: i32, v320: i32, v321: i32): + hir.store_local v319 #[local = lv0]; + hir.store_local v320 #[local = lv1]; + hir.store_local v321 #[local = lv2]; + v322 = hir.load_local : i32 #[local = lv2]; + v515 = arith.constant 0 : i32; + v513 = arith.constant 0 : i32; + v324 = arith.eq v322, v513 : i1; + v325 = arith.zext v324 : u32; + v326 = hir.bitcast v325 : i32; + v328 = arith.neq v326, v515 : i1; + scf.if v328{ + ^block42: scf.yield ; } else { - ^block45: - hir.exec @root_ns:root@1.0.0/vec_alloc_vec/__rustc::__rust_dealloc(v280, v282, v281) + ^block43: + v329 = hir.load_local : i32 #[local = lv0]; + v330 = hir.load_local : i32 #[local = lv2]; + v331 = hir.load_local : i32 #[local = lv1]; + hir.exec @root_ns:root@1.0.0/vec_alloc_vec/__rustc::__rust_dealloc(v329, v330, v331) scf.yield ; }; builtin.ret ; }; - private builtin.function @::max(v289: i32, v290: i32) -> i32 { - ^block46(v289: i32, v290: i32): - v297 = arith.constant 0 : i32; - v293 = hir.bitcast v290 : u32; - v292 = hir.bitcast v289 : u32; - v294 = arith.gt v292, v293 : i1; - v295 = arith.zext v294 : u32; - v296 = hir.bitcast v295 : i32; - v298 = arith.neq v296, v297 : i1; - v299 = cf.select v298, v289, v290 : i32; - builtin.ret v299; + private builtin.function @::max(v332: i32, v333: i32) -> i32 { + ^block44(v332: i32, v333: i32): + v516 = arith.constant 0 : i32; + v340 = hir.bitcast v333 : u32; + v339 = hir.bitcast v332 : u32; + v341 = arith.gt v339, v340 : i1; + v342 = arith.zext v341 : u32; + v343 = hir.bitcast v342 : i32; + v345 = arith.neq v343, v516 : i1; + v346 = cf.select v345, v332, v333 : i32; + builtin.ret v346; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/vec_alloc_vec.masm b/tests/integration/expected/vec_alloc_vec.masm index e80d09edd..ff90c1a15 100644 --- a/tests/integration/expected/vec_alloc_vec.masm +++ b/tests/integration/expected/vec_alloc_vec.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -10,8 +10,9 @@ proc init mem_store.278528 end -# mod root_ns:root@1.0.0::vec_alloc_vec +# mod ::"root_ns:root@1.0.0"::vec_alloc_vec +@locals("2") @callconv("C") proc __rustc::__rust_alloc(i32, i32) -> i32 push.1048576 @@ -19,11 +20,12 @@ proc __rustc::__rust_alloc(i32, i32) -> i32 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::vec_alloc_vec::::alloc + exec.::"root_ns:root@1.0.0"::vec_alloc_vec::::alloc trace.252 nop end +@locals("3") @callconv("C") proc __rustc::__rust_dealloc(i32, i32, i32) drop @@ -31,8 +33,17 @@ proc __rustc::__rust_dealloc(i32, i32, i32) drop end +@locals("5") @callconv("C") pub proc entrypoint(i32) -> felt + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114112 u32divmod.4 swap.1 @@ -43,9 +54,16 @@ pub proc entrypoint(i32) -> felt nop push.16 u32wrapping_sub - push.1114112 - dup.1 + dup.0 + locaddr.1 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114112 u32divmod.4 swap.1 trace.240 @@ -55,55 +73,60 @@ pub proc entrypoint(i32) -> felt nop trace.240 nop - exec.::root_ns:root@1.0.0::vec_alloc_vec::__rustc::__rust_no_alloc_shim_is_unstable_v2 + exec.::"root_ns:root@1.0.0"::vec_alloc_vec::__rustc::__rust_no_alloc_shim_is_unstable_v2 trace.252 nop push.4 push.12 trace.240 nop - exec.::root_ns:root@1.0.0::vec_alloc_vec::__rustc::__rust_alloc + exec.::"root_ns:root@1.0.0"::vec_alloc_vec::__rustc::__rust_alloc trace.252 nop + dup.0 + locaddr.2 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 - dup.2 + push.0 + movup.2 eq neq if.true - drop - drop - drop push.12 push.4 trace.240 nop - exec.::root_ns:root@1.0.0::vec_alloc_vec::alloc::alloc::handle_alloc_error + exec.::"root_ns:root@1.0.0"::vec_alloc_vec::alloc::alloc::handle_alloc_error trace.252 nop push.0 push.3735929054 else push.1 + locaddr.3 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::vec_alloc_vec::intrinsics::felt::from_u32 - trace.252 - nop - push.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::vec_alloc_vec::intrinsics::felt::from_u32 + exec.::intrinsics::mem::store_felt trace.252 nop - push.3 + locaddr.2 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::vec_alloc_vec::intrinsics::felt::from_u32 + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.4 + swap.1 add u32assert push.4 @@ -112,6 +135,8 @@ pub proc entrypoint(i32) -> felt u32mod u32assert assertz + push.3 + swap.1 u32divmod.4 swap.1 trace.240 @@ -119,8 +144,16 @@ pub proc entrypoint(i32) -> felt exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.3 + swap.1 add u32assert push.4 @@ -129,6 +162,8 @@ pub proc entrypoint(i32) -> felt u32mod u32assert assertz + push.2 + swap.1 u32divmod.4 swap.1 trace.240 @@ -136,7 +171,23 @@ pub proc entrypoint(i32) -> felt exec.::intrinsics::mem::store_felt trace.252 nop - dup.1 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.1 push.4 dup.1 swap.1 @@ -150,8 +201,16 @@ pub proc entrypoint(i32) -> felt exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.2 + swap.1 add u32assert push.4 @@ -169,8 +228,24 @@ pub proc entrypoint(i32) -> felt exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.8 - dup.2 + movup.2 add u32assert push.4 @@ -179,8 +254,6 @@ pub proc entrypoint(i32) -> felt u32mod u32assert assertz - dup.1 - swap.1 u32divmod.4 swap.1 trace.240 @@ -188,8 +261,16 @@ pub proc entrypoint(i32) -> felt exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.2 + swap.1 add u32assert push.4 @@ -207,25 +288,42 @@ pub proc entrypoint(i32) -> felt exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.3 - dup.4 + movup.2 swap.1 u32gte neq dup.0 if.true - movdn.3 - drop - drop - drop push.3735929054 else - push.2 - movup.4 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.2 u32shl - movup.2 u32wrapping_add push.4 dup.1 @@ -240,20 +338,43 @@ pub proc entrypoint(i32) -> felt exec.::intrinsics::mem::load_felt trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 push.4 - dup.4 + movup.2 u32wrapping_add dup.1 swap.2 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::vec_alloc_vec::::deallocate + exec.::"root_ns:root@1.0.0"::vec_alloc_vec::::deallocate + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.16 - movup.3 u32wrapping_add push.1114112 u32divmod.4 @@ -263,6 +384,14 @@ pub proc entrypoint(i32) -> felt exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop end push.1 push.0 @@ -289,87 +418,213 @@ proc __rustc::__rust_no_alloc_shim_is_unstable_v2( nop end +@locals("5") @callconv("C") proc ::alloc( i32, i32, i32 ) -> i32 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 push.0 push.16 - dup.4 + dup.3 swap.1 u32gt neq - dup.3 + movup.2 swap.1 cdrop + dup.0 + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 push.4294967295 - dup.2 + movup.2 u32wrapping_add - dup.2 + movup.2 u32and neq if.true - dropw push.0 push.3735929054 else - movup.2 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + trace.240 + nop + exec.::"root_ns:root@1.0.0"::vec_alloc_vec::::max + trace.252 + nop + dup.0 + locaddr.1 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::vec_alloc_vec::::max + exec.::intrinsics::mem::store_sw trace.252 nop push.0 push.2147483648 - dup.2 + movup.2 u32wrapping_sub - dup.4 + movup.2 swap.1 u32gt neq dup.0 if.true - movdn.3 - drop - drop - drop push.3735929054 else push.0 - dup.2 - u32wrapping_sub - push.4294967295 - movup.5 - dup.4 - u32wrapping_add - u32wrapping_add - u32and - dup.3 - push.4 - dup.1 + locaddr.3 + push.0 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 swap.1 trace.240 nop exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.1 push.0 - neq - if.true + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + dup.1 + u32wrapping_sub + push.4294967295 + movup.3 + movup.3 + u32wrapping_add + u32wrapping_add + u32and + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + neq + if.true nop else + locaddr.0 + push.0 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::vec_alloc_vec::intrinsics::mem::heap_base + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::"root_ns:root@1.0.0"::vec_alloc_vec::"intrinsics::mem::heap_base" trace.252 nop trace.240 @@ -377,7 +632,7 @@ proc ::alloc( exec.::intrinsics::mem::memory_size trace.252 nop - dup.5 + movup.2 push.4 dup.1 swap.1 @@ -399,7 +654,22 @@ proc ::alloc( trace.252 nop end - dup.3 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -413,31 +683,58 @@ proc ::alloc( exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 push.4294967295 - dup.2 + movup.2 u32xor - dup.3 + movup.2 swap.1 u32gt neq if.true - drop - drop - movdn.2 - drop - drop - push.0 + nop else - movup.4 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 push.4 dup.1 swap.1 u32mod u32assert assertz - movup.2 - dup.2 + movdn.2 u32wrapping_add swap.1 u32divmod.4 @@ -447,9 +744,40 @@ proc ::alloc( exec.::intrinsics::mem::store_sw trace.252 nop - movup.2 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop u32wrapping_add + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop end push.1 push.0 @@ -480,11 +808,7 @@ proc intrinsics::mem::heap_base( nop end -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - +@locals("2") @callconv("C") proc alloc::alloc::handle_alloc_error(i32, i32) drop @@ -493,12 +817,22 @@ proc alloc::alloc::handle_alloc_error(i32, i32) assert end +@locals("4") @callconv("C") proc ::deallocate( i32, i32, i32 ) + movup.2 + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.1114112 u32divmod.4 swap.1 @@ -509,9 +843,16 @@ proc ::deallocate( nop push.16 u32wrapping_sub - push.1114112 - dup.1 + dup.0 + locaddr.3 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114112 u32divmod.4 swap.1 trace.240 @@ -519,21 +860,44 @@ proc ::deallocate( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.1 + movup.2 u32wrapping_add swap.1 - swap.4 swap.3 swap.2 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::vec_alloc_vec::::current_memory + exec.::"root_ns:root@1.0.0"::vec_alloc_vec::"::current_memory" + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.8 - dup.1 + swap.1 add u32assert push.4 @@ -549,16 +913,33 @@ proc ::deallocate( exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.2 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 - dup.2 + push.0 + movup.2 eq neq if.true - drop + nop else + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.2 + swap.1 add u32assert push.4 @@ -574,8 +955,24 @@ proc ::deallocate( exec.::intrinsics::mem::load_sw trace.252 nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.12 - dup.3 + swap.1 add u32assert push.4 @@ -591,13 +988,21 @@ proc ::deallocate( exec.::intrinsics::mem::load_sw trace.252 nop - movdn.2 + swap.2 trace.240 nop - exec.::root_ns:root@1.0.0::vec_alloc_vec::::deallocate + exec.::"root_ns:root@1.0.0"::vec_alloc_vec::"::deallocate" trace.252 nop end + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 u32wrapping_add push.1114112 @@ -610,6 +1015,7 @@ proc ::deallocate( nop end +@locals("7") @callconv("C") proc ::current_memory( i32, @@ -617,20 +1023,80 @@ proc ::current_memory( i32, i32 ) + locaddr.0 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.3 push.0 - dup.5 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 eq neq if.true - movdn.3 - drop - drop - drop - push.0 - push.4 + nop else - dup.1 + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 dup.1 swap.1 @@ -644,25 +1110,41 @@ proc ::current_memory( exec.::intrinsics::mem::load_sw trace.252 nop + dup.0 + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop push.0 push.0 - dup.2 + movup.2 eq neq - dup.0 if.true + nop + else + locaddr.0 + push.0 swap.1 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 push.0 - else + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - dup.3 + movup.2 add u32assert push.4 @@ -671,8 +1153,6 @@ proc ::current_memory( u32mod u32assert assertz - movup.5 - swap.1 u32divmod.4 swap.1 trace.240 @@ -680,8 +1160,24 @@ proc ::current_memory( exec.::intrinsics::mem::store_sw trace.252 nop + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.4 - movup.4 + swap.1 add u32assert push.4 @@ -697,7 +1193,7 @@ proc ::current_memory( exec.::intrinsics::mem::load_sw trace.252 nop - dup.3 + swap.1 push.4 dup.1 swap.1 @@ -711,21 +1207,71 @@ proc ::current_memory( exec.::intrinsics::mem::store_sw trace.252 nop - swap.3 + locaddr.6 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.3 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop trace.240 nop exec.::intrinsics::i32::wrapping_mul trace.252 nop - movup.2 + locaddr.4 + push.0 swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - push.8 - push.4 - movup.3 - cdrop end - movup.2 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.5 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.4 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movdn.2 u32wrapping_add push.4 dup.1 @@ -742,32 +1288,87 @@ proc ::current_memory( nop end +@locals("3") @callconv("C") proc ::deallocate( i32, i32, i32 ) + locaddr.0 push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.0 - dup.4 + push.0 + movup.2 eq neq if.true - drop - drop - drop + nop else - movup.2 + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::vec_alloc_vec::__rustc::__rust_dealloc + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.2 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.2 + trace.240 + nop + exec.::"root_ns:root@1.0.0"::vec_alloc_vec::__rustc::__rust_dealloc trace.252 nop end end +@locals("2") @callconv("C") proc ::max( i32, diff --git a/tests/integration/expected/xor_bool.hir b/tests/integration/expected/xor_bool.hir index b43860061..64b3a8055 100644 --- a/tests/integration/expected/xor_bool.hir +++ b/tests/integration/expected/xor_bool.hir @@ -2,8 +2,8 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @test_rust_12478c1c469cdb8e5c0d08223b9ea0b6f7c1cade83ed772fb79969d2af3004cb { public builtin.function @entrypoint(v0: i32, v1: i32) -> i32 { ^block6(v0: i32, v1: i32): - v3 = arith.bxor v0, v1 : i32; - builtin.ret v3; + v5 = arith.bxor v0, v1 : i32; + builtin.ret v5; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/xor_bool.masm b/tests/integration/expected/xor_bool.masm index 58413645b..67bd335ee 100644 --- a/tests/integration/expected/xor_bool.masm +++ b/tests/integration/expected/xor_bool.masm @@ -1,4 +1,4 @@ -# mod root_ns:root@1.0.0 +# mod ::"root_ns:root@1.0.0" proc init push.1179648 @@ -16,8 +16,9 @@ proc init mem_store.278530 end -# mod root_ns:root@1.0.0::test_rust_12478c1c469cdb8e5c0d08223b9ea0b6f7c1cade83ed772fb79969d2af3004cb +# mod ::"root_ns:root@1.0.0"::test_rust_12478c1c469cdb8e5c0d08223b9ea0b6f7c1cade83ed772fb79969d2af3004cb +@locals("2") @callconv("C") pub proc entrypoint(i32, i32) -> i32 u32xor diff --git a/tests/integration/src/cargo_proj/mod.rs b/tests/integration/src/cargo_proj/mod.rs index cf68b9166..4370f2eae 100644 --- a/tests/integration/src/cargo_proj/mod.rs +++ b/tests/integration/src/cargo_proj/mod.rs @@ -4,6 +4,7 @@ #![allow(dead_code)] use std::{ + borrow::Cow, env, fmt::Write, fs, os, @@ -67,30 +68,52 @@ impl FileBuilder { } } - fn mk(&mut self) { - if self.executable { - let mut path = self.path.clone().into_os_string(); - write!(path, "{}", env::consts::EXE_SUFFIX).unwrap(); - self.path = path.into(); + /// Return the final path for this file, including any platform-specific executable suffix. + fn output_path(&self) -> PathBuf { + if !self.executable { + return self.path.clone(); } - self.dirname().mkdir_p(); - fs::write(&self.path, &self.body) - .unwrap_or_else(|e| panic!("could not create file {}: {}", self.path.display(), e)); + let mut path = self.path.clone().into_os_string(); + write!(path, "{}", env::consts::EXE_SUFFIX).unwrap(); + path.into() + } + + /// Write the file to disk, but avoid touching the file when content is unchanged. + /// + /// Returns `(path, changed)`, where `changed` is `true` if a write occurred. + fn mk(&self) -> (PathBuf, bool) { + let path = self.output_path(); + + path.parent().unwrap().mkdir_p(); + + if fs::read(&path).ok().as_deref() == Some(self.body.as_bytes()) { + #[cfg(unix)] + if self.executable { + use std::os::unix::fs::PermissionsExt; + let mut perms = fs::metadata(&path).unwrap().permissions(); + let mode = perms.mode(); + perms.set_mode(mode | 0o111); + fs::set_permissions(&path, perms).unwrap(); + } + + return (path, false); + } + + fs::write(&path, &self.body) + .unwrap_or_else(|e| panic!("could not create file {}: {}", path.display(), e)); #[cfg(unix)] if self.executable { use std::os::unix::fs::PermissionsExt; - let mut perms = fs::metadata(&self.path).unwrap().permissions(); + let mut perms = fs::metadata(&path).unwrap().permissions(); let mode = perms.mode(); perms.set_mode(mode | 0o111); - fs::set_permissions(&self.path, perms).unwrap(); + fs::set_permissions(&path, perms).unwrap(); } - } - fn dirname(&self) -> &Path { - self.path.parent().unwrap() + (path, true) } } @@ -158,6 +181,7 @@ impl ProjectBuilder { self.root.target_debug_dir() } + /// Creates a new [`ProjectBuilder`] rooted at `root`. pub fn new(root: PathBuf) -> ProjectBuilder { ProjectBuilder { root: Project { root }, @@ -180,7 +204,13 @@ impl ProjectBuilder { } fn _file(&mut self, path: &Path, body: &str, executable: bool) { - self.files.push(FileBuilder::new(self.root.root().join(path), body, executable)); + let body = if path == Path::new("Cargo.toml") { + ensure_workspace_root_manifest(body) + } else { + Cow::Borrowed(body) + }; + self.files + .push(FileBuilder::new(self.root.root().join(path), body.as_ref(), executable)); } /// Adds a symlink to a file to the project. @@ -197,12 +227,17 @@ impl ProjectBuilder { self } + /// Disables automatic generation of a `Cargo.toml` when building the project. pub fn no_manifest(mut self) -> Self { self.no_manifest = true; self } - /// Creates the project. + /// Creates the project on disk. + /// + /// This is intentionally incremental: it prunes stale files from previous runs and rewrites + /// only changed files, while preserving Cargo artifacts like `target/` and `Cargo.lock` to + /// maximize caching across test runs. pub fn build(mut self) -> Project { let last_path_component = self.root.root().file_name().unwrap().to_string_lossy().to_string(); @@ -212,10 +247,7 @@ impl ProjectBuilder { return self.root; } - // First, clean the directory if it already exists - self.rm_root(); - - // Create the empty directory + // Create the directory if missing self.root.root().mkdir_p(); let manifest_path = self.root.root().join("Cargo.toml"); @@ -223,18 +255,18 @@ impl ProjectBuilder { self._file(Path::new("Cargo.toml"), &basic_manifest("foo", "0.0.1"), false) } + // Prune stale files from previous runs (but keep Cargo build artifacts). + self.prune_root(); + let past = time::SystemTime::now() - Duration::new(1, 0); let ftime = filetime::FileTime::from_system_time(past); - for file in self.files.iter_mut() { - file.mk(); - if is_coarse_mtime() { - // Place the entire project 1 second in the past to ensure - // that if cargo is called multiple times, the 2nd call will - // see targets as "fresh". Without this, if cargo finishes in - // under 1 second, the second call will see the mtime of - // source == mtime of output and consider it dirty. - filetime::set_file_times(&file.path, ftime, ftime).unwrap(); + for file in self.files.iter() { + let (path, changed) = file.mk(); + if changed && is_coarse_mtime() { + // Place updated files 1 second in the past to avoid coarse mtime + // collisions with build outputs (e.g. HFS on CI). + filetime::set_file_times(&path, ftime, ftime).unwrap(); } } @@ -250,6 +282,59 @@ impl ProjectBuilder { self.root.root().rm_rf() } + /// Remove stale, non-generated files from prior runs while preserving Cargo artifacts. + fn prune_root(&self) { + use std::collections::HashSet; + + let root = self.root.root(); + let expected_files: HashSet = + self.files.iter().map(|file| file.output_path()).collect(); + let expected_symlinks: HashSet = + self.symlinks.iter().map(|link| link.src.clone()).collect(); + + fn prune_dir( + dir: &Path, + expected_files: &HashSet, + expected_symlinks: &HashSet, + ) { + let entries = match fs::read_dir(dir) { + Ok(entries) => entries, + Err(_) => return, + }; + + for entry in entries.flatten() { + let path = entry.path(); + + // Preserve Cargo build artifacts and lockfile to maximize caching. + if path.file_name() == Some(std::ffi::OsStr::new("target")) + || path.file_name() == Some(std::ffi::OsStr::new("Cargo.lock")) + { + continue; + } + + let ft = match entry.file_type() { + Ok(ft) => ft, + Err(_) => continue, + }; + + if ft.is_dir() { + prune_dir(&path, expected_files, expected_symlinks); + // Best-effort cleanup of now-empty directories + let _ = fs::remove_dir(&path); + continue; + } + + let is_expected = + expected_files.contains(&path) || expected_symlinks.contains(&path); + if !is_expected { + let _ = fs::remove_file(&path); + } + } + } + + prune_dir(&root, &expected_files, &expected_symlinks); + } + fn skip_rust_compilation(&self, artifact_name: &str) -> bool { let computed_artifact_path_wuu = self .root() @@ -276,6 +361,26 @@ impl ProjectBuilder { } } +/// Ensure a generated `Cargo.toml` is treated as its own workspace root. +/// +/// When we place generated projects under this repository's `target/` directory, Cargo will +/// otherwise discover the repo's root workspace and reject the generated package as an unlisted +/// member. Adding an (empty) `[workspace]` table makes the generated package its own workspace. +fn ensure_workspace_root_manifest(manifest: &str) -> Cow<'_, str> { + let has_workspace_table = manifest.lines().any(|line| line.trim() == "[workspace]"); + if has_workspace_table { + return Cow::Borrowed(manifest); + } + + let mut s = manifest.to_string(); + if !s.ends_with('\n') { + s.push('\n'); + } + s.push('\n'); + s.push_str("[workspace]\n"); + Cow::Owned(s) +} + impl Project { /// Root of the project, ex: `/path/to/cargo/target/cit/t0/foo` pub fn root(&self) -> PathBuf { @@ -335,7 +440,7 @@ impl Project { /// Changes the contents of an existing file. pub fn change_file(&self, path: &str, body: &str) { - FileBuilder::new(self.root().join(path), body, false).mk() + let _ = FileBuilder::new(self.root().join(path), body, false).mk(); } /// Returns the contents of `Cargo.lock`. @@ -356,6 +461,7 @@ impl Project { fs::write(self.root().join("Cargo.toml"), contents).unwrap(); } + /// Creates a symlink within the project directory. pub fn symlink(&self, src: impl AsRef, dst: impl AsRef) { let src = self.root().join(src.as_ref()); let dst = self.root().join(dst.as_ref()); @@ -367,12 +473,68 @@ impl Project { } } -// Generates a project layout +/// Creates a [`ProjectBuilder`] for a generated Cargo project. +/// +/// The project is located under the Cargo target directory to maximize reuse of build artifacts +/// across test runs. +/// +/// The directory is derived from an absolute `CARGO_TARGET_DIR` when set, or inferred from the test +/// executable location. +#[track_caller] pub fn project(proj_folder_name: &str) -> ProjectBuilder { - let temp_dir = &std::env::temp_dir(); - let cargo_projects_root = temp_dir.join("miden_test_cargo_projects"); + /// Compute the directory under which generated Cargo projects should live. + /// + /// We keep these projects in the Cargo target directory so that Cargo build artifacts + /// (under each project's `target/`) can be reused across test runs. + fn cargo_projects_root() -> PathBuf { + static ROOT: OnceLock = OnceLock::new(); + ROOT.get_or_init(|| { + // Prefer an explicit override when provided (useful in CI). + if let Ok(dir) = std::env::var("CARGO_TARGET_DIR") { + let dir = PathBuf::from(dir); + if dir.is_absolute() { + return dir.join("miden_test_cargo_projects"); + } + } + + let exe = std::env::current_exe() + .unwrap_or_else(|e| panic!("failed to determine test target directory: {e}")); + + // `cargo test` places the test binary at `//deps/`. + if let Some(target_dir) = exe.parent().and_then(|p| p.parent()).and_then(|p| p.parent()) + { + return target_dir.join("miden_test_cargo_projects"); + } + + for ancestor in exe.ancestors() { + if ancestor.file_name() == Some(std::ffi::OsStr::new("target")) { + return ancestor.join("miden_test_cargo_projects"); + } + } + + panic!("failed to determine test target directory from current_exe: {}", exe.display()); + }) + .clone() + } + + /// Convert a call site into a stable directory name component. + fn callsite_dir(file: &str, line: u32, column: u32) -> String { + let mut s = String::new(); + for ch in file.chars() { + if ch.is_ascii_alphanumeric() || ch == '-' || ch == '_' { + s.push(ch); + } else { + s.push('_'); + } + } + write!(&mut s, "_{}_{}", line, column).unwrap(); + s + } + + let loc = std::panic::Location::caller(); + let cargo_projects_root = + cargo_projects_root().join(callsite_dir(loc.file(), loc.line(), loc.column())); let cargo_proj_path = cargo_projects_root.join(proj_folder_name); - // dbg!(&cargo_proj_path); ProjectBuilder::new(cargo_proj_path) } diff --git a/tests/integration/src/codegen/intrinsics/mem.rs b/tests/integration/src/codegen/intrinsics/mem.rs index e6a1d98c6..f0f5f39e5 100644 --- a/tests/integration/src/codegen/intrinsics/mem.rs +++ b/tests/integration/src/codegen/intrinsics/mem.rs @@ -4,7 +4,7 @@ use miden_debug::ToMidenRepr; use midenc_dialect_arith::ArithOpBuilder; use midenc_dialect_hir::HirOpBuilder; use midenc_hir::{ - AbiParam, Felt, PointerType, Signature, SourceSpan, Type, ValueRef, + AbiParam, Builder, Felt, PointerType, Signature, SourceSpan, Type, ValueRef, dialects::builtin::BuiltinOpBuilder, }; use proptest::{ @@ -166,6 +166,78 @@ fn load_dw() { } } +/// Regression test for `store_double_word_int` handling immediate-address stores. +/// +/// Global variable initializers are lowered using `store_imm`, which passes an immediate native +/// pointer (element address + byte offset) to the store helpers, i.e. the pointer is **not** +/// present on the operand stack. +#[test] +fn global_u64_initializer_uses_immediate_store_dw() { + setup::enable_compiler_instrumentation(); + + let init_value = 0x0123_4567_89ab_cdef_u64; + + let context = setup::dummy_context(&["--test-harness", "--entrypoint", "test::main"]); + let link_output = setup::build_empty_component_for_test(context.clone()); + + // Define `test` module. + let module = { + let mut component_builder = + midenc_hir::dialects::builtin::ComponentBuilder::new(link_output.component); + component_builder + .define_module(midenc_hir::Ident::with_empty_span("test".into())) + .unwrap() + }; + + // Define a u64 global with an initializer that returns a u64 literal. + let mut gv = { + let mut module_builder = midenc_hir::dialects::builtin::ModuleBuilder::new(module); + module_builder + .define_global_variable( + midenc_hir::Ident::with_empty_span("gv_u64".into()), + midenc_hir::Visibility::Private, + Type::U64, + ) + .unwrap() + }; + { + let init_region_ref = { + let mut global_var = gv.borrow_mut(); + global_var.initializer_mut().as_region_ref() + }; + let mut op_builder = midenc_hir::OpBuilder::new(context.clone()); + op_builder.create_block(init_region_ref, None, &[]); + op_builder.ret_imm(init_value.into(), SourceSpan::default()).unwrap(); + } + + // Entrypoint: load the global and return it. + let signature = Signature::new([], [AbiParam::new(Type::U64)]); + let function = { + let mut module_builder = midenc_hir::dialects::builtin::ModuleBuilder::new(module); + module_builder + .define_function(midenc_hir::Ident::with_empty_span("main".into()), signature.clone()) + .unwrap() + }; + { + let mut builder = midenc_hir::OpBuilder::new(context.clone()); + let mut builder = + midenc_hir::dialects::builtin::FunctionBuilder::new(function, &mut builder); + let loaded = builder.load_global(gv, SourceSpan::default()).unwrap(); + builder.ret(Some(loaded), SourceSpan::default()).unwrap(); + } + + let output = eval_link_output::( + link_output, + std::iter::empty::>(), + &[], + context.session(), + |_| Ok(()), + ) + .unwrap(); + + assert_eq!(output, init_value); +} + /// Tests the memory load intrinsic for loads of single-byte (i.e. 8-bit) values #[test] fn load_u8() { diff --git a/tests/integration/src/compiler_test.rs b/tests/integration/src/compiler_test.rs index eb1be3674..4b6ba753d 100644 --- a/tests/integration/src/compiler_test.rs +++ b/tests/integration/src/compiler_test.rs @@ -9,7 +9,7 @@ use std::{ sync::Arc, }; -use miden_assembly::LibraryPath; +use miden_assembly::PathBuf as LibraryPath; use midenc_compile::{ compile_link_output_to_masm_with_pre_assembly_stage, compile_to_unoptimized_hir, }; @@ -194,6 +194,8 @@ impl CompilerTestBuilder { "-C".into(), "target-feature=+bulk-memory,+wide-arithmetic".into(), // Compile with panic=immediate-abort to avoid emitting any panic formatting code + "-Z".into(), + "unstable-options".into(), "-C".into(), "panic=immediate-abort".into(), // Remap the compiler workspace to `.` so that build outputs do not embed user- @@ -301,8 +303,10 @@ impl CompilerTestBuilder { /// Consume the builder, invoke any tools required to obtain the inputs for the test, and if /// successful, return a [CompilerTest], ready for evaluation. pub fn build(mut self) -> CompilerTest { + let source = self.source; + // Set up the command used to compile the test inputs (typically Rust -> Wasm) - let mut command = match self.source { + let mut command = match &source { CompilerTestInputType::CargoMiden(_) => { let mut cmd = Command::new("cargo"); cmd.arg("miden").arg("build"); @@ -312,18 +316,18 @@ impl CompilerTestBuilder { }; // Extract the directory in which source code is presumed to exist (or will be placed) - let project_dir = match self.source { - CompilerTestInputType::CargoMiden(CargoTest { - ref project_dir, .. - }) => Cow::Borrowed(project_dir.as_path()), - CompilerTestInputType::Rustc(RustcTest { ref target_dir, .. }) => target_dir + let project_dir = match &source { + CompilerTestInputType::CargoMiden(CargoTest { project_dir, .. }) => { + Cow::Borrowed(project_dir.as_path()) + } + CompilerTestInputType::Rustc(RustcTest { target_dir, .. }) => target_dir .as_deref() .map(Cow::Borrowed) .unwrap_or_else(|| Cow::Owned(std::env::temp_dir())), }; // Cargo-based source types share a lot of configuration in common - if let CompilerTestInputType::CargoMiden(ref config) = self.source { + if let CompilerTestInputType::CargoMiden(ref config) = source { let manifest_path = project_dir.join("Cargo.toml"); command.arg("--manifest-path").arg(manifest_path); if config.release { @@ -332,6 +336,7 @@ impl CompilerTestBuilder { } // All test source types support custom RUSTFLAGS + let mut rustflags_env = None::; if !self.rustflags.is_empty() { let mut flags = String::with_capacity( self.rustflags.iter().map(|flag| flag.len()).sum::() + self.rustflags.len(), @@ -342,15 +347,18 @@ impl CompilerTestBuilder { } flags.push_str(flag.as_ref()); } - command.env("RUSTFLAGS", flags); + command.env("RUSTFLAGS", &flags); + rustflags_env = Some(flags); } // Pipe output of command to terminal command.stdout(Stdio::piped()); // Build test - match self.source { - CompilerTestInputType::CargoMiden(..) => { + match source { + CompilerTestInputType::CargoMiden(config) => { + maybe_dump_cargo_expand(&config, rustflags_env.as_deref()); + let mut args = vec![command.get_program().to_str().unwrap().to_string()]; let cmd_args: Vec = command .get_args() @@ -359,6 +367,8 @@ impl CompilerTestBuilder { .map(|s| s.to_str().unwrap().to_string()) .collect(); args.extend(cmd_args); + log::debug!(target: "cargo-miden", "arguments: {args:#?}"); + log::debug!(target: "cargo-miden", "env : {:#?}", command.get_envs()); let build_output = cargo_miden::run(args.into_iter(), cargo_miden::OutputType::Wasm) .unwrap() @@ -371,8 +381,6 @@ impl CompilerTestBuilder { } => (artifact_path, midenc_flags), other => panic!("Expected Wasm output, got {:?}", other), }; - // dbg!(&wasm_artifact_path); - // dbg!(&extra_midenc_flags); self.midenc_flags.append(&mut extra_midenc_flags); let artifact_name = wasm_artifact_path.file_stem().unwrap().to_str().unwrap().to_string(); @@ -388,7 +396,6 @@ impl CompilerTestBuilder { }, ) })); - // dbg!(&inputs); let context = setup::default_context(inputs, &self.midenc_flags); let session = context.session_rc(); @@ -650,7 +657,8 @@ impl CompilerTestBuilder { panic = "abort" # optimize for size opt-level = "z" - debug = false + debug = true + trim-paths = ["diagnostics", "object"] "#, sdk_path = sdk_path.display(), sdk_alloc_path = sdk_alloc_path.display(), @@ -854,7 +862,6 @@ impl CompilerTest { /// Compare the compiled MASM against the expected output pub fn expect_masm(&mut self, expected_masm_file: midenc_expect_test::ExpectFile) { let program = demangle(self.masm_src().as_str()); - std::println!("{program}"); expected_masm_file.assert_eq(&program); } @@ -1029,6 +1036,93 @@ fn wasm_to_wat(wasm_bytes: &[u8]) -> String { wat } +/// Run `cargo expand` for the given Cargo test fixture, and write the expanded Rust code to disk if +/// `MIDENC_EMIT_MACRO_EXPAND[=]` is set. +/// +/// When `MIDENC_EMIT_MACRO_EXPAND` is set with an empty value, the expanded output is written to +/// the current working directory. When set to `1`, it is treated as enabled and also defaults to +/// the current working directory. When set to a non-empty value other than `1`, it is treated as +/// the output directory. +fn maybe_dump_cargo_expand(test: &CargoTest, rustflags_env: Option<&str>) { + let Some(value) = std::env::var_os("MIDENC_EMIT_MACRO_EXPAND") else { + return; + }; + + let project_dir = if test.project_dir.is_absolute() { + test.project_dir.clone() + } else { + std::env::current_dir().unwrap().join(&test.project_dir) + }; + + let out_dir = if value.is_empty() || value == std::ffi::OsStr::new("1") { + std::env::current_dir().unwrap() + } else { + PathBuf::from(value) + }; + fs::create_dir_all(&out_dir).unwrap_or_else(|err| { + panic!( + "failed to create MIDENC_EMIT_MACRO_EXPAND output directory '{}': {err}", + out_dir.display() + ) + }); + + let filename = format!("{}.expanded.rs", sanitize_filename_component(test.name.as_ref())); + let out_file = out_dir.join(filename); + + let manifest_path = project_dir.join("Cargo.toml"); + + let mut cmd = Command::new("cargo"); + cmd.arg("expand") + .arg("--manifest-path") + .arg(&manifest_path) + // Match the target used by `cargo miden build` (and our compiler tests), so `cfg(target_*)` + // and target-specific `RUSTFLAGS` behave consistently. + .arg("--target") + .arg("wasm32-wasip2") + // Ensure the output we write doesn't include ANSI codes. + .env("CARGO_TERM_COLOR", "never"); + + if test.release { + cmd.arg("--release"); + } + if let Some(rustflags_env) = rustflags_env { + cmd.env("RUSTFLAGS", rustflags_env); + } + + let output = cmd.output().unwrap_or_else(|err| { + panic!("failed to invoke 'cargo expand' (is cargo-expand installed?): {err}") + }); + if !output.status.success() { + panic!( + "'cargo expand' failed (status: {:?})\nstdout:\n{}\nstderr:\n{}", + output.status.code(), + String::from_utf8_lossy(&output.stdout), + String::from_utf8_lossy(&output.stderr) + ); + } + + fs::write(&out_file, &output.stdout).unwrap_or_else(|err| { + panic!("failed to write expanded Rust code to '{}': {err}", out_file.display()) + }); + eprintln!("wrote expanded Rust code to '{}'", out_file.display()); +} + +/// Convert an arbitrary test name into a reasonable filename component. +fn sanitize_filename_component(name: &str) -> String { + let mut out = String::with_capacity(name.len()); + for ch in name.chars() { + match ch { + 'a'..='z' | 'A'..='Z' | '0'..='9' | '-' | '_' => out.push(ch), + _ => out.push('_'), + } + } + if out.is_empty() { + "expanded".to_string() + } else { + out + } +} + fn hash_string(inputs: &str) -> String { let hash = ::digest(inputs.as_bytes()); format!("{hash:x}") diff --git a/tests/integration/src/lib.rs b/tests/integration/src/lib.rs index 3a7da5321..f29af9ef0 100644 --- a/tests/integration/src/lib.rs +++ b/tests/integration/src/lib.rs @@ -8,6 +8,12 @@ mod cargo_proj; mod compiler_test; pub mod testing; +/// Represents an on-disk Cargo project generated for tests. +pub use self::cargo_proj::Project; +/// Builder for constructing on-disk Cargo projects used by tests. +pub use self::cargo_proj::ProjectBuilder; +/// Generates an on-disk Cargo project in the Cargo target directory for use in tests. +pub use self::cargo_proj::project; pub use self::{ compiler_test::{CargoTest, CompilerTest, CompilerTestBuilder, RustcTest}, testing::setup::default_session, diff --git a/tests/integration/src/rust_masm_tests/abi_transform/advice_map.rs b/tests/integration/src/rust_masm_tests/abi_transform/advice_map.rs index 30e4f5cbc..000f39dfe 100644 --- a/tests/integration/src/rust_masm_tests/abi_transform/advice_map.rs +++ b/tests/integration/src/rust_masm_tests/abi_transform/advice_map.rs @@ -3,8 +3,9 @@ use std::{collections::VecDeque, sync::Arc}; use miden_core::{FieldElement, StarkField, utils::group_slice_elements}; use miden_debug::{Executor, Felt as TestFelt, FromMidenRepr, ToMidenRepr}; -use miden_lib::MidenLib; use miden_processor::AdviceInputs; +use miden_protocol::ProtocolLib; +use miden_standards::StandardsLib; use midenc_expect_test::expect_file; use midenc_frontend_wasm::WasmTranslationConfig; use midenc_hir::Felt; @@ -92,9 +93,12 @@ fn test_adv_load_preimage() { let std_library = (*STDLIB).clone(); exec.dependency_resolver_mut() .add(*std_library.digest(), std_library.clone().into()); - let base_library = Arc::new(MidenLib::default().as_ref().clone()); + let protocol_library = Arc::new(ProtocolLib::default().as_ref().clone()); exec.dependency_resolver_mut() - .add(*base_library.digest(), base_library.clone().into()); + .add(*protocol_library.digest(), protocol_library.clone().into()); + let standards_library = Arc::new(StandardsLib::default().as_ref().clone()); + exec.dependency_resolver_mut() + .add(*standards_library.digest(), standards_library.clone().into()); exec.with_dependencies(package.manifest.dependencies()) .expect("Failed to register dependencies"); exec.with_advice_inputs(AdviceInputs::default().with_map(advice_map)); diff --git a/tests/integration/src/rust_masm_tests/abi_transform/stdlib.rs b/tests/integration/src/rust_masm_tests/abi_transform/stdlib.rs index 87d578981..12e2fbaf5 100644 --- a/tests/integration/src/rust_masm_tests/abi_transform/stdlib.rs +++ b/tests/integration/src/rust_masm_tests/abi_transform/stdlib.rs @@ -23,10 +23,10 @@ use crate::{ #[test] fn test_hash_elements() { let main_fn = r#" - (input: alloc::vec::Vec) -> miden_stdlib_sys::Felt { - let res = miden_stdlib_sys::hash_elements(input); - res.inner.inner.0 - }"# + (input: alloc::vec::Vec) -> miden_stdlib_sys::Felt { + let res = miden_stdlib_sys::hash_elements(input); + res.inner[0] + }"# .to_string(); let config = WasmTranslationConfig::default(); let mut test = CompilerTest::rust_fn_body_with_stdlib_sys( @@ -105,11 +105,11 @@ fn test_hash_elements() { fn test_hash_words() { // Similar to test_hash_elements, but passes Vec and uses hash_words let main_fn = r#" - (input: alloc::vec::Vec) -> miden_stdlib_sys::Felt { - let res = miden_stdlib_sys::hash_words(&input); - // Return the first limb of the digest for easy comparison - res.inner.inner.0 - }"# + (input: alloc::vec::Vec) -> miden_stdlib_sys::Felt { + let res = miden_stdlib_sys::hash_words(&input); + // Return the first limb of the digest for easy comparison + res.inner[0] + }"# .to_string(); let config = WasmTranslationConfig::default(); diff --git a/tests/integration/src/rust_masm_tests/abi_transform/tx_kernel.rs b/tests/integration/src/rust_masm_tests/abi_transform/tx_kernel.rs index c2fa19b3e..58f980526 100644 --- a/tests/integration/src/rust_masm_tests/abi_transform/tx_kernel.rs +++ b/tests/integration/src/rust_masm_tests/abi_transform/tx_kernel.rs @@ -3,8 +3,11 @@ use std::sync::Arc; use miden_assembly::Assembler; use miden_core::Felt; use miden_debug::{Executor, Felt as TestFelt}; -use miden_lib::MidenLib; -use miden_objects::note::{NoteInputs, NoteRecipient, NoteScript}; +use miden_protocol::{ + ProtocolLib, + note::{NoteInputs, NoteRecipient, NoteScript}, +}; +use miden_standards::StandardsLib; use midenc_expect_test::expect_file; use midenc_frontend_wasm::WasmTranslationConfig; use midenc_session::{Emit, STDLIB, diagnostics::Report}; @@ -14,30 +17,83 @@ use crate::{ testing::{Initializer, eval_package}, }; -#[allow(unused)] -fn setup_log() { - use log::LevelFilter; - let _ = env_logger::builder() - .filter_level(LevelFilter::Trace) - .format_timestamp(None) - .is_test(true) - .try_init(); -} - #[test] fn test_get_inputs_4() -> Result<(), Report> { test_get_inputs("4", vec![u32::MAX, 1, 2, 3]) } +#[test] +fn test_get_metadata() -> Result<(), Report> { + // Mock the Miden protocol `active_note::get_metadata` procedure. + // + // The raw protocol signature returns 8 felts on the operand stack: + // `[NOTE_ATTACHMENT (4), METADATA_HEADER (4)]`. + let masm = r#" +pub proc get_metadata + # Stack input: [] + # Stack output: [NOTE_ATTACHMENT, METADATA_HEADER] + # + # Return two word-sized values with distinct elements so we can validate that: + # - the ABI adapter consumes all 8 felts (not just 4) + # - the words are grouped/ordered correctly + # - both words are written to the return area + push.21 push.22 push.23 push.24 # METADATA_HEADER + push.11 push.12 push.13 push.14 # NOTE_ATTACHMENT +end +"# + .to_string(); + + let main_fn = r#"() -> () { + let meta = miden::active_note::get_metadata(); + + let attachment = meta.attachment; + assert_eq(attachment[0], felt!(11)); + assert_eq(attachment[1], felt!(12)); + assert_eq(attachment[2], felt!(13)); + assert_eq(attachment[3], felt!(14)); + + let header = meta.header; + assert_eq(header[0], felt!(21)); + assert_eq(header[1], felt!(22)); + assert_eq(header[2], felt!(23)); + assert_eq(header[3], felt!(24)); + }"# + .to_string(); + + let artifact_name = "abi_transform_tx_kernel_get_metadata"; + let config = WasmTranslationConfig::default(); + let mut test_builder = + CompilerTestBuilder::rust_fn_body_with_sdk(artifact_name, &main_fn, config, []); + test_builder.link_with_masm_module("miden::protocol::active_note", masm); + let mut test = test_builder.build(); + + let package = test.compiled_package(); + + let mut exec = Executor::new(vec![]); + let std_library = (*STDLIB).clone(); + exec.dependency_resolver_mut() + .add(*std_library.digest(), std_library.clone().into()); + exec.with_dependencies(package.manifest.dependencies())?; + + let _ = exec.execute(&package.unwrap_program(), test.session.source_manager.clone()); + Ok(()) +} + fn test_get_inputs(test_name: &str, expected_inputs: Vec) -> Result<(), Report> { assert!(expected_inputs.len() == 4, "for now only word-sized inputs are supported"); let masm = format!( " -export.get_inputs - push.{expect1}.{expect2}.{expect3}.{expect4} - # write word to memory, leaving the pointer on the stack - dup.4 mem_storew_be dropw - # push the inputs len on the stack +pub proc get_inputs + # Stack input: [dest_ptr] + # + # Write 4 inputs to memory starting at `dest_ptr`, then return `[num_inputs, dest_ptr]`. + # + # This matches the Miden protocol `active_note::get_inputs` convention, where `dest_ptr` is + # preserved on the operand stack alongside `num_inputs`. + dup.0 push.{expect1} swap.1 mem_store + dup.0 push.1 u32wrapping_add push.{expect2} swap.1 mem_store + dup.0 push.2 u32wrapping_add push.{expect3} swap.1 mem_store + dup.0 push.3 u32wrapping_add push.{expect4} swap.1 mem_store push.4 end ", @@ -64,21 +120,21 @@ end let config = WasmTranslationConfig::default(); let mut test_builder = CompilerTestBuilder::rust_fn_body_with_sdk(artifact_name.clone(), &main_fn, config, []); - test_builder.link_with_masm_module("miden::active_note", masm); + test_builder.link_with_masm_module("miden::protocol::active_note", masm); let mut test = test_builder.build(); - test.expect_wasm(expect_file![format!("../../../expected/{artifact_name}.wat")]); - test.expect_ir(expect_file![format!("../../../expected/{artifact_name}.hir")]); - test.expect_masm(expect_file![format!("../../../expected/{artifact_name}.masm")]); let package = test.compiled_package(); let mut exec = Executor::new(vec![]); let std_library = (*STDLIB).clone(); exec.dependency_resolver_mut() .add(*std_library.digest(), std_library.clone().into()); - let base_library = Arc::new(MidenLib::default().as_ref().clone()); + let protocol_library = Arc::new(ProtocolLib::default().as_ref().clone()); + exec.dependency_resolver_mut() + .add(*protocol_library.digest(), protocol_library.clone().into()); + let standards_library = Arc::new(StandardsLib::default().as_ref().clone()); exec.dependency_resolver_mut() - .add(*base_library.digest(), base_library.clone().into()); + .add(*standards_library.digest(), standards_library.clone().into()); exec.with_dependencies(package.manifest.dependencies())?; let _ = exec.execute(&package.unwrap_program(), test.session.source_manager.clone()); @@ -107,8 +163,8 @@ end let note_recipient = NoteRecipient::new(serial_num, note_script.clone(), inputs); let expected_digest = note_recipient.digest(); - let main_fn = r#"(serial_num: Word, script_digest: Digest, padded_inputs: Vec) -> Word { - let recipient = Recipient::compute(serial_num, script_digest, padded_inputs); + let main_fn = r#"(serial_num: Word, script_digest: Digest, inputs: Vec) -> Word { + let recipient = Recipient::compute(serial_num, script_digest, inputs); recipient.inner }"# .to_string(); @@ -124,16 +180,7 @@ end let package = test.compiled_package(); - let padded_inputs = [ - input1, - input2, - Felt::new(0), - Felt::new(0), - Felt::new(0), - Felt::new(0), - Felt::new(0), - Felt::new(0), - ]; + let inputs = [input1, input2]; let script_root: miden_core::Word = note_script.root(); // The Rust extern "C" ABI for this entrypoint uses byval pointers for the `Word`, `Digest`, @@ -155,12 +202,12 @@ end init_felts.extend_from_slice(&serial_num_felts); init_felts.extend_from_slice(&script_digest_felts); init_felts.extend_from_slice(&[ - Felt::from(padded_inputs.len() as u32), + Felt::from(inputs.len() as u32), Felt::from(vec_data_ptr), - Felt::from(padded_inputs.len() as u32), + Felt::from(inputs.len() as u32), Felt::new(0), ]); - init_felts.extend_from_slice(&padded_inputs); + init_felts.extend_from_slice(&inputs); let initializers = [Initializer::MemoryFelts { addr: base_addr / 4, diff --git a/tests/integration/src/rust_masm_tests/debug_source_locations.rs b/tests/integration/src/rust_masm_tests/debug_source_locations.rs new file mode 100644 index 000000000..e0dda2be9 --- /dev/null +++ b/tests/integration/src/rust_masm_tests/debug_source_locations.rs @@ -0,0 +1,64 @@ +//! Tests that verify debug source location information is correctly preserved +//! from Rust source code through to MASM compilation and execution. + +use std::panic::{self, AssertUnwindSafe}; + +use miden_core::Felt; +use midenc_frontend_wasm::WasmTranslationConfig; + +use crate::{CompilerTest, testing::executor_with_std}; + +#[test] +fn test_rust_assert_macro_source_location_with_debug_executor() { + let config = WasmTranslationConfig::default(); + + let mut test = CompilerTest::rust_source_cargo_miden( + "../rust-apps-wasm/rust-sdk/assert-debug-test", + config, + [], + ); + + let package = test.compiled_package(); + let program = package.unwrap_program(); + + // First, test that the function works when assertion passes (x > 100) + { + let args = vec![Felt::new(200)]; + let exec = executor_with_std(args, Some(&package)); + + let trace = exec.execute(&program, test.session.source_manager.clone()); + let result: u32 = trace.parse_result().expect("Failed to parse result"); + assert_eq!(result, 200, "When x > 100, function should return x"); + } + + // Now test that when assertion fails (x <= 100), we get a panic with source location + { + let args = vec![Felt::new(50)]; + let exec = executor_with_std(args, Some(&package)); + + let program_clone = program.clone(); + let source_manager = test.session.source_manager.clone(); + + let result = panic::catch_unwind(AssertUnwindSafe(move || { + exec.execute(&program_clone, source_manager) + })); + + let panic_message = match result { + Ok(_) => panic!("Expected execution to fail due to assertion (x=50 <= 100)"), + Err(panic_info) => { + if let Some(s) = panic_info.downcast_ref::() { + s.clone() + } else if let Some(s) = panic_info.downcast_ref::<&str>() { + s.to_string() + } else { + "Unknown panic".to_string() + } + } + }; + + if !panic_message.contains("lib.rs") || !panic_message.contains(":26:13") { + dbg!(&panic_message); + panic!("Panic message should contain source location 'lib.rs' and ':26:13'"); + } + } +} diff --git a/tests/integration/src/rust_masm_tests/examples.rs b/tests/integration/src/rust_masm_tests/examples.rs index e45c0116e..ff5df7b01 100644 --- a/tests/integration/src/rust_masm_tests/examples.rs +++ b/tests/integration/src/rust_masm_tests/examples.rs @@ -1,20 +1,18 @@ -use std::{borrow::Borrow, collections::VecDeque, sync::Arc}; +use std::{borrow::Borrow, collections::VecDeque}; use miden_core::utils::{Deserializable, Serializable}; -use miden_debug::{Executor, ToMidenRepr}; -use miden_lib::MidenLib; -use miden_mast_package::{Package, SectionId}; -use miden_objects::account::AccountComponentMetadata; +use miden_debug::ToMidenRepr; +use miden_mast_package::SectionId; +use miden_protocol::account::AccountComponentMetadata; use midenc_expect_test::{expect, expect_file}; use midenc_frontend_wasm::WasmTranslationConfig; use midenc_hir::{ Felt, FunctionIdent, Ident, Immediate, Op, SourceSpan, SymbolTable, interner::Symbol, }; -use midenc_session::STDLIB; use prop::test_runner::{Config, TestRunner}; use proptest::prelude::*; -use crate::{CompilerTest, CompilerTestBuilder, cargo_proj::project}; +use crate::{CompilerTest, CompilerTestBuilder, cargo_proj::project, testing::executor_with_std}; #[test] fn storage_example() { @@ -48,34 +46,22 @@ fn storage_example() { version = "0.1.0" supported-types = ["RegularAccountUpdatableCode"] - [[storage]] - name = "owner_public_key" - description = "test value" - slot = 0 - type = "auth::rpo_falcon512::pub_key" - - [[storage]] - name = "asset_qty_map" - description = "test map" - slot = 1 - values = [] + [[storage.slots]] + name = "miden::component::miden_storage_example::asset_qty_map" + description = "asset quantity map" + + [storage.slots.type] + key = "word" + value = "word" + + [[storage.slots]] + name = "miden::component::miden_storage_example::owner_public_key" + description = "owner public key" + type = "word" "#]] .assert_eq(&toml); } -fn executor_with_std(package: &Package, args: Vec) -> Result { - let mut exec = Executor::new(args); - let std_library = (*STDLIB).clone(); - exec.dependency_resolver_mut() - .add(*std_library.digest(), std_library.clone().into()); - let base_library = Arc::new(MidenLib::default().as_ref().clone()); - exec.dependency_resolver_mut() - .add(*base_library.digest(), base_library.clone().into()); - exec.with_dependencies(package.manifest.dependencies()) - .map_err(|err| TestCaseError::fail(err.to_string()))?; - Ok(exec) -} - #[test] fn fibonacci() { fn expected_fib(n: u32) -> u32 { @@ -100,7 +86,7 @@ fn fibonacci() { TestRunner::default() .run(&(1u32..30), move |a| { let rust_out = expected_fib(a); - let exec = executor_with_std(&package, vec![Felt::new(a as u64)])?; + let exec = executor_with_std(vec![Felt::new(a as u64)], Some(&package)); let output: u32 = exec.execute_into(&package.unwrap_program(), test.session.source_manager.clone()); dbg!(output); @@ -112,7 +98,7 @@ fn fibonacci() { #[test] fn collatz() { - let _ = env_logger::Builder::from_env("MIDENC_TRACE") + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") .format_timestamp(None) .is_test(true) .try_init(); @@ -143,7 +129,7 @@ fn collatz() { .run(&(1u32..30), move |a| { let rust_out = expected(a); let args = a.to_felts().to_vec(); - let exec = executor_with_std(&package, args)?; + let exec = executor_with_std(args, Some(&package)); let output: u32 = exec.execute_into(&package.unwrap_program(), test.session.source_manager.clone()); dbg!(output); @@ -157,7 +143,7 @@ fn collatz() { #[test] fn is_prime() { - let _ = env_logger::Builder::from_env("MIDENC_TRACE") + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") .format_timestamp(None) .is_test(true) .try_init(); @@ -223,7 +209,7 @@ fn is_prime() { prop_assert_eq!(rust_out as i32, result); let args = a.to_felts().to_vec(); - let exec = executor_with_std(&package, args)?; + let exec = executor_with_std(args, Some(&package)); let output: u32 = exec.execute_into(&package.unwrap_program(), test.session.source_manager.clone()); dbg!(output); @@ -271,11 +257,13 @@ fn counter_contract() { version = "0.1.0" supported-types = ["RegularAccountUpdatableCode"] - [[storage]] - name = "count_map" + [[storage.slots]] + name = "miden::component::miden_counter_contract::count_map" description = "counter contract storage map" - slot = 0 - values = [] + + [storage.slots.type] + key = "word" + value = "word" "#]] .assert_eq(&toml); } @@ -363,12 +351,12 @@ fn auth_component_no_auth() { let expected_function = "auth__procedure"; let exports = lib .exports() - .map(|e| format!("{}::{}", e.name.module, e.name.name.as_str())) + .map(|e| e.path().as_ref().as_str().to_string()) .collect::>(); - // dbg!(&exports); assert!( - lib.exports().any(|export| { export.name.name.as_str() == expected_function }), - "expected one of the exports to contain function '{expected_function}'" + lib.exports() + .any(|export| export.path().as_ref().last() == Some(expected_function)), + "expected one of the exports to contain function '{expected_function}', got: {exports:?}" ); // Test that the package loads @@ -398,7 +386,8 @@ fn auth_component_rpo_falcon512() { let expected_function = "auth__procedure"; assert!( - lib.exports().any(|export| { export.name.name.as_str() == expected_function }), + lib.exports() + .any(|export| export.path().as_ref().last() == Some(expected_function)), "expected one of the exports to contain function '{expected_function}'" ); diff --git a/tests/integration/src/rust_masm_tests/instructions.rs b/tests/integration/src/rust_masm_tests/instructions.rs index e81d94fa5..b61201280 100644 --- a/tests/integration/src/rust_masm_tests/instructions.rs +++ b/tests/integration/src/rust_masm_tests/instructions.rs @@ -421,14 +421,14 @@ test_unary_op_total!(bnot, !, bool); #[test] fn test_hmerge() { let main_fn = r#" - (f0: miden_stdlib_sys::Felt, f1: miden_stdlib_sys::Felt, f2: miden_stdlib_sys::Felt, f3: miden_stdlib_sys::Felt, f4: miden_stdlib_sys::Felt, f5: miden_stdlib_sys::Felt, f6: miden_stdlib_sys::Felt, f7: miden_stdlib_sys::Felt) -> miden_stdlib_sys::Felt { - let digest1 = miden_stdlib_sys::Digest::new([f0, f1, f2, f3]); - let digest2 = miden_stdlib_sys::Digest::new([f4, f5, f6, f7]); - let digests = [digest1, digest2]; - let res = miden_stdlib_sys::intrinsics::crypto::merge(digests); - res.inner.inner.0 - }"# - .to_string(); + (f0: miden_stdlib_sys::Felt, f1: miden_stdlib_sys::Felt, f2: miden_stdlib_sys::Felt, f3: miden_stdlib_sys::Felt, f4: miden_stdlib_sys::Felt, f5: miden_stdlib_sys::Felt, f6: miden_stdlib_sys::Felt, f7: miden_stdlib_sys::Felt) -> miden_stdlib_sys::Felt { + let digest1 = miden_stdlib_sys::Digest::new([f0, f1, f2, f3]); + let digest2 = miden_stdlib_sys::Digest::new([f4, f5, f6, f7]); + let digests = [digest1, digest2]; + let res = miden_stdlib_sys::intrinsics::crypto::merge(digests); + res.inner[0] + }"# + .to_string(); let config = WasmTranslationConfig::default(); let mut test = CompilerTest::rust_fn_body_with_stdlib_sys("hmerge", &main_fn, config, []); diff --git a/tests/integration/src/rust_masm_tests/intrinsics.rs b/tests/integration/src/rust_masm_tests/intrinsics.rs index bac3d51cd..74dea90d4 100644 --- a/tests/integration/src/rust_masm_tests/intrinsics.rs +++ b/tests/integration/src/rust_masm_tests/intrinsics.rs @@ -55,21 +55,44 @@ macro_rules! test_bin_op { }; } -/// Compiles given binary operation -macro_rules! test_compile_comparison_op { - ($name:ident, $op:tt) => { +macro_rules! test_bin_op_via_u64 { + ($name:ident, $op:tt, $op_ty:tt, $res_ty:tt, $a_range:expr, $b_range:expr) => { concat_idents::concat_idents!(test_name = $name { #[test] fn test_name() { let op_str = stringify!($op); - let main_fn = format!("(a: Felt, b: Felt) -> bool {{ a {op_str} b }}"); - let artifact_name = format!("{}_felt", stringify!($name)); + let op_ty_str = stringify!($op_ty); + let res_ty_str = stringify!($res_ty); + let main_fn = format!("(a: {op_ty_str}, b: {op_ty_str}) -> {res_ty_str} {{ a {op_str} b }}"); + let artifact_name = format!("{}_{}", stringify!($name), stringify!($op_ty).to_lowercase()); let config = WasmTranslationConfig::default(); let mut test = CompilerTest::rust_fn_body_with_stdlib_sys(artifact_name.clone(), &main_fn, config, None); // Test expected compilation artifacts test.expect_wasm(expect_file![format!("../../expected/{artifact_name}.wat")]); test.expect_ir(expect_file![format!("../../expected/{artifact_name}.hir")]); test.expect_masm(expect_file![format!("../../expected/{artifact_name}.masm")]); + let package = test.compiled_package(); + + // Run the Rust and compiled MASM code against a bunch of random inputs and compare the results + let res = TestRunner::default() + .run(&($a_range, $b_range), move |(a, b)| { + dbg!(a, b); + let a_felt: Felt = a.0; + let b_felt: Felt = b.0; + let rs_out = a_felt.as_int() $op b_felt.as_int(); + dbg!(&rs_out); + let mut args = Vec::::default(); + b.push_to_operand_stack(&mut args); + a.push_to_operand_stack(&mut args); + run_masm_vs_rust(rs_out, &package, &args, &test.session) + }); + match res { + Err(TestError::Fail(_, value)) => { + panic!("Found minimal(shrinked) failing case: {:?}", value); + }, + Ok(_) => (), + _ => panic!("Unexpected test result: {:?}", res), + } } }); }; @@ -87,6 +110,12 @@ macro_rules! test_bool_op_total { }; } +macro_rules! test_bool_op_total_u64 { + ($name:ident, $op:tt) => { + test_bin_op_via_u64!($name, $op, Felt, bool, any::(), any::()); + }; +} + test_bin_op_total!(add, +); test_bin_op_total!(sub, -); test_bin_op_total!(mul, *); @@ -95,15 +124,7 @@ test_bin_op_total!(neg, -); test_bool_op_total!(eq, ==); -// TODO: Comparison operators are not defined for Felt, so we cannot compile a Rust equivalent for -// the semantic test -// see https://github.com/0xMiden/compiler/issues/175 -// test_bool_op_total!(gt, >); -// test_bool_op_total!(lt, <); -// test_bool_op_total!(ge, >=); -// test_bool_op_total!(le, <=); - -test_compile_comparison_op!(gt, >); -test_compile_comparison_op!(lt, <); -test_compile_comparison_op!(ge, >=); -test_compile_comparison_op!(le, <=); +test_bool_op_total_u64!(gt, >); +test_bool_op_total_u64!(lt, <); +test_bool_op_total_u64!(ge, >=); +test_bool_op_total_u64!(le, <=); diff --git a/tests/integration/src/rust_masm_tests/misc.rs b/tests/integration/src/rust_masm_tests/misc.rs index 961fc0960..c6648c83a 100644 --- a/tests/integration/src/rust_masm_tests/misc.rs +++ b/tests/integration/src/rust_masm_tests/misc.rs @@ -55,6 +55,234 @@ fn test_func_arg_same() { .unwrap(); } +/// Regression test for https://github.com/0xMiden/compiler/issues/872 +/// +/// Previously, compilation could panic during stack manipulation with: +/// `invalid stack index: only the first 16 elements on the stack are directly accessible, got 16`. +#[test] +fn test_invalid_stack_index_16_issue_872() { + let main_fn = r#" + (a0: Felt, a1: Felt, a2: Felt, a3: Felt, a4: Felt, a5: Felt, a6: Felt, a7: Felt, + a8: Felt, a9: Felt, a10: Felt, a11: Felt, a12: Felt, a13: Felt, a14: Felt, a15: Felt) -> Felt { + // Keep locals live across the call which are used only after the call, so that the 16 + // call arguments are not at the top of the operand stack at call time. + let post = a0 + miden_stdlib_sys::felt!(1); + + let res = callee_16(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + + // Use all post-call locals to prevent DCE. + res + post + } + + #[inline(never)] + fn callee_16( + a0: Felt, a1: Felt, a2: Felt, a3: Felt, a4: Felt, a5: Felt, a6: Felt, a7: Felt, + a8: Felt, a9: Felt, a10: Felt, a11: Felt, a12: Felt, a13: Felt, a14: Felt, a15: Felt, + ) -> Felt { + a0 + a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9 + a10 + a11 + a12 + a13 + a14 + a15 + } + "#; + + setup::enable_compiler_instrumentation(); + let config = WasmTranslationConfig::default(); + let mut test = + CompilerTest::rust_fn_body_with_stdlib_sys("movup_16_issue_831", main_fn, config, []); + + let package = test.compiled_package(); + + // This should execute and return the expected value. + // Arguments are pushed in reverse order on stack. + let args: [Felt; 16] = [ + Felt::from(16u32), + Felt::from(15u32), + Felt::from(14u32), + Felt::from(13u32), + Felt::from(12u32), + Felt::from(11u32), + Felt::from(10u32), + Felt::from(9u32), + Felt::from(8u32), + Felt::from(7u32), + Felt::from(6u32), + Felt::from(5u32), + Felt::from(4u32), + Felt::from(3u32), + Felt::from(2u32), + Felt::from(1u32), + ]; + + let expected = (1u32..=16u32).fold(Felt::ZERO, |acc, x| acc + Felt::from(x)) + Felt::from(2u32); + + eval_package::(&package, [], &args, &test.session, |trace| { + let res: Felt = trace.parse_result().unwrap(); + assert_eq!(res, expected); + Ok(()) + }) + .unwrap(); +} + +/// Regression test for the case of 4 words + 1 felt (17 felts) function args the words are passed by pointer. +#[test] +fn test_invalid_stack_index_4_word_1_felt_args() { + let main_fn = r#" + ( + w0_0: Felt, + w0_1: Felt, + w0_2: Felt, + w0_3: Felt, + w1_0: Felt, + w1_1: Felt, + w1_2: Felt, + w1_3: Felt, + w2_0: Felt, + w2_1: Felt, + w2_2: Felt, + w2_3: Felt, + w3_0: Felt, + w3_1: Felt, + w3_2: Felt, + w3_3: Felt, + ) -> Felt { + let w0 = Word::new([w0_0, w0_1, w0_2, w0_3]); + let w1 = Word::new([w1_0, w1_1, w1_2, w1_3]); + let w2 = Word::new([w2_0, w2_1, w2_2, w2_3]); + let w3 = Word::new([w3_0, w3_1, w3_2, w3_3]); + + // Keep locals live across the call which are used only after the call, so that the + // call arguments are not at the top of the operand stack at call time. + let post = w0[0] + miden_stdlib_sys::felt!(1); + + let extra = w0[1]; + let res = callee_5(w0, w1, w2, w3, extra); + + // Use all post-call locals to prevent DCE. + res + post + } + + #[inline(never)] + fn callee_5(w0: Word, w1: Word, w2: Word, w3: Word, extra: Felt) -> Felt { + w0[0] + w0[1] + w0[2] + w0[3] + + w1[0] + w1[1] + w1[2] + w1[3] + + w2[0] + w2[1] + w2[2] + w2[3] + + w3[0] + w3[1] + w3[2] + w3[3] + + extra + } + "#; + + setup::enable_compiler_instrumentation(); + let config = WasmTranslationConfig::default(); + let mut test = CompilerTest::rust_fn_body_with_stdlib_sys( + "movup_4_word_1_felt_args_invalid_stack_index", + main_fn, + config, + [], + ); + + let package = test.compiled_package(); + + // This should execute and return the expected value. + // Arguments are pushed in reverse order on stack (with each Word pushed as d, c, b, a). + let args: [Felt; 16] = [ + // w3 (d, c, b, a) + Felt::from(16u32), + Felt::from(15u32), + Felt::from(14u32), + Felt::from(13u32), + // w2 (d, c, b, a) + Felt::from(12u32), + Felt::from(11u32), + Felt::from(10u32), + Felt::from(9u32), + // w1 (d, c, b, a) + Felt::from(8u32), + Felt::from(7u32), + Felt::from(6u32), + Felt::from(5u32), + // w0 (d, c, b, a) + Felt::from(4u32), + Felt::from(3u32), + Felt::from(2u32), + Felt::from(1u32), + ]; + + // Expected: + // - callee_5 sums 1..=16 and adds `extra` (w0[1] == 2) + // - main adds `post` (w0[0] + 1 == 2) + let expected = (1u32..=16u32).fold(Felt::ZERO, |acc, x| acc + Felt::from(x)) + Felt::from(4u32); + + eval_package::(&package, [], &args, &test.session, |trace| { + let res: Felt = trace.parse_result().unwrap(); + assert_eq!(res, expected); + Ok(()) + }) + .unwrap(); +} + +/// Regression test for https://github.com/0xMiden/compiler/issues/811 +/// +/// This reproduces a bug (byte-by-byte copying) in `memory.copy` lowering used by `Vec` reallocation. +#[test] +fn test_vec_realloc_copies_data_issue_811() { + let main_fn = r#"() -> Felt { + extern crate alloc; + use alloc::vec::Vec; + + // Create a Vec with a tiny capacity to make growth (and thus reallocation) likely. + let mut v: Vec = Vec::with_capacity(1); + + v.push(felt!(11111)); + let mut last_ptr = v.as_ptr() as u32; + let mut moves: u32 = 0; + + v.push(felt!(22222)); + let ptr = v.as_ptr() as u32; + if ptr != last_ptr { + moves += 1; + last_ptr = ptr; + } + + v.push(felt!(33333)); + let ptr = v.as_ptr() as u32; + if ptr != last_ptr { + moves += 1; + last_ptr = ptr; + } + + v.push(felt!(44444)); + let ptr = v.as_ptr() as u32; + if ptr != last_ptr { + moves += 1; + last_ptr = ptr; + } + + v.push(felt!(55555)); + let ptr = v.as_ptr() as u32; + if ptr != last_ptr { + moves += 1; + last_ptr = ptr; + } + + // Sum all elements - if realloc doesn't copy, the first 4 elements will be garbage. + let sum = v[0] + v[1] + v[2] + v[3] + v[4]; + if moves >= 2 { sum } else { felt!(0) } + }"#; + + setup::enable_compiler_instrumentation(); + let config = WasmTranslationConfig::default(); + let mut test = + CompilerTest::rust_fn_body_with_stdlib_sys("vec_realloc_copies_data", main_fn, config, []); + + let package = test.compiled_package(); + let args: [Felt; 0] = []; + + eval_package::(&package, [], &args, &test.session, |trace| { + let result: u64 = trace.parse_result::().unwrap().as_int(); + assert_eq!(result, 166_665, "Vec reallocation failed to copy existing elements"); + Ok(()) + }) + .unwrap(); +} + #[ignore = "too fragile (depends on mem addrs), this bug is also covered by the test_hmerge test"] #[test] fn test_func_arg_order() { @@ -73,7 +301,7 @@ fn test_func_arg_order() { let digest2 = miden_stdlib_sys::Digest::new([f4, f5, f6, f7]); let digests = [digest1, digest2]; let res = merge(digests); - res.inner.inner.0 + res.inner[0] }} #[inline] diff --git a/tests/integration/src/rust_masm_tests/mod.rs b/tests/integration/src/rust_masm_tests/mod.rs index cdcc68eca..649e4b58c 100644 --- a/tests/integration/src/rust_masm_tests/mod.rs +++ b/tests/integration/src/rust_masm_tests/mod.rs @@ -12,6 +12,7 @@ use crate::testing::eval_package; mod abi_transform; mod apps; +mod debug_source_locations; mod examples; mod instructions; mod intrinsics; diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/account.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/account.rs index 550b1c4c4..12575344b 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/base/account.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/account.rs @@ -1,7 +1,7 @@ use super::*; #[allow(clippy::uninlined_format_args)] -fn run_account_binding_test(name: &str, method: &str) { +fn run_account_binding_test_with_struct(name: &str, account_struct: &str, method: &str) { let lib_rs = format!( r"#![no_std] #![feature(alloc_error_handler)] @@ -9,13 +9,14 @@ fn run_account_binding_test(name: &str, method: &str) { use miden::*; #[component] -struct TestAccount; +{account_struct} #[component] impl TestAccount {{ {method} }} ", + account_struct = account_struct, method = method ); @@ -71,6 +72,11 @@ debug = false test.compiled_package(); } +#[allow(clippy::uninlined_format_args)] +fn run_account_binding_test(name: &str, method: &str) { + run_account_binding_test_with_struct(name, "struct TestAccount;", method) +} + #[test] fn rust_sdk_account_get_code_commitment_binding() { run_account_binding_test( @@ -219,21 +225,29 @@ fn rust_sdk_account_was_procedure_called_binding() { #[test] fn rust_sdk_account_storage_get_initial_item_binding() { - run_account_binding_test( + run_account_binding_test_with_struct( "rust_sdk_account_storage_get_initial_item_binding", + r#"struct TestAccount { + #[storage(description = "test value")] + value: Value, +}"#, "pub fn binding(&self) -> Word { - storage::get_initial_item(0) + storage::get_initial_item(Self::default().value.slot) }", ); } #[test] fn rust_sdk_account_storage_get_initial_map_item_binding() { - run_account_binding_test( + run_account_binding_test_with_struct( "rust_sdk_account_storage_get_initial_map_item_binding", + r#"struct TestAccount { + #[storage(description = "test map")] + map: StorageMap, +}"#, "pub fn binding(&self) -> Word { let key = Word::from([Felt::from_u32(0); 4]); - storage::get_initial_map_item(0, &key) + storage::get_initial_map_item(Self::default().map.slot, &key) }", ); } diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/input_note.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/input_note.rs index 54f2aa17f..7b1afe315 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/base/input_note.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/input_note.rs @@ -111,7 +111,7 @@ fn rust_sdk_input_note_get_metadata_binding() { run_input_note_binding_test( "rust_sdk_input_note_get_metadata_binding", "pub fn binding(&self) -> Word { - input_note::get_metadata(NoteIdx { inner: Felt::from_u32(0) }) + input_note::get_metadata(NoteIdx { inner: Felt::from_u32(0) }).header }", ); } diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/mod.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/mod.rs index cd1d1b3a6..20768f793 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/base/mod.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/mod.rs @@ -4,6 +4,5 @@ pub mod account; pub mod asset; pub mod faucet; pub mod input_note; -pub mod note; pub mod output_note; pub mod tx; diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/note.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/note.rs deleted file mode 100644 index 88422a767..000000000 --- a/tests/integration/src/rust_masm_tests/rust_sdk/base/note.rs +++ /dev/null @@ -1,79 +0,0 @@ -use super::*; - -#[allow(clippy::uninlined_format_args)] -fn run_note_binding_test(name: &str, body: &str) { - let lib_rs = format!( - r"#![no_std] -#![feature(alloc_error_handler)] - -use miden::*; - -#[note_script] -fn run(_arg: Word) {{ - {body} -}} -", - body = body - ); - - let sdk_path = sdk_crate_path(); - let sdk_alloc_path = sdk_alloc_crate_path(); - let component_package = format!("miden:{}", name.replace('_', "-")); - let cargo_toml = format!( - r#" -[package] -name = "{name}" -version = "0.0.1" -edition = "2024" -authors = [] - -[lib] -crate-type = ["cdylib"] - -[dependencies] -miden-sdk-alloc = {{ path = "{sdk_alloc_path}" }} -miden = {{ path = "{sdk_path}" }} - -[package.metadata.component] -package = "{component_package}" - -[package.metadata.miden] -project-kind = "note-script" - -[profile.release] -opt-level = "z" -panic = "abort" -debug = false -"#, - name = name, - sdk_path = sdk_path.display(), - sdk_alloc_path = sdk_alloc_path.display(), - component_package = component_package, - ); - - let cargo_proj = project(name) - .file("Cargo.toml", &cargo_toml) - .file("src/lib.rs", &lib_rs) - .build(); - - let mut test = CompilerTestBuilder::rust_source_cargo_miden( - cargo_proj.root(), - WasmTranslationConfig::default(), - [], - ) - .build(); - - test.expect_wasm(expect_file![format!("../../../../expected/rust_sdk/{name}.wat")]); - test.expect_ir(expect_file![format!("../../../../expected/rust_sdk/{name}.hir")]); - test.expect_masm(expect_file![format!("../../../../expected/rust_sdk/{name}.masm")]); - - test.compiled_package(); -} - -#[test] -fn rust_sdk_note_add_assets_to_account_binding() { - run_note_binding_test( - "rust_sdk_note_add_assets_to_account_binding", - "active_note::add_assets_to_account();", - ); -} diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/output_note.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/output_note.rs index 3df3ef1b2..c1cd79b66 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/base/output_note.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/output_note.rs @@ -1,6 +1,8 @@ use super::*; #[allow(clippy::uninlined_format_args)] +/// Compiles a minimal `miden` account component which calls the specified `output_note` method, and +/// compares the generated WAT/HIR/MASM output to the checked-in expectations. fn run_output_note_binding_test(name: &str, method: &str) { let lib_rs = format!( r"#![no_std] @@ -111,7 +113,7 @@ fn rust_sdk_output_note_get_metadata_binding() { run_output_note_binding_test( "rust_sdk_output_note_get_metadata_binding", "pub fn binding(&self) -> Word { - output_note::get_metadata(NoteIdx { inner: Felt::from_u32(0) }) + output_note::get_metadata(NoteIdx { inner: Felt::from_u32(0) }).header }", ); } @@ -123,8 +125,8 @@ fn rust_sdk_output_note_create_binding() { "pub fn binding(&self) -> NoteIdx { let recipient = Recipient::from([Felt::from_u32(0); 4]); let tag = Tag { inner: Felt::from_u32(0) }; - let note_type = NoteType { inner: Felt::from_u32(0) }; - output_note::create(tag, Felt::from_u32(0), note_type, Felt::from_u32(0), recipient) + let note_type = NoteType { inner: Felt::from_u32(1) }; + output_note::create(tag, note_type, recipient) }", ); } @@ -141,3 +143,46 @@ fn rust_sdk_output_note_add_asset_binding() { }", ); } + +#[test] +fn rust_sdk_output_note_set_attachment_binding() { + run_output_note_binding_test( + "rust_sdk_output_note_set_attachment_binding", + "pub fn binding(&self) -> Felt { + let idx = NoteIdx { inner: Felt::from_u32(0) }; + let attachment_scheme = Felt::from_u32(0); + let attachment_kind = Felt::from_u32(0); + let attachment = Word::from([Felt::from_u32(0); 4]); + output_note::set_attachment(idx, attachment_scheme, attachment_kind, attachment); + Felt::from_u32(0) + }", + ); +} + +#[test] +fn rust_sdk_output_note_set_word_attachment_binding() { + run_output_note_binding_test( + "rust_sdk_output_note_set_word_attachment_binding", + "pub fn binding(&self) -> Felt { + let idx = NoteIdx { inner: Felt::from_u32(0) }; + let attachment_scheme = Felt::from_u32(0); + let attachment = Word::from([Felt::from_u32(0); 4]); + output_note::set_word_attachment(idx, attachment_scheme, attachment); + Felt::from_u32(0) + }", + ); +} + +#[test] +fn rust_sdk_output_note_set_array_attachment_binding() { + run_output_note_binding_test( + "rust_sdk_output_note_set_array_attachment_binding", + "pub fn binding(&self) -> Felt { + let idx = NoteIdx { inner: Felt::from_u32(0) }; + let attachment_scheme = Felt::from_u32(0); + let attachment = Word::from([Felt::from_u32(0); 4]); + output_note::set_array_attachment(idx, attachment_scheme, attachment); + Felt::from_u32(0) + }", + ); +} diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/macros.rs b/tests/integration/src/rust_masm_tests/rust_sdk/macros.rs index c6aa89c39..561dd5c6f 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/macros.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/macros.rs @@ -35,7 +35,7 @@ fn component_macros_account_and_note() { let note_package = note.compiled_package(); let program = note_package.unwrap_program(); - let mut exec = executor_with_std(vec![]); + let mut exec = executor_with_std(vec![], None); exec.dependency_resolver_mut() .add(account_package.digest(), account_package.into()); exec.with_dependencies(note_package.manifest.dependencies()) diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs b/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs index d46df91e9..e7ba7d868 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs @@ -1,13 +1,10 @@ -use std::{collections::BTreeMap, env, path::PathBuf, sync::Arc}; +use std::{collections::BTreeMap, env, path::PathBuf}; use miden_core::{ Felt, FieldElement, Word, utils::{Deserializable, Serializable}, }; -use miden_debug::Executor; -use miden_lib::MidenLib; -use miden_mast_package::Package; -use miden_objects::account::{AccountComponentMetadata, AccountComponentTemplate, InitStorageData}; +use miden_protocol::account::{AccountComponentMetadata, component::InitStorageData}; use midenc_expect_test::expect_file; use midenc_frontend_wasm::WasmTranslationConfig; use midenc_hir::{FunctionIdent, Ident, SourceSpan, interner::Symbol}; @@ -17,44 +14,13 @@ use crate::{ CompilerTest, CompilerTestBuilder, cargo_proj::project, compiler_test::{sdk_alloc_crate_path, sdk_crate_path}, + testing::{self, executor_with_std}, }; mod base; mod macros; mod stdlib; -fn executor_with_std(args: Vec) -> Executor { - let mut exec = Executor::new(args); - let std_library = (*STDLIB).clone(); - exec.dependency_resolver_mut() - .add(*std_library.digest(), std_library.clone().into()); - let base_library = Arc::new(MidenLib::default().as_ref().clone()); - exec.dependency_resolver_mut() - .add(*base_library.digest(), base_library.clone().into()); - exec -} - -#[test] -#[ignore = "until https://github.com/0xMiden/compiler/issues/439 is fixed"] -fn account() { - let artifact_name = "miden_sdk_account_test"; - let config = WasmTranslationConfig::default(); - let mut test = CompilerTest::rust_source_cargo_miden( - "../rust-apps-wasm/rust-sdk/account-test", - config, - [], - ); - test.expect_wasm(expect_file![format!( - "../../../expected/rust_sdk_account_test/{artifact_name}.wat" - )]); - test.expect_ir(expect_file![format!( - "../../../expected/rust_sdk_account_test/{artifact_name}.hir" - )]); - // test.expect_masm(expect_file![format!( - // "../../../expected/rust_sdk_account_test/{artifact_name}.masm" - // )]); -} - #[test] fn rust_sdk_swapp_note_bindings() { let name = "rust_sdk_swapp_note_bindings"; @@ -98,18 +64,24 @@ debug = false use miden::*; -#[note_script] -fn run(_arg: Word) { - let sender = active_note::get_sender(); - let script_root = active_note::get_script_root(); - let serial_number = active_note::get_serial_number(); - let balance = active_account::get_balance(sender); +#[note] +struct Note; + +#[note] +impl Note { + #[note_script] + pub fn run(self, _arg: Word) { + let sender = active_note::get_sender(); + let script_root = active_note::get_script_root(); + let serial_number = active_note::get_serial_number(); + let balance = active_account::get_balance(sender); - assert_eq!(sender.prefix, sender.prefix); - assert_eq!(sender.suffix, sender.suffix); - assert_eq!(script_root, script_root); - assert_eq!(serial_number, serial_number); - assert_eq!(balance, balance); + assert_eq!(sender.prefix, sender.prefix); + assert_eq!(sender.suffix, sender.suffix); + assert_eq!(script_root, script_root); + assert_eq!(serial_number, serial_number); + assert_eq!(balance, balance); + } } "#; @@ -136,6 +108,24 @@ fn run(_arg: Word) { test.compiled_package(); } +/// Regression test for https://github.com/0xMiden/compiler/issues/831 +/// +/// Previously, compilation could panic during MASM codegen with: +/// `invalid stack offset for movup: 16 is out of range`. +#[test] +fn rust_sdk_invalid_stack_offset_movup_16_issue_831() { + let config = WasmTranslationConfig::default(); + let mut test = CompilerTest::rust_source_cargo_miden( + "../rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup", + config, + [], + ); + + // Ensure the crate compiles all the way to a package. This previously triggered the #831 + // panic in MASM codegen. + let package = test.compiled_package(); +} + #[test] fn rust_sdk_cross_ctx_account_and_note() { let config = WasmTranslationConfig::default(); @@ -149,20 +139,23 @@ fn rust_sdk_cross_ctx_account_and_note() { test.expect_masm(expect_file![format!("../../../expected/rust_sdk/cross_ctx_account.masm")]); let account_package = test.compiled_package(); let lib = account_package.unwrap_library(); + let exports = lib + .exports() + .filter(|e| !e.path().as_ref().as_str().starts_with("intrinsics")) + .map(|e| e.path().as_ref().as_str().to_string()) + .collect::>(); assert!( !lib.exports() - .any(|export| { export.name.to_string().starts_with("intrinsics") }), + .any(|export| export.path().as_ref().as_str().starts_with("intrinsics")), "expected no intrinsics in the exports" ); - let expected_module = "miden:cross-ctx-account/foo@1.0.0"; - let expected_function = "process-felt"; + let expected_module_prefix = "::\"miden:cross-ctx-account/"; + let expected_function_suffix = "\"process-felt\""; assert!( - lib.exports().any(|export| { - export.name.module.to_string() == expected_module - && export.name.name.as_str() == expected_function - }), - "expected one of the exports to contain module '{expected_module}' and function \ - '{expected_function}" + exports.iter().any(|export| export.starts_with(expected_module_prefix) + && export.ends_with(expected_function_suffix)), + "expected one of the exports to start with '{expected_module_prefix}' and end with \ + '{expected_function_suffix}', got exports: {exports:?}" ); // Test that the package loads let bytes = account_package.to_bytes(); @@ -181,7 +174,7 @@ fn rust_sdk_cross_ctx_account_and_note() { test.expect_masm(expect_file![format!("../../../expected/rust_sdk/cross_ctx_note.masm")]); let package = test.compiled_package(); let program = package.unwrap_program(); - let mut exec = executor_with_std(vec![]); + let mut exec = executor_with_std(vec![], None); exec.dependency_resolver_mut() .add(account_package.digest(), account_package.into()); exec.with_dependencies(package.manifest.dependencies()) @@ -206,21 +199,19 @@ fn rust_sdk_cross_ctx_account_and_note_word() { )]); let account_package = test.compiled_package(); let lib = account_package.unwrap_library(); - let expected_module = "miden:cross-ctx-account-word/foo@1.0.0"; - let expected_function = "process-word"; + let expected_module_prefix = "::\"miden:cross-ctx-account-word/"; + let expected_function_suffix = "\"process-word\""; let exports = lib .exports() - .filter(|e| !e.name.module.to_string().starts_with("intrinsics")) - .map(|e| format!("{}::{}", e.name.module, e.name.name.as_str())) + .filter(|e| !e.path().as_ref().as_str().starts_with("intrinsics")) + .map(|e| e.path().as_ref().as_str().to_string()) .collect::>(); // dbg!(&exports); assert!( - lib.exports().any(|export| { - export.name.module.to_string() == expected_module - && export.name.name.as_str() == expected_function - }), - "expected one of the exports to contain module '{expected_module}' and function \ - '{expected_function}" + exports.iter().any(|export| export.starts_with(expected_module_prefix) + && export.ends_with(expected_function_suffix)), + "expected one of the exports to start with '{expected_module_prefix}' and end with \ + '{expected_function_suffix}', got exports: {exports:?}" ); // Test that the package loads let bytes = account_package.to_bytes(); @@ -238,7 +229,7 @@ fn rust_sdk_cross_ctx_account_and_note_word() { test.expect_ir(expect_file![format!("../../../expected/rust_sdk/cross_ctx_note_word.hir")]); test.expect_masm(expect_file![format!("../../../expected/rust_sdk/cross_ctx_note_word.masm")]); let package = test.compiled_package(); - let mut exec = executor_with_std(vec![]); + let mut exec = executor_with_std(vec![], None); exec.dependency_resolver_mut() .add(account_package.digest(), account_package.into()); exec.with_dependencies(package.manifest.dependencies()) @@ -248,7 +239,7 @@ fn rust_sdk_cross_ctx_account_and_note_word() { #[test] fn pure_rust_hir2() { - let _ = env_logger::builder().is_test(true).try_init(); + testing::setup::enable_compiler_instrumentation(); let config = WasmTranslationConfig::default(); let mut test = CompilerTest::rust_source_cargo_miden("../rust-apps-wasm/rust-sdk/add", config, []); @@ -277,21 +268,18 @@ fn rust_sdk_cross_ctx_word_arg_account_and_note() { let account_package = test.compiled_package(); let lib = account_package.unwrap_library(); - let expected_module = "miden:cross-ctx-account-word-arg/foo@1.0.0"; - let expected_function = "process-word"; + let expected_module_prefix = "::\"miden:cross-ctx-account-word-arg/"; + let expected_function_suffix = "\"process-word\""; let exports = lib .exports() - .filter(|e| !e.name.module.to_string().starts_with("intrinsics")) - .map(|e| format!("{}::{}", e.name.module, e.name.name.as_str())) + .filter(|e| !e.path().as_ref().as_str().starts_with("intrinsics")) + .map(|e| e.path().as_ref().as_str().to_string()) .collect::>(); - dbg!(&exports); assert!( - lib.exports().any(|export| { - export.name.module.to_string() == expected_module - && export.name.name.as_str() == expected_function - }), - "expected one of the exports to contain module '{expected_module}' and function \ - '{expected_function}" + exports.iter().any(|export| export.starts_with(expected_module_prefix) + && export.ends_with(expected_function_suffix)), + "expected one of the exports to start with '{expected_module_prefix}' and end with \ + '{expected_function_suffix}', got exports: {exports:?}" ); // Build counter note @@ -310,7 +298,7 @@ fn rust_sdk_cross_ctx_word_arg_account_and_note() { )]); let package = test.compiled_package(); assert!(package.is_program()); - let mut exec = executor_with_std(vec![]); + let mut exec = executor_with_std(vec![], None); exec.dependency_resolver_mut() .add(account_package.digest(), account_package.into()); exec.with_dependencies(package.manifest.dependencies()) diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/collections.rs b/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/collections.rs index 7f2f13985..f00efdd4b 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/collections.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/collections.rs @@ -5,8 +5,9 @@ use miden_core::{ crypto::merkle::{MerkleStore, Smt}, }; use miden_debug::Executor; -use miden_lib::MidenLib; use miden_processor::AdviceInputs; +use miden_protocol::ProtocolLib; +use miden_standards::StandardsLib; use midenc_expect_test::expect_file; use midenc_frontend_wasm::WasmTranslationConfig; use midenc_session::STDLIB; @@ -56,9 +57,12 @@ fn executor_with_std(args: Vec) -> Executor { let std_library = (*STDLIB).clone(); exec.dependency_resolver_mut() .add(*std_library.digest(), std_library.clone().into()); - let base_library = Arc::new(MidenLib::default().as_ref().clone()); + let protocol_library = Arc::new(ProtocolLib::default().as_ref().clone()); exec.dependency_resolver_mut() - .add(*base_library.digest(), base_library.clone().into()); + .add(*protocol_library.digest(), protocol_library.clone().into()); + let standards_library = Arc::new(StandardsLib::default().as_ref().clone()); + exec.dependency_resolver_mut() + .add(*standards_library.digest(), standards_library.clone().into()); exec } diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/hashes.rs b/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/hashes.rs index 60d875e2c..012592f6b 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/hashes.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/hashes.rs @@ -15,7 +15,7 @@ use crate::{ /// Runs the provided stdlib hash function against random 32-byte inputs and compares the outputs /// between Rust and the compiled MASM program. -fn run_stdlib_hash_1to1_test(artifact_name: &'static str, rust_call_expr: &str, expected_fn: F) +fn run_stdlib_hash_test(artifact_name: &'static str, rust_call_expr: &str, expected_fn: F) where F: Fn(&[u8; 32]) -> [u8; 32] + Copy, { @@ -69,7 +69,7 @@ where /// Runs the provided stdlib hash function against random 64-byte inputs and compares the outputs /// between Rust and the compiled MASM program. -fn run_stdlib_hash_2to1_test(artifact_name: &'static str, rust_call_expr: &str, expected_fn: F) +fn run_stdlib_merge_test(artifact_name: &'static str, rust_call_expr: &str, expected_fn: F) where F: Fn(&[u8; 64]) -> [u8; 32] + Copy, { @@ -121,9 +121,9 @@ where /// Tests the BLAKE3 hash helper exported by the Rust stdlib bindings. #[test] fn test_blake3_1to1_hash() { - run_stdlib_hash_1to1_test( + run_stdlib_hash_test( "abi_transform_stdlib_blake3_hash", - "miden_stdlib_sys::blake3_hash_1to1(a)", + "miden_stdlib_sys::blake3_hash(a)", |ibytes| { let hash = blake3::hash(ibytes); let mut output = [0u8; 32]; @@ -136,9 +136,9 @@ fn test_blake3_1to1_hash() { /// Tests the SHA-256 hash helper exported by the Rust stdlib bindings. #[test] fn test_sha256_1to1_hash() { - run_stdlib_hash_1to1_test( + run_stdlib_hash_test( "rust_sdk_stdlib_sha256_hash", - "miden_stdlib_sys::sha256_hash_1to1(a)", + "miden_stdlib_sys::sha256_hash(a)", |ibytes| { let hash = Sha256::digest(ibytes); let mut output = [0u8; 32]; @@ -151,10 +151,10 @@ fn test_sha256_1to1_hash() { /// Tests the BLAKE3 hash helper (2-to-1) via the full compilation pipeline. #[test] #[ignore = "requires large stack frame; kept for reference"] -fn test_blake3_hash_2to1() { - run_stdlib_hash_2to1_test( - "abi_transform_stdlib_blake3_hash_2to1", - "miden_stdlib_sys::blake3_hash_2to1(a)", +fn test_blake3_merge() { + run_stdlib_merge_test( + "abi_transform_stdlib_blake3_merge", + "miden_stdlib_sys::blake3_merge(a)", |ibytes| { let hash = blake3::hash(ibytes); let mut output = [0u8; 32]; @@ -167,10 +167,10 @@ fn test_blake3_hash_2to1() { /// Tests the SHA-256 hash helper (2-to-1) via the full compilation pipeline. #[test] #[ignore = "requires large stack frame; kept for reference"] -fn test_sha256_hash_2to1() { - run_stdlib_hash_2to1_test( - "rust_sdk_stdlib_sha256_hash_2to1", - "miden_stdlib_sys::sha256_hash_2to1(a)", +fn test_sha256_merge() { + run_stdlib_merge_test( + "rust_sdk_stdlib_sha256_merge", + "miden_stdlib_sys::sha256_merge(a)", |ibytes| { let hash = Sha256::digest(ibytes); let mut output = [0u8; 32]; diff --git a/tests/integration/src/testing/eval.rs b/tests/integration/src/testing/eval.rs index 9ddfeb387..2964270d6 100644 --- a/tests/integration/src/testing/eval.rs +++ b/tests/integration/src/testing/eval.rs @@ -2,8 +2,9 @@ use std::sync::Arc; use miden_core::{Felt, FieldElement}; use miden_debug::{ExecutionTrace, Executor, FromMidenRepr}; -use miden_lib::MidenLib; use miden_processor::AdviceInputs; +use miden_protocol::ProtocolLib; +use miden_standards::StandardsLib; use midenc_compile::LinkOutput; use midenc_session::{STDLIB, Session}; use proptest::test_runner::TestCaseError; @@ -110,9 +111,12 @@ where let std_library = (*STDLIB).clone(); exec.dependency_resolver_mut() .add(*std_library.digest(), std_library.clone().into()); - let base_library = Arc::new(MidenLib::default().as_ref().clone()); + let protocol_library = Arc::new(ProtocolLib::default().as_ref().clone()); exec.dependency_resolver_mut() - .add(*base_library.digest(), base_library.clone().into()); + .add(*protocol_library.digest(), protocol_library.clone().into()); + let standards_library = Arc::new(StandardsLib::default().as_ref().clone()); + exec.dependency_resolver_mut() + .add(*standards_library.digest(), standards_library.clone().into()); exec.with_dependencies(package.manifest.dependencies()) .map_err(|err| TestCaseError::fail(format_report(err)))?; diff --git a/tests/integration/src/testing/mod.rs b/tests/integration/src/testing/mod.rs index fad919d3a..396da7552 100644 --- a/tests/integration/src/testing/mod.rs +++ b/tests/integration/src/testing/mod.rs @@ -4,11 +4,41 @@ mod eval; mod initializer; pub mod setup; +use std::sync::Arc; + +use miden_core::Felt; +use miden_debug::Executor; +use miden_mast_package::Package; +use miden_protocol::ProtocolLib; +use miden_standards::StandardsLib; +use midenc_session::STDLIB; + pub use self::{ eval::{compile_link_output_to_package, compile_test_module, eval_link_output, eval_package}, initializer::Initializer, }; +/// Creates an executor with standard library and base library loaded. +/// +/// If a package is provided, its dependencies will also be added to the executor. +pub fn executor_with_std(args: Vec, package: Option<&Package>) -> Executor { + let mut exec = Executor::new(args); + let std_library = (*STDLIB).clone(); + exec.dependency_resolver_mut() + .add(*std_library.digest(), std_library.clone().into()); + let protocol_library = Arc::new(ProtocolLib::default().as_ref().clone()); + exec.dependency_resolver_mut() + .add(*protocol_library.digest(), protocol_library.clone().into()); + let standards_library = Arc::new(StandardsLib::default().as_ref().clone()); + exec.dependency_resolver_mut() + .add(*standards_library.digest(), standards_library.clone().into()); + if let Some(pkg) = package { + exec.with_dependencies(pkg.manifest.dependencies()) + .expect("Failed to set up dependencies"); + } + exec +} + /// Pretty-print `report` to a String pub fn format_report(report: miden_assembly::diagnostics::Report) -> String { use core::fmt::Write; diff --git a/tests/integration/src/testing/setup.rs b/tests/integration/src/testing/setup.rs index 6725c508c..53917c15b 100644 --- a/tests/integration/src/testing/setup.rs +++ b/tests/integration/src/testing/setup.rs @@ -15,7 +15,7 @@ use super::format_report; /// Enable compiler-internal tracing and instrumentation during tests pub fn enable_compiler_instrumentation() { - let _ = env_logger::Builder::from_env("MIDENC_TRACE") + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") .format_timestamp(None) .is_test(true) .try_init(); diff --git a/tests/lit/debuginfo/inline-stubs.wat b/tests/lit/debuginfo/inline-stubs.wat new file mode 100644 index 000000000..151775a49 --- /dev/null +++ b/tests/lit/debuginfo/inline-stubs.wat @@ -0,0 +1,103 @@ +;; RUN: midenc %s --entrypoint=test_felt_add --emit=hir=- 2>&1 | filecheck %s --check-prefix=HIR-ADD +;; RUN: midenc %s --entrypoint=test_felt_assert_eq --emit=hir=- 2>&1 | filecheck %s --check-prefix=HIR-ASSERT +;; RUN: midenc %s --entrypoint=test_felt_arithmetic --emit=hir=- 2>&1 | filecheck %s --check-prefix=HIR-ARITH +;; +;; This test verifies that linker stubs (intrinsic functions like felt::add, felt::assert_eq) +;; are inlined at call sites rather than being emitted as separate function definitions. +;; + +;; === Test 1: felt::add should be inlined === +;; The arith.add operation should appear directly in test_felt_add, +;; NOT as a call to a separate intrinsics::felt::add function. + +;; HIR-ADD: public builtin.function @test_felt_add +;; HIR-ADD: arith.add {{.*}} : felt +;; HIR-ADD: builtin.ret + +;; Verify NO separate stub function is created for felt::add +;; HIR-ADD-NOT: builtin.function @intrinsics::felt::add + +;; === Test 2: felt::assert_eq should be inlined === +;; The hir.assert_eq operation should appear directly in test_felt_assert_eq. + +;; HIR-ASSERT: public builtin.function @test_felt_assert_eq +;; HIR-ASSERT: hir.assert_eq +;; HIR-ASSERT: builtin.ret + +;; Verify NO separate stub function is created for felt::assert_eq +;; HIR-ASSERT-NOT: builtin.function @intrinsics::felt::assert_eq + +;; === Test 3: Multiple felt operations should all be inlined === +;; All arithmetic operations should be inlined in test_felt_arithmetic. + +;; HIR-ARITH: public builtin.function @test_felt_arithmetic +;; HIR-ARITH: arith.add {{.*}} : felt +;; HIR-ARITH: arith.sub {{.*}} : felt +;; HIR-ARITH: arith.mul {{.*}} : felt +;; HIR-ARITH: builtin.ret + +;; Verify NO separate stub functions are created +;; HIR-ARITH-NOT: builtin.function @intrinsics::felt::add +;; HIR-ARITH-NOT: builtin.function @intrinsics::felt::sub +;; HIR-ARITH-NOT: builtin.function @intrinsics::felt::mul + +(module $inline_stubs_test.wasm + (type (;0;) (func (param f32 f32) (result f32))) + (type (;1;) (func (param f32 f32))) + (memory (;0;) 16) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (export "memory" (memory 0)) + (export "test_felt_add" (func $test_felt_add)) + (export "test_felt_assert_eq" (func $test_felt_assert_eq)) + (export "test_felt_arithmetic" (func $test_felt_arithmetic)) + + ;; Test function that calls felt::add stub + ;; The stub should be inlined as arith.add + (func $test_felt_add (;0;) (type 0) (param f32 f32) (result f32) + local.get 0 + local.get 1 + call $intrinsics::felt::add + ) + + ;; Test function that calls felt::assert_eq stub + ;; The stub should be inlined as hir.assert_eq + (func $test_felt_assert_eq (;1;) (type 1) (param f32 f32) + local.get 0 + local.get 1 + call $intrinsics::felt::assert_eq + ) + + ;; Test function that calls multiple felt stubs + ;; All stubs should be inlined + (func $test_felt_arithmetic (;2;) (type 0) (param f32 f32) (result f32) + (local f32 f32) + ;; sum = a + b + local.get 0 + local.get 1 + call $intrinsics::felt::add + local.set 2 + ;; diff = a - b + local.get 0 + local.get 1 + call $intrinsics::felt::sub + local.set 3 + ;; return sum * diff + local.get 2 + local.get 3 + call $intrinsics::felt::mul + ) + + ;; Linker stubs - these have unreachable bodies and should be inlined at call sites + (func $intrinsics::felt::add (;3;) (type 0) (param f32 f32) (result f32) + unreachable + ) + (func $intrinsics::felt::sub (;4;) (type 0) (param f32 f32) (result f32) + unreachable + ) + (func $intrinsics::felt::mul (;5;) (type 0) (param f32 f32) (result f32) + unreachable + ) + (func $intrinsics::felt::assert_eq (;6;) (type 1) (param f32 f32) + unreachable + ) +) diff --git a/tests/lit/source-location/test-project/Cargo.lock b/tests/lit/debuginfo/source-locations/test-project/Cargo.lock similarity index 100% rename from tests/lit/source-location/test-project/Cargo.lock rename to tests/lit/debuginfo/source-locations/test-project/Cargo.lock diff --git a/tests/lit/source-location/test-project/Cargo.toml b/tests/lit/debuginfo/source-locations/test-project/Cargo.toml similarity index 95% rename from tests/lit/source-location/test-project/Cargo.toml rename to tests/lit/debuginfo/source-locations/test-project/Cargo.toml index 9abe2f178..ca252c50d 100644 --- a/tests/lit/source-location/test-project/Cargo.toml +++ b/tests/lit/debuginfo/source-locations/test-project/Cargo.toml @@ -1,5 +1,7 @@ cargo-features = ["trim-paths"] +[workspace] + [package] name = "source_location_test" version = "0.1.0" diff --git a/tests/lit/debuginfo/source-locations/test-project/rust-toolchain.toml b/tests/lit/debuginfo/source-locations/test-project/rust-toolchain.toml new file mode 100644 index 000000000..81d4d4199 --- /dev/null +++ b/tests/lit/debuginfo/source-locations/test-project/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "nightly-2025-12-10" +targets = ["wasm32-unknown-unknown"] +profile = "minimal" diff --git a/tests/lit/source-location/test-project/src/lib.rs b/tests/lit/debuginfo/source-locations/test-project/src/lib.rs similarity index 100% rename from tests/lit/source-location/test-project/src/lib.rs rename to tests/lit/debuginfo/source-locations/test-project/src/lib.rs diff --git a/tests/lit/debuginfo/source-locations/trim-paths.wat b/tests/lit/debuginfo/source-locations/trim-paths.wat new file mode 100644 index 000000000..25fe305ff --- /dev/null +++ b/tests/lit/debuginfo/source-locations/trim-paths.wat @@ -0,0 +1,29 @@ +;; RUN: %cargo build --target-dir %target_dir/trim-paths --manifest-path %S/test-project/Cargo.toml --release --target wasm32-unknown-unknown 2>&1 +;; RUN: env MIDENC_TRACE=debug midenc %target_dir/trim-paths/wasm32-unknown-unknown/release/source_location_test.wasm --entrypoint=source_location_test::test_assertion -Z trim-path-prefix=%S/test-project --emit=masm=- 2>&1 | filecheck %s +;; RUN: midenc %target_dir/trim-paths/wasm32-unknown-unknown/release/source_location_test.wasm --entrypoint=source_location_test::test_assertion -Z trim-path-prefix=%S/test-project -Z print-hir-source-locations --emit=hir=- 2>&1 | filecheck %s --check-prefix=HIR +;; +;; This test verifies that source location information from DWARF is correctly +;; resolved when trim-paths is enabled. +;; +;; The source_location_test example is compiled with: +;; debug = true +;; trim-paths = ["diagnostics", "object"] +;; +;; This causes DWARF to contain relative paths. +;; + +;; CHECK: resolved source path './src/lib.rs' +;; CHECK: test-project/src/lib.rs +;; CHECK: pub proc test_assertion +;; CHECK-NOT: failed to resolve source path + +;; Verify HIR output contains source locations with absolute paths +;; HIR: hir.bitcast {{.*}} #loc("/{{.*}}test-project/src/lib.rs":{{.*}}) +;; HIR: arith.gt {{.*}} #loc("/{{.*}}test-project/src/lib.rs":{{.*}}) +;; HIR: builtin.ret {{.*}} #loc("/{{.*}}test-project/src/lib.rs":{{.*}}) + +;; Verify that unreachable instructions following panic calls inherit source locations +;; This tests the fix where unreachable instructions without DWARF debug info +;; inherit the span from the previous valid instruction (the panic call). +;; HIR: hir.exec @{{.*}}panic_fmt +;; HIR-NEXT: ub.unreachable{{.*}}#loc("/{{.*}}test-project/src/lib.rs":11: diff --git a/tests/lit/lit.suite.toml b/tests/lit/lit.suite.toml new file mode 100644 index 000000000..1feb382fb --- /dev/null +++ b/tests/lit/lit.suite.toml @@ -0,0 +1,9 @@ +name = "compiler" +patterns = ["*.wat", "*.masm", "*.stderr"] + +[substitutions] +"midenc" = "$$MIDENC_BIN_DIR/midenc" +"%cargo" = "cargo +$$CARGO_MAKE_RUSTUP_TOOLCHAIN_NAME" +"%target_dir" = "$$CARGO_TARGET_DIR" + +[format.shtest] diff --git a/tests/lit/parse/fib.hir b/tests/lit/parse/fib.hir deleted file mode 100644 index 70d704e5d..000000000 --- a/tests/lit/parse/fib.hir +++ /dev/null @@ -1,42 +0,0 @@ -; RUN: midenc compile --stdout --emit=hir %s | filecheck %s - -(module #test - ;; Functions - (func (export #fib) (param u32) (result u32) - (block 0 (param v0 u32) - (let (v1 u32) (const.u32 0)) - (let (v2 u32) (const.u32 1)) - (br (block 1 v1 v2 v1))) - - (block 1 (param v3 u32) (param v4 u32) (param v5 u32) - (let (v6 i1) (lt v5 v0)) - (condbr v6 (block 2) (block 3 v3))) - - (block 2 - (let (v7 u32) (add.checked v3 v4)) - (let (v8 u32) (incr.wrapping v5)) - (br (block 1 v4 v7 v8))) - - (block 3 (param v9 u32) - (ret v9)) - ) -) - -; CHECK-LABEL: (func (export #fib -; CHECK-NEXT: (block 0 (param v0 u32) -; CHECK-NEXT: (let (v1 u32) (const.u32 0)) -; CHECK-NEXT: (let (v2 u32) (const.u32 1)) -; CHECK-NEXT: (br (block 1 v1 v2 v1))) -; CHECK-EMPTY: -; CHECK-NEXT: (block 1 (param v3 u32) (param v4 u32) (param v5 u32) -; CHECK-NEXT: (let (v6 i1) (lt v5 v0)) -; CHECK-NEXT: (condbr v6 (block 2) (block 3 v3))) -; CHECK-EMPTY: -; CHECK-NEXT: (block 2 -; CHECK-NEXT: (let (v7 u32) (add.checked v3 v4)) -; CHECK-NEXT: (let (v8 u32) (incr.wrapping v5)) -; CHECK-NEXT: (br (block 1 v4 v7 v8))) -; CHECK-EMPTY: -; CHECK-NEXT: (block 3 (param v9 u32) -; CHECK-NEXT: (ret v9)) -; CHECK-NEXT: ) diff --git a/tests/lit/parse/lit.suite.toml b/tests/lit/parse/lit.suite.toml deleted file mode 100644 index a83e466fd..000000000 --- a/tests/lit/parse/lit.suite.toml +++ /dev/null @@ -1,4 +0,0 @@ -name = "parsing" -patterns = ["*.hir"] - -[format.shtest] diff --git a/tests/lit/sdk/component-macro-invalid-argument.stderr b/tests/lit/sdk/component-macro-invalid-argument.stderr new file mode 100644 index 000000000..70332dc69 --- /dev/null +++ b/tests/lit/sdk/component-macro-invalid-argument.stderr @@ -0,0 +1,7 @@ +// RUN: env CARGO_TARGET_DIR=%target_dir/lit/sdk-project cargo run --bin component-macro-invalid-argument --manifest-path %S/sdk-project/Cargo.toml 2>&1 | filecheck %s + +// CHECK: error: #[component] does not accept arguments +// CHECK-NEXT: --> {{.*\.rs}}:[[#%d,ERRLINE:]]:{{[0-9]+}} +// CHECK-NEXT: | +// CHECK-NEXT: [[#ERRLINE]] | #[component(foo)] +// CHECK-NEXT: | ^^^^^^^^^^^^^^^^^ diff --git a/tests/lit/sdk/component-macro-invalid-field.stderr b/tests/lit/sdk/component-macro-invalid-field.stderr new file mode 100644 index 000000000..f9844fbe3 --- /dev/null +++ b/tests/lit/sdk/component-macro-invalid-field.stderr @@ -0,0 +1,7 @@ +// RUN: env CARGO_TARGET_DIR=%target_dir/lit/sdk-project cargo run --bin component-macro-invalid-field --manifest-path %S/sdk-project/Cargo.toml 2>&1 | filecheck %s + +// CHECK: error: storage field type can only be `StorageMap` or `Value` from `miden` crate +// CHECK-NEXT: --> {{.*\.rs}}:[[#%d,ERRLINE:]]:{{[0-9]+}} +// CHECK-NEXT: | +// CHECK-NEXT: [[#ERRLINE]] | counter: u32, +// CHECK-NEXT: | ^^^^^^^^^^^^ diff --git a/tests/lit/sdk/sdk-project/.gitignore b/tests/lit/sdk/sdk-project/.gitignore new file mode 100644 index 000000000..02d8d5826 --- /dev/null +++ b/tests/lit/sdk/sdk-project/.gitignore @@ -0,0 +1,2 @@ +# Ignore to avoid noise. Anyway, this project mainly uses path deps with committed Cargo.lock files. +Cargo.lock diff --git a/tests/lit/sdk/sdk-project/Cargo.toml b/tests/lit/sdk/sdk-project/Cargo.toml new file mode 100644 index 000000000..81db8ed4e --- /dev/null +++ b/tests/lit/sdk/sdk-project/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "sdk-project" +version = "0.1.0" +edition = "2024" + +[dependencies] +miden-base-macros = {path = "../../../../sdk/base-macros"} diff --git a/tests/lit/sdk/sdk-project/src/bin/component-macro-invalid-argument.rs b/tests/lit/sdk/sdk-project/src/bin/component-macro-invalid-argument.rs new file mode 100644 index 000000000..fee59e404 --- /dev/null +++ b/tests/lit/sdk/sdk-project/src/bin/component-macro-invalid-argument.rs @@ -0,0 +1,6 @@ +use miden_base_macros::component; + +#[component(foo)] +struct Contract; + +fn main() {} diff --git a/tests/lit/sdk/sdk-project/src/bin/component-macro-invalid-field.rs b/tests/lit/sdk/sdk-project/src/bin/component-macro-invalid-field.rs new file mode 100644 index 000000000..cc2a1cce2 --- /dev/null +++ b/tests/lit/sdk/sdk-project/src/bin/component-macro-invalid-field.rs @@ -0,0 +1,8 @@ +use miden_base_macros::component; + +#[component] +struct Contract { + counter: u32, +} + +fn main() {} diff --git a/tests/lit/sdk/sdk-project/src/lib.rs b/tests/lit/sdk/sdk-project/src/lib.rs new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/tests/lit/sdk/sdk-project/src/lib.rs @@ -0,0 +1 @@ + diff --git a/tests/lit/source-location/lit.suite.toml b/tests/lit/source-location/lit.suite.toml deleted file mode 100644 index ab10b18f3..000000000 --- a/tests/lit/source-location/lit.suite.toml +++ /dev/null @@ -1,5 +0,0 @@ -name = "source-location" -patterns = ["*.wat"] -working_dir = "../../../" - -[format.shtest] diff --git a/tests/lit/source-location/test.wat b/tests/lit/source-location/test.wat deleted file mode 100644 index 9193e1d87..000000000 --- a/tests/lit/source-location/test.wat +++ /dev/null @@ -1,23 +0,0 @@ -;; RUN: cargo build --release --target wasm32-unknown-unknown --manifest-path %S/test-project/Cargo.toml 2>&1 -;; RUN: env MIDENC_TRACE=debug bin/midenc %S/test-project/target/wasm32-unknown-unknown/release/source_location_test.wasm --entrypoint=source_location_test::test_assertion -Z trim-path-prefix=%S/test-project --emit=masm=- 2>&1 | filecheck %s -;; RUN: bin/midenc %S/test-project/target/wasm32-unknown-unknown/release/source_location_test.wasm --entrypoint=source_location_test::test_assertion -Z trim-path-prefix=%S/test-project -Z print-hir-source-locations --emit=hir=- 2>&1 | filecheck %s --check-prefix=HIR -;; -;; This test verifies that source location information from DWARF is correctly -;; resolved when trim-paths is enabled. -;; -;; The source_location_test example is compiled with: -;; debug = true -;; trim-paths = ["diagnostics", "object"] -;; -;; This causes DWARF to contain relative paths. -;; - -;; CHECK: resolved source path './src/lib.rs' -;; CHECK: test-project/src/lib.rs -;; CHECK: pub proc test_assertion -;; CHECK-NOT: failed to resolve source path - -;; Verify HIR output contains source locations with absolute paths -;; HIR: hir.bitcast {{.*}} #loc("/{{.*}}test-project/src/lib.rs":{{.*}}) -;; HIR: arith.gt {{.*}} #loc("/{{.*}}test-project/src/lib.rs":{{.*}}) -;; HIR: builtin.ret {{.*}} #loc("/{{.*}}test-project/src/lib.rs":{{.*}}) diff --git a/tests/lit/wasm-translation/br.wat b/tests/lit/wasm-translation/br.wat deleted file mode 100644 index 128855acf..000000000 --- a/tests/lit/wasm-translation/br.wat +++ /dev/null @@ -1,27 +0,0 @@ -;; RUN: bin/midenc compile --stdout --emit=hir %s | filecheck %s -(module - (func $main (result i32) (local i32) - block - i32.const 3 - local.set 0 - br 0 - end - local.get 0 - ) -) - -;; CHECK: (module #br -;; CHECK-NEXT: ;; Functions -;; CHECK-NEXT: (func (export #main) -;; CHECK-NEXT: (block 0 -;; CHECK-NEXT: (let (v1 i32) (const.i32 0)) -;; CHECK-NEXT: (let (v2 i32) (const.i32 3)) -;; CHECK-NEXT: (br (block 2))) -;; CHECK-EMPTY: -;; CHECK-NEXT: (block 1 (param v0 i32) -;; CHECK-NEXT: (ret v0)) -;; CHECK-EMPTY: -;; CHECK-NEXT: (block 2 -;; CHECK-NEXT: (br (block 1 v2)) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) diff --git a/tests/lit/wasm-translation/func_call.wat b/tests/lit/wasm-translation/func_call.wat deleted file mode 100644 index 670394b48..000000000 --- a/tests/lit/wasm-translation/func_call.wat +++ /dev/null @@ -1,36 +0,0 @@ -;; RUN: bin/midenc compile --stdout --emit=hir %s | filecheck %s -(module - (func $add (param i32 i32) (result i32) - local.get 0 - local.get 1 - i32.add - ) - (func $main (result i32) - i32.const 3 - i32.const 5 - call $add - ) -) - -;; CHECK: (module #func_call -;; CHECK-NEXT: ;; Functions -;; CHECK-NEXT: (func (export #add) (param i32) (param i32) (result i32) -;; CHECK-NEXT: (block 0 (param v0 i32) (param v1 i32) -;; CHECK-NEXT: (let (v3 i32) (add.wrapping v0 v1)) -;; CHECK-NEXT: (br (block 1 v3))) -;; CHECK-EMPTY: -;; CHECK-NEXT: (block 1 (param v2 i32) -;; CHECK-NEXT: (ret v2)) -;; CHECK-NEXT: ) -;; CHECK-EMPTY: -;; CHECK-NEXT: (func (export #main) (result i32) -;; CHECK-NEXT: (block 0 -;; CHECK-NEXT: (let (v1 i32) (const.i32 3)) -;; CHECK-NEXT: (let (v2 i32) (const.i32 5)) -;; CHECK-NEXT: (let (v3 i32) (call #add v1 v2)) -;; CHECK-NEXT: (br (block 1 v3))) -;; CHECK-EMPTY: -;; CHECK-NEXT: (block 1 (param v0 i32) -;; CHECK-NEXT: (ret v0)) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) diff --git a/tests/lit/wasm-translation/global_var.wat b/tests/lit/wasm-translation/global_var.wat deleted file mode 100644 index c9987b020..000000000 --- a/tests/lit/wasm-translation/global_var.wat +++ /dev/null @@ -1,32 +0,0 @@ -;; RUN: bin/midenc compile --stdout --emit=hir %s | filecheck %s -(module - (global $MyGlobalVal (mut i32) i32.const 42) - (func $main - global.get $MyGlobalVal - i32.const 9 - i32.add - global.set $MyGlobalVal - ) -) - -;; CHECK: (module #global_var -;; CHECK-NEXT: ;; Constants -;; CHECK-NEXT: (const (id 0) 0x0000002a) -;; CHECK-EMPTY: -;; CHECK-NEXT: ;; Global Variables -;; CHECK-NEXT: (global (export #MyGlobalVal) (id 0) (type i32) (const 0)) -;; CHECK-EMPTY: -;; CHECK-NEXT: ;; Functions -;; CHECK-NEXT: (func (export #main) -;; CHECK-NEXT: (block 0 -;; CHECK-NEXT: (let (v0 i32) (global.load i32 (global.symbol #MyGlobalVal))) -;; CHECK-NEXT: (let (v1 i32) (const.i32 9)) -;; CHECK-NEXT: (let (v2 i32) (add.wrapping v0 v1)) -;; CHECK-NEXT: (let (v3 (ptr i32)) (global.symbol #MyGlobalVal)) -;; CHECK-NEXT: (store v3 v2) -;; CHECK-NEXT: (br (block 1))) -;; CHECK-EMPTY: -;; CHECK-NEXT: (block 1 -;; CHECK-NEXT: (ret)) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) diff --git a/tests/lit/wasm-translation/if_then_else.wat b/tests/lit/wasm-translation/if_then_else.wat deleted file mode 100644 index f6f9d95d5..000000000 --- a/tests/lit/wasm-translation/if_then_else.wat +++ /dev/null @@ -1,35 +0,0 @@ -;; RUN: bin/midenc compile --stdout --emit=hir %s | filecheck %s -(module - (func $main (result i32) - i32.const 2 - if (result i32) - i32.const 3 - else - i32.const 5 - end - ) -) - -;; CHECK: (module #if_then_else -;; CHECK-NEXT: ;; Functions -;; CHECK-NEXT: (func (export #main) (result i32) -;; CHECK-NEXT: (block 0 -;; CHECK-NEXT: (let (v1 i32) (const.i32 2)) -;; CHECK-NEXT: (let (v2 i1) (neq v1 0)) -;; CHECK-NEXT: (condbr v2 (block 2) (block 4))) -;; CHECK-EMPTY: -;; CHECK-NEXT: (block 1 (param v0 i32) -;; CHECK-NEXT: (ret v0)) -;; CHECK-EMPTY: -;; CHECK-NEXT: (block 2 -;; CHECK-NEXT: (let (v4 i32) (const.i32 3)) -;; CHECK-NEXT: (br (block 3 v4))) -;; CHECK-EMPTY: -;; CHECK-NEXT: (block 3 (param v3 i32) -;; CHECK-NEXT: (br (block 1 v3))) -;; CHECK-EMPTY: -;; CHECK-NEXT: (block 4 -;; CHECK-NEXT: (let (v5 i32) (const.i32 5)) -;; CHECK-NEXT: (br (block 3 v5))) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) diff --git a/tests/lit/wasm-translation/lit.suite.toml b/tests/lit/wasm-translation/lit.suite.toml deleted file mode 100644 index aa7a659f2..000000000 --- a/tests/lit/wasm-translation/lit.suite.toml +++ /dev/null @@ -1,5 +0,0 @@ -name = "wasm-translation" -patterns = ["*.wat"] -working_dir = "../../../" - -[format.shtest] diff --git a/tests/lit/wasm-translation/locals.wat b/tests/lit/wasm-translation/locals.wat deleted file mode 100644 index d3833562f..000000000 --- a/tests/lit/wasm-translation/locals.wat +++ /dev/null @@ -1,22 +0,0 @@ -;; RUN: bin/midenc compile --stdout --emit=hir %s | filecheck %s -(module - (func $main (local i32) - i32.const 1 - local.set 0 - local.get 0 - drop - ) -) - -;; CHECK: (module #locals -;; CHECK-NEXT: ;; Functions -;; CHECK-NEXT: (func (export #main) -;; CHECK-NEXT: (block 0 -;; CHECK-NEXT: (let (v0 i32) (const.i32 0)) -;; CHECK-NEXT: (let (v1 i32) (const.i32 1)) -;; CHECK-NEXT: (br (block 1))) -;; CHECK-EMPTY: -;; CHECK-NEXT: (block 1 -;; CHECK-NEXT: (ret)) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) diff --git a/tests/lit/wasm-translation/locals_inter_block.wat b/tests/lit/wasm-translation/locals_inter_block.wat deleted file mode 100644 index fd0f0367c..000000000 --- a/tests/lit/wasm-translation/locals_inter_block.wat +++ /dev/null @@ -1,41 +0,0 @@ -;; RUN: bin/midenc compile --stdout --emit=hir %s | filecheck %s -(module - (func $main (result i32) (local i32) - block - i32.const 3 - local.set 0 - end - block - local.get 0 - i32.const 5 - i32.add - local.set 0 - end - i32.const 7 - local.get 0 - i32.add - ) -) - -;; CHECK: (module #locals_inter_block -;; CHECK-NEXT: ;; Functions -;; CHECK-NEXT: (func (export #main) (result i32) -;; CHECK-NEXT: (block 0 -;; CHECK-NEXT: (let (v1 i32) (const.i32 0)) -;; CHECK-NEXT: (let (v2 i32) (const.i32 3)) -;; CHECK-NEXT: (br (block 2))) -;; CHECK-EMPTY: -;; CHECK-NEXT: (block 1 (param v0 i32) -;; CHECK-NEXT: (ret v0)) -;; CHECK-EMPTY: -;; CHECK-NEXT: (block 2 -;; CHECK-NEXT: (let (v3 i32) (const.i32 5)) -;; CHECK-NEXT: (let (v4 i32) (add.wrapping v2 v3)) -;; CHECK-NEXT: (br (block 3))) -;; CHECK-EMPTY: -;; CHECK-NEXT: (block 3 -;; CHECK-NEXT: (let (v5 i32) (const.i32 7)) -;; CHECK-NEXT: (let (v6 i32) (add.wrapping v5 v4)) -;; CHECK-NEXT: (br (block 1 v6))) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) diff --git a/tests/lit/wasm-translation/loop_br_if.wat b/tests/lit/wasm-translation/loop_br_if.wat deleted file mode 100644 index 7dee5aed9..000000000 --- a/tests/lit/wasm-translation/loop_br_if.wat +++ /dev/null @@ -1,46 +0,0 @@ -;; RUN: bin/midenc compile --stdout --emit=hir %s | filecheck %s -(module - ;; Sum the decreasing numbers from 2 to 0, i.e. 2 + 1 + 0, then exit the loop - (func $main (result i32) (local i32 i32) - i32.const 2 - local.set 0 - loop - local.get 0 - local.get 1 - i32.add - local.set 1 - local.get 0 - i32.const 1 - i32.sub - local.tee 0 - br_if 0 - end - local.get 1 - ) -) - -;; CHECK: (module #loop_br_if -;; CHECK-NEXT: ;; Functions -;; CHECK-NEXT: (func (export #main) (result i32) -;; CHECK-NEXT: (block 0 -;; CHECK-NEXT: (let (v1 i32) (const.i32 0)) -;; CHECK-NEXT: (let (v2 i32) (const.i32 2)) -;; CHECK-NEXT: (br (block 2 v2 v1))) -;; CHECK-EMPTY: -;; CHECK-NEXT: (block 1 (param v0 i32) -;; CHECK-NEXT: (ret v0)) -;; CHECK-EMPTY: -;; CHECK-NEXT: (block 2 (param v3 i32) (param v4 i32) -;; CHECK-NEXT: (let (v5 i32) (add.wrapping v3 v4)) -;; CHECK-NEXT: (let (v6 i32) (const.i32 1)) -;; CHECK-NEXT: (let (v7 i32) (sub.wrapping v3 v6)) -;; CHECK-NEXT: (let (v8 i1) (neq v7 0)) -;; CHECK-NEXT: (condbr v8 (block 2 v7 v5) (block 4))) -;; CHECK-EMPTY: -;; CHECK-NEXT: (block 3 -;; CHECK-NEXT: (br (block 1 v5))) -;; CHECK-EMPTY: -;; CHECK-NEXT: (block 4 -;; CHECK-NEXT: (br (block 3))) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) diff --git a/tests/lit/wasm-translation/modules.wat b/tests/lit/wasm-translation/modules.wat deleted file mode 100644 index 81cbe2664..000000000 --- a/tests/lit/wasm-translation/modules.wat +++ /dev/null @@ -1,19 +0,0 @@ -;; RUN: bin/midenc compile --stdout --emit=hir %s | filecheck %s -(module - (func $main - i32.const 0 - drop - ) -) - -;; CHECK: (module #modules -;; CHECK-NEXT: ;; Functions -;; CHECK-NEXT: (func (export #main) -;; CHECK-NEXT: (block 0 -;; CHECK-NEXT: (let (v0 i32) (const.i32 0)) -;; CHECK-NEXT: (br (block 1))) -;; CHECK-EMPTY: -;; CHECK-NEXT: (block 1 -;; CHECK-NEXT: (ret)) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) diff --git a/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.toml b/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.toml deleted file mode 100644 index 9d6aa3113..000000000 --- a/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.toml +++ /dev/null @@ -1,20 +0,0 @@ -cargo-features = ["trim-paths"] - -[package] -name = "miden-sdk-account-test" -rust-version = "1.71" -license = "MIT" -edition = "2024" - -[lib] -crate-type = ["cdylib", "rlib"] - -[dependencies] -miden = { path = "../../../../sdk/sdk" } - -[profile.release] -panic = "abort" -# optimize for size -opt-level = "z" -debug = true -trim-paths = ["diagnostics", "object"] diff --git a/tests/rust-apps-wasm/rust-sdk/account-test/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/account-test/src/lib.rs deleted file mode 100644 index 2b0b5003b..000000000 --- a/tests/rust-apps-wasm/rust-sdk/account-test/src/lib.rs +++ /dev/null @@ -1,108 +0,0 @@ -#![no_std] -#![feature(alloc_error_handler)] - -extern crate alloc; - -use miden::*; - -#[global_allocator] -static ALLOC: BumpAlloc = BumpAlloc::new(); - -pub struct Account; - -impl Account { - #[unsafe(no_mangle)] - pub fn get_wallet_magic_number() -> Felt { - let acc_id = miden::active_account::get_id(); - let magic = felt!(42); - magic + acc_id.into() - } - - #[unsafe(no_mangle)] - pub fn test_add_asset() -> Felt { - let asset_in = Asset::new([felt!(1), felt!(2), felt!(3), felt!(4)]); - let asset_out = miden::native_account::add_asset(asset_in); - asset_out.as_word()[0] - } - - #[unsafe(no_mangle)] - pub fn test_felt_ops_smoke(a: Felt, b: Felt) -> Felt { - let d = a.as_u64(); - if a > b { - a.inv() + b - } else if a < b { - a.exp(b) - b - } else if a <= b { - a.pow2() * b - } else if a >= b { - b / a - } else if a == b { - miden::assert_eq(a, b); - a + Felt::from_u64_unchecked(d) - } else if a != b { - -a - } else if b.is_odd() { - assert(a); - b - } else { - assertz(b); - a - } - } -} - -pub struct Note; - -impl Note { - #[unsafe(no_mangle)] - pub fn note_script() -> Felt { - let mut sum = Felt::new(0).unwrap(); - for input in miden::active_note::get_inputs() { - sum = sum + input; - } - sum - } -} - -#[unsafe(no_mangle)] -pub fn test_blake3_hash_1to1(input: [u8; 32]) -> [u8; 32] { - blake3_hash_1to1(input) -} - -#[unsafe(no_mangle)] -pub fn test_blake3_hash_2to1(input: [u8; 64]) -> [u8; 32] { - blake3_hash_2to1(input) -} - -#[unsafe(no_mangle)] -pub fn test_rpo_falcon512_verify(pk: Word, msg: Word) { - rpo_falcon512_verify(pk, msg) -} - -#[unsafe(no_mangle)] -pub fn test_pipe_words_to_memory(num_words: Felt) -> (Word, Vec) { - pipe_words_to_memory(num_words) -} - -#[unsafe(no_mangle)] -pub fn test_pipe_double_words_to_memory(num_words: Felt) -> (Word, Vec) { - pipe_double_words_to_memory(num_words) -} - -#[unsafe(no_mangle)] -pub fn test_remove_asset(asset: Asset) -> Felt { - let asset_out = miden::native_account::remove_asset(asset); - asset_out.as_word()[0] -} - -#[unsafe(no_mangle)] -pub fn test_create_note( - asset: Asset, - tag: Tag, - note_type: NoteType, - recipient: Recipient, -) -> NoteIdx { - let note_idx = miden::output_note::create(tag, Felt::ZERO, note_type, Felt::ZERO, recipient); - miden::output_note::add_asset(asset, note_idx); - note_idx -} diff --git a/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock index 7b72aa6d5..ddc702909 100644 --- a/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + [[package]] name = "aead" version = "0.5.2" @@ -21,6 +36,56 @@ dependencies = [ "memchr", ] +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + [[package]] name = "anyhow" version = "1.0.100" @@ -54,6 +119,30 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-link 0.2.1", +] + +[[package]] +name = "backtrace-ext" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" +dependencies = [ + "backtrace", +] + [[package]] name = "base16ct" version = "0.2.0" @@ -127,6 +216,8 @@ version = "1.2.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -171,6 +262,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + [[package]] name = "const-oid" version = "0.9.6" @@ -264,7 +361,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -294,7 +391,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -389,15 +486,26 @@ dependencies = [ ] [[package]] -name = "enum_dispatch" -version = "0.3.13" +name = "env_filter" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn", + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", ] [[package]] @@ -406,6 +514,16 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + [[package]] name = "ff" version = "0.13.1" @@ -446,6 +564,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "fs-err" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf68cef89750956493a66a10f512b9e58d9db21f2a573c079c0bdf1207a54a7" +dependencies = [ + "autocfg", +] + [[package]] name = "futures" version = "0.3.31" @@ -559,6 +686,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + [[package]] name = "glob" version = "0.3.2" @@ -641,6 +774,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "is_ci" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + [[package]] name = "itertools" version = "0.14.0" @@ -656,6 +801,40 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jiff" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.3", + "libc", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -743,6 +922,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + [[package]] name = "lock_api" version = "0.4.13" @@ -789,10 +974,13 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.8.0" +version = "0.10.0" dependencies = [ "miden-base", + "miden-base-macros", "miden-base-sys", + "miden-field", + "miden-field-repr", "miden-sdk-alloc", "miden-stdlib-sys", "wit-bindgen", @@ -800,9 +988,9 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" +checksum = "3d819876b9e9b630e63152400e6df2a201668a9bdfd33d54d6806b9d7b992ff8" dependencies = [ "miden-core", "miden-utils-indexing", @@ -813,9 +1001,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" +checksum = "24c6a18e29c03141cf9044604390a00691c7342924ec865b4acfdd560ff41ede" dependencies = [ "log", "miden-assembly-syntax", @@ -827,9 +1015,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" +checksum = "7458ff670f5a514bf972aa84d6e1851a4c4e9afa351f53b71bdc2218b99254b6" dependencies = [ "aho-corasick", "lalrpop", @@ -839,6 +1027,7 @@ dependencies = [ "miden-debug-types", "miden-utils-diagnostics", "midenc-hir-type", + "proptest", "regex", "rustc_version 0.4.1", "semver 1.0.26", @@ -848,23 +1037,22 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.8.0" +version = "0.10.0" dependencies = [ - "miden-base-macros", "miden-base-sys", "miden-stdlib-sys", ] [[package]] name = "miden-base-macros" -version = "0.8.0" +version = "0.10.0" dependencies = [ "heck", - "miden-objects", + "miden-protocol", "proc-macro2", "quote", "semver 1.0.26", - "syn", + "syn 2.0.106", "toml 0.8.23", "wit-bindgen-core", "wit-bindgen-rust", @@ -872,21 +1060,24 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.1" +version = "0.10.0" dependencies = [ + "miden-field-repr", "miden-stdlib-sys", ] [[package]] name = "miden-core" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" +checksum = "21a5c9c8c3d42ae8381ed49e47ff9ad2d2e345c4726761be36b7d4000ebb40ae" dependencies = [ - "enum_dispatch", + "derive_more", + "itertools", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-core-derive", "miden-utils-indexing", "num-derive", "num-traits", @@ -895,14 +1086,33 @@ dependencies = [ "winter-utils", ] +[[package]] +name = "miden-core-lib" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6556494ea5576803730fa15015bee6bd9d1a117450f22e7df0883421e7423674" +dependencies = [ + "env_logger", + "fs-err", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", + "sha2", + "thiserror", +] + [[package]] name = "miden-crypto" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" +checksum = "6e28b6e110f339c2edc2760a8cb94863f0a055ee658a49bc90c8560eff2feef4" dependencies = [ "blake3", + "cc", "chacha20poly1305", + "curve25519-dalek", "ed25519-dalek", "flume", "glob", @@ -915,6 +1125,7 @@ dependencies = [ "rand_chacha", "rand_core 0.9.3", "rand_hc", + "sha2", "sha3", "subtle", "thiserror", @@ -926,19 +1137,19 @@ dependencies = [ [[package]] name = "miden-crypto-derive" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +checksum = "f40e95b9c7c99ed6bbf073d9e02721d812dedd2c195019c0a0e0a3dbb9cbf034" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] name = "miden-debug-types" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" +checksum = "19123e896f24b575e69921a79a39a0a4babeb98404a8601017feb13b75d653b3" dependencies = [ "memchr", "miden-crypto", @@ -947,9 +1158,36 @@ dependencies = [ "miden-utils-indexing", "miden-utils-sync", "paste", + "serde", + "serde_spanned 1.0.0", "thiserror", ] +[[package]] +name = "miden-field" +version = "0.10.0" +dependencies = [ + "miden-core", +] + +[[package]] +name = "miden-field-repr" +version = "0.10.0" +dependencies = [ + "miden-core", + "miden-field", + "miden-field-repr-derive", +] + +[[package]] +name = "miden-field-repr-derive" +version = "0.10.0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + [[package]] name = "miden-formatting" version = "0.1.1" @@ -961,9 +1199,9 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" +checksum = "f0d6a322b91efa1bb71e224395ca1fb9ca00e2614f89427e35d8c42a903868a3" dependencies = [ "derive_more", "miden-assembly-syntax", @@ -977,6 +1215,8 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eef536978f24a179d94fa2a41e4f92b28e7d8aab14b8d23df28ad2a3d7098b20" dependencies = [ + "backtrace", + "backtrace-ext", "cfg-if", "futures", "indenter", @@ -989,7 +1229,11 @@ dependencies = [ "serde_json", "spin", "strip-ansi-escapes", - "syn", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "syn 2.0.106", + "terminal_size", "textwrap", "thiserror", "trybuild", @@ -1004,63 +1248,93 @@ checksum = "86a905f3ea65634dd4d1041a4f0fd0a3e77aa4118341d265af1a94339182222f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] -name = "miden-objects" -version = "0.12.1" +name = "miden-processor" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" +checksum = "4a659fac55de14647e2695f03d96b83ff94fe65fd31e74d81c225ec52af25acf" +dependencies = [ + "itertools", + "miden-air", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", + "thiserror", + "tokio", + "tracing", + "winter-prover", +] + +[[package]] +name = "miden-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfed3ae85e2fabbf8a2e7416e388a40519e10cbf0cdceda222ef858c2f270b35" dependencies = [ "bech32", + "fs-err", "getrandom 0.3.3", "miden-assembly", "miden-assembly-syntax", "miden-core", + "miden-core-lib", "miden-crypto", "miden-mast-package", "miden-processor", + "miden-protocol-macros", "miden-utils-sync", "miden-verifier", "rand", + "regex", "semver 1.0.26", "thiserror", + "walkdir", ] [[package]] -name = "miden-processor" -version = "0.19.1" +name = "miden-protocol-macros" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" +checksum = "f41a93dd532baa3a4c821073baad5d700aab119b3831ef7fdf004e196c10157e" dependencies = [ - "itertools", - "miden-air", - "miden-core", - "miden-debug-types", - "miden-utils-diagnostics", - "miden-utils-indexing", - "paste", - "rayon", - "thiserror", - "tokio", - "tracing", - "winter-prover", + "proc-macro2", + "quote", + "syn 2.0.106", ] [[package]] name = "miden-sdk-alloc" -version = "0.8.0" +version = "0.10.0" [[package]] name = "miden-stdlib-sys" -version = "0.8.0" +version = "0.10.0" +dependencies = [ + "miden-field", +] + +[[package]] +name = "miden-utils-core-derive" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa207ffd8b26a79d9b5b246a352812f0015c0bb8f75492ec089c5c8e6d5f9e2b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] name = "miden-utils-diagnostics" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" +checksum = "6b2f55477d410542a5d8990ca04856adf5bef91bfa3b54ca3c03a5ff14a6e25c" dependencies = [ "miden-crypto", "miden-debug-types", @@ -1071,28 +1345,29 @@ dependencies = [ [[package]] name = "miden-utils-indexing" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +checksum = "f39efae17e14ec8f8a1266cffd29eb7a08ac837143cd09223b1af361bbb55730" dependencies = [ "thiserror", ] [[package]] name = "miden-utils-sync" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" +checksum = "da7fa8f5fd27f122c83f55752f2a964bbfc2b713de419e9c152f7dcc05c194ec" dependencies = [ "lock_api", "loom", + "parking_lot", ] [[package]] name = "miden-verifier" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" +checksum = "fbddac2e76486fb657929338323c68b9e7f40e33b8cfb593d0fb5bf637db046e" dependencies = [ "miden-air", "miden-core", @@ -1112,6 +1387,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + [[package]] name = "nanorand" version = "0.7.0" @@ -1178,7 +1462,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1222,12 +1506,27 @@ dependencies = [ "libm", ] +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "opaque-debug" version = "0.3.1" @@ -1266,7 +1565,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -1327,6 +1626,21 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -1349,7 +1663,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.106", ] [[package]] @@ -1361,6 +1675,21 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +dependencies = [ + "bitflags", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax 0.8.5", + "unarray", +] + [[package]] name = "pure-rust-add" version = "0.1.0" @@ -1389,6 +1718,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ + "rand_chacha", "rand_core 0.9.3", ] @@ -1416,6 +1746,9 @@ name = "rand_core" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", +] [[package]] name = "rand_hc" @@ -1426,6 +1759,15 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.3", +] + [[package]] name = "rayon" version = "1.11.0" @@ -1509,6 +1851,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "rustc-demangle" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1527,6 +1875,19 @@ dependencies = [ "semver 1.0.26", ] +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.59.0", +] + [[package]] name = "rustversion" version = "1.0.21" @@ -1600,22 +1961,32 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1758,6 +2129,38 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "supports-color" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c64fc7232dd8d2e4ac5ce4ef302b1d81e0b80d055b9d77c7c4f51f6aa4c867d6" +dependencies = [ + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e396b6523b11ccb83120b115a0b7366de372751aa6edf19844dfb13a6af97e91" + +[[package]] +name = "supports-unicode" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.106" @@ -1781,7 +2184,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -1793,6 +2196,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix", + "windows-sys 0.48.0", +] + [[package]] name = "textwrap" version = "0.16.2" @@ -1821,7 +2234,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1942,7 +2355,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2006,6 +2419,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicode-ident" version = "1.0.18" @@ -2046,6 +2465,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "valuable" version = "0.1.1" @@ -2113,7 +2538,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-shared", ] @@ -2135,7 +2560,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2205,7 +2630,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -2223,7 +2648,7 @@ dependencies = [ "windows-collections", "windows-core", "windows-future", - "windows-link", + "windows-link 0.1.3", "windows-numerics", ] @@ -2244,7 +2669,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", - "windows-link", + "windows-link 0.1.3", "windows-result", "windows-strings", ] @@ -2256,7 +2681,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", "windows-threading", ] @@ -2268,7 +2693,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2279,7 +2704,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2288,6 +2713,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-numerics" version = "0.2.0" @@ -2295,7 +2726,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2304,7 +2735,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2313,7 +2744,16 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", ] [[package]] @@ -2322,7 +2762,31 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -2331,14 +2795,14 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2347,21 +2811,39 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -2374,24 +2856,48 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -2459,7 +2965,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d31a19dae58475d019850e25b0170e94b16d382fbf6afee9c0e80fdc935e73e" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2535,7 +3041,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn", + "syn 2.0.106", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -2551,7 +3057,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -2620,7 +3126,7 @@ checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] diff --git a/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/assert-debug-test/Cargo.lock similarity index 85% rename from tests/rust-apps-wasm/rust-sdk/account-test/Cargo.lock rename to tests/rust-apps-wasm/rust-sdk/assert-debug-test/Cargo.lock index 314dbafc1..35a2a2f18 100644 --- a/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/assert-debug-test/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -29,9 +29,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" dependencies = [ "memchr", ] @@ -113,11 +113,18 @@ dependencies = [ "term", ] +[[package]] +name = "assert-debug-test" +version = "0.1.0" +dependencies = [ + "miden", +] + [[package]] name = "autocfg" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "backtrace" @@ -157,9 +164,9 @@ checksum = "0e050f626429857a27ddccb31e0aca21356bfa709c04041aefddac081a8f068a" [[package]] name = "bech32" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" +checksum = "32637268377fc7b10a8c6d51de3e7fba1ce5dd371a96e342b34e6078db558e7f" [[package]] name = "bit-set" @@ -178,9 +185,9 @@ checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" [[package]] name = "bitflags" -version = "2.9.1" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" [[package]] name = "blake3" @@ -206,16 +213,17 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.17.0" +version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" [[package]] name = "cc" -version = "1.2.23" +version = "1.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4ac86a9e5bc1e2b3449ab9d7d3a6a405e3d1bb28d7b9be8614f55846ae3766" +checksum = "90583009037521a116abf44494efecd645ba48b6622457080f080b85544e2215" dependencies = [ + "find-msvc-tools", "jobserver", "libc", "shlex", @@ -223,9 +231,9 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "chacha20" @@ -328,9 +336,9 @@ dependencies = [ [[package]] name = "crypto-common" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" dependencies = [ "generic-array", "rand_core 0.6.4", @@ -361,7 +369,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.111", ] [[package]] @@ -376,22 +384,23 @@ dependencies = [ [[package]] name = "derive_more" -version = "2.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678" +checksum = "10b768e943bed7bf2cab53df09f4bc34bfd217cdb57d971e769874c9a6710618" dependencies = [ "derive_more-impl", ] [[package]] name = "derive_more-impl" -version = "2.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" +checksum = "6d286bfdaf75e988b4a78e013ecd79c581e06399ab53fbacd2d916c2f904f30b" dependencies = [ "proc-macro2", "quote", - "syn", + "rustc_version 0.4.1", + "syn 2.0.111", ] [[package]] @@ -485,18 +494,6 @@ dependencies = [ "log", ] -[[package]] -name = "enum_dispatch" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" -dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "env_filter" version = "0.1.4" @@ -533,7 +530,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -552,6 +549,12 @@ version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" +[[package]] +name = "find-msvc-tools" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" + [[package]] name = "fixedbitset" version = "0.5.7" @@ -578,9 +581,9 @@ checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" [[package]] name = "fs-err" -version = "3.2.0" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62d91fd049c123429b018c47887d3f75a265540dd3c30ba9cb7bae9197edb03a" +checksum = "824f08d01d0f496b3eca4f001a13cf17690a6ee930043d20817f547455fd98f8" dependencies = [ "autocfg", ] @@ -648,9 +651,9 @@ dependencies = [ [[package]] name = "generator" -version = "0.8.5" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d18470a76cb7f8ff746cf1f7470914f900252ec36bbc40b569d74b1258446827" +checksum = "605183a538e3e2a9c1038635cc5c2d194e2ee8fd0d1b66b8349fad7dbacce5a2" dependencies = [ "cc", "cfg-if", @@ -680,21 +683,21 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "wasi 0.11.1+wasi-snapshot-preview1", + "wasi", "wasm-bindgen", ] [[package]] name = "getrandom" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", "js-sys", "libc", "r-efi", - "wasi 0.14.2+wasi-0.2.4", + "wasip2", "wasm-bindgen", ] @@ -706,9 +709,9 @@ checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" [[package]] name = "glob" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" [[package]] name = "group" @@ -723,13 +726,19 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.3" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ "foldhash", ] +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" + [[package]] name = "heck" version = "0.5.0" @@ -762,19 +771,20 @@ checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" [[package]] name = "indenter" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" +checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5" [[package]] name = "indexmap" -version = "2.9.0" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.16.1", "serde", + "serde_core", ] [[package]] @@ -834,7 +844,7 @@ checksum = "980af8b43c3ad5d8d349ace167ec8170839f753a42d233ba19e08afe1850fa69" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.111", ] [[package]] @@ -843,15 +853,15 @@ version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" dependencies = [ - "getrandom 0.3.3", + "getrandom 0.3.4", "libc", ] [[package]] name = "js-sys" -version = "0.3.77" +version = "0.3.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8" dependencies = [ "once_cell", "wasm-bindgen", @@ -893,7 +903,7 @@ dependencies = [ "lalrpop-util", "petgraph", "regex", - "regex-syntax 0.8.5", + "regex-syntax", "sha3", "string_cache", "term", @@ -924,9 +934,9 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" [[package]] name = "libc" -version = "0.2.172" +version = "0.2.178" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" +checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" [[package]] name = "libm" @@ -942,19 +952,18 @@ checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" [[package]] name = "lock_api" -version = "0.4.12" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" dependencies = [ - "autocfg", "scopeguard", ] [[package]] name = "log" -version = "0.4.27" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "loom" @@ -971,25 +980,28 @@ dependencies = [ [[package]] name = "matchers" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" dependencies = [ - "regex-automata 0.1.10", + "regex-automata", ] [[package]] name = "memchr" -version = "2.7.4" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "miden" -version = "0.7.1" +version = "0.10.0" dependencies = [ "miden-base", + "miden-base-macros", "miden-base-sys", + "miden-field", + "miden-field-repr", "miden-sdk-alloc", "miden-stdlib-sys", "wit-bindgen", @@ -997,9 +1009,9 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" +checksum = "3d819876b9e9b630e63152400e6df2a201668a9bdfd33d54d6806b9d7b992ff8" dependencies = [ "miden-core", "miden-utils-indexing", @@ -1010,9 +1022,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" +checksum = "24c6a18e29c03141cf9044604390a00691c7342924ec865b4acfdd560ff41ede" dependencies = [ "log", "miden-assembly-syntax", @@ -1024,9 +1036,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" +checksum = "7458ff670f5a514bf972aa84d6e1851a4c4e9afa351f53b71bdc2218b99254b6" dependencies = [ "aho-corasick", "lalrpop", @@ -1039,52 +1051,54 @@ dependencies = [ "proptest", "regex", "rustc_version 0.4.1", - "semver 1.0.26", + "semver 1.0.27", "smallvec", "thiserror", ] [[package]] name = "miden-base" -version = "0.7.1" +version = "0.10.0" dependencies = [ - "miden-base-macros", "miden-base-sys", "miden-stdlib-sys", ] [[package]] name = "miden-base-macros" -version = "0.7.1" +version = "0.10.0" dependencies = [ "heck", - "miden-objects", + "miden-protocol", "proc-macro2", "quote", - "semver 1.0.26", - "syn", - "toml", + "semver 1.0.27", + "syn 2.0.111", + "toml 0.8.23", "wit-bindgen-core", "wit-bindgen-rust", ] [[package]] name = "miden-base-sys" -version = "0.8.0" +version = "0.10.0" dependencies = [ + "miden-field-repr", "miden-stdlib-sys", ] [[package]] name = "miden-core" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" +checksum = "21a5c9c8c3d42ae8381ed49e47ff9ad2d2e345c4726761be36b7d4000ebb40ae" dependencies = [ - "enum_dispatch", + "derive_more", + "itertools", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-core-derive", "miden-utils-indexing", "num-derive", "num-traits", @@ -1093,15 +1107,33 @@ dependencies = [ "winter-utils", ] +[[package]] +name = "miden-core-lib" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6556494ea5576803730fa15015bee6bd9d1a117450f22e7df0883421e7423674" +dependencies = [ + "env_logger", + "fs-err", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", + "sha2", + "thiserror", +] + [[package]] name = "miden-crypto" -version = "0.18.5" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395e5cc76b64e24533ee55c8d1ff90305b8cad372bdbea4f4f324239e36a895f" +checksum = "6e28b6e110f339c2edc2760a8cb94863f0a055ee658a49bc90c8560eff2feef4" dependencies = [ "blake3", "cc", "chacha20poly1305", + "curve25519-dalek", "ed25519-dalek", "flume", "glob", @@ -1114,6 +1146,7 @@ dependencies = [ "rand_chacha", "rand_core 0.9.3", "rand_hc", + "sha2", "sha3", "subtle", "thiserror", @@ -1125,19 +1158,19 @@ dependencies = [ [[package]] name = "miden-crypto-derive" -version = "0.18.5" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89641b257eb395cf03105ac1c6cbdf3fd9a5450749696af9835c3c47fc6806e" +checksum = "f40e95b9c7c99ed6bbf073d9e02721d812dedd2c195019c0a0e0a3dbb9cbf034" dependencies = [ "quote", - "syn", + "syn 2.0.111", ] [[package]] name = "miden-debug-types" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" +checksum = "19123e896f24b575e69921a79a39a0a4babeb98404a8601017feb13b75d653b3" dependencies = [ "memchr", "miden-crypto", @@ -1151,6 +1184,31 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-field" +version = "0.10.0" +dependencies = [ + "miden-core", +] + +[[package]] +name = "miden-field-repr" +version = "0.10.0" +dependencies = [ + "miden-core", + "miden-field", + "miden-field-repr-derive", +] + +[[package]] +name = "miden-field-repr-derive" +version = "0.10.0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "miden-formatting" version = "0.1.1" @@ -1162,9 +1220,9 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" +checksum = "f0d6a322b91efa1bb71e224395ca1fb9ca00e2614f89427e35d8c42a903868a3" dependencies = [ "derive_more", "miden-assembly-syntax", @@ -1195,7 +1253,7 @@ dependencies = [ "supports-color", "supports-hyperlinks", "supports-unicode", - "syn", + "syn 2.0.111", "terminal_size", "textwrap", "thiserror", @@ -1211,36 +1269,14 @@ checksum = "86a905f3ea65634dd4d1041a4f0fd0a3e77aa4118341d265af1a94339182222f" dependencies = [ "proc-macro2", "quote", - "syn", -] - -[[package]] -name = "miden-objects" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace4018bb2d6cdbcff4d86d8af5ade8efca9f0479f7e5775c7f09cfab5f91ebe" -dependencies = [ - "bech32", - "getrandom 0.3.3", - "miden-assembly", - "miden-assembly-syntax", - "miden-core", - "miden-crypto", - "miden-mast-package", - "miden-processor", - "miden-stdlib", - "miden-utils-sync", - "miden-verifier", - "rand", - "semver 1.0.26", - "thiserror", + "syn 2.0.111", ] [[package]] name = "miden-processor" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" +checksum = "4a659fac55de14647e2695f03d96b83ff94fe65fd31e74d81c225ec52af25acf" dependencies = [ "itertools", "miden-air", @@ -1257,41 +1293,69 @@ dependencies = [ ] [[package]] -name = "miden-sdk-account-test" -version = "0.0.0" -dependencies = [ - "miden", -] - -[[package]] -name = "miden-sdk-alloc" -version = "0.7.0" - -[[package]] -name = "miden-stdlib" -version = "0.19.1" +name = "miden-protocol" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e90a5de45a1e6213ff17b66fff8accde0bbc64264e2c22bbcb9a895f8f3b767" +checksum = "dfed3ae85e2fabbf8a2e7416e388a40519e10cbf0cdceda222ef858c2f270b35" dependencies = [ - "env_logger", + "bech32", "fs-err", + "getrandom 0.3.4", "miden-assembly", + "miden-assembly-syntax", "miden-core", + "miden-core-lib", "miden-crypto", + "miden-mast-package", "miden-processor", + "miden-protocol-macros", "miden-utils-sync", + "miden-verifier", + "rand", + "regex", + "semver 1.0.27", "thiserror", + "walkdir", ] +[[package]] +name = "miden-protocol-macros" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f41a93dd532baa3a4c821073baad5d700aab119b3831ef7fdf004e196c10157e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "miden-sdk-alloc" +version = "0.10.0" + [[package]] name = "miden-stdlib-sys" -version = "0.7.1" +version = "0.10.0" +dependencies = [ + "miden-field", +] + +[[package]] +name = "miden-utils-core-derive" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa207ffd8b26a79d9b5b246a352812f0015c0bb8f75492ec089c5c8e6d5f9e2b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] name = "miden-utils-diagnostics" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" +checksum = "6b2f55477d410542a5d8990ca04856adf5bef91bfa3b54ca3c03a5ff14a6e25c" dependencies = [ "miden-crypto", "miden-debug-types", @@ -1302,18 +1366,18 @@ dependencies = [ [[package]] name = "miden-utils-indexing" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +checksum = "f39efae17e14ec8f8a1266cffd29eb7a08ac837143cd09223b1af361bbb55730" dependencies = [ "thiserror", ] [[package]] name = "miden-utils-sync" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" +checksum = "da7fa8f5fd27f122c83f55752f2a964bbfc2b713de419e9c152f7dcc05c194ec" dependencies = [ "lock_api", "loom", @@ -1322,9 +1386,9 @@ dependencies = [ [[package]] name = "miden-verifier" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" +checksum = "fbddac2e76486fb657929338323c68b9e7f40e33b8cfb593d0fb5bf637db046e" dependencies = [ "miden-air", "miden-core", @@ -1370,12 +1434,11 @@ checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" [[package]] name = "nu-ansi-term" -version = "0.46.0" +version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "overload", - "winapi", + "windows-sys 0.61.2", ] [[package]] @@ -1419,7 +1482,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.111", ] [[package]] @@ -1490,23 +1553,17 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - [[package]] name = "owo-colors" -version = "4.2.1" +version = "4.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26995317201fa17f3656c36716aed4a7c81743a9634ac4c99c0eeda495db0cec" +checksum = "9c6901729fa79e91a0913333229e9ca5dc725089d1c363b2f4b4760709dc4a52" [[package]] name = "parking_lot" -version = "0.12.3" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" dependencies = [ "lock_api", "parking_lot_core", @@ -1514,15 +1571,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.10" +version = "0.9.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets 0.52.6", + "windows-link 0.2.1", ] [[package]] @@ -1620,14 +1677,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.111", ] [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" dependencies = [ "unicode-ident", ] @@ -1643,30 +1700,30 @@ dependencies = [ "rand", "rand_chacha", "rand_xorshift", - "regex-syntax 0.8.5", + "regex-syntax", "unarray", ] [[package]] name = "quote" -version = "1.0.40" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" dependencies = [ "proc-macro2", ] [[package]] name = "r-efi" -version = "5.2.0" +version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" [[package]] name = "rand" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ "rand_chacha", "rand_core 0.9.3", @@ -1697,7 +1754,7 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" dependencies = [ - "getrandom 0.3.3", + "getrandom 0.3.4", ] [[package]] @@ -1740,9 +1797,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.12" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "928fca9cf2aa042393a8325b9ead81d2f0df4cb12e1e24cef072922ccd99c5af" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ "bitflags", ] @@ -1755,17 +1812,8 @@ checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.13", - "regex-syntax 0.8.5", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", + "regex-automata", + "regex-syntax", ] [[package]] @@ -1776,20 +1824,14 @@ checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.5", + "regex-syntax", ] [[package]] name = "regex-syntax" -version = "0.6.29" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - -[[package]] -name = "regex-syntax" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "rfc6979" @@ -1822,7 +1864,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ - "semver 1.0.26", + "semver 1.0.27", ] [[package]] @@ -1840,9 +1882,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.20" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "ryu" @@ -1896,11 +1938,12 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" dependencies = [ "serde", + "serde_core", ] [[package]] @@ -1936,26 +1979,27 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.111", ] [[package]] name = "serde_json" -version = "1.0.140" +version = "1.0.145" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" dependencies = [ "itoa", "memchr", "ryu", "serde", + "serde_core", ] [[package]] name = "serde_spanned" -version = "0.6.8" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" dependencies = [ "serde", ] @@ -2023,9 +2067,9 @@ checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" [[package]] name = "smallvec" -version = "1.15.0" +version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "smawk" @@ -2102,9 +2146,20 @@ checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" [[package]] name = "syn" -version = "2.0.106" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" +checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" dependencies = [ "proc-macro2", "quote", @@ -2113,17 +2168,17 @@ dependencies = [ [[package]] name = "target-triple" -version = "0.1.4" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ac9aa371f599d22256307c24a9d748c041e548cbf599f35d890f9d365361790" +checksum = "591ef38edfb78ca4771ee32cf494cb8771944bee237a9b91fc9c1424ac4b777b" [[package]] name = "term" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" +checksum = "d8c27177b12a6399ffc08b98f76f7c9a1f4fe9fc967c784c5a071fa8d93cf7e1" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -2153,37 +2208,36 @@ checksum = "c13547615a44dc9c452a8a534638acdf07120d4b6847c8178705da06306a3057" dependencies = [ "smawk", "unicode-linebreak", - "unicode-width 0.2.0", + "unicode-width 0.2.2", ] [[package]] name = "thiserror" -version = "2.0.12" +version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "2.0.12" +version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.111", ] [[package]] name = "thread_local" -version = "1.1.8" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" dependencies = [ "cfg-if", - "once_cell", ] [[package]] @@ -2197,51 +2251,90 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.22" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ae329d1f08c4d17a59bed7ff5b5a769d062e64a62d34a3261b219e62cd5aae" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" dependencies = [ "indexmap", "serde", - "serde_spanned 0.6.8", - "toml_datetime", + "serde_spanned 0.6.9", + "toml_datetime 0.6.11", "toml_edit", ] +[[package]] +name = "toml" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0dc8b1fb61449e27716ec0e1bdf0f6b8f3e8f6b05391e8497b8b6d7804ea6d8" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned 1.0.3", + "toml_datetime 0.7.3", + "toml_parser", + "toml_writer", + "winnow", +] + [[package]] name = "toml_datetime" -version = "0.6.9" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" dependencies = [ "serde", ] +[[package]] +name = "toml_datetime" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533" +dependencies = [ + "serde_core", +] + [[package]] name = "toml_edit" -version = "0.22.26" +version = "0.22.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" dependencies = [ "indexmap", "serde", - "serde_spanned 0.6.8", - "toml_datetime", + "serde_spanned 0.6.9", + "toml_datetime 0.6.11", "toml_write", "winnow", ] +[[package]] +name = "toml_parser" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e" +dependencies = [ + "winnow", +] + [[package]] name = "toml_write" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfb942dfe1d8e29a7ee7fcbde5bd2b9a25fb89aa70caea2eba3bee836ff41076" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "toml_writer" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df8b2b54733674ad286d16267dcfc7a71ed5c776e4ac7aa3c3e2561f7c637bf2" [[package]] name = "tracing" -version = "0.1.41" +version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +checksum = "2d15d90a0b5c19378952d479dc858407149d7bb45a14de0142f6c534b16fc647" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -2250,20 +2343,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.28" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.111", ] [[package]] name = "tracing-core" -version = "0.1.33" +version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" +checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c" dependencies = [ "once_cell", "valuable", @@ -2282,14 +2375,14 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.19" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" +checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e" dependencies = [ "matchers", "nu-ansi-term", "once_cell", - "regex", + "regex-automata", "sharded-slab", "smallvec", "thread_local", @@ -2300,9 +2393,9 @@ dependencies = [ [[package]] name = "trybuild" -version = "1.0.105" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c9bf9513a2f4aeef5fdac8677d7d349c79fdbcc03b9c86da6e9d254f1e43be2" +checksum = "3e17e807bff86d2a06b52bca4276746584a78375055b6e45843925ce2802b335" dependencies = [ "dissimilar", "glob", @@ -2311,14 +2404,14 @@ dependencies = [ "serde_json", "target-triple", "termcolor", - "toml", + "toml 0.9.8", ] [[package]] name = "typenum" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" [[package]] name = "unarray" @@ -2328,9 +2421,9 @@ checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" [[package]] name = "unicode-ident" -version = "1.0.18" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" [[package]] name = "unicode-linebreak" @@ -2346,9 +2439,9 @@ checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "unicode-width" -version = "0.2.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" [[package]] name = "unicode-xid" @@ -2410,44 +2503,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] -name = "wasi" -version = "0.14.2+wasi-0.2.4" +name = "wasip2" +version = "1.0.1+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" dependencies = [ - "wit-bindgen-rt", + "wit-bindgen", ] [[package]] name = "wasm-bindgen" -version = "0.2.100" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd" dependencies = [ "cfg-if", "once_cell", + "rustversion", "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" -dependencies = [ - "bumpalo", - "log", - "proc-macro2", - "quote", - "syn", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.100" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2455,22 +2536,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.100" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40" dependencies = [ + "bumpalo", "proc-macro2", "quote", - "syn", - "wasm-bindgen-backend", + "syn 2.0.111", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.100" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4" dependencies = [ "unicode-ident", ] @@ -2504,52 +2585,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c9d90bb93e764f6beabf1d02028c70a2156a6583e63ac4218dd07ef733368b0" dependencies = [ "bitflags", - "hashbrown", + "hashbrown 0.15.5", "indexmap", - "semver 1.0.26", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", + "semver 1.0.27", ] -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - [[package]] name = "winapi-util" -version = "0.1.9" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - [[package]] name = "windows" -version = "0.61.1" +version = "0.61.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5ee8f3d025738cb02bad7868bbb5f8a6327501e870bf51f1b455b0a2454a419" +checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" dependencies = [ "windows-collections", "windows-core", "windows-future", - "windows-link 0.1.1", + "windows-link 0.1.3", "windows-numerics", ] @@ -2564,13 +2623,13 @@ dependencies = [ [[package]] name = "windows-core" -version = "0.61.1" +version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46ec44dc15085cea82cf9c78f85a9114c463a369786585ad2882d1ff0b0acf40" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", - "windows-link 0.1.1", + "windows-link 0.1.3", "windows-result", "windows-strings", ] @@ -2582,37 +2641,37 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" dependencies = [ "windows-core", - "windows-link 0.1.1", + "windows-link 0.1.3", "windows-threading", ] [[package]] name = "windows-implement" -version = "0.60.0" +version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.111", ] [[package]] name = "windows-interface" -version = "0.59.1" +version = "0.59.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.111", ] [[package]] name = "windows-link" -version = "0.1.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" [[package]] name = "windows-link" @@ -2627,25 +2686,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ "windows-core", - "windows-link 0.1.1", + "windows-link 0.1.3", ] [[package]] name = "windows-result" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b895b5356fc36103d0f64dd1e94dfa7ac5633f1c9dd6e80fe9ec4adef69e09d" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link 0.1.1", + "windows-link 0.1.3", ] [[package]] name = "windows-strings" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a7ab927b2637c19b3dbe0965e75d8f2d30bdd697a1516191cad2ec4df8fb28a" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link 0.1.1", + "windows-link 0.1.3", ] [[package]] @@ -2712,7 +2771,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" dependencies = [ - "windows-link 0.1.1", + "windows-link 0.1.3", ] [[package]] @@ -2807,9 +2866,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.7.10" +version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06928c8748d81b05c9be96aad92e1b6ff01833332f281e8cfca3be4b35fc9ec" +checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829" dependencies = [ "memchr", ] @@ -2866,7 +2925,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d31a19dae58475d019850e25b0170e94b16d382fbf6afee9c0e80fdc935e73e" dependencies = [ "quote", - "syn", + "syn 2.0.111", ] [[package]] @@ -2923,15 +2982,6 @@ dependencies = [ "wit-parser", ] -[[package]] -name = "wit-bindgen-rt" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" -dependencies = [ - "bitflags", -] - [[package]] name = "wit-bindgen-rust" version = "0.46.0" @@ -2942,7 +2992,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn", + "syn 2.0.111", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -2958,7 +3008,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn", + "syn 2.0.111", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -2992,7 +3042,7 @@ dependencies = [ "id-arena", "indexmap", "log", - "semver 1.0.26", + "semver 1.0.27", "serde", "serde_derive", "serde_json", @@ -3027,7 +3077,7 @@ checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.111", ] [[package]] diff --git a/tests/rust-apps-wasm/rust-sdk/assert-debug-test/Cargo.toml b/tests/rust-apps-wasm/rust-sdk/assert-debug-test/Cargo.toml new file mode 100644 index 000000000..68a98e220 --- /dev/null +++ b/tests/rust-apps-wasm/rust-sdk/assert-debug-test/Cargo.toml @@ -0,0 +1,26 @@ +cargo-features = ["trim-paths"] + +[package] +name = "assert-debug-test" +version = "0.1.0" +edition = "2021" + +[lib] +crate-type = ["cdylib"] + +[dependencies] +miden = { path = "../../../../sdk/sdk" } + +[profile.release] +opt-level = "z" +panic = "abort" +debug = true +trim-paths = ["diagnostics", "object"] + +[profile.dev] +panic = "abort" +opt-level = 1 +debug-assertions = true +overflow-checks = false +debug = true +trim-paths = ["diagnostics", "object"] diff --git a/tests/rust-apps-wasm/rust-sdk/assert-debug-test/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/assert-debug-test/src/lib.rs new file mode 100644 index 000000000..d11ccbd8b --- /dev/null +++ b/tests/rust-apps-wasm/rust-sdk/assert-debug-test/src/lib.rs @@ -0,0 +1,28 @@ +//! Test fixture for verifying Rust assert! macro source location preservation. +//! +//! This test verifies that debug source location information is correctly +//! preserved from Rust source code through to MASM compilation and execution. + +#![no_std] +#![feature(alloc_error_handler)] + +#[global_allocator] +static ALLOC: miden::BumpAlloc = miden::BumpAlloc::new(); + +#[panic_handler] +fn my_panic(_info: &core::panic::PanicInfo) -> ! { + loop {} +} + +#[alloc_error_handler] +fn my_alloc_error(_info: core::alloc::Layout) -> ! { + loop {} +} + +/// Main entrypoint that tests assertion with source location tracking. +/// When x > 100, returns x. When x <= 100, panics with assertion failure. +#[no_mangle] +pub fn entrypoint(x: u32) -> u32 { + assert!(x > 100); + x +} diff --git a/tests/rust-apps-wasm/rust-sdk/component-macros-account/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/component-macros-account/Cargo.lock index 39ee83072..44ed5e991 100644 --- a/tests/rust-apps-wasm/rust-sdk/component-macros-account/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/component-macros-account/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + [[package]] name = "aead" version = "0.5.2" @@ -21,6 +36,56 @@ dependencies = [ "memchr", ] +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + [[package]] name = "anyhow" version = "1.0.100" @@ -54,6 +119,30 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-link 0.2.1", +] + +[[package]] +name = "backtrace-ext" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" +dependencies = [ + "backtrace", +] + [[package]] name = "base16ct" version = "0.2.0" @@ -128,6 +217,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac9fe6cdbb24b6ade63616c0a0688e45bb56732262c158df3c0c4bea4ca47cb7" dependencies = [ "find-msvc-tools", + "jobserver", + "libc", "shlex", ] @@ -172,6 +263,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + [[package]] name = "component_macros_account" version = "0.1.0" @@ -272,7 +369,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -302,7 +399,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -397,15 +494,26 @@ dependencies = [ ] [[package]] -name = "enum_dispatch" -version = "0.3.13" +name = "env_filter" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn", + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", ] [[package]] @@ -414,6 +522,16 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + [[package]] name = "ff" version = "0.13.1" @@ -460,6 +578,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "fs-err" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf68cef89750956493a66a10f512b9e58d9db21f2a573c079c0bdf1207a54a7" +dependencies = [ + "autocfg", +] + [[package]] name = "futures" version = "0.3.31" @@ -573,6 +700,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + [[package]] name = "glob" version = "0.3.3" @@ -662,6 +795,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "is_ci" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + [[package]] name = "itertools" version = "0.14.0" @@ -677,6 +822,40 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jiff" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.108", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.4", + "libc", +] + [[package]] name = "js-sys" version = "0.3.81" @@ -764,6 +943,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + [[package]] name = "lock_api" version = "0.4.14" @@ -809,10 +994,13 @@ checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "miden" -version = "0.8.0" +version = "0.10.0" dependencies = [ "miden-base", + "miden-base-macros", "miden-base-sys", + "miden-field", + "miden-field-repr", "miden-sdk-alloc", "miden-stdlib-sys", "wit-bindgen", @@ -820,9 +1008,9 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" +checksum = "3d819876b9e9b630e63152400e6df2a201668a9bdfd33d54d6806b9d7b992ff8" dependencies = [ "miden-core", "miden-utils-indexing", @@ -833,9 +1021,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" +checksum = "24c6a18e29c03141cf9044604390a00691c7342924ec865b4acfdd560ff41ede" dependencies = [ "log", "miden-assembly-syntax", @@ -847,9 +1035,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" +checksum = "7458ff670f5a514bf972aa84d6e1851a4c4e9afa351f53b71bdc2218b99254b6" dependencies = [ "aho-corasick", "lalrpop", @@ -859,6 +1047,7 @@ dependencies = [ "miden-debug-types", "miden-utils-diagnostics", "midenc-hir-type", + "proptest", "regex", "rustc_version 0.4.1", "semver 1.0.27", @@ -868,23 +1057,22 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.8.0" +version = "0.10.0" dependencies = [ - "miden-base-macros", "miden-base-sys", "miden-stdlib-sys", ] [[package]] name = "miden-base-macros" -version = "0.8.0" +version = "0.10.0" dependencies = [ "heck", - "miden-objects", + "miden-protocol", "proc-macro2", "quote", "semver 1.0.27", - "syn", + "syn 2.0.108", "toml 0.8.23", "wit-bindgen-core", "wit-bindgen-rust", @@ -892,21 +1080,24 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.1" +version = "0.10.0" dependencies = [ + "miden-field-repr", "miden-stdlib-sys", ] [[package]] name = "miden-core" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" +checksum = "21a5c9c8c3d42ae8381ed49e47ff9ad2d2e345c4726761be36b7d4000ebb40ae" dependencies = [ - "enum_dispatch", + "derive_more", + "itertools", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-core-derive", "miden-utils-indexing", "num-derive", "num-traits", @@ -915,14 +1106,33 @@ dependencies = [ "winter-utils", ] +[[package]] +name = "miden-core-lib" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6556494ea5576803730fa15015bee6bd9d1a117450f22e7df0883421e7423674" +dependencies = [ + "env_logger", + "fs-err", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", + "sha2", + "thiserror", +] + [[package]] name = "miden-crypto" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" +checksum = "6e28b6e110f339c2edc2760a8cb94863f0a055ee658a49bc90c8560eff2feef4" dependencies = [ "blake3", + "cc", "chacha20poly1305", + "curve25519-dalek", "ed25519-dalek", "flume", "glob", @@ -935,6 +1145,7 @@ dependencies = [ "rand_chacha", "rand_core 0.9.3", "rand_hc", + "sha2", "sha3", "subtle", "thiserror", @@ -946,19 +1157,19 @@ dependencies = [ [[package]] name = "miden-crypto-derive" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +checksum = "f40e95b9c7c99ed6bbf073d9e02721d812dedd2c195019c0a0e0a3dbb9cbf034" dependencies = [ "quote", - "syn", + "syn 2.0.108", ] [[package]] name = "miden-debug-types" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" +checksum = "19123e896f24b575e69921a79a39a0a4babeb98404a8601017feb13b75d653b3" dependencies = [ "memchr", "miden-crypto", @@ -967,9 +1178,36 @@ dependencies = [ "miden-utils-indexing", "miden-utils-sync", "paste", + "serde", + "serde_spanned 1.0.3", "thiserror", ] +[[package]] +name = "miden-field" +version = "0.10.0" +dependencies = [ + "miden-core", +] + +[[package]] +name = "miden-field-repr" +version = "0.10.0" +dependencies = [ + "miden-core", + "miden-field", + "miden-field-repr-derive", +] + +[[package]] +name = "miden-field-repr-derive" +version = "0.10.0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.108", +] + [[package]] name = "miden-formatting" version = "0.1.1" @@ -981,9 +1219,9 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" +checksum = "f0d6a322b91efa1bb71e224395ca1fb9ca00e2614f89427e35d8c42a903868a3" dependencies = [ "derive_more", "miden-assembly-syntax", @@ -997,6 +1235,8 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eef536978f24a179d94fa2a41e4f92b28e7d8aab14b8d23df28ad2a3d7098b20" dependencies = [ + "backtrace", + "backtrace-ext", "cfg-if", "futures", "indenter", @@ -1009,7 +1249,11 @@ dependencies = [ "serde_json", "spin", "strip-ansi-escapes", - "syn", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "syn 2.0.108", + "terminal_size", "textwrap", "thiserror", "trybuild", @@ -1024,63 +1268,93 @@ checksum = "86a905f3ea65634dd4d1041a4f0fd0a3e77aa4118341d265af1a94339182222f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] -name = "miden-objects" -version = "0.12.1" +name = "miden-processor" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a659fac55de14647e2695f03d96b83ff94fe65fd31e74d81c225ec52af25acf" +dependencies = [ + "itertools", + "miden-air", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", + "thiserror", + "tokio", + "tracing", + "winter-prover", +] + +[[package]] +name = "miden-protocol" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" +checksum = "dfed3ae85e2fabbf8a2e7416e388a40519e10cbf0cdceda222ef858c2f270b35" dependencies = [ "bech32", + "fs-err", "getrandom 0.3.4", "miden-assembly", "miden-assembly-syntax", "miden-core", + "miden-core-lib", "miden-crypto", "miden-mast-package", "miden-processor", + "miden-protocol-macros", "miden-utils-sync", "miden-verifier", "rand", + "regex", "semver 1.0.27", "thiserror", + "walkdir", ] [[package]] -name = "miden-processor" -version = "0.19.1" +name = "miden-protocol-macros" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" +checksum = "f41a93dd532baa3a4c821073baad5d700aab119b3831ef7fdf004e196c10157e" dependencies = [ - "itertools", - "miden-air", - "miden-core", - "miden-debug-types", - "miden-utils-diagnostics", - "miden-utils-indexing", - "paste", - "rayon", - "thiserror", - "tokio", - "tracing", - "winter-prover", + "proc-macro2", + "quote", + "syn 2.0.108", ] [[package]] name = "miden-sdk-alloc" -version = "0.8.0" +version = "0.10.0" [[package]] name = "miden-stdlib-sys" -version = "0.8.0" +version = "0.10.0" +dependencies = [ + "miden-field", +] + +[[package]] +name = "miden-utils-core-derive" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa207ffd8b26a79d9b5b246a352812f0015c0bb8f75492ec089c5c8e6d5f9e2b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] name = "miden-utils-diagnostics" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" +checksum = "6b2f55477d410542a5d8990ca04856adf5bef91bfa3b54ca3c03a5ff14a6e25c" dependencies = [ "miden-crypto", "miden-debug-types", @@ -1091,28 +1365,29 @@ dependencies = [ [[package]] name = "miden-utils-indexing" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +checksum = "f39efae17e14ec8f8a1266cffd29eb7a08ac837143cd09223b1af361bbb55730" dependencies = [ "thiserror", ] [[package]] name = "miden-utils-sync" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" +checksum = "da7fa8f5fd27f122c83f55752f2a964bbfc2b713de419e9c152f7dcc05c194ec" dependencies = [ "lock_api", "loom", + "parking_lot", ] [[package]] name = "miden-verifier" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" +checksum = "fbddac2e76486fb657929338323c68b9e7f40e33b8cfb593d0fb5bf637db046e" dependencies = [ "miden-air", "miden-core", @@ -1132,6 +1407,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + [[package]] name = "nanorand" version = "0.7.0" @@ -1153,7 +1437,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -1197,7 +1481,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -1241,12 +1525,27 @@ dependencies = [ "libm", ] +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "opaque-debug" version = "0.3.1" @@ -1340,6 +1639,21 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -1362,7 +1676,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.108", ] [[package]] @@ -1374,6 +1688,21 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +dependencies = [ + "bitflags", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax", + "unarray", +] + [[package]] name = "quote" version = "1.0.41" @@ -1395,6 +1724,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ + "rand_chacha", "rand_core 0.9.3", ] @@ -1422,6 +1752,9 @@ name = "rand_core" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.4", +] [[package]] name = "rand_hc" @@ -1432,6 +1765,15 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.3", +] + [[package]] name = "rayon" version = "1.11.0" @@ -1500,6 +1842,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "rustc-demangle" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1518,6 +1866,19 @@ dependencies = [ "semver 1.0.27", ] +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.59.0", +] + [[package]] name = "rustversion" version = "1.0.22" @@ -1597,6 +1958,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" dependencies = [ "serde_core", + "serde_derive", ] [[package]] @@ -1616,7 +1978,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -1760,6 +2122,38 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "supports-color" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c64fc7232dd8d2e4ac5ce4ef302b1d81e0b80d055b9d77c7c4f51f6aa4c867d6" +dependencies = [ + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e396b6523b11ccb83120b115a0b7366de372751aa6edf19844dfb13a6af97e91" + +[[package]] +name = "supports-unicode" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.108" @@ -1783,7 +2177,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -1795,6 +2189,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix", + "windows-sys 0.48.0", +] + [[package]] name = "textwrap" version = "0.16.2" @@ -1823,7 +2227,7 @@ checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -1944,7 +2348,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -2008,6 +2412,12 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicode-ident" version = "1.0.20" @@ -2048,6 +2458,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "valuable" version = "0.1.1" @@ -2117,7 +2533,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn", + "syn 2.0.108", "wasm-bindgen-shared", ] @@ -2139,7 +2555,7 @@ checksum = "9f07d2f20d4da7b26400c9f4a0511e6e0345b040694e8a75bd41d578fa4421d7" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2193,7 +2609,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -2250,7 +2666,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -2261,7 +2677,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -2304,6 +2720,24 @@ dependencies = [ "windows-link 0.1.3", ] +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.61.2" @@ -2313,6 +2747,37 @@ dependencies = [ "windows-link 0.2.1", ] +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + [[package]] name = "windows-threading" version = "0.1.0" @@ -2322,6 +2787,96 @@ dependencies = [ "windows-link 0.1.3", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + [[package]] name = "winnow" version = "0.7.13" @@ -2383,7 +2938,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d31a19dae58475d019850e25b0170e94b16d382fbf6afee9c0e80fdc935e73e" dependencies = [ "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -2450,7 +3005,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn", + "syn 2.0.108", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -2466,7 +3021,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn", + "syn 2.0.108", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -2535,7 +3090,7 @@ checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] diff --git a/tests/rust-apps-wasm/rust-sdk/component-macros-note/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/component-macros-note/Cargo.lock index 46bf528d9..a357a4c6d 100644 --- a/tests/rust-apps-wasm/rust-sdk/component-macros-note/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/component-macros-note/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + [[package]] name = "aead" version = "0.5.2" @@ -21,6 +36,56 @@ dependencies = [ "memchr", ] +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + [[package]] name = "anyhow" version = "1.0.100" @@ -54,6 +119,30 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-link 0.2.1", +] + +[[package]] +name = "backtrace-ext" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" +dependencies = [ + "backtrace", +] + [[package]] name = "base16ct" version = "0.2.0" @@ -128,6 +217,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac9fe6cdbb24b6ade63616c0a0688e45bb56732262c158df3c0c4bea4ca47cb7" dependencies = [ "find-msvc-tools", + "jobserver", + "libc", "shlex", ] @@ -172,6 +263,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + [[package]] name = "component_macros_note" version = "0.1.0" @@ -272,7 +369,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -302,7 +399,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -397,15 +494,26 @@ dependencies = [ ] [[package]] -name = "enum_dispatch" -version = "0.3.13" +name = "env_filter" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn", + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", ] [[package]] @@ -414,6 +522,16 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + [[package]] name = "ff" version = "0.13.1" @@ -460,6 +578,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "fs-err" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf68cef89750956493a66a10f512b9e58d9db21f2a573c079c0bdf1207a54a7" +dependencies = [ + "autocfg", +] + [[package]] name = "futures" version = "0.3.31" @@ -573,6 +700,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + [[package]] name = "glob" version = "0.3.3" @@ -662,6 +795,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "is_ci" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + [[package]] name = "itertools" version = "0.14.0" @@ -677,6 +822,40 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jiff" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.108", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.4", + "libc", +] + [[package]] name = "js-sys" version = "0.3.81" @@ -764,6 +943,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + [[package]] name = "lock_api" version = "0.4.14" @@ -809,10 +994,13 @@ checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "miden" -version = "0.8.0" +version = "0.10.0" dependencies = [ "miden-base", + "miden-base-macros", "miden-base-sys", + "miden-field", + "miden-field-repr", "miden-sdk-alloc", "miden-stdlib-sys", "wit-bindgen", @@ -820,9 +1008,9 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" +checksum = "3d819876b9e9b630e63152400e6df2a201668a9bdfd33d54d6806b9d7b992ff8" dependencies = [ "miden-core", "miden-utils-indexing", @@ -833,9 +1021,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" +checksum = "24c6a18e29c03141cf9044604390a00691c7342924ec865b4acfdd560ff41ede" dependencies = [ "log", "miden-assembly-syntax", @@ -847,9 +1035,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" +checksum = "7458ff670f5a514bf972aa84d6e1851a4c4e9afa351f53b71bdc2218b99254b6" dependencies = [ "aho-corasick", "lalrpop", @@ -859,6 +1047,7 @@ dependencies = [ "miden-debug-types", "miden-utils-diagnostics", "midenc-hir-type", + "proptest", "regex", "rustc_version 0.4.1", "semver 1.0.27", @@ -868,23 +1057,22 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.8.0" +version = "0.10.0" dependencies = [ - "miden-base-macros", "miden-base-sys", "miden-stdlib-sys", ] [[package]] name = "miden-base-macros" -version = "0.8.0" +version = "0.10.0" dependencies = [ "heck", - "miden-objects", + "miden-protocol", "proc-macro2", "quote", "semver 1.0.27", - "syn", + "syn 2.0.108", "toml 0.8.23", "wit-bindgen-core", "wit-bindgen-rust", @@ -892,21 +1080,24 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.1" +version = "0.10.0" dependencies = [ + "miden-field-repr", "miden-stdlib-sys", ] [[package]] name = "miden-core" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" +checksum = "21a5c9c8c3d42ae8381ed49e47ff9ad2d2e345c4726761be36b7d4000ebb40ae" dependencies = [ - "enum_dispatch", + "derive_more", + "itertools", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-core-derive", "miden-utils-indexing", "num-derive", "num-traits", @@ -915,14 +1106,33 @@ dependencies = [ "winter-utils", ] +[[package]] +name = "miden-core-lib" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6556494ea5576803730fa15015bee6bd9d1a117450f22e7df0883421e7423674" +dependencies = [ + "env_logger", + "fs-err", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", + "sha2", + "thiserror", +] + [[package]] name = "miden-crypto" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" +checksum = "6e28b6e110f339c2edc2760a8cb94863f0a055ee658a49bc90c8560eff2feef4" dependencies = [ "blake3", + "cc", "chacha20poly1305", + "curve25519-dalek", "ed25519-dalek", "flume", "glob", @@ -935,6 +1145,7 @@ dependencies = [ "rand_chacha", "rand_core 0.9.3", "rand_hc", + "sha2", "sha3", "subtle", "thiserror", @@ -946,19 +1157,19 @@ dependencies = [ [[package]] name = "miden-crypto-derive" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +checksum = "f40e95b9c7c99ed6bbf073d9e02721d812dedd2c195019c0a0e0a3dbb9cbf034" dependencies = [ "quote", - "syn", + "syn 2.0.108", ] [[package]] name = "miden-debug-types" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" +checksum = "19123e896f24b575e69921a79a39a0a4babeb98404a8601017feb13b75d653b3" dependencies = [ "memchr", "miden-crypto", @@ -967,9 +1178,36 @@ dependencies = [ "miden-utils-indexing", "miden-utils-sync", "paste", + "serde", + "serde_spanned 1.0.3", "thiserror", ] +[[package]] +name = "miden-field" +version = "0.10.0" +dependencies = [ + "miden-core", +] + +[[package]] +name = "miden-field-repr" +version = "0.10.0" +dependencies = [ + "miden-core", + "miden-field", + "miden-field-repr-derive", +] + +[[package]] +name = "miden-field-repr-derive" +version = "0.10.0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.108", +] + [[package]] name = "miden-formatting" version = "0.1.1" @@ -981,9 +1219,9 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" +checksum = "f0d6a322b91efa1bb71e224395ca1fb9ca00e2614f89427e35d8c42a903868a3" dependencies = [ "derive_more", "miden-assembly-syntax", @@ -997,6 +1235,8 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eef536978f24a179d94fa2a41e4f92b28e7d8aab14b8d23df28ad2a3d7098b20" dependencies = [ + "backtrace", + "backtrace-ext", "cfg-if", "futures", "indenter", @@ -1009,7 +1249,11 @@ dependencies = [ "serde_json", "spin", "strip-ansi-escapes", - "syn", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "syn 2.0.108", + "terminal_size", "textwrap", "thiserror", "trybuild", @@ -1024,63 +1268,93 @@ checksum = "86a905f3ea65634dd4d1041a4f0fd0a3e77aa4118341d265af1a94339182222f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] -name = "miden-objects" -version = "0.12.1" +name = "miden-processor" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a659fac55de14647e2695f03d96b83ff94fe65fd31e74d81c225ec52af25acf" +dependencies = [ + "itertools", + "miden-air", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", + "thiserror", + "tokio", + "tracing", + "winter-prover", +] + +[[package]] +name = "miden-protocol" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" +checksum = "dfed3ae85e2fabbf8a2e7416e388a40519e10cbf0cdceda222ef858c2f270b35" dependencies = [ "bech32", + "fs-err", "getrandom 0.3.4", "miden-assembly", "miden-assembly-syntax", "miden-core", + "miden-core-lib", "miden-crypto", "miden-mast-package", "miden-processor", + "miden-protocol-macros", "miden-utils-sync", "miden-verifier", "rand", + "regex", "semver 1.0.27", "thiserror", + "walkdir", ] [[package]] -name = "miden-processor" -version = "0.19.1" +name = "miden-protocol-macros" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" +checksum = "f41a93dd532baa3a4c821073baad5d700aab119b3831ef7fdf004e196c10157e" dependencies = [ - "itertools", - "miden-air", - "miden-core", - "miden-debug-types", - "miden-utils-diagnostics", - "miden-utils-indexing", - "paste", - "rayon", - "thiserror", - "tokio", - "tracing", - "winter-prover", + "proc-macro2", + "quote", + "syn 2.0.108", ] [[package]] name = "miden-sdk-alloc" -version = "0.8.0" +version = "0.10.0" [[package]] name = "miden-stdlib-sys" -version = "0.8.0" +version = "0.10.0" +dependencies = [ + "miden-field", +] + +[[package]] +name = "miden-utils-core-derive" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa207ffd8b26a79d9b5b246a352812f0015c0bb8f75492ec089c5c8e6d5f9e2b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] name = "miden-utils-diagnostics" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" +checksum = "6b2f55477d410542a5d8990ca04856adf5bef91bfa3b54ca3c03a5ff14a6e25c" dependencies = [ "miden-crypto", "miden-debug-types", @@ -1091,28 +1365,29 @@ dependencies = [ [[package]] name = "miden-utils-indexing" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +checksum = "f39efae17e14ec8f8a1266cffd29eb7a08ac837143cd09223b1af361bbb55730" dependencies = [ "thiserror", ] [[package]] name = "miden-utils-sync" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" +checksum = "da7fa8f5fd27f122c83f55752f2a964bbfc2b713de419e9c152f7dcc05c194ec" dependencies = [ "lock_api", "loom", + "parking_lot", ] [[package]] name = "miden-verifier" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" +checksum = "fbddac2e76486fb657929338323c68b9e7f40e33b8cfb593d0fb5bf637db046e" dependencies = [ "miden-air", "miden-core", @@ -1132,6 +1407,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + [[package]] name = "nanorand" version = "0.7.0" @@ -1153,7 +1437,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -1197,7 +1481,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -1241,12 +1525,27 @@ dependencies = [ "libm", ] +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "opaque-debug" version = "0.3.1" @@ -1340,6 +1639,21 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -1362,7 +1676,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.108", ] [[package]] @@ -1374,6 +1688,21 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +dependencies = [ + "bitflags", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax", + "unarray", +] + [[package]] name = "quote" version = "1.0.41" @@ -1395,6 +1724,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ + "rand_chacha", "rand_core 0.9.3", ] @@ -1422,6 +1752,9 @@ name = "rand_core" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.4", +] [[package]] name = "rand_hc" @@ -1432,6 +1765,15 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.3", +] + [[package]] name = "rayon" version = "1.11.0" @@ -1500,6 +1842,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "rustc-demangle" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1518,6 +1866,19 @@ dependencies = [ "semver 1.0.27", ] +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.59.0", +] + [[package]] name = "rustversion" version = "1.0.22" @@ -1597,6 +1958,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" dependencies = [ "serde_core", + "serde_derive", ] [[package]] @@ -1616,7 +1978,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -1760,6 +2122,38 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "supports-color" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c64fc7232dd8d2e4ac5ce4ef302b1d81e0b80d055b9d77c7c4f51f6aa4c867d6" +dependencies = [ + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e396b6523b11ccb83120b115a0b7366de372751aa6edf19844dfb13a6af97e91" + +[[package]] +name = "supports-unicode" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.108" @@ -1783,7 +2177,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -1795,6 +2189,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix", + "windows-sys 0.48.0", +] + [[package]] name = "textwrap" version = "0.16.2" @@ -1823,7 +2227,7 @@ checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -1944,7 +2348,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -2008,6 +2412,12 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicode-ident" version = "1.0.20" @@ -2048,6 +2458,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "valuable" version = "0.1.1" @@ -2117,7 +2533,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn", + "syn 2.0.108", "wasm-bindgen-shared", ] @@ -2139,7 +2555,7 @@ checksum = "9f07d2f20d4da7b26400c9f4a0511e6e0345b040694e8a75bd41d578fa4421d7" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2193,7 +2609,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -2250,7 +2666,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -2261,7 +2677,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -2304,6 +2720,24 @@ dependencies = [ "windows-link 0.1.3", ] +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.61.2" @@ -2313,6 +2747,37 @@ dependencies = [ "windows-link 0.2.1", ] +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + [[package]] name = "windows-threading" version = "0.1.0" @@ -2322,6 +2787,96 @@ dependencies = [ "windows-link 0.1.3", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + [[package]] name = "winnow" version = "0.7.13" @@ -2383,7 +2938,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d31a19dae58475d019850e25b0170e94b16d382fbf6afee9c0e80fdc935e73e" dependencies = [ "quote", - "syn", + "syn 2.0.108", ] [[package]] @@ -2450,7 +3005,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn", + "syn 2.0.108", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -2466,7 +3021,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn", + "syn 2.0.108", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -2535,7 +3090,7 @@ checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.108", ] [[package]] diff --git a/tests/rust-apps-wasm/rust-sdk/component-macros-note/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/component-macros-note/src/lib.rs index 98a31d169..55a808465 100644 --- a/tests/rust-apps-wasm/rust-sdk/component-macros-note/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/component-macros-note/src/lib.rs @@ -7,20 +7,26 @@ use crate::bindings::miden::component_macros_account::component_macros_account:: StructA, StructB, test_custom_types, }; -#[note_script] -fn run(_arg: Word) { - let foo_val = Word::from([felt!(11), felt!(22), felt!(33), felt!(44)]); - let asset = Asset::new([felt!(99), felt!(88), felt!(77), felt!(66)]); - let value = StructA { - foo: foo_val, - asset, - }; - let result = test_custom_types(value, asset); - let expected = StructB { - bar: foo_val.inner.0, - baz: asset.inner.inner.0, - }; +#[note] +struct MyNote; - assert_eq!(result.bar, expected.bar); - assert_eq!(result.baz, expected.baz); +#[note] +impl MyNote { + #[note_script] + pub fn execute(self, _arg: Word) { + let foo_val = Word::from_u64_unchecked(11, 22, 33, 44); + let asset = Asset::new([felt!(99), felt!(88), felt!(77), felt!(66)]); + let value = StructA { + foo: foo_val, + asset, + }; + let result = test_custom_types(value, asset); + let expected = StructB { + bar: foo_val.inner.0, + baz: asset.inner.inner.0, + }; + + assert_eq!(result.bar, expected.bar); + assert_eq!(result.baz, expected.baz); + } } diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/Cargo.lock index a1b2c5078..651630718 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + [[package]] name = "aead" version = "0.5.2" @@ -21,6 +36,56 @@ dependencies = [ "memchr", ] +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + [[package]] name = "anyhow" version = "1.0.100" @@ -54,6 +119,30 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-link 0.2.1", +] + +[[package]] +name = "backtrace-ext" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" +dependencies = [ + "backtrace", +] + [[package]] name = "base16ct" version = "0.2.0" @@ -127,6 +216,8 @@ version = "1.2.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -171,6 +262,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + [[package]] name = "const-oid" version = "0.9.6" @@ -271,7 +368,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -301,7 +398,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -396,15 +493,26 @@ dependencies = [ ] [[package]] -name = "enum_dispatch" -version = "0.3.13" +name = "env_filter" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn", + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", ] [[package]] @@ -413,6 +521,16 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + [[package]] name = "ff" version = "0.13.1" @@ -453,6 +571,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "fs-err" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf68cef89750956493a66a10f512b9e58d9db21f2a573c079c0bdf1207a54a7" +dependencies = [ + "autocfg", +] + [[package]] name = "futures" version = "0.3.31" @@ -566,6 +693,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + [[package]] name = "glob" version = "0.3.2" @@ -648,6 +781,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "is_ci" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + [[package]] name = "itertools" version = "0.14.0" @@ -663,6 +808,40 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jiff" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.3", + "libc", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -750,6 +929,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + [[package]] name = "lock_api" version = "0.4.13" @@ -796,10 +981,13 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.8.0" +version = "0.10.0" dependencies = [ "miden-base", + "miden-base-macros", "miden-base-sys", + "miden-field", + "miden-field-repr", "miden-sdk-alloc", "miden-stdlib-sys", "wit-bindgen", @@ -807,9 +995,9 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" +checksum = "3d819876b9e9b630e63152400e6df2a201668a9bdfd33d54d6806b9d7b992ff8" dependencies = [ "miden-core", "miden-utils-indexing", @@ -820,9 +1008,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" +checksum = "24c6a18e29c03141cf9044604390a00691c7342924ec865b4acfdd560ff41ede" dependencies = [ "log", "miden-assembly-syntax", @@ -834,9 +1022,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" +checksum = "7458ff670f5a514bf972aa84d6e1851a4c4e9afa351f53b71bdc2218b99254b6" dependencies = [ "aho-corasick", "lalrpop", @@ -846,6 +1034,7 @@ dependencies = [ "miden-debug-types", "miden-utils-diagnostics", "midenc-hir-type", + "proptest", "regex", "rustc_version 0.4.1", "semver 1.0.26", @@ -855,23 +1044,22 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.8.0" +version = "0.10.0" dependencies = [ - "miden-base-macros", "miden-base-sys", "miden-stdlib-sys", ] [[package]] name = "miden-base-macros" -version = "0.8.0" +version = "0.10.0" dependencies = [ "heck", - "miden-objects", + "miden-protocol", "proc-macro2", "quote", "semver 1.0.26", - "syn", + "syn 2.0.106", "toml 0.8.23", "wit-bindgen-core", "wit-bindgen-rust", @@ -879,21 +1067,24 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.1" +version = "0.10.0" dependencies = [ + "miden-field-repr", "miden-stdlib-sys", ] [[package]] name = "miden-core" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" +checksum = "21a5c9c8c3d42ae8381ed49e47ff9ad2d2e345c4726761be36b7d4000ebb40ae" dependencies = [ - "enum_dispatch", + "derive_more", + "itertools", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-core-derive", "miden-utils-indexing", "num-derive", "num-traits", @@ -902,14 +1093,33 @@ dependencies = [ "winter-utils", ] +[[package]] +name = "miden-core-lib" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6556494ea5576803730fa15015bee6bd9d1a117450f22e7df0883421e7423674" +dependencies = [ + "env_logger", + "fs-err", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", + "sha2", + "thiserror", +] + [[package]] name = "miden-crypto" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" +checksum = "6e28b6e110f339c2edc2760a8cb94863f0a055ee658a49bc90c8560eff2feef4" dependencies = [ "blake3", + "cc", "chacha20poly1305", + "curve25519-dalek", "ed25519-dalek", "flume", "glob", @@ -922,6 +1132,7 @@ dependencies = [ "rand_chacha", "rand_core 0.9.3", "rand_hc", + "sha2", "sha3", "subtle", "thiserror", @@ -933,19 +1144,19 @@ dependencies = [ [[package]] name = "miden-crypto-derive" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +checksum = "f40e95b9c7c99ed6bbf073d9e02721d812dedd2c195019c0a0e0a3dbb9cbf034" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] name = "miden-debug-types" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" +checksum = "19123e896f24b575e69921a79a39a0a4babeb98404a8601017feb13b75d653b3" dependencies = [ "memchr", "miden-crypto", @@ -954,9 +1165,36 @@ dependencies = [ "miden-utils-indexing", "miden-utils-sync", "paste", + "serde", + "serde_spanned 1.0.0", "thiserror", ] +[[package]] +name = "miden-field" +version = "0.10.0" +dependencies = [ + "miden-core", +] + +[[package]] +name = "miden-field-repr" +version = "0.10.0" +dependencies = [ + "miden-core", + "miden-field", + "miden-field-repr-derive", +] + +[[package]] +name = "miden-field-repr-derive" +version = "0.10.0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + [[package]] name = "miden-formatting" version = "0.1.1" @@ -968,9 +1206,9 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" +checksum = "f0d6a322b91efa1bb71e224395ca1fb9ca00e2614f89427e35d8c42a903868a3" dependencies = [ "derive_more", "miden-assembly-syntax", @@ -984,6 +1222,8 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eef536978f24a179d94fa2a41e4f92b28e7d8aab14b8d23df28ad2a3d7098b20" dependencies = [ + "backtrace", + "backtrace-ext", "cfg-if", "futures", "indenter", @@ -996,7 +1236,11 @@ dependencies = [ "serde_json", "spin", "strip-ansi-escapes", - "syn", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "syn 2.0.106", + "terminal_size", "textwrap", "thiserror", "trybuild", @@ -1011,63 +1255,93 @@ checksum = "86a905f3ea65634dd4d1041a4f0fd0a3e77aa4118341d265af1a94339182222f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] -name = "miden-objects" -version = "0.12.1" +name = "miden-processor" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" +checksum = "4a659fac55de14647e2695f03d96b83ff94fe65fd31e74d81c225ec52af25acf" +dependencies = [ + "itertools", + "miden-air", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", + "thiserror", + "tokio", + "tracing", + "winter-prover", +] + +[[package]] +name = "miden-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfed3ae85e2fabbf8a2e7416e388a40519e10cbf0cdceda222ef858c2f270b35" dependencies = [ "bech32", + "fs-err", "getrandom 0.3.3", "miden-assembly", "miden-assembly-syntax", "miden-core", + "miden-core-lib", "miden-crypto", "miden-mast-package", "miden-processor", + "miden-protocol-macros", "miden-utils-sync", "miden-verifier", "rand", + "regex", "semver 1.0.26", "thiserror", + "walkdir", ] [[package]] -name = "miden-processor" -version = "0.19.1" +name = "miden-protocol-macros" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" +checksum = "f41a93dd532baa3a4c821073baad5d700aab119b3831ef7fdf004e196c10157e" dependencies = [ - "itertools", - "miden-air", - "miden-core", - "miden-debug-types", - "miden-utils-diagnostics", - "miden-utils-indexing", - "paste", - "rayon", - "thiserror", - "tokio", - "tracing", - "winter-prover", + "proc-macro2", + "quote", + "syn 2.0.106", ] [[package]] name = "miden-sdk-alloc" -version = "0.8.0" +version = "0.10.0" [[package]] name = "miden-stdlib-sys" -version = "0.8.0" +version = "0.10.0" +dependencies = [ + "miden-field", +] + +[[package]] +name = "miden-utils-core-derive" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa207ffd8b26a79d9b5b246a352812f0015c0bb8f75492ec089c5c8e6d5f9e2b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] name = "miden-utils-diagnostics" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" +checksum = "6b2f55477d410542a5d8990ca04856adf5bef91bfa3b54ca3c03a5ff14a6e25c" dependencies = [ "miden-crypto", "miden-debug-types", @@ -1078,28 +1352,29 @@ dependencies = [ [[package]] name = "miden-utils-indexing" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +checksum = "f39efae17e14ec8f8a1266cffd29eb7a08ac837143cd09223b1af361bbb55730" dependencies = [ "thiserror", ] [[package]] name = "miden-utils-sync" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" +checksum = "da7fa8f5fd27f122c83f55752f2a964bbfc2b713de419e9c152f7dcc05c194ec" dependencies = [ "lock_api", "loom", + "parking_lot", ] [[package]] name = "miden-verifier" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" +checksum = "fbddac2e76486fb657929338323c68b9e7f40e33b8cfb593d0fb5bf637db046e" dependencies = [ "miden-air", "miden-core", @@ -1119,6 +1394,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + [[package]] name = "nanorand" version = "0.7.0" @@ -1185,7 +1469,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1229,12 +1513,27 @@ dependencies = [ "libm", ] +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "opaque-debug" version = "0.3.1" @@ -1273,7 +1572,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -1334,6 +1633,21 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -1356,7 +1670,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.106", ] [[package]] @@ -1368,6 +1682,21 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +dependencies = [ + "bitflags", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax 0.8.5", + "unarray", +] + [[package]] name = "quote" version = "1.0.40" @@ -1389,6 +1718,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ + "rand_chacha", "rand_core 0.9.3", ] @@ -1416,6 +1746,9 @@ name = "rand_core" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", +] [[package]] name = "rand_hc" @@ -1426,6 +1759,15 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.3", +] + [[package]] name = "rayon" version = "1.11.0" @@ -1509,6 +1851,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "rustc-demangle" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1527,6 +1875,19 @@ dependencies = [ "semver 1.0.26", ] +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.59.0", +] + [[package]] name = "rustversion" version = "1.0.21" @@ -1600,22 +1961,32 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1758,6 +2129,38 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "supports-color" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c64fc7232dd8d2e4ac5ce4ef302b1d81e0b80d055b9d77c7c4f51f6aa4c867d6" +dependencies = [ + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e396b6523b11ccb83120b115a0b7366de372751aa6edf19844dfb13a6af97e91" + +[[package]] +name = "supports-unicode" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.106" @@ -1781,7 +2184,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -1793,6 +2196,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix", + "windows-sys 0.48.0", +] + [[package]] name = "textwrap" version = "0.16.2" @@ -1821,7 +2234,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1942,7 +2355,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2006,6 +2419,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicode-ident" version = "1.0.18" @@ -2046,6 +2465,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "valuable" version = "0.1.1" @@ -2113,7 +2538,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-shared", ] @@ -2135,7 +2560,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2205,7 +2630,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -2223,7 +2648,7 @@ dependencies = [ "windows-collections", "windows-core", "windows-future", - "windows-link", + "windows-link 0.1.3", "windows-numerics", ] @@ -2244,7 +2669,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", - "windows-link", + "windows-link 0.1.3", "windows-result", "windows-strings", ] @@ -2256,7 +2681,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", "windows-threading", ] @@ -2268,7 +2693,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2279,7 +2704,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2288,6 +2713,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-numerics" version = "0.2.0" @@ -2295,7 +2726,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2304,7 +2735,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2313,7 +2744,16 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", ] [[package]] @@ -2322,7 +2762,31 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -2331,14 +2795,14 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2347,21 +2811,39 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -2374,24 +2856,48 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -2459,7 +2965,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d31a19dae58475d019850e25b0170e94b16d382fbf6afee9c0e80fdc935e73e" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2535,7 +3041,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn", + "syn 2.0.106", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -2551,7 +3057,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -2620,7 +3126,7 @@ checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/Cargo.lock index 1f6e0f348..8f92d5000 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + [[package]] name = "aead" version = "0.5.2" @@ -21,6 +36,56 @@ dependencies = [ "memchr", ] +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + [[package]] name = "anyhow" version = "1.0.100" @@ -54,6 +119,30 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-link 0.2.1", +] + +[[package]] +name = "backtrace-ext" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" +dependencies = [ + "backtrace", +] + [[package]] name = "base16ct" version = "0.2.0" @@ -127,6 +216,8 @@ version = "1.2.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -171,6 +262,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + [[package]] name = "const-oid" version = "0.9.6" @@ -271,7 +368,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -301,7 +398,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -396,15 +493,26 @@ dependencies = [ ] [[package]] -name = "enum_dispatch" -version = "0.3.13" +name = "env_filter" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn", + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", ] [[package]] @@ -413,6 +521,16 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + [[package]] name = "ff" version = "0.13.1" @@ -453,6 +571,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "fs-err" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf68cef89750956493a66a10f512b9e58d9db21f2a573c079c0bdf1207a54a7" +dependencies = [ + "autocfg", +] + [[package]] name = "futures" version = "0.3.31" @@ -566,6 +693,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + [[package]] name = "glob" version = "0.3.2" @@ -648,6 +781,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "is_ci" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + [[package]] name = "itertools" version = "0.14.0" @@ -663,6 +808,40 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jiff" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.3", + "libc", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -750,6 +929,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + [[package]] name = "lock_api" version = "0.4.13" @@ -796,10 +981,13 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.8.0" +version = "0.10.0" dependencies = [ "miden-base", + "miden-base-macros", "miden-base-sys", + "miden-field", + "miden-field-repr", "miden-sdk-alloc", "miden-stdlib-sys", "wit-bindgen", @@ -807,9 +995,9 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" +checksum = "3d819876b9e9b630e63152400e6df2a201668a9bdfd33d54d6806b9d7b992ff8" dependencies = [ "miden-core", "miden-utils-indexing", @@ -820,9 +1008,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" +checksum = "24c6a18e29c03141cf9044604390a00691c7342924ec865b4acfdd560ff41ede" dependencies = [ "log", "miden-assembly-syntax", @@ -834,9 +1022,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" +checksum = "7458ff670f5a514bf972aa84d6e1851a4c4e9afa351f53b71bdc2218b99254b6" dependencies = [ "aho-corasick", "lalrpop", @@ -846,6 +1034,7 @@ dependencies = [ "miden-debug-types", "miden-utils-diagnostics", "midenc-hir-type", + "proptest", "regex", "rustc_version 0.4.1", "semver 1.0.26", @@ -855,23 +1044,22 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.8.0" +version = "0.10.0" dependencies = [ - "miden-base-macros", "miden-base-sys", "miden-stdlib-sys", ] [[package]] name = "miden-base-macros" -version = "0.8.0" +version = "0.10.0" dependencies = [ "heck", - "miden-objects", + "miden-protocol", "proc-macro2", "quote", "semver 1.0.26", - "syn", + "syn 2.0.106", "toml 0.8.23", "wit-bindgen-core", "wit-bindgen-rust", @@ -879,21 +1067,24 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.1" +version = "0.10.0" dependencies = [ + "miden-field-repr", "miden-stdlib-sys", ] [[package]] name = "miden-core" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" +checksum = "21a5c9c8c3d42ae8381ed49e47ff9ad2d2e345c4726761be36b7d4000ebb40ae" dependencies = [ - "enum_dispatch", + "derive_more", + "itertools", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-core-derive", "miden-utils-indexing", "num-derive", "num-traits", @@ -902,14 +1093,33 @@ dependencies = [ "winter-utils", ] +[[package]] +name = "miden-core-lib" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6556494ea5576803730fa15015bee6bd9d1a117450f22e7df0883421e7423674" +dependencies = [ + "env_logger", + "fs-err", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", + "sha2", + "thiserror", +] + [[package]] name = "miden-crypto" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" +checksum = "6e28b6e110f339c2edc2760a8cb94863f0a055ee658a49bc90c8560eff2feef4" dependencies = [ "blake3", + "cc", "chacha20poly1305", + "curve25519-dalek", "ed25519-dalek", "flume", "glob", @@ -922,6 +1132,7 @@ dependencies = [ "rand_chacha", "rand_core 0.9.3", "rand_hc", + "sha2", "sha3", "subtle", "thiserror", @@ -933,19 +1144,19 @@ dependencies = [ [[package]] name = "miden-crypto-derive" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +checksum = "f40e95b9c7c99ed6bbf073d9e02721d812dedd2c195019c0a0e0a3dbb9cbf034" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] name = "miden-debug-types" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" +checksum = "19123e896f24b575e69921a79a39a0a4babeb98404a8601017feb13b75d653b3" dependencies = [ "memchr", "miden-crypto", @@ -954,9 +1165,36 @@ dependencies = [ "miden-utils-indexing", "miden-utils-sync", "paste", + "serde", + "serde_spanned 1.0.0", "thiserror", ] +[[package]] +name = "miden-field" +version = "0.10.0" +dependencies = [ + "miden-core", +] + +[[package]] +name = "miden-field-repr" +version = "0.10.0" +dependencies = [ + "miden-core", + "miden-field", + "miden-field-repr-derive", +] + +[[package]] +name = "miden-field-repr-derive" +version = "0.10.0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + [[package]] name = "miden-formatting" version = "0.1.1" @@ -968,9 +1206,9 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" +checksum = "f0d6a322b91efa1bb71e224395ca1fb9ca00e2614f89427e35d8c42a903868a3" dependencies = [ "derive_more", "miden-assembly-syntax", @@ -984,6 +1222,8 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eef536978f24a179d94fa2a41e4f92b28e7d8aab14b8d23df28ad2a3d7098b20" dependencies = [ + "backtrace", + "backtrace-ext", "cfg-if", "futures", "indenter", @@ -996,7 +1236,11 @@ dependencies = [ "serde_json", "spin", "strip-ansi-escapes", - "syn", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "syn 2.0.106", + "terminal_size", "textwrap", "thiserror", "trybuild", @@ -1011,63 +1255,93 @@ checksum = "86a905f3ea65634dd4d1041a4f0fd0a3e77aa4118341d265af1a94339182222f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] -name = "miden-objects" -version = "0.12.1" +name = "miden-processor" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" +checksum = "4a659fac55de14647e2695f03d96b83ff94fe65fd31e74d81c225ec52af25acf" +dependencies = [ + "itertools", + "miden-air", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", + "thiserror", + "tokio", + "tracing", + "winter-prover", +] + +[[package]] +name = "miden-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfed3ae85e2fabbf8a2e7416e388a40519e10cbf0cdceda222ef858c2f270b35" dependencies = [ "bech32", + "fs-err", "getrandom 0.3.3", "miden-assembly", "miden-assembly-syntax", "miden-core", + "miden-core-lib", "miden-crypto", "miden-mast-package", "miden-processor", + "miden-protocol-macros", "miden-utils-sync", "miden-verifier", "rand", + "regex", "semver 1.0.26", "thiserror", + "walkdir", ] [[package]] -name = "miden-processor" -version = "0.19.1" +name = "miden-protocol-macros" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" +checksum = "f41a93dd532baa3a4c821073baad5d700aab119b3831ef7fdf004e196c10157e" dependencies = [ - "itertools", - "miden-air", - "miden-core", - "miden-debug-types", - "miden-utils-diagnostics", - "miden-utils-indexing", - "paste", - "rayon", - "thiserror", - "tokio", - "tracing", - "winter-prover", + "proc-macro2", + "quote", + "syn 2.0.106", ] [[package]] name = "miden-sdk-alloc" -version = "0.8.0" +version = "0.10.0" [[package]] name = "miden-stdlib-sys" -version = "0.8.0" +version = "0.10.0" +dependencies = [ + "miden-field", +] + +[[package]] +name = "miden-utils-core-derive" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa207ffd8b26a79d9b5b246a352812f0015c0bb8f75492ec089c5c8e6d5f9e2b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] name = "miden-utils-diagnostics" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" +checksum = "6b2f55477d410542a5d8990ca04856adf5bef91bfa3b54ca3c03a5ff14a6e25c" dependencies = [ "miden-crypto", "miden-debug-types", @@ -1078,28 +1352,29 @@ dependencies = [ [[package]] name = "miden-utils-indexing" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +checksum = "f39efae17e14ec8f8a1266cffd29eb7a08ac837143cd09223b1af361bbb55730" dependencies = [ "thiserror", ] [[package]] name = "miden-utils-sync" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" +checksum = "da7fa8f5fd27f122c83f55752f2a964bbfc2b713de419e9c152f7dcc05c194ec" dependencies = [ "lock_api", "loom", + "parking_lot", ] [[package]] name = "miden-verifier" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" +checksum = "fbddac2e76486fb657929338323c68b9e7f40e33b8cfb593d0fb5bf637db046e" dependencies = [ "miden-air", "miden-core", @@ -1119,6 +1394,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + [[package]] name = "nanorand" version = "0.7.0" @@ -1185,7 +1469,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1229,12 +1513,27 @@ dependencies = [ "libm", ] +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "opaque-debug" version = "0.3.1" @@ -1273,7 +1572,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -1334,6 +1633,21 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -1356,7 +1670,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.106", ] [[package]] @@ -1368,6 +1682,21 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +dependencies = [ + "bitflags", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax 0.8.5", + "unarray", +] + [[package]] name = "quote" version = "1.0.40" @@ -1389,6 +1718,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ + "rand_chacha", "rand_core 0.9.3", ] @@ -1416,6 +1746,9 @@ name = "rand_core" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", +] [[package]] name = "rand_hc" @@ -1426,6 +1759,15 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.3", +] + [[package]] name = "rayon" version = "1.11.0" @@ -1509,6 +1851,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "rustc-demangle" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1527,6 +1875,19 @@ dependencies = [ "semver 1.0.26", ] +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.59.0", +] + [[package]] name = "rustversion" version = "1.0.21" @@ -1600,22 +1961,32 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1758,6 +2129,38 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "supports-color" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c64fc7232dd8d2e4ac5ce4ef302b1d81e0b80d055b9d77c7c4f51f6aa4c867d6" +dependencies = [ + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e396b6523b11ccb83120b115a0b7366de372751aa6edf19844dfb13a6af97e91" + +[[package]] +name = "supports-unicode" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.106" @@ -1781,7 +2184,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -1793,6 +2196,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix", + "windows-sys 0.48.0", +] + [[package]] name = "textwrap" version = "0.16.2" @@ -1821,7 +2234,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1942,7 +2355,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2006,6 +2419,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicode-ident" version = "1.0.18" @@ -2046,6 +2465,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "valuable" version = "0.1.1" @@ -2113,7 +2538,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-shared", ] @@ -2135,7 +2560,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2205,7 +2630,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -2223,7 +2648,7 @@ dependencies = [ "windows-collections", "windows-core", "windows-future", - "windows-link", + "windows-link 0.1.3", "windows-numerics", ] @@ -2244,7 +2669,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", - "windows-link", + "windows-link 0.1.3", "windows-result", "windows-strings", ] @@ -2256,7 +2681,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", "windows-threading", ] @@ -2268,7 +2693,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2279,7 +2704,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2288,6 +2713,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-numerics" version = "0.2.0" @@ -2295,7 +2726,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2304,7 +2735,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2313,7 +2744,16 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", ] [[package]] @@ -2322,7 +2762,31 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -2331,14 +2795,14 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2347,21 +2811,39 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -2374,24 +2856,48 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -2459,7 +2965,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d31a19dae58475d019850e25b0170e94b16d382fbf6afee9c0e80fdc935e73e" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2535,7 +3041,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn", + "syn 2.0.106", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -2551,7 +3057,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -2620,7 +3126,7 @@ checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/Cargo.lock index 24af5ffb9..1d2fec9a8 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + [[package]] name = "aead" version = "0.5.2" @@ -21,6 +36,56 @@ dependencies = [ "memchr", ] +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + [[package]] name = "anyhow" version = "1.0.100" @@ -54,6 +119,30 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-link 0.2.1", +] + +[[package]] +name = "backtrace-ext" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" +dependencies = [ + "backtrace", +] + [[package]] name = "base16ct" version = "0.2.0" @@ -127,6 +216,8 @@ version = "1.2.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -171,6 +262,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + [[package]] name = "const-oid" version = "0.9.6" @@ -271,7 +368,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -301,7 +398,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -396,15 +493,26 @@ dependencies = [ ] [[package]] -name = "enum_dispatch" -version = "0.3.13" +name = "env_filter" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn", + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", ] [[package]] @@ -413,6 +521,16 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + [[package]] name = "ff" version = "0.13.1" @@ -453,6 +571,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "fs-err" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf68cef89750956493a66a10f512b9e58d9db21f2a573c079c0bdf1207a54a7" +dependencies = [ + "autocfg", +] + [[package]] name = "futures" version = "0.3.31" @@ -566,6 +693,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + [[package]] name = "glob" version = "0.3.2" @@ -648,6 +781,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "is_ci" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + [[package]] name = "itertools" version = "0.14.0" @@ -663,6 +808,40 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jiff" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.3", + "libc", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -750,6 +929,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + [[package]] name = "lock_api" version = "0.4.13" @@ -796,10 +981,13 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.8.0" +version = "0.10.0" dependencies = [ "miden-base", + "miden-base-macros", "miden-base-sys", + "miden-field", + "miden-field-repr", "miden-sdk-alloc", "miden-stdlib-sys", "wit-bindgen", @@ -807,9 +995,9 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" +checksum = "3d819876b9e9b630e63152400e6df2a201668a9bdfd33d54d6806b9d7b992ff8" dependencies = [ "miden-core", "miden-utils-indexing", @@ -820,9 +1008,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" +checksum = "24c6a18e29c03141cf9044604390a00691c7342924ec865b4acfdd560ff41ede" dependencies = [ "log", "miden-assembly-syntax", @@ -834,9 +1022,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" +checksum = "7458ff670f5a514bf972aa84d6e1851a4c4e9afa351f53b71bdc2218b99254b6" dependencies = [ "aho-corasick", "lalrpop", @@ -846,6 +1034,7 @@ dependencies = [ "miden-debug-types", "miden-utils-diagnostics", "midenc-hir-type", + "proptest", "regex", "rustc_version 0.4.1", "semver 1.0.26", @@ -855,23 +1044,22 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.8.0" +version = "0.10.0" dependencies = [ - "miden-base-macros", "miden-base-sys", "miden-stdlib-sys", ] [[package]] name = "miden-base-macros" -version = "0.8.0" +version = "0.10.0" dependencies = [ "heck", - "miden-objects", + "miden-protocol", "proc-macro2", "quote", "semver 1.0.26", - "syn", + "syn 2.0.106", "toml 0.8.23", "wit-bindgen-core", "wit-bindgen-rust", @@ -879,21 +1067,24 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.1" +version = "0.10.0" dependencies = [ + "miden-field-repr", "miden-stdlib-sys", ] [[package]] name = "miden-core" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" +checksum = "21a5c9c8c3d42ae8381ed49e47ff9ad2d2e345c4726761be36b7d4000ebb40ae" dependencies = [ - "enum_dispatch", + "derive_more", + "itertools", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-core-derive", "miden-utils-indexing", "num-derive", "num-traits", @@ -902,14 +1093,33 @@ dependencies = [ "winter-utils", ] +[[package]] +name = "miden-core-lib" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6556494ea5576803730fa15015bee6bd9d1a117450f22e7df0883421e7423674" +dependencies = [ + "env_logger", + "fs-err", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", + "sha2", + "thiserror", +] + [[package]] name = "miden-crypto" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" +checksum = "6e28b6e110f339c2edc2760a8cb94863f0a055ee658a49bc90c8560eff2feef4" dependencies = [ "blake3", + "cc", "chacha20poly1305", + "curve25519-dalek", "ed25519-dalek", "flume", "glob", @@ -922,6 +1132,7 @@ dependencies = [ "rand_chacha", "rand_core 0.9.3", "rand_hc", + "sha2", "sha3", "subtle", "thiserror", @@ -933,19 +1144,19 @@ dependencies = [ [[package]] name = "miden-crypto-derive" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +checksum = "f40e95b9c7c99ed6bbf073d9e02721d812dedd2c195019c0a0e0a3dbb9cbf034" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] name = "miden-debug-types" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" +checksum = "19123e896f24b575e69921a79a39a0a4babeb98404a8601017feb13b75d653b3" dependencies = [ "memchr", "miden-crypto", @@ -954,9 +1165,36 @@ dependencies = [ "miden-utils-indexing", "miden-utils-sync", "paste", + "serde", + "serde_spanned 1.0.0", "thiserror", ] +[[package]] +name = "miden-field" +version = "0.10.0" +dependencies = [ + "miden-core", +] + +[[package]] +name = "miden-field-repr" +version = "0.10.0" +dependencies = [ + "miden-core", + "miden-field", + "miden-field-repr-derive", +] + +[[package]] +name = "miden-field-repr-derive" +version = "0.10.0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + [[package]] name = "miden-formatting" version = "0.1.1" @@ -968,9 +1206,9 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" +checksum = "f0d6a322b91efa1bb71e224395ca1fb9ca00e2614f89427e35d8c42a903868a3" dependencies = [ "derive_more", "miden-assembly-syntax", @@ -984,6 +1222,8 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eef536978f24a179d94fa2a41e4f92b28e7d8aab14b8d23df28ad2a3d7098b20" dependencies = [ + "backtrace", + "backtrace-ext", "cfg-if", "futures", "indenter", @@ -996,7 +1236,11 @@ dependencies = [ "serde_json", "spin", "strip-ansi-escapes", - "syn", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "syn 2.0.106", + "terminal_size", "textwrap", "thiserror", "trybuild", @@ -1011,63 +1255,93 @@ checksum = "86a905f3ea65634dd4d1041a4f0fd0a3e77aa4118341d265af1a94339182222f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] -name = "miden-objects" -version = "0.12.1" +name = "miden-processor" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" +checksum = "4a659fac55de14647e2695f03d96b83ff94fe65fd31e74d81c225ec52af25acf" +dependencies = [ + "itertools", + "miden-air", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", + "thiserror", + "tokio", + "tracing", + "winter-prover", +] + +[[package]] +name = "miden-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfed3ae85e2fabbf8a2e7416e388a40519e10cbf0cdceda222ef858c2f270b35" dependencies = [ "bech32", + "fs-err", "getrandom 0.3.3", "miden-assembly", "miden-assembly-syntax", "miden-core", + "miden-core-lib", "miden-crypto", "miden-mast-package", "miden-processor", + "miden-protocol-macros", "miden-utils-sync", "miden-verifier", "rand", + "regex", "semver 1.0.26", "thiserror", + "walkdir", ] [[package]] -name = "miden-processor" -version = "0.19.1" +name = "miden-protocol-macros" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" +checksum = "f41a93dd532baa3a4c821073baad5d700aab119b3831ef7fdf004e196c10157e" dependencies = [ - "itertools", - "miden-air", - "miden-core", - "miden-debug-types", - "miden-utils-diagnostics", - "miden-utils-indexing", - "paste", - "rayon", - "thiserror", - "tokio", - "tracing", - "winter-prover", + "proc-macro2", + "quote", + "syn 2.0.106", ] [[package]] name = "miden-sdk-alloc" -version = "0.8.0" +version = "0.10.0" [[package]] name = "miden-stdlib-sys" -version = "0.8.0" +version = "0.10.0" +dependencies = [ + "miden-field", +] + +[[package]] +name = "miden-utils-core-derive" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa207ffd8b26a79d9b5b246a352812f0015c0bb8f75492ec089c5c8e6d5f9e2b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] name = "miden-utils-diagnostics" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" +checksum = "6b2f55477d410542a5d8990ca04856adf5bef91bfa3b54ca3c03a5ff14a6e25c" dependencies = [ "miden-crypto", "miden-debug-types", @@ -1078,28 +1352,29 @@ dependencies = [ [[package]] name = "miden-utils-indexing" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +checksum = "f39efae17e14ec8f8a1266cffd29eb7a08ac837143cd09223b1af361bbb55730" dependencies = [ "thiserror", ] [[package]] name = "miden-utils-sync" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" +checksum = "da7fa8f5fd27f122c83f55752f2a964bbfc2b713de419e9c152f7dcc05c194ec" dependencies = [ "lock_api", "loom", + "parking_lot", ] [[package]] name = "miden-verifier" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" +checksum = "fbddac2e76486fb657929338323c68b9e7f40e33b8cfb593d0fb5bf637db046e" dependencies = [ "miden-air", "miden-core", @@ -1119,6 +1394,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + [[package]] name = "nanorand" version = "0.7.0" @@ -1185,7 +1469,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1229,12 +1513,27 @@ dependencies = [ "libm", ] +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "opaque-debug" version = "0.3.1" @@ -1273,7 +1572,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -1334,6 +1633,21 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -1356,7 +1670,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.106", ] [[package]] @@ -1368,6 +1682,21 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +dependencies = [ + "bitflags", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax 0.8.5", + "unarray", +] + [[package]] name = "quote" version = "1.0.40" @@ -1389,6 +1718,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ + "rand_chacha", "rand_core 0.9.3", ] @@ -1416,6 +1746,9 @@ name = "rand_core" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", +] [[package]] name = "rand_hc" @@ -1426,6 +1759,15 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.3", +] + [[package]] name = "rayon" version = "1.11.0" @@ -1509,6 +1851,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "rustc-demangle" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1527,6 +1875,19 @@ dependencies = [ "semver 1.0.26", ] +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.59.0", +] + [[package]] name = "rustversion" version = "1.0.21" @@ -1600,22 +1961,32 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1758,6 +2129,38 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "supports-color" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c64fc7232dd8d2e4ac5ce4ef302b1d81e0b80d055b9d77c7c4f51f6aa4c867d6" +dependencies = [ + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e396b6523b11ccb83120b115a0b7366de372751aa6edf19844dfb13a6af97e91" + +[[package]] +name = "supports-unicode" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.106" @@ -1781,7 +2184,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -1793,6 +2196,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix", + "windows-sys 0.48.0", +] + [[package]] name = "textwrap" version = "0.16.2" @@ -1821,7 +2234,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1942,7 +2355,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2006,6 +2419,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicode-ident" version = "1.0.18" @@ -2046,6 +2465,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "valuable" version = "0.1.1" @@ -2113,7 +2538,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-shared", ] @@ -2135,7 +2560,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2205,7 +2630,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -2223,7 +2648,7 @@ dependencies = [ "windows-collections", "windows-core", "windows-future", - "windows-link", + "windows-link 0.1.3", "windows-numerics", ] @@ -2244,7 +2669,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", - "windows-link", + "windows-link 0.1.3", "windows-result", "windows-strings", ] @@ -2256,7 +2681,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", "windows-threading", ] @@ -2268,7 +2693,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2279,7 +2704,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2288,6 +2713,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-numerics" version = "0.2.0" @@ -2295,7 +2726,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2304,7 +2735,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2313,7 +2744,16 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", ] [[package]] @@ -2322,7 +2762,31 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -2331,14 +2795,14 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2347,21 +2811,39 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -2374,24 +2856,48 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -2459,7 +2965,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d31a19dae58475d019850e25b0170e94b16d382fbf6afee9c0e80fdc935e73e" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2535,7 +3041,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn", + "syn 2.0.106", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -2551,7 +3057,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -2620,7 +3126,7 @@ checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/Cargo.lock index f640057d4..4a8ba1cc1 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + [[package]] name = "aead" version = "0.5.2" @@ -21,6 +36,56 @@ dependencies = [ "memchr", ] +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + [[package]] name = "anyhow" version = "1.0.100" @@ -54,6 +119,30 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-link 0.2.1", +] + +[[package]] +name = "backtrace-ext" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" +dependencies = [ + "backtrace", +] + [[package]] name = "base16ct" version = "0.2.0" @@ -127,6 +216,8 @@ version = "1.2.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -171,6 +262,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + [[package]] name = "const-oid" version = "0.9.6" @@ -271,7 +368,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -301,7 +398,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -396,15 +493,26 @@ dependencies = [ ] [[package]] -name = "enum_dispatch" -version = "0.3.13" +name = "env_filter" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn", + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", ] [[package]] @@ -413,6 +521,16 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + [[package]] name = "ff" version = "0.13.1" @@ -453,6 +571,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "fs-err" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf68cef89750956493a66a10f512b9e58d9db21f2a573c079c0bdf1207a54a7" +dependencies = [ + "autocfg", +] + [[package]] name = "futures" version = "0.3.31" @@ -566,6 +693,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + [[package]] name = "glob" version = "0.3.2" @@ -648,6 +781,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "is_ci" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + [[package]] name = "itertools" version = "0.14.0" @@ -663,6 +808,40 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jiff" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.3", + "libc", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -750,6 +929,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + [[package]] name = "lock_api" version = "0.4.13" @@ -796,10 +981,13 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.8.0" +version = "0.10.0" dependencies = [ "miden-base", + "miden-base-macros", "miden-base-sys", + "miden-field", + "miden-field-repr", "miden-sdk-alloc", "miden-stdlib-sys", "wit-bindgen", @@ -807,9 +995,9 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" +checksum = "3d819876b9e9b630e63152400e6df2a201668a9bdfd33d54d6806b9d7b992ff8" dependencies = [ "miden-core", "miden-utils-indexing", @@ -820,9 +1008,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" +checksum = "24c6a18e29c03141cf9044604390a00691c7342924ec865b4acfdd560ff41ede" dependencies = [ "log", "miden-assembly-syntax", @@ -834,9 +1022,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" +checksum = "7458ff670f5a514bf972aa84d6e1851a4c4e9afa351f53b71bdc2218b99254b6" dependencies = [ "aho-corasick", "lalrpop", @@ -846,6 +1034,7 @@ dependencies = [ "miden-debug-types", "miden-utils-diagnostics", "midenc-hir-type", + "proptest", "regex", "rustc_version 0.4.1", "semver 1.0.26", @@ -855,23 +1044,22 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.8.0" +version = "0.10.0" dependencies = [ - "miden-base-macros", "miden-base-sys", "miden-stdlib-sys", ] [[package]] name = "miden-base-macros" -version = "0.8.0" +version = "0.10.0" dependencies = [ "heck", - "miden-objects", + "miden-protocol", "proc-macro2", "quote", "semver 1.0.26", - "syn", + "syn 2.0.106", "toml 0.8.23", "wit-bindgen-core", "wit-bindgen-rust", @@ -879,21 +1067,24 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.1" +version = "0.10.0" dependencies = [ + "miden-field-repr", "miden-stdlib-sys", ] [[package]] name = "miden-core" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" +checksum = "21a5c9c8c3d42ae8381ed49e47ff9ad2d2e345c4726761be36b7d4000ebb40ae" dependencies = [ - "enum_dispatch", + "derive_more", + "itertools", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-core-derive", "miden-utils-indexing", "num-derive", "num-traits", @@ -902,14 +1093,33 @@ dependencies = [ "winter-utils", ] +[[package]] +name = "miden-core-lib" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6556494ea5576803730fa15015bee6bd9d1a117450f22e7df0883421e7423674" +dependencies = [ + "env_logger", + "fs-err", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", + "sha2", + "thiserror", +] + [[package]] name = "miden-crypto" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" +checksum = "6e28b6e110f339c2edc2760a8cb94863f0a055ee658a49bc90c8560eff2feef4" dependencies = [ "blake3", + "cc", "chacha20poly1305", + "curve25519-dalek", "ed25519-dalek", "flume", "glob", @@ -922,6 +1132,7 @@ dependencies = [ "rand_chacha", "rand_core 0.9.3", "rand_hc", + "sha2", "sha3", "subtle", "thiserror", @@ -933,19 +1144,19 @@ dependencies = [ [[package]] name = "miden-crypto-derive" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +checksum = "f40e95b9c7c99ed6bbf073d9e02721d812dedd2c195019c0a0e0a3dbb9cbf034" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] name = "miden-debug-types" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" +checksum = "19123e896f24b575e69921a79a39a0a4babeb98404a8601017feb13b75d653b3" dependencies = [ "memchr", "miden-crypto", @@ -954,9 +1165,36 @@ dependencies = [ "miden-utils-indexing", "miden-utils-sync", "paste", + "serde", + "serde_spanned 1.0.0", "thiserror", ] +[[package]] +name = "miden-field" +version = "0.10.0" +dependencies = [ + "miden-core", +] + +[[package]] +name = "miden-field-repr" +version = "0.10.0" +dependencies = [ + "miden-core", + "miden-field", + "miden-field-repr-derive", +] + +[[package]] +name = "miden-field-repr-derive" +version = "0.10.0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + [[package]] name = "miden-formatting" version = "0.1.1" @@ -968,9 +1206,9 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" +checksum = "f0d6a322b91efa1bb71e224395ca1fb9ca00e2614f89427e35d8c42a903868a3" dependencies = [ "derive_more", "miden-assembly-syntax", @@ -984,6 +1222,8 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eef536978f24a179d94fa2a41e4f92b28e7d8aab14b8d23df28ad2a3d7098b20" dependencies = [ + "backtrace", + "backtrace-ext", "cfg-if", "futures", "indenter", @@ -996,7 +1236,11 @@ dependencies = [ "serde_json", "spin", "strip-ansi-escapes", - "syn", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "syn 2.0.106", + "terminal_size", "textwrap", "thiserror", "trybuild", @@ -1011,63 +1255,93 @@ checksum = "86a905f3ea65634dd4d1041a4f0fd0a3e77aa4118341d265af1a94339182222f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] -name = "miden-objects" -version = "0.12.1" +name = "miden-processor" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" +checksum = "4a659fac55de14647e2695f03d96b83ff94fe65fd31e74d81c225ec52af25acf" +dependencies = [ + "itertools", + "miden-air", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", + "thiserror", + "tokio", + "tracing", + "winter-prover", +] + +[[package]] +name = "miden-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfed3ae85e2fabbf8a2e7416e388a40519e10cbf0cdceda222ef858c2f270b35" dependencies = [ "bech32", + "fs-err", "getrandom 0.3.3", "miden-assembly", "miden-assembly-syntax", "miden-core", + "miden-core-lib", "miden-crypto", "miden-mast-package", "miden-processor", + "miden-protocol-macros", "miden-utils-sync", "miden-verifier", "rand", + "regex", "semver 1.0.26", "thiserror", + "walkdir", ] [[package]] -name = "miden-processor" -version = "0.19.1" +name = "miden-protocol-macros" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" +checksum = "f41a93dd532baa3a4c821073baad5d700aab119b3831ef7fdf004e196c10157e" dependencies = [ - "itertools", - "miden-air", - "miden-core", - "miden-debug-types", - "miden-utils-diagnostics", - "miden-utils-indexing", - "paste", - "rayon", - "thiserror", - "tokio", - "tracing", - "winter-prover", + "proc-macro2", + "quote", + "syn 2.0.106", ] [[package]] name = "miden-sdk-alloc" -version = "0.8.0" +version = "0.10.0" [[package]] name = "miden-stdlib-sys" -version = "0.8.0" +version = "0.10.0" +dependencies = [ + "miden-field", +] + +[[package]] +name = "miden-utils-core-derive" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa207ffd8b26a79d9b5b246a352812f0015c0bb8f75492ec089c5c8e6d5f9e2b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] name = "miden-utils-diagnostics" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" +checksum = "6b2f55477d410542a5d8990ca04856adf5bef91bfa3b54ca3c03a5ff14a6e25c" dependencies = [ "miden-crypto", "miden-debug-types", @@ -1078,28 +1352,29 @@ dependencies = [ [[package]] name = "miden-utils-indexing" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +checksum = "f39efae17e14ec8f8a1266cffd29eb7a08ac837143cd09223b1af361bbb55730" dependencies = [ "thiserror", ] [[package]] name = "miden-utils-sync" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" +checksum = "da7fa8f5fd27f122c83f55752f2a964bbfc2b713de419e9c152f7dcc05c194ec" dependencies = [ "lock_api", "loom", + "parking_lot", ] [[package]] name = "miden-verifier" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" +checksum = "fbddac2e76486fb657929338323c68b9e7f40e33b8cfb593d0fb5bf637db046e" dependencies = [ "miden-air", "miden-core", @@ -1119,6 +1394,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + [[package]] name = "nanorand" version = "0.7.0" @@ -1185,7 +1469,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1229,12 +1513,27 @@ dependencies = [ "libm", ] +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "opaque-debug" version = "0.3.1" @@ -1273,7 +1572,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -1334,6 +1633,21 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -1356,7 +1670,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.106", ] [[package]] @@ -1368,6 +1682,21 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +dependencies = [ + "bitflags", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax 0.8.5", + "unarray", +] + [[package]] name = "quote" version = "1.0.40" @@ -1389,6 +1718,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ + "rand_chacha", "rand_core 0.9.3", ] @@ -1416,6 +1746,9 @@ name = "rand_core" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", +] [[package]] name = "rand_hc" @@ -1426,6 +1759,15 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.3", +] + [[package]] name = "rayon" version = "1.11.0" @@ -1509,6 +1851,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "rustc-demangle" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1527,6 +1875,19 @@ dependencies = [ "semver 1.0.26", ] +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.59.0", +] + [[package]] name = "rustversion" version = "1.0.21" @@ -1600,22 +1961,32 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1758,6 +2129,38 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "supports-color" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c64fc7232dd8d2e4ac5ce4ef302b1d81e0b80d055b9d77c7c4f51f6aa4c867d6" +dependencies = [ + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e396b6523b11ccb83120b115a0b7366de372751aa6edf19844dfb13a6af97e91" + +[[package]] +name = "supports-unicode" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.106" @@ -1781,7 +2184,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -1793,6 +2196,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix", + "windows-sys 0.48.0", +] + [[package]] name = "textwrap" version = "0.16.2" @@ -1821,7 +2234,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1942,7 +2355,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2006,6 +2419,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicode-ident" version = "1.0.18" @@ -2046,6 +2465,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "valuable" version = "0.1.1" @@ -2113,7 +2538,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-shared", ] @@ -2135,7 +2560,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2205,7 +2630,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -2223,7 +2648,7 @@ dependencies = [ "windows-collections", "windows-core", "windows-future", - "windows-link", + "windows-link 0.1.3", "windows-numerics", ] @@ -2244,7 +2669,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", - "windows-link", + "windows-link 0.1.3", "windows-result", "windows-strings", ] @@ -2256,7 +2681,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", "windows-threading", ] @@ -2268,7 +2693,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2279,7 +2704,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2288,6 +2713,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-numerics" version = "0.2.0" @@ -2295,7 +2726,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2304,7 +2735,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2313,7 +2744,16 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", ] [[package]] @@ -2322,7 +2762,31 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -2331,14 +2795,14 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2347,21 +2811,39 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -2374,24 +2856,48 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -2459,7 +2965,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d31a19dae58475d019850e25b0170e94b16d382fbf6afee9c0e80fdc935e73e" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2535,7 +3041,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn", + "syn 2.0.106", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -2551,7 +3057,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -2620,7 +3126,7 @@ checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/Cargo.lock index 45463b09a..ef4ecab4e 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + [[package]] name = "aead" version = "0.5.2" @@ -21,6 +36,56 @@ dependencies = [ "memchr", ] +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + [[package]] name = "anyhow" version = "1.0.100" @@ -54,6 +119,30 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-link 0.2.1", +] + +[[package]] +name = "backtrace-ext" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" +dependencies = [ + "backtrace", +] + [[package]] name = "base16ct" version = "0.2.0" @@ -127,6 +216,8 @@ version = "1.2.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -171,6 +262,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + [[package]] name = "const-oid" version = "0.9.6" @@ -271,7 +368,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -301,7 +398,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -396,15 +493,26 @@ dependencies = [ ] [[package]] -name = "enum_dispatch" -version = "0.3.13" +name = "env_filter" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn", + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", ] [[package]] @@ -413,6 +521,16 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + [[package]] name = "ff" version = "0.13.1" @@ -453,6 +571,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "fs-err" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf68cef89750956493a66a10f512b9e58d9db21f2a573c079c0bdf1207a54a7" +dependencies = [ + "autocfg", +] + [[package]] name = "futures" version = "0.3.31" @@ -566,6 +693,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + [[package]] name = "glob" version = "0.3.2" @@ -648,6 +781,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "is_ci" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + [[package]] name = "itertools" version = "0.14.0" @@ -663,6 +808,40 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jiff" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.3", + "libc", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -750,6 +929,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + [[package]] name = "lock_api" version = "0.4.13" @@ -796,10 +981,13 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.8.0" +version = "0.10.0" dependencies = [ "miden-base", + "miden-base-macros", "miden-base-sys", + "miden-field", + "miden-field-repr", "miden-sdk-alloc", "miden-stdlib-sys", "wit-bindgen", @@ -807,9 +995,9 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" +checksum = "3d819876b9e9b630e63152400e6df2a201668a9bdfd33d54d6806b9d7b992ff8" dependencies = [ "miden-core", "miden-utils-indexing", @@ -820,9 +1008,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" +checksum = "24c6a18e29c03141cf9044604390a00691c7342924ec865b4acfdd560ff41ede" dependencies = [ "log", "miden-assembly-syntax", @@ -834,9 +1022,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" +checksum = "7458ff670f5a514bf972aa84d6e1851a4c4e9afa351f53b71bdc2218b99254b6" dependencies = [ "aho-corasick", "lalrpop", @@ -846,6 +1034,7 @@ dependencies = [ "miden-debug-types", "miden-utils-diagnostics", "midenc-hir-type", + "proptest", "regex", "rustc_version 0.4.1", "semver 1.0.26", @@ -855,23 +1044,22 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.8.0" +version = "0.10.0" dependencies = [ - "miden-base-macros", "miden-base-sys", "miden-stdlib-sys", ] [[package]] name = "miden-base-macros" -version = "0.8.0" +version = "0.10.0" dependencies = [ "heck", - "miden-objects", + "miden-protocol", "proc-macro2", "quote", "semver 1.0.26", - "syn", + "syn 2.0.106", "toml 0.8.23", "wit-bindgen-core", "wit-bindgen-rust", @@ -879,21 +1067,24 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.1" +version = "0.10.0" dependencies = [ + "miden-field-repr", "miden-stdlib-sys", ] [[package]] name = "miden-core" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" +checksum = "21a5c9c8c3d42ae8381ed49e47ff9ad2d2e345c4726761be36b7d4000ebb40ae" dependencies = [ - "enum_dispatch", + "derive_more", + "itertools", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-core-derive", "miden-utils-indexing", "num-derive", "num-traits", @@ -902,14 +1093,33 @@ dependencies = [ "winter-utils", ] +[[package]] +name = "miden-core-lib" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6556494ea5576803730fa15015bee6bd9d1a117450f22e7df0883421e7423674" +dependencies = [ + "env_logger", + "fs-err", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", + "sha2", + "thiserror", +] + [[package]] name = "miden-crypto" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" +checksum = "6e28b6e110f339c2edc2760a8cb94863f0a055ee658a49bc90c8560eff2feef4" dependencies = [ "blake3", + "cc", "chacha20poly1305", + "curve25519-dalek", "ed25519-dalek", "flume", "glob", @@ -922,6 +1132,7 @@ dependencies = [ "rand_chacha", "rand_core 0.9.3", "rand_hc", + "sha2", "sha3", "subtle", "thiserror", @@ -933,19 +1144,19 @@ dependencies = [ [[package]] name = "miden-crypto-derive" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +checksum = "f40e95b9c7c99ed6bbf073d9e02721d812dedd2c195019c0a0e0a3dbb9cbf034" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] name = "miden-debug-types" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" +checksum = "19123e896f24b575e69921a79a39a0a4babeb98404a8601017feb13b75d653b3" dependencies = [ "memchr", "miden-crypto", @@ -954,9 +1165,36 @@ dependencies = [ "miden-utils-indexing", "miden-utils-sync", "paste", + "serde", + "serde_spanned 1.0.0", "thiserror", ] +[[package]] +name = "miden-field" +version = "0.10.0" +dependencies = [ + "miden-core", +] + +[[package]] +name = "miden-field-repr" +version = "0.10.0" +dependencies = [ + "miden-core", + "miden-field", + "miden-field-repr-derive", +] + +[[package]] +name = "miden-field-repr-derive" +version = "0.10.0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + [[package]] name = "miden-formatting" version = "0.1.1" @@ -968,9 +1206,9 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" +checksum = "f0d6a322b91efa1bb71e224395ca1fb9ca00e2614f89427e35d8c42a903868a3" dependencies = [ "derive_more", "miden-assembly-syntax", @@ -984,6 +1222,8 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eef536978f24a179d94fa2a41e4f92b28e7d8aab14b8d23df28ad2a3d7098b20" dependencies = [ + "backtrace", + "backtrace-ext", "cfg-if", "futures", "indenter", @@ -996,7 +1236,11 @@ dependencies = [ "serde_json", "spin", "strip-ansi-escapes", - "syn", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "syn 2.0.106", + "terminal_size", "textwrap", "thiserror", "trybuild", @@ -1011,63 +1255,93 @@ checksum = "86a905f3ea65634dd4d1041a4f0fd0a3e77aa4118341d265af1a94339182222f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] -name = "miden-objects" -version = "0.12.1" +name = "miden-processor" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" +checksum = "4a659fac55de14647e2695f03d96b83ff94fe65fd31e74d81c225ec52af25acf" +dependencies = [ + "itertools", + "miden-air", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", + "thiserror", + "tokio", + "tracing", + "winter-prover", +] + +[[package]] +name = "miden-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfed3ae85e2fabbf8a2e7416e388a40519e10cbf0cdceda222ef858c2f270b35" dependencies = [ "bech32", + "fs-err", "getrandom 0.3.3", "miden-assembly", "miden-assembly-syntax", "miden-core", + "miden-core-lib", "miden-crypto", "miden-mast-package", "miden-processor", + "miden-protocol-macros", "miden-utils-sync", "miden-verifier", "rand", + "regex", "semver 1.0.26", "thiserror", + "walkdir", ] [[package]] -name = "miden-processor" -version = "0.19.1" +name = "miden-protocol-macros" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" +checksum = "f41a93dd532baa3a4c821073baad5d700aab119b3831ef7fdf004e196c10157e" dependencies = [ - "itertools", - "miden-air", - "miden-core", - "miden-debug-types", - "miden-utils-diagnostics", - "miden-utils-indexing", - "paste", - "rayon", - "thiserror", - "tokio", - "tracing", - "winter-prover", + "proc-macro2", + "quote", + "syn 2.0.106", ] [[package]] name = "miden-sdk-alloc" -version = "0.8.0" +version = "0.10.0" [[package]] name = "miden-stdlib-sys" -version = "0.8.0" +version = "0.10.0" +dependencies = [ + "miden-field", +] + +[[package]] +name = "miden-utils-core-derive" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa207ffd8b26a79d9b5b246a352812f0015c0bb8f75492ec089c5c8e6d5f9e2b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] name = "miden-utils-diagnostics" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" +checksum = "6b2f55477d410542a5d8990ca04856adf5bef91bfa3b54ca3c03a5ff14a6e25c" dependencies = [ "miden-crypto", "miden-debug-types", @@ -1078,28 +1352,29 @@ dependencies = [ [[package]] name = "miden-utils-indexing" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +checksum = "f39efae17e14ec8f8a1266cffd29eb7a08ac837143cd09223b1af361bbb55730" dependencies = [ "thiserror", ] [[package]] name = "miden-utils-sync" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" +checksum = "da7fa8f5fd27f122c83f55752f2a964bbfc2b713de419e9c152f7dcc05c194ec" dependencies = [ "lock_api", "loom", + "parking_lot", ] [[package]] name = "miden-verifier" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" +checksum = "fbddac2e76486fb657929338323c68b9e7f40e33b8cfb593d0fb5bf637db046e" dependencies = [ "miden-air", "miden-core", @@ -1119,6 +1394,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + [[package]] name = "nanorand" version = "0.7.0" @@ -1185,7 +1469,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1229,12 +1513,27 @@ dependencies = [ "libm", ] +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "opaque-debug" version = "0.3.1" @@ -1273,7 +1572,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -1334,6 +1633,21 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -1356,7 +1670,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.106", ] [[package]] @@ -1368,6 +1682,21 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +dependencies = [ + "bitflags", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax 0.8.5", + "unarray", +] + [[package]] name = "quote" version = "1.0.40" @@ -1389,6 +1718,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ + "rand_chacha", "rand_core 0.9.3", ] @@ -1416,6 +1746,9 @@ name = "rand_core" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", +] [[package]] name = "rand_hc" @@ -1426,6 +1759,15 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.3", +] + [[package]] name = "rayon" version = "1.11.0" @@ -1509,6 +1851,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "rustc-demangle" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1527,6 +1875,19 @@ dependencies = [ "semver 1.0.26", ] +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.59.0", +] + [[package]] name = "rustversion" version = "1.0.21" @@ -1600,22 +1961,32 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1758,6 +2129,38 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "supports-color" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c64fc7232dd8d2e4ac5ce4ef302b1d81e0b80d055b9d77c7c4f51f6aa4c867d6" +dependencies = [ + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e396b6523b11ccb83120b115a0b7366de372751aa6edf19844dfb13a6af97e91" + +[[package]] +name = "supports-unicode" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.106" @@ -1781,7 +2184,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -1793,6 +2196,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix", + "windows-sys 0.48.0", +] + [[package]] name = "textwrap" version = "0.16.2" @@ -1821,7 +2234,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1942,7 +2355,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2006,6 +2419,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicode-ident" version = "1.0.18" @@ -2046,6 +2465,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "valuable" version = "0.1.1" @@ -2113,7 +2538,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-shared", ] @@ -2135,7 +2560,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2205,7 +2630,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -2223,7 +2648,7 @@ dependencies = [ "windows-collections", "windows-core", "windows-future", - "windows-link", + "windows-link 0.1.3", "windows-numerics", ] @@ -2244,7 +2669,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", - "windows-link", + "windows-link 0.1.3", "windows-result", "windows-strings", ] @@ -2256,7 +2681,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", "windows-threading", ] @@ -2268,7 +2693,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2279,7 +2704,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2288,6 +2713,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-numerics" version = "0.2.0" @@ -2295,7 +2726,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2304,7 +2735,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2313,7 +2744,16 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", ] [[package]] @@ -2322,7 +2762,31 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -2331,14 +2795,14 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2347,21 +2811,39 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -2374,24 +2856,48 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -2459,7 +2965,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d31a19dae58475d019850e25b0170e94b16d382fbf6afee9c0e80fdc935e73e" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2535,7 +3041,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn", + "syn 2.0.106", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -2551,7 +3057,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -2620,7 +3126,7 @@ checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/Cargo.lock index 84766fb81..aeb4a5451 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + [[package]] name = "aead" version = "0.5.2" @@ -21,6 +36,56 @@ dependencies = [ "memchr", ] +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + [[package]] name = "anyhow" version = "1.0.100" @@ -54,6 +119,30 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-link 0.2.1", +] + +[[package]] +name = "backtrace-ext" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" +dependencies = [ + "backtrace", +] + [[package]] name = "base16ct" version = "0.2.0" @@ -127,6 +216,8 @@ version = "1.2.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -171,6 +262,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + [[package]] name = "const-oid" version = "0.9.6" @@ -271,7 +368,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -301,7 +398,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -396,15 +493,26 @@ dependencies = [ ] [[package]] -name = "enum_dispatch" -version = "0.3.13" +name = "env_filter" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn", + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", ] [[package]] @@ -413,6 +521,16 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + [[package]] name = "ff" version = "0.13.1" @@ -453,6 +571,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "fs-err" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf68cef89750956493a66a10f512b9e58d9db21f2a573c079c0bdf1207a54a7" +dependencies = [ + "autocfg", +] + [[package]] name = "futures" version = "0.3.31" @@ -566,6 +693,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + [[package]] name = "glob" version = "0.3.2" @@ -648,6 +781,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "is_ci" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + [[package]] name = "itertools" version = "0.14.0" @@ -663,6 +808,40 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jiff" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.3", + "libc", +] + [[package]] name = "js-sys" version = "0.3.77" @@ -750,6 +929,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + [[package]] name = "lock_api" version = "0.4.13" @@ -796,10 +981,13 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.8.0" +version = "0.10.0" dependencies = [ "miden-base", + "miden-base-macros", "miden-base-sys", + "miden-field", + "miden-field-repr", "miden-sdk-alloc", "miden-stdlib-sys", "wit-bindgen", @@ -807,9 +995,9 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" +checksum = "3d819876b9e9b630e63152400e6df2a201668a9bdfd33d54d6806b9d7b992ff8" dependencies = [ "miden-core", "miden-utils-indexing", @@ -820,9 +1008,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" +checksum = "24c6a18e29c03141cf9044604390a00691c7342924ec865b4acfdd560ff41ede" dependencies = [ "log", "miden-assembly-syntax", @@ -834,9 +1022,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" +checksum = "7458ff670f5a514bf972aa84d6e1851a4c4e9afa351f53b71bdc2218b99254b6" dependencies = [ "aho-corasick", "lalrpop", @@ -846,6 +1034,7 @@ dependencies = [ "miden-debug-types", "miden-utils-diagnostics", "midenc-hir-type", + "proptest", "regex", "rustc_version 0.4.1", "semver 1.0.26", @@ -855,23 +1044,22 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.8.0" +version = "0.10.0" dependencies = [ - "miden-base-macros", "miden-base-sys", "miden-stdlib-sys", ] [[package]] name = "miden-base-macros" -version = "0.8.0" +version = "0.10.0" dependencies = [ "heck", - "miden-objects", + "miden-protocol", "proc-macro2", "quote", "semver 1.0.26", - "syn", + "syn 2.0.106", "toml 0.8.23", "wit-bindgen-core", "wit-bindgen-rust", @@ -879,21 +1067,24 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.1" +version = "0.10.0" dependencies = [ + "miden-field-repr", "miden-stdlib-sys", ] [[package]] name = "miden-core" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" +checksum = "21a5c9c8c3d42ae8381ed49e47ff9ad2d2e345c4726761be36b7d4000ebb40ae" dependencies = [ - "enum_dispatch", + "derive_more", + "itertools", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-core-derive", "miden-utils-indexing", "num-derive", "num-traits", @@ -902,14 +1093,33 @@ dependencies = [ "winter-utils", ] +[[package]] +name = "miden-core-lib" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6556494ea5576803730fa15015bee6bd9d1a117450f22e7df0883421e7423674" +dependencies = [ + "env_logger", + "fs-err", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", + "sha2", + "thiserror", +] + [[package]] name = "miden-crypto" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" +checksum = "6e28b6e110f339c2edc2760a8cb94863f0a055ee658a49bc90c8560eff2feef4" dependencies = [ "blake3", + "cc", "chacha20poly1305", + "curve25519-dalek", "ed25519-dalek", "flume", "glob", @@ -922,6 +1132,7 @@ dependencies = [ "rand_chacha", "rand_core 0.9.3", "rand_hc", + "sha2", "sha3", "subtle", "thiserror", @@ -933,19 +1144,19 @@ dependencies = [ [[package]] name = "miden-crypto-derive" -version = "0.18.2" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +checksum = "f40e95b9c7c99ed6bbf073d9e02721d812dedd2c195019c0a0e0a3dbb9cbf034" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] name = "miden-debug-types" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" +checksum = "19123e896f24b575e69921a79a39a0a4babeb98404a8601017feb13b75d653b3" dependencies = [ "memchr", "miden-crypto", @@ -954,9 +1165,36 @@ dependencies = [ "miden-utils-indexing", "miden-utils-sync", "paste", + "serde", + "serde_spanned 1.0.0", "thiserror", ] +[[package]] +name = "miden-field" +version = "0.10.0" +dependencies = [ + "miden-core", +] + +[[package]] +name = "miden-field-repr" +version = "0.10.0" +dependencies = [ + "miden-core", + "miden-field", + "miden-field-repr-derive", +] + +[[package]] +name = "miden-field-repr-derive" +version = "0.10.0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + [[package]] name = "miden-formatting" version = "0.1.1" @@ -968,9 +1206,9 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" +checksum = "f0d6a322b91efa1bb71e224395ca1fb9ca00e2614f89427e35d8c42a903868a3" dependencies = [ "derive_more", "miden-assembly-syntax", @@ -984,6 +1222,8 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eef536978f24a179d94fa2a41e4f92b28e7d8aab14b8d23df28ad2a3d7098b20" dependencies = [ + "backtrace", + "backtrace-ext", "cfg-if", "futures", "indenter", @@ -996,7 +1236,11 @@ dependencies = [ "serde_json", "spin", "strip-ansi-escapes", - "syn", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "syn 2.0.106", + "terminal_size", "textwrap", "thiserror", "trybuild", @@ -1011,63 +1255,93 @@ checksum = "86a905f3ea65634dd4d1041a4f0fd0a3e77aa4118341d265af1a94339182222f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] -name = "miden-objects" -version = "0.12.1" +name = "miden-processor" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" +checksum = "4a659fac55de14647e2695f03d96b83ff94fe65fd31e74d81c225ec52af25acf" +dependencies = [ + "itertools", + "miden-air", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", + "thiserror", + "tokio", + "tracing", + "winter-prover", +] + +[[package]] +name = "miden-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfed3ae85e2fabbf8a2e7416e388a40519e10cbf0cdceda222ef858c2f270b35" dependencies = [ "bech32", + "fs-err", "getrandom 0.3.3", "miden-assembly", "miden-assembly-syntax", "miden-core", + "miden-core-lib", "miden-crypto", "miden-mast-package", "miden-processor", + "miden-protocol-macros", "miden-utils-sync", "miden-verifier", "rand", + "regex", "semver 1.0.26", "thiserror", + "walkdir", ] [[package]] -name = "miden-processor" -version = "0.19.1" +name = "miden-protocol-macros" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" +checksum = "f41a93dd532baa3a4c821073baad5d700aab119b3831ef7fdf004e196c10157e" dependencies = [ - "itertools", - "miden-air", - "miden-core", - "miden-debug-types", - "miden-utils-diagnostics", - "miden-utils-indexing", - "paste", - "rayon", - "thiserror", - "tokio", - "tracing", - "winter-prover", + "proc-macro2", + "quote", + "syn 2.0.106", ] [[package]] name = "miden-sdk-alloc" -version = "0.8.0" +version = "0.10.0" [[package]] name = "miden-stdlib-sys" -version = "0.8.0" +version = "0.10.0" +dependencies = [ + "miden-field", +] + +[[package]] +name = "miden-utils-core-derive" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa207ffd8b26a79d9b5b246a352812f0015c0bb8f75492ec089c5c8e6d5f9e2b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] name = "miden-utils-diagnostics" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" +checksum = "6b2f55477d410542a5d8990ca04856adf5bef91bfa3b54ca3c03a5ff14a6e25c" dependencies = [ "miden-crypto", "miden-debug-types", @@ -1078,28 +1352,29 @@ dependencies = [ [[package]] name = "miden-utils-indexing" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +checksum = "f39efae17e14ec8f8a1266cffd29eb7a08ac837143cd09223b1af361bbb55730" dependencies = [ "thiserror", ] [[package]] name = "miden-utils-sync" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" +checksum = "da7fa8f5fd27f122c83f55752f2a964bbfc2b713de419e9c152f7dcc05c194ec" dependencies = [ "lock_api", "loom", + "parking_lot", ] [[package]] name = "miden-verifier" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" +checksum = "fbddac2e76486fb657929338323c68b9e7f40e33b8cfb593d0fb5bf637db046e" dependencies = [ "miden-air", "miden-core", @@ -1119,6 +1394,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + [[package]] name = "nanorand" version = "0.7.0" @@ -1185,7 +1469,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1229,12 +1513,27 @@ dependencies = [ "libm", ] +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "opaque-debug" version = "0.3.1" @@ -1273,7 +1572,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -1334,6 +1633,21 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -1356,7 +1670,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.106", ] [[package]] @@ -1368,6 +1682,21 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +dependencies = [ + "bitflags", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax 0.8.5", + "unarray", +] + [[package]] name = "quote" version = "1.0.40" @@ -1389,6 +1718,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ + "rand_chacha", "rand_core 0.9.3", ] @@ -1416,6 +1746,9 @@ name = "rand_core" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", +] [[package]] name = "rand_hc" @@ -1426,6 +1759,15 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.3", +] + [[package]] name = "rayon" version = "1.11.0" @@ -1509,6 +1851,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "rustc-demangle" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" + [[package]] name = "rustc_version" version = "0.2.3" @@ -1527,6 +1875,19 @@ dependencies = [ "semver 1.0.26", ] +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.59.0", +] + [[package]] name = "rustversion" version = "1.0.21" @@ -1600,22 +1961,32 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1758,6 +2129,38 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "supports-color" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c64fc7232dd8d2e4ac5ce4ef302b1d81e0b80d055b9d77c7c4f51f6aa4c867d6" +dependencies = [ + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e396b6523b11ccb83120b115a0b7366de372751aa6edf19844dfb13a6af97e91" + +[[package]] +name = "supports-unicode" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.106" @@ -1781,7 +2184,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -1793,6 +2196,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix", + "windows-sys 0.48.0", +] + [[package]] name = "textwrap" version = "0.16.2" @@ -1821,7 +2234,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -1942,7 +2355,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2006,6 +2419,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicode-ident" version = "1.0.18" @@ -2046,6 +2465,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "valuable" version = "0.1.1" @@ -2113,7 +2538,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-shared", ] @@ -2135,7 +2560,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2205,7 +2630,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -2223,7 +2648,7 @@ dependencies = [ "windows-collections", "windows-core", "windows-future", - "windows-link", + "windows-link 0.1.3", "windows-numerics", ] @@ -2244,7 +2669,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", - "windows-link", + "windows-link 0.1.3", "windows-result", "windows-strings", ] @@ -2256,7 +2681,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", "windows-threading", ] @@ -2268,7 +2693,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2279,7 +2704,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2288,6 +2713,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-numerics" version = "0.2.0" @@ -2295,7 +2726,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2304,7 +2735,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -2313,7 +2744,16 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", ] [[package]] @@ -2322,7 +2762,31 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -2331,14 +2795,14 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2347,21 +2811,39 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -2374,24 +2856,48 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -2459,7 +2965,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d31a19dae58475d019850e25b0170e94b16d382fbf6afee9c0e80fdc935e73e" dependencies = [ "quote", - "syn", + "syn 2.0.106", ] [[package]] @@ -2535,7 +3041,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn", + "syn 2.0.106", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -2551,7 +3057,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn", + "syn 2.0.106", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -2620,7 +3126,7 @@ checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.106", ] [[package]] diff --git a/tests/rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup/.gitignore b/tests/rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup/.gitignore new file mode 100644 index 000000000..96ef6c0b9 --- /dev/null +++ b/tests/rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup/.gitignore @@ -0,0 +1,2 @@ +/target +Cargo.lock diff --git a/tests/rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup/Cargo.toml b/tests/rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup/Cargo.toml new file mode 100644 index 000000000..15c350487 --- /dev/null +++ b/tests/rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup/Cargo.toml @@ -0,0 +1,32 @@ +cargo-features = ["trim-paths"] + +[package] +name = "issue-invalid-stack-offset-movup" +version = "0.1.0" +edition = "2024" + +[lib] +crate-type = ["cdylib"] + +[dependencies] +miden = { path = "../../../../sdk/sdk" } + +[package.metadata.component] +package = "miden:issue-invalid-stack-offset-movup" + +[package.metadata.miden] +project-kind = "note-script" + +[profile.release] +opt-level = "z" +panic = "abort" +debug = false +trim-paths = ["diagnostics", "object"] + +[profile.dev] +panic = "abort" +opt-level = 1 +debug-assertions = true +overflow-checks = false +debug = true +trim-paths = ["diagnostics", "object"] diff --git a/tests/rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup/src/lib.rs new file mode 100644 index 000000000..c8d6d692d --- /dev/null +++ b/tests/rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup/src/lib.rs @@ -0,0 +1,205 @@ +//! Reproducer for https://github.com/0xMiden/compiler/issues/831 +//! +//! This note-script previously triggered a panic during MASM codegen with: +//! `invalid stack offset for movup: 16 is out of range`. + +#![no_std] +#![feature(alloc_error_handler)] + +#[macro_use] +extern crate alloc; + +use miden::*; + +#[note] +struct InvalidStackOffsetMovupNote; + +#[note] +impl InvalidStackOffsetMovupNote { + /// Note-script entrypoint used to reproduce issue #831. + /// + /// The `create_swapp_note` call uses a flattened argument size of 15 felts. + #[note_script] + pub fn run(self, arg: Word) { + // NOTE: Guard the reproduction logic behind a runtime condition so that once #831 is fixed, + // this note can execute without requiring a full `active_note`/`output_note` runtime context. + if arg[0] == felt!(0) { + return; + } + + let inputs = active_note::get_inputs(); + + let executing_account_id = active_account::get_id(); + let swapp_note_creator_id = AccountId::new(inputs[8], inputs[9]); + + if swapp_note_creator_id == executing_account_id { + // active_note::add_assets_to_account(); + return; + } + + let inflight_val = arg[0]; + let input_amount = arg[1]; + let _inflight = inflight_val != felt!(0); + + let _requested_asset_word = Asset::from([inputs[0], inputs[1], inputs[2], inputs[3]]); + let offered_asset_word = Asset::from([inputs[4], inputs[5], inputs[6], inputs[7]]); + + let note_assets = active_note::get_assets(); + let num_assets = note_assets.len(); + assert_eq(Felt::from_u32(num_assets as u32), felt!(1)); + + let note_asset = note_assets[0]; + let assets_match = if offered_asset_word == note_asset { + felt!(1) + } else { + felt!(0) + }; + assert_eq(assets_match, felt!(1)); + + let requested_asset_total = inputs[3]; + let offered_asset_total = inputs[7]; + + let current_note_serial = active_note::get_serial_number(); + + let is_valid = if input_amount <= requested_asset_total { + felt!(1) + } else { + felt!(0) + }; + assert_eq(is_valid, felt!(1)); + + let _one = felt!(1); + let offered_out = + calculate_output_amount(offered_asset_total, requested_asset_total, input_amount); + + // active_note::add_assets_to_account(); + + let routing_serial = add_word(current_note_serial, Word::from_u64_unchecked(0, 0, 0, 1)); + + let aux_value = offered_out; + let input_asset = Asset::new(Word::from([inputs[0], inputs[1], inputs[2], input_amount])); + + create_p2id_note(routing_serial, input_asset, swapp_note_creator_id, aux_value); + + if offered_out < offered_asset_total { + let remainder_serial = hash_words(&[current_note_serial]).inner; + let remainder_aux = offered_out; + let remainder_requested_asset = + Asset::from([inputs[0], inputs[1], inputs[2], inputs[3] - input_amount]); + let remainder_offered_asset = + Asset::from([inputs[4], inputs[5], inputs[6], inputs[7] - offered_out]); + + create_swapp_note( + remainder_serial, + remainder_requested_asset, + remainder_offered_asset, + swapp_note_creator_id, + remainder_aux, + ); + } + } +} + +/// Calculates the output amount for the given swap parameters. +fn calculate_output_amount(offered_total: Felt, requested_total: Felt, input_amount: Felt) -> Felt { + let precision_factor = Felt::from_u32(100000); + + if offered_total > requested_total { + let ratio = (offered_total * precision_factor) / requested_total; + (input_amount * ratio) / precision_factor + } else { + let ratio = (requested_total * precision_factor) / offered_total; + (input_amount * ratio) / precision_factor + } +} + +/// Adds two words element-wise. +fn add_word(a: Word, b: Word) -> Word { + Word::from([a[0] + b[0], a[1] + b[1], a[2] + b[2], a[3] + b[3]]) +} + +/// Creates a P2ID output note. +fn create_p2id_note(serial_num: Word, input_asset: Asset, recipient_id: AccountId, _aux: Felt) { + let tag = Tag::from(felt!(0)); + let note_type = get_note_type(); + + let _p2id_note_root_digest = Digest::from_word(Word::new([ + Felt::from_u64_unchecked(6412241294473976817), + Felt::from_u64_unchecked(10671567784403105513), + Felt::from_u64_unchecked(4275774806771663409), + Felt::from_u64_unchecked(17933276983439992403), + ])); + + let recipient = Recipient::compute( + serial_num, + Digest::from_word(active_note::get_script_root()), + vec![ + recipient_id.prefix, + recipient_id.suffix, + felt!(0), + felt!(0), + felt!(0), + felt!(0), + felt!(0), + felt!(0), + ], + ); + + let note_idx = output_note::create(tag, note_type, recipient); + output_note::add_asset(input_asset, note_idx); +} + +/// Creates a SWAPP output note. +fn create_swapp_note( + serial_num: Word, + offered_asset: Asset, + requested_asset: Asset, + note_creator_id: AccountId, + _aux: Felt, +) { + let tag = get_note_tag(); + let note_type = get_note_type(); + + let recipient = Recipient::compute( + serial_num, + Digest::from_word(active_note::get_script_root()), + vec![ + offered_asset.inner[0], + offered_asset.inner[1], + offered_asset.inner[2], + offered_asset.inner[3], + requested_asset.inner[0], + requested_asset.inner[1], + requested_asset.inner[2], + requested_asset.inner[3], + note_creator_id.prefix, + note_creator_id.suffix, + felt!(0), + felt!(0), + felt!(0), + felt!(0), + felt!(0), + felt!(0), + ], + ); + + let note_idx = output_note::create(tag, note_type, recipient); + output_note::add_asset(offered_asset, note_idx); +} + +/// Extracts the note tag from the active note metadata. +fn get_note_tag() -> Tag { + let metadata = active_note::get_metadata().header; + let left_shifted_32 = metadata[2] * Felt::from_u32(2u32.pow(32)); + let tag_felt = left_shifted_32 / (Felt::from_u32(2u32.pow(32))); + Tag::from(tag_felt) +} + +/// Extracts the note type from the active note metadata. +fn get_note_type() -> NoteType { + let metadata = active_note::get_metadata().header; + let second_felt = metadata[1]; + let left_shifted_56 = second_felt * Felt::from_u32(2u32.pow(56)); + let note_type_felt = left_shifted_56 / Felt::from_u32(2u32.pow(62)); + NoteType::from(note_type_felt) +} diff --git a/tools/cargo-miden/Cargo.toml b/tools/cargo-miden/Cargo.toml index ef79ec0e1..926bd498f 100644 --- a/tools/cargo-miden/Cargo.toml +++ b/tools/cargo-miden/Cargo.toml @@ -24,7 +24,7 @@ path = "tests/mod.rs" [dependencies] midenc-compile.workspace = true midenc-session.workspace = true -env_logger.workspace = true +midenc-log.workspace = true log.workspace = true clap.workspace = true anyhow.workspace = true diff --git a/tools/cargo-miden/src/cli.rs b/tools/cargo-miden/src/cli.rs index 7b36a2126..59a184db8 100644 --- a/tools/cargo-miden/src/cli.rs +++ b/tools/cargo-miden/src/cli.rs @@ -1,6 +1,6 @@ use clap::{Parser, Subcommand}; -use crate::commands::{BuildCommand, ExampleCommand, NewCommand}; +use crate::commands::{BuildCommand, NewCommand, TestCommand}; /// Top-level command-line interface for `cargo-miden`. #[derive(Debug, Parser)] @@ -23,6 +23,6 @@ pub enum CargoMidenCommand { New(NewCommand), /// Compile the current crate to Miden package. Build(BuildCommand), - /// Scaffold one of the curated example projects. - Example(ExampleCommand), + /// Run the miden-tests in the project. + Test(TestCommand), } diff --git a/tools/cargo-miden/src/commands/build.rs b/tools/cargo-miden/src/commands/build.rs index 6f534115c..89fa8631a 100644 --- a/tools/cargo-miden/src/commands/build.rs +++ b/tools/cargo-miden/src/commands/build.rs @@ -1,11 +1,10 @@ use std::{ - io::{BufRead, BufReader}, path::{Path, PathBuf}, process::{Command, Stdio}, }; use anyhow::{Context, Result, bail}; -use cargo_metadata::{Artifact, Message, Metadata, MetadataCommand, Package, camino}; +use cargo_metadata::{Metadata, MetadataCommand, Package, camino}; use clap::Args; use midenc_compile::Compiler; use midenc_session::TargetEnv; @@ -72,6 +71,9 @@ impl BuildCommand { // Enable memcopy and 128-bit arithmetic ops let mut extra_rust_flags = String::from("-C target-feature=+bulk-memory,+wide-arithmetic"); + // Propagate the Miden VM target signal to the entire crate graph so Cargo can use it for + // cfg-based dependency selection. + extra_rust_flags.push_str(" --cfg miden"); // Enable errors on missing stub functions extra_rust_flags.push_str(" -C link-args=--fatal-warnings"); // Remove the source file paths in the data segment for panics @@ -106,9 +108,17 @@ impl BuildCommand { midenc_flags.push(dep_path.to_string_lossy().to_string()); } - // Merge user-provided midenc options from parsed Compiler struct - // User options override target-derived defaults - midenc_flags = merge_midenc_flags(midenc_flags, &compiler_opts); + // Merge user-provided build options + midenc_flags.extend_from_slice(&self.args); + // When debug info is enabled, automatically add -Ztrim-path-prefix to normalize + // source paths in debug information. + let package_source_dir = cargo_package.manifest_path.parent().map(|p| p.as_std_path()); + if compiler_opts.debug != midenc_session::DebugInfo::None + && let Some(source_dir) = package_source_dir + { + let trim_prefix = format!("-Ztrim-path-prefix={}", source_dir.display()); + midenc_flags.push(trim_prefix); + } match build_output_type { OutputType::Wasm => Ok(Some(CommandOutput::BuildCommandOutput { @@ -188,7 +198,7 @@ fn build_cargo_args(cargo_opts: &CargoOptions) -> Vec { // Add build-std flags required for Miden compilation args.extend( - ["-Z", "build-std=core,alloc,proc_macro,panic_abort", "-Z", "build-std-features="] + ["-Z", "build-std=core,alloc,panic_abort", "-Z", "build-std-features="] .into_iter() .map(|s| s.to_string()), ); @@ -231,36 +241,6 @@ fn build_cargo_args(cargo_opts: &CargoOptions) -> Vec { args } -/// Merges user-provided `--emit` option with target-derived defaults. -/// -/// Only the `--emit` option is merged from user input. All other options are -/// determined by the detected target environment and project type. -fn merge_midenc_flags(mut base: Vec, compiler: &Compiler) -> Vec { - // Only merge --emit options from user input - for spec in &compiler.output_types { - base.push("--emit".to_string()); - let spec_str = match spec { - midenc_session::OutputTypeSpec::All { path } => { - if let Some(p) = path { - format!("all={p}") - } else { - "all".to_string() - } - } - midenc_session::OutputTypeSpec::Typed { output_type, path } => { - if let Some(p) = path { - format!("{output_type}={p}") - } else { - output_type.to_string() - } - } - }; - base.push(spec_str); - } - - base -} - fn run_cargo(wasi: &str, spawn_args: &[String], env: E) -> Result> where E: IntoIterator, @@ -272,6 +252,10 @@ where let mut cargo = Command::new(&cargo_path); cargo.envs(env); + // This env var is used by crates (e.g. `miden-field`) to distinguish compiling to Wasm for a + // "real" Wasm runtime vs compiling to Wasm as an intermediate artifact that will be compiled + // to Miden VM code by `midenc`. + cargo.env("MIDENC_TARGET_IS_MIDEN_VM", "1"); cargo.args(spawn_args); // Handle the target for buildable commands @@ -284,7 +268,7 @@ where cargo.arg("--message-format").arg("json-render-diagnostics"); cargo.stdout(Stdio::piped()); - let artifacts = spawn_cargo(cargo, &cargo_path)?; + let artifacts = crate::utils::spawn_cargo(cargo, &cargo_path)?; let outputs: Vec = artifacts .into_iter() @@ -301,51 +285,6 @@ where Ok(outputs) } -fn spawn_cargo(mut cmd: Command, cargo: &Path) -> Result> { - log::debug!("spawning command {cmd:?}"); - - let mut child = cmd - .spawn() - .context(format!("failed to spawn `{cargo}`", cargo = cargo.display()))?; - - let mut artifacts = Vec::new(); - let stdout = child.stdout.take().expect("no stdout"); - let reader = BufReader::new(stdout); - for line in reader.lines() { - let line = line.context("failed to read output from `cargo`")?; - - if line.is_empty() { - continue; - } - - for message in Message::parse_stream(line.as_bytes()) { - if let Message::CompilerArtifact(artifact) = - message.context("unexpected JSON message from cargo")? - { - for path in &artifact.filenames { - match path.extension() { - Some("wasm") => { - artifacts.push(artifact); - break; - } - _ => continue, - } - } - } - } - } - - let status = child - .wait() - .context(format!("failed to wait for `{cargo}` to finish", cargo = cargo.display()))?; - - if !status.success() { - std::process::exit(status.code().unwrap_or(1)); - } - - Ok(artifacts) -} - fn determine_cargo_package<'a>( metadata: &'a cargo_metadata::Metadata, cargo_opts: &CargoOptions, diff --git a/tools/cargo-miden/src/commands/example_project.rs b/tools/cargo-miden/src/commands/example_project.rs deleted file mode 100644 index 6914f4b21..000000000 --- a/tools/cargo-miden/src/commands/example_project.rs +++ /dev/null @@ -1,359 +0,0 @@ -use std::path::{Path, PathBuf}; - -use anyhow::Context; -use clap::Args; -use toml_edit::{DocumentMut, Item}; - -use crate::{ - template::{GenerateArgs, TemplatePath, generate}, - utils::compiler_path, -}; - -/// Paired project mappings for examples that create multiple related projects -const PAIRED_PROJECTS: &[(&str, &str)] = &[("counter-contract", "counter-note")]; - -/// Triple project mappings for examples that create three related projects -/// Each tuple contains (tx-script, account, note) project names -/// Any of these names can be used to create all three projects -const TRIPLE_PROJECTS: &[(&str, &str, &str)] = - &[("basic-wallet-tx-script", "basic-wallet", "p2id-note")]; - -/// Create a new Miden example project -#[derive(Debug, Args)] -#[clap(disable_version_flag = true)] -pub struct ExampleCommand { - #[clap(help = r#"The example name to use from the compiler repository -Available examples: -basic-wallet : Basic wallet account -p2id-note : Pay-to-ID note -basic-wallet-tx-script: Transaction script used in basic-wallet and p2id-note -counter-contract : Counter contract -counter-note : Counter note -fibonacci : Fibonacci sequence calculator -collatz : Collatz conjecture calculator -is-prime : Prime number checker -storage-example : Storage operations example"#)] - pub example_name: String, -} - -use std::fs; - -impl ExampleCommand { - pub fn exec(self) -> anyhow::Result { - // Check if this is a triple project - any of the three names can be used - if let Some((tx_script, account, note)) = - TRIPLE_PROJECTS.iter().find(|(tx_script, account, note)| { - *tx_script == self.example_name - || *account == self.example_name - || *note == self.example_name - }) - { - // Always use the tx-script name as the main directory name - self.exec_triple_projects(tx_script, account, note) - } else if let Some((first, second)) = PAIRED_PROJECTS - .iter() - .find(|(first, second)| *first == self.example_name || *second == self.example_name) - { - self.exec_paired_projects(first, second) - } else { - self.exec_single_project() - } - } - - fn exec_single_project(&self) -> anyhow::Result { - // Use example name as project name - let project_name = self.example_name.clone(); - let project_path = PathBuf::from(&project_name); - - // Check if directory already exists - if project_path.exists() { - return Err(anyhow::anyhow!( - "Directory '{project_name}' already exists. Please remove it or choose a \ - different location." - )); - } - - let template_path = template_path(&project_name); - - // Generate in current directory - let destination = { - use path_absolutize::Absolutize; - std::env::current_dir()?.absolutize().map(|p| p.to_path_buf())? - }; - - let generate_args = GenerateArgs { - template_path, - destination: Some(destination), - name: Some(project_name.clone()), - // Force the `name` to not be kebab-cased - force: true, - force_git_init: true, - verbose: true, - ..Default::default() - }; - generate(generate_args) - .context("Failed to scaffold new Miden project from the template")?; - - // Process the Cargo.toml to update dependencies and WIT paths - process_cargo_toml(&project_path).context("Failed to process Cargo.toml")?; - - Ok(project_path) - } - - /// Create a pair (account and note script) projects in a sub-folder - fn exec_paired_projects( - &self, - first_project: &str, - second_project: &str, - ) -> anyhow::Result { - // Create main directory with the requested example name - let main_dir = PathBuf::from(&self.example_name); - - if main_dir.exists() { - return Err(anyhow::anyhow!( - "Directory '{}' already exists. Please remove it or choose a different location.", - self.example_name - )); - } - - // Create the main directory - fs::create_dir_all(&main_dir)?; - - // Generate both projects - let project_names = [first_project, second_project]; - for project_name in &project_names { - let template_path = template_path(project_name); - - let destination = { - use path_absolutize::Absolutize; - main_dir.absolutize().map(|p| p.to_path_buf())? - }; - - let generate_args = GenerateArgs { - template_path, - destination: Some(destination), - name: Some(project_name.to_string()), - force: true, - force_git_init: false, // Don't init git for subdirectories - verbose: true, - ..Default::default() - }; - - generate(generate_args) - .context(format!("Failed to scaffold {project_name} project"))?; - - let project_path = main_dir.join(project_name); - - // Process the Cargo.toml - process_cargo_toml(&project_path) - .context(format!("Failed to process Cargo.toml for {project_name}"))?; - } - - // Update dependencies for paired projects - if first_project == "counter-contract" && second_project == "counter-note" { - update_project_dependency( - &main_dir, - "counter-note", - "miden:counter-contract", - "counter-contract", - "counter.wit", - )?; - } - - Ok(main_dir) - } - - /// Create a triple (tx-script, account and note script) projects in a sub-folder - fn exec_triple_projects( - &self, - tx_script: &str, - account: &str, - note: &str, - ) -> anyhow::Result { - // Create main directory with the requested example name - let main_dir = PathBuf::from(&self.example_name); - - if main_dir.exists() { - return Err(anyhow::anyhow!( - "Directory '{}' already exists. Please remove it or choose a different location.", - self.example_name - )); - } - - // Create the main directory - fs::create_dir_all(&main_dir)?; - - // Generate all three projects - let project_names = [tx_script, account, note]; - for project_name in &project_names { - let template_path = template_path(project_name); - - let destination = { - use path_absolutize::Absolutize; - main_dir.absolutize().map(|p| p.to_path_buf())? - }; - - let generate_args = GenerateArgs { - template_path, - destination: Some(destination), - name: Some(project_name.to_string()), - force: true, - force_git_init: false, // Don't init git for subdirectories - verbose: true, - ..Default::default() - }; - - generate(generate_args) - .context(format!("Failed to scaffold {project_name} project"))?; - - let project_path = main_dir.join(project_name); - - // Process the Cargo.toml - process_cargo_toml(&project_path) - .context(format!("Failed to process Cargo.toml for {project_name}"))?; - } - - // Update dependencies for triple projects - update_triple_project_dependencies(&main_dir, tx_script, account, note)?; - - Ok(main_dir) - } -} - -/// Update dependencies for triple projects in a generic way -fn update_triple_project_dependencies( - main_dir: &Path, - tx_script: &str, - account: &str, - note: &str, -) -> anyhow::Result<()> { - // Use the actual WIT file name (keep hyphens) - let account_wit = format!("{account}.wit"); - - // Update note to depend on account - update_project_dependency(main_dir, note, &format!("miden:{account}"), account, &account_wit)?; - - // Update tx script to depend on account - update_project_dependency( - main_dir, - tx_script, - &format!("miden:{account}"), - account, - &account_wit, - )?; - - Ok(()) -} - -/// Process the generated Cargo.toml to update dependencies and WIT paths. -/// The projects in `example` folder set Miden SDK dependencies as local paths. -/// After copying we switch them to a git dependency (Miden SDK crate) and drop -/// the explicit `miden:base` WIT dependency since the SDK prelude is injected -/// automatically by the `miden::generate!` macro. -fn process_cargo_toml(project_path: &Path) -> anyhow::Result<()> { - let cargo_toml_path = project_path.join("Cargo.toml"); - let content = fs::read_to_string(&cargo_toml_path)?; - let mut doc = content.parse::()?; - - // Update miden dependency to use git repository - if let Some(deps) = doc.get_mut("dependencies").and_then(|d| d.as_table_mut()) - && let Some(miden_dep) = deps.get_mut("miden") - { - *miden_dep = Item::Value(toml_edit::Value::InlineTable({ - let mut table = toml_edit::InlineTable::new(); - if cfg!(test) || std::env::var("TEST").is_ok() { - table.insert("path", compiler_path().join("sdk/sdk").to_str().unwrap().into()); - } else { - table.insert("git", "https://github.com/0xMiden/compiler".into()); - } - - table - })); - } - - // Write the updated Cargo.toml - fs::write(&cargo_toml_path, doc.to_string())?; - Ok(()) -} - -/// Update a project's dependencies to use another local project -/// This is used when one project in a pair/triple depends on another -fn update_project_dependency( - main_dir: &Path, - note_dir: &str, - dependency_name: &str, - contract_dir: &str, - wit_file_name: &str, -) -> anyhow::Result<()> { - let note_cargo_toml = main_dir.join(note_dir).join("Cargo.toml"); - let content = fs::read_to_string(¬e_cargo_toml)?; - let mut doc = content.parse::()?; - - // Update miden dependency to use local path - if let Some(miden_deps) = doc - .get_mut("package") - .and_then(|p| p.as_table_mut()) - .and_then(|t| t.get_mut("metadata")) - .and_then(|m| m.as_table_mut()) - .and_then(|t| t.get_mut("miden")) - .and_then(|m| m.as_table_mut()) - .and_then(|t| t.get_mut("dependencies")) - .and_then(|d| d.as_table_mut()) - && let Some(dep) = miden_deps.get_mut(dependency_name) - { - *dep = Item::Value(toml_edit::Value::InlineTable({ - let mut table = toml_edit::InlineTable::new(); - table.insert("path", format!("../{contract_dir}").into()); - table - })); - } - - // Update WIT file dependency to use local contract - if let Some(wit_deps) = doc - .get_mut("package") - .and_then(|p| p.as_table_mut()) - .and_then(|t| t.get_mut("metadata")) - .and_then(|m| m.as_table_mut()) - .and_then(|t| t.get_mut("component")) - .and_then(|c| c.as_table_mut()) - .and_then(|t| t.get_mut("target")) - .and_then(|t| t.as_table_mut()) - .and_then(|t| t.get_mut("dependencies")) - .and_then(|d| d.as_table_mut()) - && let Some(wit_dep) = wit_deps.get_mut(dependency_name) - && let Some(table) = wit_dep.as_inline_table_mut() - && let Some(path_value) = table.get_mut("path") - { - let path = path_value.to_string(); - *path_value = if path.contains("target/generated-wit") { - toml_edit::Value::from(format!("../{contract_dir}/target/generated-wit/")) - } else { - toml_edit::Value::from(format!("../{contract_dir}/wit/{wit_file_name}")) - }; - } - - fs::write(¬e_cargo_toml, doc.to_string())?; - Ok(()) -} - -fn template_path(project_name: &str) -> TemplatePath { - if cfg!(test) || std::env::var("TEST").is_ok() { - TemplatePath { - path: Some( - compiler_path() - .join("examples") - .join(project_name) - .to_str() - .unwrap() - .to_string(), - ), - ..Default::default() - } - } else { - TemplatePath { - git: Some("https://github.com/0xMiden/compiler".into()), - auto_path: Some(format!("examples/{project_name}")), - ..Default::default() - } - } -} diff --git a/tools/cargo-miden/src/commands/mod.rs b/tools/cargo-miden/src/commands/mod.rs index 7f8f4d7ef..5a85ff1eb 100644 --- a/tools/cargo-miden/src/commands/mod.rs +++ b/tools/cargo-miden/src/commands/mod.rs @@ -1,8 +1,8 @@ pub mod build; -pub mod example_project; pub mod new_project; +pub mod test; pub use build::BuildCommand; pub(crate) use build::CargoOptions; -pub use example_project::ExampleCommand; pub use new_project::NewCommand; +pub use test::TestCommand; diff --git a/tools/cargo-miden/src/commands/new_project.rs b/tools/cargo-miden/src/commands/new_project.rs index 62434e651..e726f38d6 100644 --- a/tools/cargo-miden/src/commands/new_project.rs +++ b/tools/cargo-miden/src/commands/new_project.rs @@ -13,13 +13,13 @@ use crate::template::{GenerateArgs, TemplatePath, generate}; /// /// Before changing it make sure the new tag exists in the rust-templates repo and points to the /// desired commit. -const PROJECT_TEMPLATES_REPO_TAG: &str = "v0.24.0"; +const PROJECT_TEMPLATES_REPO_TAG: &str = "v0.27.0"; /// The tag used in checkout of the new Miden project template (`cargo miden new `) /// /// Before changing it make sure the new tag exists in the rust-templates repo and points to the /// desired commit. -const MIDEN_PROJECT_TEMPLATE_REPO_TAG: &str = "v0.7"; +const MIDEN_PROJECT_TEMPLATE_REPO_TAG: &str = "v0.9"; // This should have been an enum but I could not bend `clap` to expose variants as flags /// Project template diff --git a/tools/cargo-miden/src/commands/test.rs b/tools/cargo-miden/src/commands/test.rs new file mode 100644 index 000000000..35fecdc0c --- /dev/null +++ b/tools/cargo-miden/src/commands/test.rs @@ -0,0 +1,56 @@ +use std::{path::PathBuf, process::Command}; + +use clap::Args; + +/// Command-line arguments accepted by `cargo miden build`. +/// +/// This command is a thin wrapper around `cargo test`, forwarding all arguments +/// to the underlying test invocation. +#[derive(Clone, Debug, Args)] +#[command(disable_version_flag = true, trailing_var_arg = true)] +pub struct TestCommand { + /// Arguments forwarded to `cargo test`. + #[arg(value_name = "ARG", allow_hyphen_values = true)] + pub args: Vec, +} + +impl TestCommand { + pub fn exec(self) -> anyhow::Result<()> { + let spawn_args = test_cargo_args(self.args); + + run_cargo_test(&spawn_args)?; + + Ok(()) + } +} + +/// Builds the argument vector for the underlying `cargo test` invocation. +fn test_cargo_args(cli_args: Vec) -> Vec { + let mut args = vec!["test".to_string()]; + + if !cli_args.is_empty() { + args.extend(["--".into()]); + args.extend(cli_args); + } + + args +} + +fn run_cargo_test(spawn_args: &[String]) -> anyhow::Result<()> { + let cargo_path = std::env::var("CARGO") + .map(PathBuf::from) + .ok() + .unwrap_or_else(|| PathBuf::from("cargo")); + + let mut cargo = Command::new(&cargo_path); + + cargo.args(spawn_args); + + let status = cargo.status()?; + + if !status.success() { + std::process::exit(status.code().unwrap_or(1)); + } + + Ok(()) +} diff --git a/tools/cargo-miden/src/dependencies.rs b/tools/cargo-miden/src/dependencies.rs index f21b66112..92cd5ee20 100644 --- a/tools/cargo-miden/src/dependencies.rs +++ b/tools/cargo-miden/src/dependencies.rs @@ -140,8 +140,6 @@ pub fn process_miden_dependencies( if cargo_opts.release { dep_build_args.push("--release".to_string()); } - // Dependencies should always be built as libraries - dep_build_args.push("--lib".to_string()); // We expect dependencies to *always* produce Masm libraries (.masp) let command_output = crate::run(dep_build_args.into_iter(), OutputType::Masm) diff --git a/tools/cargo-miden/src/lib.rs b/tools/cargo-miden/src/lib.rs index a89ea083f..4d0fe376b 100644 --- a/tools/cargo-miden/src/lib.rs +++ b/tools/cargo-miden/src/lib.rs @@ -16,6 +16,7 @@ mod target; mod template; mod utils; +pub use commands::BuildCommand; pub use outputs::{BuildOutput, CommandOutput}; pub use target::{ detect_project_type, detect_target_environment, target_environment_to_project_type, @@ -48,11 +49,11 @@ where let project_path = cmd.exec()?; Ok(Some(CommandOutput::NewCommandOutput { project_path })) } - cli::CargoMidenCommand::Example(cmd) => { - let project_path = cmd.exec()?; - Ok(Some(CommandOutput::NewCommandOutput { project_path })) - } cli::CargoMidenCommand::Build(cmd) => cmd.exec(build_output_type), + cli::CargoMidenCommand::Test(cmd) => { + cmd.exec()?; + Ok(None) + } } } diff --git a/tools/cargo-miden/src/main.rs b/tools/cargo-miden/src/main.rs index 7048c7f85..ffd00936c 100644 --- a/tools/cargo-miden/src/main.rs +++ b/tools/cargo-miden/src/main.rs @@ -3,7 +3,7 @@ use cargo_miden::{OutputType, run}; fn main() -> anyhow::Result<()> { // Initialize logger - let mut builder = env_logger::Builder::from_env("CARGO_MIDEN_LOG"); + let mut builder = midenc_log::Builder::from_env("CARGO_MIDEN_LOG"); builder.format_indent(Some(2)); builder.format_timestamp(None); builder.init(); diff --git a/tools/cargo-miden/src/utils.rs b/tools/cargo-miden/src/utils.rs index 9556bbfb6..96370a834 100644 --- a/tools/cargo-miden/src/utils.rs +++ b/tools/cargo-miden/src/utils.rs @@ -1,4 +1,11 @@ -use std::path::{Path, PathBuf}; +use std::{ + io::{BufRead, BufReader}, + path::{Path, PathBuf}, + process::Command, +}; + +use anyhow::{Context, Result}; +use cargo_metadata::{Artifact, Message}; pub(crate) fn set_default_test_compiler(define: &mut Vec) { let compiler_path = compiler_path(); @@ -10,3 +17,48 @@ pub(crate) fn compiler_path() -> PathBuf { let compiler_path = Path::new(&manifest_dir).parent().unwrap().parent().unwrap(); compiler_path.to_path_buf() } + +pub(crate) fn spawn_cargo(mut cmd: Command, cargo: &Path) -> Result> { + log::debug!("spawning command {cmd:?}"); + + let mut child = cmd + .spawn() + .context(format!("failed to spawn `{cargo}`", cargo = cargo.display()))?; + + let mut artifacts = Vec::new(); + let stdout = child.stdout.take().expect("no stdout"); + let reader = BufReader::new(stdout); + for line in reader.lines() { + let line = line.context("failed to read output from `cargo`")?; + + if line.is_empty() { + continue; + } + + for message in Message::parse_stream(line.as_bytes()) { + if let Message::CompilerArtifact(artifact) = + message.context("unexpected JSON message from cargo")? + { + for path in &artifact.filenames { + match path.extension() { + Some("wasm") => { + artifacts.push(artifact); + break; + } + _ => continue, + } + } + } + } + } + + let status = child + .wait() + .context(format!("failed to wait for `{cargo}` to finish", cargo = cargo.display()))?; + + if !status.success() { + std::process::exit(status.code().unwrap_or(1)); + } + + Ok(artifacts) +} diff --git a/tools/cargo-miden/tests/build.rs b/tools/cargo-miden/tests/build.rs index 1c9c10f42..34569427c 100644 --- a/tools/cargo-miden/tests/build.rs +++ b/tools/cargo-miden/tests/build.rs @@ -4,15 +4,6 @@ use cargo_miden::{OutputType, run}; use miden_mast_package::Package; use midenc_session::miden_assembly::utils::Deserializable; -fn example_project_args(example_name: &str) -> Vec { - vec![ - "cargo".to_string(), - "miden".to_string(), - "example".to_string(), - example_name.to_string(), - ] -} - fn new_project_args(project_name: &str, template: &str) -> Vec { let template = if template.is_empty() { if let Ok(project_template_path) = std::env::var("TEST_LOCAL_PROJECT_TEMPLATE_PATH") { @@ -37,8 +28,8 @@ fn new_project_args(project_name: &str, template: &str) -> Vec { // that depend on the current directory #[test] -fn test_all_templates_and_examples() { - let _ = env_logger::Builder::from_env("MIDENC_TRACE") +fn test_all_templates() { + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") .is_test(true) .format_timestamp(None) .try_init(); @@ -48,93 +39,6 @@ fn test_all_templates_and_examples() { // to use an out-of-band signal like this instead unsafe { env::set_var("TEST", "1") }; - // Test example templates - - // Test counter-contract example (which also creates counter-note) - let (counter_contract, counter_note) = build_paired_example_projects( - "counter-contract", - "counter-contract", - "counter-note", - "counter_contract", - "counter_note", - ); - assert!(counter_contract.is_library()); - assert_eq!(counter_contract.name, "counter_contract"); - assert!(counter_note.is_program()); - assert_eq!(counter_note.name, "counter_note"); - - // Test fibonacci example - let fibonacci = build_example_project_from_template("fibonacci"); - assert!(fibonacci.is_program()); - assert_eq!(fibonacci.name, "fibonacci"); - - // Test collatz example - let collatz = build_example_project_from_template("collatz"); - assert!(collatz.is_program()); - assert_eq!(collatz.name, "collatz"); - - // Test is-prime example - let is_prime = build_example_project_from_template("is-prime"); - assert!(is_prime.is_program()); - assert_eq!(is_prime.name, "is_prime"); - - // Test storage-example - let storage = build_example_project_from_template("storage-example"); - assert!(storage.is_library()); - assert_eq!(storage.name, "storage_example"); - - // Test basic-wallet-tx-script example using different entry points - // Test 1: Using "basic-wallet-tx-script" as the example name - let (tx_script, wallet, p2id) = build_triple_example_projects( - "basic-wallet-tx-script", - "basic-wallet-tx-script", - "basic-wallet", - "p2id-note", - "basic_wallet_tx_script", - "basic_wallet", - "p2id", - ); - assert!(tx_script.is_program()); - assert_eq!(tx_script.name, "basic_wallet_tx_script"); - assert!(wallet.is_library()); - assert_eq!(wallet.name, "basic_wallet"); - assert!(p2id.is_program()); - assert_eq!(p2id.name, "p2id"); - - // Test 2: Using "basic-wallet" as the example name (should create all three) - let (tx_script2, wallet2, p2id2) = build_triple_example_projects( - "basic-wallet", - "basic-wallet-tx-script", - "basic-wallet", - "p2id-note", - "basic_wallet_tx_script", - "basic_wallet", - "p2id", - ); - assert!(tx_script2.is_program()); - assert_eq!(tx_script2.name, "basic_wallet_tx_script"); - assert!(wallet2.is_library()); - assert_eq!(wallet2.name, "basic_wallet"); - assert!(p2id2.is_program()); - assert_eq!(p2id2.name, "p2id"); - - // Test 3: Using "p2id-note" as the example name (should create all three) - let (tx_script3, wallet3, p2id3) = build_triple_example_projects( - "p2id-note", - "basic-wallet-tx-script", - "basic-wallet", - "p2id-note", - "basic_wallet_tx_script", - "basic_wallet", - "p2id", - ); - assert!(tx_script3.is_program()); - assert_eq!(tx_script3.name, "basic_wallet_tx_script"); - assert!(wallet3.is_library()); - assert_eq!(wallet3.name, "basic_wallet"); - assert!(p2id3.is_program()); - assert_eq!(p2id3.name, "p2id"); - // Test new project templates let account = build_new_project_from_template("--account"); assert!(account.is_library()); @@ -154,205 +58,13 @@ fn test_all_templates_and_examples() { let expected_function = "auth__procedure"; let lib = auth_comp.unwrap_library(); assert!( - lib.exports().any(|export| { export.name.name.as_str() == expected_function }), + lib.exports() + .any(|export| export.path().as_ref().last() == Some(expected_function)), "expected one of the authentication component exports to contain function \ '{expected_function}'" ); } -/// Build paired example projects (e.g., account and note script) and return their packages -/// Creates both projects in a subdirectory and builds them separately -fn build_paired_example_projects( - example_name: &str, - first_dir: &str, - second_dir: &str, - first_expected_name: &str, - second_expected_name: &str, -) -> (Package, Package) { - let restore_dir = env::current_dir().unwrap(); - let temp_dir = env::temp_dir().join(format!( - "test_example_{}", - std::time::SystemTime::now() - .duration_since(std::time::UNIX_EPOCH) - .unwrap() - .as_millis() - )); - fs::create_dir_all(&temp_dir).unwrap(); - env::set_current_dir(&temp_dir).unwrap(); - - // Create the project - it will create both projects - let args = example_project_args(example_name); - - let output = run(args.into_iter(), OutputType::Masm) - .expect("Failed to create new project") - .expect("'cargo miden example' should return Some(CommandOutput)"); - let main_project_path = match output { - cargo_miden::CommandOutput::NewCommandOutput { project_path } => { - project_path.canonicalize().unwrap() - } - other => panic!("Expected NewCommandOutput, got {other:?}"), - }; - assert!(main_project_path.exists()); - - // Build first project - let first_path = main_project_path.join(first_dir); - assert!(first_path.exists()); - env::set_current_dir(&first_path).unwrap(); - - let first_package = build_project_in_current_dir(first_expected_name); - - // Build second project - let second_path = main_project_path.join(second_dir); - assert!(second_path.exists()); - env::set_current_dir(&second_path).unwrap(); - - let second_package = build_project_in_current_dir(second_expected_name); - - env::set_current_dir(restore_dir).unwrap(); - fs::remove_dir_all(temp_dir).unwrap(); - - (first_package, second_package) -} - -/// Build triple example projects (e.g., tx-script, account and note script) and return their packages -/// Creates all three projects in a subdirectory and builds them separately -fn build_triple_example_projects( - example_name: &str, - first_dir: &str, - second_dir: &str, - third_dir: &str, - first_expected_name: &str, - second_expected_name: &str, - third_expected_name: &str, -) -> (Package, Package, Package) { - let restore_dir = env::current_dir().unwrap(); - let temp_dir = env::temp_dir().join(format!( - "test_example_{}", - std::time::SystemTime::now() - .duration_since(std::time::UNIX_EPOCH) - .unwrap() - .as_millis() - )); - fs::create_dir_all(&temp_dir).unwrap(); - env::set_current_dir(&temp_dir).unwrap(); - - // Create the project - it will create all three projects - let args = example_project_args(example_name); - - let output = run(args.into_iter(), OutputType::Masm) - .expect("Failed to create new project") - .expect("'cargo miden example' should return Some(CommandOutput)"); - let main_project_path = match output { - cargo_miden::CommandOutput::NewCommandOutput { project_path } => { - project_path.canonicalize().unwrap() - } - other => panic!("Expected NewCommandOutput, got {other:?}"), - }; - assert!(main_project_path.exists()); - - // Build second project (basic-wallet) - let second_path = main_project_path.join(second_dir); - assert!(second_path.exists()); - env::set_current_dir(&second_path).unwrap(); - let second_package = build_project_in_current_dir(second_expected_name); - - // Build third project (p2id-note) - let third_path = main_project_path.join(third_dir); - assert!(third_path.exists()); - env::set_current_dir(&third_path).unwrap(); - let third_package = build_project_in_current_dir(third_expected_name); - - // Build first project (basic-wallet-tx-script) - let first_path = main_project_path.join(first_dir); - assert!(first_path.exists()); - env::set_current_dir(&first_path).unwrap(); - let first_package = build_project_in_current_dir(first_expected_name); - - env::set_current_dir(restore_dir).unwrap(); - fs::remove_dir_all(temp_dir).unwrap(); - - (first_package, second_package, third_package) -} - -/// Build a project in the current directory and verify it compiles correctly -/// Tests both debug and release builds, returning the package from the release build -fn build_project_in_current_dir(expected_name: &str) -> Package { - // build with the dev profile - let args = ["cargo", "miden", "build"].iter().map(|s| s.to_string()); - let output = run(args, OutputType::Masm) - .expect("Failed to compile with the dev profile") - .expect("'cargo miden build' should return Some(CommandOutput)"); - let expected_masm_path = match output { - cargo_miden::CommandOutput::BuildCommandOutput { output } => match output { - cargo_miden::BuildOutput::Masm { artifact_path } => artifact_path, - other => panic!("Expected Masm output, got {other:?}"), - }, - other => panic!("Expected BuildCommandOutput, got {other:?}"), - }; - assert!(expected_masm_path.exists()); - assert!(expected_masm_path.to_str().unwrap().contains("/debug/")); - assert_eq!(expected_masm_path.extension().unwrap(), "masp"); - assert!(expected_masm_path.metadata().unwrap().len() > 0); - - // build with the release profile - let args = ["cargo", "miden", "build", "--release"].iter().map(|s| s.to_string()); - let output = run(args, OutputType::Masm) - .expect("Failed to compile with the release profile") - .expect("'cargo miden build --release' should return Some(CommandOutput)"); - let expected_masm_path = match output { - cargo_miden::CommandOutput::BuildCommandOutput { output } => match output { - cargo_miden::BuildOutput::Masm { artifact_path } => artifact_path, - other => panic!("Expected Masm output, got {other:?}"), - }, - other => panic!("Expected BuildCommandOutput, got {other:?}"), - }; - assert!(expected_masm_path.exists()); - assert_eq!(expected_masm_path.extension().unwrap(), "masp"); - assert!(expected_masm_path.to_str().unwrap().contains("/release/")); - assert!(expected_masm_path.to_str().unwrap().contains(expected_name)); - assert!(expected_masm_path.metadata().unwrap().len() > 0); - let package_bytes = fs::read(expected_masm_path).unwrap(); - Package::read_from_bytes(&package_bytes).unwrap() -} - -/// Build an example project from the specified template and return its package -/// Creates the project in a temporary directory and builds it -fn build_example_project_from_template(example_name: &str) -> Package { - let restore_dir = env::current_dir().unwrap(); - let temp_dir = env::temp_dir().join(format!( - "test_example_{}", - std::time::SystemTime::now() - .duration_since(std::time::UNIX_EPOCH) - .unwrap() - .as_millis() - )); - fs::create_dir_all(&temp_dir).unwrap(); - env::set_current_dir(&temp_dir).unwrap(); - - // Create the project - it will be named after the example - let args = example_project_args(example_name); - - let output = run(args.into_iter(), OutputType::Masm) - .expect("Failed to create new project") - .expect("'cargo miden example' should return Some(CommandOutput)"); - let new_project_path = match output { - cargo_miden::CommandOutput::NewCommandOutput { project_path } => { - project_path.canonicalize().unwrap() - } - other => panic!("Expected NewCommandOutput, got {other:?}"), - }; - assert!(new_project_path.exists()); - env::set_current_dir(&new_project_path).unwrap(); - - // Convert hyphens to underscores for the expected package name - let expected_name = example_name.replace("-", "_"); - let package = build_project_in_current_dir(&expected_name); - - env::set_current_dir(restore_dir).unwrap(); - fs::remove_dir_all(temp_dir).unwrap(); - package -} - /// Build a new project from the specified template and return its package /// Handles special cases like note templates that require a contract dependency fn build_new_project_from_template(template: &str) -> Package { @@ -440,7 +152,7 @@ fn build_new_project_from_template(template: &str) -> Package { #[test] fn new_project_integration_tests_pass() { - let _ = env_logger::Builder::from_env("MIDENC_TRACE") + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") .is_test(true) .format_timestamp(None) .try_init(); diff --git a/tools/cargo-miden/tests/workspace.rs b/tools/cargo-miden/tests/workspace.rs index 245d51045..46f80af6f 100644 --- a/tools/cargo-miden/tests/workspace.rs +++ b/tools/cargo-miden/tests/workspace.rs @@ -69,7 +69,7 @@ fn new_project_args(project_name: &str, template: &str) -> Vec { #[test] fn build_workspace_member_account_project() { - let _ = env_logger::Builder::from_env("MIDENC_TRACE") + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") .is_test(true) .format_timestamp(None) .try_init(); @@ -123,7 +123,7 @@ fn build_workspace_member_account_project() { #[test] fn build_from_workspace_root_is_rejected() { - let _ = env_logger::Builder::from_env("MIDENC_TRACE") + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") .is_test(true) .format_timestamp(None) .try_init(); @@ -175,7 +175,7 @@ fn build_from_workspace_root_is_rejected() { #[test] fn new_project_auto_adds_to_workspace() { - let _ = env_logger::Builder::from_env("MIDENC_TRACE") + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") .is_test(true) .format_timestamp(None) .try_init(); @@ -233,7 +233,7 @@ fn new_project_auto_adds_to_workspace() { #[test] fn new_project_auto_adds_to_workspace_with_existing_members() { - let _ = env_logger::Builder::from_env("MIDENC_TRACE") + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") .is_test(true) .format_timestamp(None) .try_init(); @@ -292,7 +292,7 @@ fn new_project_auto_adds_to_workspace_with_existing_members() { #[test] fn new_project_does_not_duplicate_existing_member() { - let _ = env_logger::Builder::from_env("MIDENC_TRACE") + let _ = midenc_log::Builder::from_env("MIDENC_TRACE") .is_test(true) .format_timestamp(None) .try_init();